hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/infiniband/ulp/ipoib/ipoib_netlink.c
....@@ -42,6 +42,11 @@
4242 [IFLA_IPOIB_UMCAST] = { .type = NLA_U16 },
4343 };
4444
45
+static unsigned int ipoib_get_max_num_queues(void)
46
+{
47
+ return min_t(unsigned int, num_possible_cpus(), 128);
48
+}
49
+
4550 static int ipoib_fill_info(struct sk_buff *skb, const struct net_device *dev)
4651 {
4752 struct ipoib_dev_priv *priv = ipoib_priv(dev);
....@@ -122,12 +127,36 @@
122127 } else
123128 child_pkey = nla_get_u16(data[IFLA_IPOIB_PKEY]);
124129
130
+ err = ipoib_intf_init(ppriv->ca, ppriv->port, dev->name, dev);
131
+ if (err) {
132
+ ipoib_warn(ppriv, "failed to initialize pkey device\n");
133
+ return err;
134
+ }
135
+
125136 err = __ipoib_vlan_add(ppriv, ipoib_priv(dev),
126137 child_pkey, IPOIB_RTNL_CHILD);
138
+ if (err)
139
+ return err;
127140
128
- if (!err && data)
141
+ if (data) {
129142 err = ipoib_changelink(dev, tb, data, extack);
130
- return err;
143
+ if (err) {
144
+ unregister_netdevice(dev);
145
+ return err;
146
+ }
147
+ }
148
+
149
+ return 0;
150
+}
151
+
152
+static void ipoib_del_child_link(struct net_device *dev, struct list_head *head)
153
+{
154
+ struct ipoib_dev_priv *priv = ipoib_priv(dev);
155
+
156
+ if (!priv->parent)
157
+ return;
158
+
159
+ unregister_netdevice_queue(dev, head);
131160 }
132161
133162 static size_t ipoib_get_size(const struct net_device *dev)
....@@ -139,16 +168,25 @@
139168
140169 static struct rtnl_link_ops ipoib_link_ops __read_mostly = {
141170 .kind = "ipoib",
171
+ .netns_refund = true,
142172 .maxtype = IFLA_IPOIB_MAX,
143173 .policy = ipoib_policy,
144174 .priv_size = sizeof(struct ipoib_dev_priv),
145175 .setup = ipoib_setup_common,
146176 .newlink = ipoib_new_child_link,
177
+ .dellink = ipoib_del_child_link,
147178 .changelink = ipoib_changelink,
148179 .get_size = ipoib_get_size,
149180 .fill_info = ipoib_fill_info,
181
+ .get_num_rx_queues = ipoib_get_max_num_queues,
182
+ .get_num_tx_queues = ipoib_get_max_num_queues,
150183 };
151184
185
+struct rtnl_link_ops *ipoib_get_link_ops(void)
186
+{
187
+ return &ipoib_link_ops;
188
+}
189
+
152190 int __init ipoib_netlink_init(void)
153191 {
154192 return rtnl_link_register(&ipoib_link_ops);