@@ -157,6 +157,7 @@ enum {
IFLA_GSO_MAX_SIZE,
IFLA_PAD,
IFLA_XDP,
+ IFLA_LWT_NETDEV,
__IFLA_MAX
};
@@ -2378,6 +2378,7 @@ struct net_device *rtnl_create_link(struct net *net,
struct net_device *dev;
unsigned int num_tx_queues = 1;
unsigned int num_rx_queues = 1;
+ unsigned int flags = 0;
if (tb[IFLA_NUM_TX_QUEUES])
num_tx_queues = nla_get_u32(tb[IFLA_NUM_TX_QUEUES]);
@@ -2389,8 +2390,15 @@ struct net_device *rtnl_create_link(struct net *net,
else if (ops->get_num_rx_queues)
num_rx_queues = ops->get_num_rx_queues();
+ if (tb[IFLA_LWT_NETDEV]) {
+ u8 lwt_dev = !!nla_get_u8(tb[IFLA_LWT_NETDEV]);
+
+ if (lwt_dev)
+ flags |= IFF_LWT_NETDEV;
+ }
+
dev = alloc_netdev_mqs(ops->priv_size, ifname, name_assign_type,
- ops->setup, num_tx_queues, num_rx_queues, 0);
+ ops->setup, num_tx_queues, num_rx_queues, flags);
if (!dev)
return ERR_PTR(-ENOMEM);
Allow users to make new devices lightweight by setting IFLA_LWT_NETDEV attribute in the newlink request. Signed-off-by: David Ahern <dsahern@gmail.com> --- include/uapi/linux/if_link.h | 1 + net/core/rtnetlink.c | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-)