Skip to content

Commit 92479cd

Browse files
committed
sync to upstream 01b6b9315f15 ("Merge branch net-ti-ethernet-warnings")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent a30e7a8 commit 92479cd

7 files changed

Lines changed: 212 additions & 4 deletions

File tree

Documentation/netlink/specs/mptcp_pm.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ attribute-sets:
109109
-
110110
name: port
111111
type: u16
112-
byte-order: big-endian
113112
-
114113
name: flags
115114
type: u32

Documentation/netlink/specs/netdev.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ attribute-sets:
167167
"re-attached", they are just waiting to disappear.
168168
Attribute is absent if Page Pool has not been detached, and
169169
can still be used to allocate new memory.
170+
-
171+
name: dmabuf
172+
doc: ID of the dmabuf this page-pool is attached to.
173+
type: u32
170174
-
171175
name: page-pool-info
172176
subset-of: page-pool
@@ -268,6 +272,10 @@ attribute-sets:
268272
name: napi-id
269273
doc: ID of the NAPI instance which services this queue.
270274
type: u32
275+
-
276+
name: dmabuf
277+
doc: ID of the dmabuf attached to this queue, if any.
278+
type: u32
271279

272280
-
273281
name: qstats
@@ -457,6 +465,39 @@ attribute-sets:
457465
Number of times driver re-started accepting send
458466
requests to this queue from the stack.
459467
type: uint
468+
-
469+
name: queue-id
470+
subset-of: queue
471+
attributes:
472+
-
473+
name: id
474+
-
475+
name: type
476+
-
477+
name: dmabuf
478+
attributes:
479+
-
480+
name: ifindex
481+
doc: netdev ifindex to bind the dmabuf to.
482+
type: u32
483+
checks:
484+
min: 1
485+
-
486+
name: queues
487+
doc: receive queues to bind the dmabuf to.
488+
type: nest
489+
nested-attributes: queue-id
490+
multi-attr: true
491+
-
492+
name: fd
493+
doc: dmabuf file descriptor to bind.
494+
type: u32
495+
-
496+
name: id
497+
doc: id of the dmabuf binding
498+
type: u32
499+
checks:
500+
min: 1
460501

461502
operations:
462503
list:
@@ -510,6 +551,7 @@ operations:
510551
- inflight
511552
- inflight-mem
512553
- detach-time
554+
- dmabuf
513555
dump:
514556
reply: *pp-reply
515557
config-cond: page-pool
@@ -574,6 +616,7 @@ operations:
574616
- type
575617
- napi-id
576618
- ifindex
619+
- dmabuf
577620
dump:
578621
request:
579622
attributes:
@@ -619,6 +662,24 @@ operations:
619662
- rx-bytes
620663
- tx-packets
621664
- tx-bytes
665+
-
666+
name: bind-rx
667+
doc: Bind dmabuf to netdev
668+
attribute-set: dmabuf
669+
flags: [ admin-perm ]
670+
do:
671+
request:
672+
attributes:
673+
- ifindex
674+
- fd
675+
- queues
676+
reply:
677+
attributes:
678+
- id
679+
680+
kernel-family:
681+
headers: [ "linux/list.h"]
682+
sock-priv: struct list_head
622683

623684
mcast-groups:
624685
list:

Documentation/netlink/specs/rt_link.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,6 +1137,10 @@ attribute-sets:
11371137
name: dpll-pin
11381138
type: nest
11391139
nested-attributes: link-dpll-pin-attrs
1140+
-
1141+
name: max-pacing-offload-horizon
1142+
type: uint
1143+
doc: EDT offload horizon supported by the device (in nsec).
11401144
-
11411145
name: af-spec-attrs
11421146
attributes:

generated/mptcp_pm-user.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ struct mptcp_pm_address {
3434
std::optional<__u8> id;
3535
std::optional<__u32> addr4 /* big-endian */;
3636
std::vector<__u8> addr6;
37-
std::optional<__u16> port /* big-endian */;
37+
std::optional<__u16> port;
3838
std::optional<__u32> flags;
3939
std::optional<__s32> if_idx;
4040
};

generated/netdev-user.cpp

Lines changed: 108 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
namespace ynl_cpp {
1515

1616
/* Enums */
17-
static constexpr std::array<std::string_view, NETDEV_CMD_QSTATS_GET + 1> netdev_op_strmap = []() {
18-
std::array<std::string_view, NETDEV_CMD_QSTATS_GET + 1> arr{};
17+
static constexpr std::array<std::string_view, NETDEV_CMD_BIND_RX + 1> netdev_op_strmap = []() {
18+
std::array<std::string_view, NETDEV_CMD_BIND_RX + 1> arr{};
1919
arr[NETDEV_CMD_DEV_GET] = "dev-get";
2020
arr[NETDEV_CMD_DEV_ADD_NTF] = "dev-add-ntf";
2121
arr[NETDEV_CMD_DEV_DEL_NTF] = "dev-del-ntf";
@@ -28,6 +28,7 @@ static constexpr std::array<std::string_view, NETDEV_CMD_QSTATS_GET + 1> netdev_
2828
arr[NETDEV_CMD_QUEUE_GET] = "queue-get";
2929
arr[NETDEV_CMD_NAPI_GET] = "napi-get";
3030
arr[NETDEV_CMD_QSTATS_GET] = "qstats-get";
31+
arr[NETDEV_CMD_BIND_RX] = "bind-rx";
3132
return arr;
3233
} ();
3334

@@ -130,6 +131,18 @@ struct ynl_policy_nest netdev_page_pool_info_nest = {
130131
.table = netdev_page_pool_info_policy.data(),
131132
};
132133

134+
static std::array<ynl_policy_attr,NETDEV_A_QUEUE_MAX + 1> netdev_queue_id_policy = []() {
135+
std::array<ynl_policy_attr,NETDEV_A_QUEUE_MAX + 1> arr{};
136+
arr[NETDEV_A_QUEUE_ID] = { .name = "id", .type = YNL_PT_U32, };
137+
arr[NETDEV_A_QUEUE_TYPE] = { .name = "type", .type = YNL_PT_U32, };
138+
return arr;
139+
} ();
140+
141+
struct ynl_policy_nest netdev_queue_id_nest = {
142+
.max_attr = NETDEV_A_QUEUE_MAX,
143+
.table = netdev_queue_id_policy.data(),
144+
};
145+
133146
static std::array<ynl_policy_attr,NETDEV_A_DEV_MAX + 1> netdev_dev_policy = []() {
134147
std::array<ynl_policy_attr,NETDEV_A_DEV_MAX + 1> arr{};
135148
arr[NETDEV_A_DEV_IFINDEX] = { .name = "ifindex", .type = YNL_PT_U32, };
@@ -154,6 +167,7 @@ static std::array<ynl_policy_attr,NETDEV_A_PAGE_POOL_MAX + 1> netdev_page_pool_p
154167
arr[NETDEV_A_PAGE_POOL_INFLIGHT] = { .name = "inflight", .type = YNL_PT_UINT, };
155168
arr[NETDEV_A_PAGE_POOL_INFLIGHT_MEM] = { .name = "inflight-mem", .type = YNL_PT_UINT, };
156169
arr[NETDEV_A_PAGE_POOL_DETACH_TIME] = { .name = "detach-time", .type = YNL_PT_UINT, };
170+
arr[NETDEV_A_PAGE_POOL_DMABUF] = { .name = "dmabuf", .type = YNL_PT_U32, };
157171
return arr;
158172
} ();
159173

@@ -190,6 +204,7 @@ static std::array<ynl_policy_attr,NETDEV_A_QUEUE_MAX + 1> netdev_queue_policy =
190204
arr[NETDEV_A_QUEUE_IFINDEX] = { .name = "ifindex", .type = YNL_PT_U32, };
191205
arr[NETDEV_A_QUEUE_TYPE] = { .name = "type", .type = YNL_PT_U32, };
192206
arr[NETDEV_A_QUEUE_NAPI_ID] = { .name = "napi-id", .type = YNL_PT_U32, };
207+
arr[NETDEV_A_QUEUE_DMABUF] = { .name = "dmabuf", .type = YNL_PT_U32, };
193208
return arr;
194209
} ();
195210

@@ -253,6 +268,20 @@ struct ynl_policy_nest netdev_qstats_nest = {
253268
.table = netdev_qstats_policy.data(),
254269
};
255270

271+
static std::array<ynl_policy_attr,NETDEV_A_DMABUF_MAX + 1> netdev_dmabuf_policy = []() {
272+
std::array<ynl_policy_attr,NETDEV_A_DMABUF_MAX + 1> arr{};
273+
arr[NETDEV_A_DMABUF_IFINDEX] = { .name = "ifindex", .type = YNL_PT_U32, };
274+
arr[NETDEV_A_DMABUF_QUEUES] = { .name = "queues", .type = YNL_PT_NEST, .nest = &netdev_queue_id_nest, };
275+
arr[NETDEV_A_DMABUF_FD] = { .name = "fd", .type = YNL_PT_U32, };
276+
arr[NETDEV_A_DMABUF_ID] = { .name = "id", .type = YNL_PT_U32, };
277+
return arr;
278+
} ();
279+
280+
struct ynl_policy_nest netdev_dmabuf_nest = {
281+
.max_attr = NETDEV_A_DMABUF_MAX,
282+
.table = netdev_dmabuf_policy.data(),
283+
};
284+
256285
/* Common nested types */
257286
int netdev_page_pool_info_put(struct nlmsghdr *nlh, unsigned int attr_type,
258287
const netdev_page_pool_info& obj)
@@ -292,6 +321,21 @@ int netdev_page_pool_info_parse(struct ynl_parse_arg *yarg,
292321
return 0;
293322
}
294323

324+
int netdev_queue_id_put(struct nlmsghdr *nlh, unsigned int attr_type,
325+
const netdev_queue_id& obj)
326+
{
327+
struct nlattr *nest;
328+
329+
nest = ynl_attr_nest_start(nlh, attr_type);
330+
if (obj.id.has_value())
331+
ynl_attr_put_u32(nlh, NETDEV_A_QUEUE_ID, obj.id.value());
332+
if (obj.type.has_value())
333+
ynl_attr_put_u32(nlh, NETDEV_A_QUEUE_TYPE, obj.type.value());
334+
ynl_attr_nest_end(nlh, nest);
335+
336+
return 0;
337+
}
338+
295339
/* ============== NETDEV_CMD_DEV_GET ============== */
296340
/* NETDEV_CMD_DEV_GET - do */
297341
int netdev_dev_get_rsp_parse(const struct nlmsghdr *nlh,
@@ -421,6 +465,10 @@ int netdev_page_pool_get_rsp_parse(const struct nlmsghdr *nlh,
421465
if (ynl_attr_validate(yarg, attr))
422466
return YNL_PARSE_CB_ERROR;
423467
dst->detach_time = (__u64)ynl_attr_get_uint(attr);
468+
} else if (type == NETDEV_A_PAGE_POOL_DMABUF) {
469+
if (ynl_attr_validate(yarg, attr))
470+
return YNL_PARSE_CB_ERROR;
471+
dst->dmabuf = (__u32)ynl_attr_get_u32(attr);
424472
}
425473
}
426474

@@ -635,6 +683,10 @@ int netdev_queue_get_rsp_parse(const struct nlmsghdr *nlh,
635683
if (ynl_attr_validate(yarg, attr))
636684
return YNL_PARSE_CB_ERROR;
637685
dst->ifindex = (__u32)ynl_attr_get_u32(attr);
686+
} else if (type == NETDEV_A_QUEUE_DMABUF) {
687+
if (ynl_attr_validate(yarg, attr))
688+
return YNL_PARSE_CB_ERROR;
689+
dst->dmabuf = (__u32)ynl_attr_get_u32(attr);
638690
}
639691
}
640692

@@ -870,6 +922,60 @@ netdev_qstats_get_dump(ynl_cpp::ynl_socket& ys,
870922
return ret;
871923
}
872924

925+
/* ============== NETDEV_CMD_BIND_RX ============== */
926+
/* NETDEV_CMD_BIND_RX - do */
927+
int netdev_bind_rx_rsp_parse(const struct nlmsghdr *nlh,
928+
struct ynl_parse_arg *yarg)
929+
{
930+
const struct nlattr *attr;
931+
netdev_bind_rx_rsp *dst;
932+
933+
dst = (netdev_bind_rx_rsp*)yarg->data;
934+
935+
ynl_attr_for_each(attr, nlh, yarg->ys->family->hdr_len) {
936+
unsigned int type = ynl_attr_type(attr);
937+
938+
if (type == NETDEV_A_DMABUF_ID) {
939+
if (ynl_attr_validate(yarg, attr))
940+
return YNL_PARSE_CB_ERROR;
941+
dst->id = (__u32)ynl_attr_get_u32(attr);
942+
}
943+
}
944+
945+
return YNL_PARSE_CB_OK;
946+
}
947+
948+
std::unique_ptr<netdev_bind_rx_rsp>
949+
netdev_bind_rx(ynl_cpp::ynl_socket& ys, netdev_bind_rx_req& req)
950+
{
951+
struct ynl_req_state yrs = { .yarg = { .ys = ys, }, };
952+
std::unique_ptr<netdev_bind_rx_rsp> rsp;
953+
struct nlmsghdr *nlh;
954+
int err;
955+
956+
nlh = ynl_gemsg_start_req(ys, ((struct ynl_sock*)ys)->family_id, NETDEV_CMD_BIND_RX, 1);
957+
((struct ynl_sock*)ys)->req_policy = &netdev_dmabuf_nest;
958+
yrs.yarg.rsp_policy = &netdev_dmabuf_nest;
959+
960+
if (req.ifindex.has_value())
961+
ynl_attr_put_u32(nlh, NETDEV_A_DMABUF_IFINDEX, req.ifindex.value());
962+
if (req.fd.has_value())
963+
ynl_attr_put_u32(nlh, NETDEV_A_DMABUF_FD, req.fd.value());
964+
for (unsigned int i = 0; i < req.queues.size(); i++)
965+
netdev_queue_id_put(nlh, NETDEV_A_DMABUF_QUEUES, req.queues[i]);
966+
967+
rsp.reset(new netdev_bind_rx_rsp());
968+
yrs.yarg.data = rsp.get();
969+
yrs.cb = netdev_bind_rx_rsp_parse;
970+
yrs.rsp_cmd = NETDEV_CMD_BIND_RX;
971+
972+
err = ynl_exec(ys, nlh, &yrs);
973+
if (err < 0)
974+
return nullptr;
975+
976+
return rsp;
977+
}
978+
873979
static constexpr std::array<ynl_ntf_info, NETDEV_CMD_PAGE_POOL_CHANGE_NTF + 1> netdev_ntf_info = []() {
874980
std::array<ynl_ntf_info, NETDEV_CMD_PAGE_POOL_CHANGE_NTF + 1> arr{};
875981
arr[NETDEV_CMD_DEV_ADD_NTF] = {

generated/netdev-user.hpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ struct netdev_page_pool_info {
3838
std::optional<__u32> ifindex;
3939
};
4040

41+
struct netdev_queue_id {
42+
std::optional<__u32> id;
43+
std::optional<netdev_queue_type> type;
44+
};
45+
4146
/* ============== NETDEV_CMD_DEV_GET ============== */
4247
/* NETDEV_CMD_DEV_GET - do */
4348
struct netdev_dev_get_req {
@@ -83,6 +88,7 @@ struct netdev_page_pool_get_rsp {
8388
std::optional<__u64> inflight;
8489
std::optional<__u64> inflight_mem;
8590
std::optional<__u64> detach_time;
91+
std::optional<__u32> dmabuf;
8692
};
8793

8894
/*
@@ -154,6 +160,7 @@ struct netdev_queue_get_rsp {
154160
std::optional<netdev_queue_type> type;
155161
std::optional<__u32> napi_id;
156162
std::optional<__u32> ifindex;
163+
std::optional<__u32> dmabuf;
157164
};
158165

159166
/*
@@ -230,5 +237,23 @@ std::unique_ptr<netdev_qstats_get_rsp_list>
230237
netdev_qstats_get_dump(ynl_cpp::ynl_socket& ys,
231238
netdev_qstats_get_req_dump& req);
232239

240+
/* ============== NETDEV_CMD_BIND_RX ============== */
241+
/* NETDEV_CMD_BIND_RX - do */
242+
struct netdev_bind_rx_req {
243+
std::optional<__u32> ifindex;
244+
std::optional<__u32> fd;
245+
std::vector<netdev_queue_id> queues;
246+
};
247+
248+
struct netdev_bind_rx_rsp {
249+
std::optional<__u32> id;
250+
};
251+
252+
/*
253+
* Bind dmabuf to netdev
254+
*/
255+
std::unique_ptr<netdev_bind_rx_rsp>
256+
netdev_bind_rx(ynl_cpp::ynl_socket& ys, netdev_bind_rx_req& req);
257+
233258
} //namespace ynl_cpp
234259
#endif /* _LINUX_NETDEV_GEN_H */

0 commit comments

Comments
 (0)