hc
2024-05-14 bedbef8ad3e75a304af6361af235302bcc61d06b
kernel/drivers/infiniband/ulp/ipoib/ipoib_vlan.c
....@@ -85,7 +85,7 @@
8585
8686 /*
8787 * NOTE: If this function fails then the priv->dev will remain valid, however
88
- * priv can have been freed and must not be touched by caller in the error
88
+ * priv will have been freed and must not be touched by caller in the error
8989 * case.
9090 *
9191 * If (ndev->reg_state == NETREG_UNINITIALIZED) then it is up to the caller to
....@@ -97,8 +97,15 @@
9797 {
9898 struct net_device *ndev = priv->dev;
9999 int result;
100
+ struct rdma_netdev *rn = netdev_priv(ndev);
100101
101102 ASSERT_RTNL();
103
+
104
+ /*
105
+ * We do not need to touch priv if register_netdevice fails, so just
106
+ * always use this flow.
107
+ */
108
+ ndev->priv_destructor = ipoib_intf_free;
102109
103110 /*
104111 * Racing with unregister of the parent must be prevented by the
....@@ -111,6 +118,8 @@
111118 goto out_early;
112119 }
113120
121
+ rn->mtu = priv->mcast_mtu;
122
+
114123 priv->parent = ppriv->dev;
115124 priv->pkey = pkey;
116125 priv->child_type = type;
....@@ -119,9 +128,6 @@
119128 result = -ENOTUNIQ;
120129 goto out_early;
121130 }
122
-
123
- /* We do not need to touch priv if register_netdevice fails */
124
- ndev->priv_destructor = ipoib_intf_free;
125131
126132 result = register_netdevice(ndev);
127133 if (result) {
....@@ -182,12 +188,14 @@
182188 snprintf(intf_name, sizeof(intf_name), "%s.%04x",
183189 ppriv->dev->name, pkey);
184190
185
- priv = ipoib_intf_alloc(ppriv->ca, ppriv->port, intf_name);
186
- if (!priv) {
187
- result = -ENOMEM;
191
+ ndev = ipoib_intf_alloc(ppriv->ca, ppriv->port, intf_name);
192
+ if (IS_ERR(ndev)) {
193
+ result = PTR_ERR(ndev);
188194 goto out;
189195 }
190
- ndev = priv->dev;
196
+ priv = ipoib_priv(ndev);
197
+
198
+ ndev->rtnl_link_ops = ipoib_get_link_ops();
191199
192200 result = __ipoib_vlan_add(ppriv, priv, pkey, IPOIB_LEGACY_CHILD);
193201