| .. | .. |
|---|
| 85 | 85 | |
|---|
| 86 | 86 | /* |
|---|
| 87 | 87 | * 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 |
|---|
| 89 | 89 | * case. |
|---|
| 90 | 90 | * |
|---|
| 91 | 91 | * If (ndev->reg_state == NETREG_UNINITIALIZED) then it is up to the caller to |
|---|
| .. | .. |
|---|
| 97 | 97 | { |
|---|
| 98 | 98 | struct net_device *ndev = priv->dev; |
|---|
| 99 | 99 | int result; |
|---|
| 100 | + struct rdma_netdev *rn = netdev_priv(ndev); |
|---|
| 100 | 101 | |
|---|
| 101 | 102 | 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; |
|---|
| 102 | 109 | |
|---|
| 103 | 110 | /* |
|---|
| 104 | 111 | * Racing with unregister of the parent must be prevented by the |
|---|
| .. | .. |
|---|
| 111 | 118 | goto out_early; |
|---|
| 112 | 119 | } |
|---|
| 113 | 120 | |
|---|
| 121 | + rn->mtu = priv->mcast_mtu; |
|---|
| 122 | + |
|---|
| 114 | 123 | priv->parent = ppriv->dev; |
|---|
| 115 | 124 | priv->pkey = pkey; |
|---|
| 116 | 125 | priv->child_type = type; |
|---|
| .. | .. |
|---|
| 119 | 128 | result = -ENOTUNIQ; |
|---|
| 120 | 129 | goto out_early; |
|---|
| 121 | 130 | } |
|---|
| 122 | | - |
|---|
| 123 | | - /* We do not need to touch priv if register_netdevice fails */ |
|---|
| 124 | | - ndev->priv_destructor = ipoib_intf_free; |
|---|
| 125 | 131 | |
|---|
| 126 | 132 | result = register_netdevice(ndev); |
|---|
| 127 | 133 | if (result) { |
|---|
| .. | .. |
|---|
| 182 | 188 | snprintf(intf_name, sizeof(intf_name), "%s.%04x", |
|---|
| 183 | 189 | ppriv->dev->name, pkey); |
|---|
| 184 | 190 | |
|---|
| 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); |
|---|
| 188 | 194 | goto out; |
|---|
| 189 | 195 | } |
|---|
| 190 | | - ndev = priv->dev; |
|---|
| 196 | + priv = ipoib_priv(ndev); |
|---|
| 197 | + |
|---|
| 198 | + ndev->rtnl_link_ops = ipoib_get_link_ops(); |
|---|
| 191 | 199 | |
|---|
| 192 | 200 | result = __ipoib_vlan_add(ppriv, priv, pkey, IPOIB_LEGACY_CHILD); |
|---|
| 193 | 201 | |
|---|