On Tue, Mar 10, 2026 at 06:58:00PM -0700, Yanjun.Zhu wrote:
> On 3/10/26 12:01 PM, Leon Romanovsky wrote:
> > It is an RXE‑specific description, but you are adding code to the general
> > nldev path. Please clarify that this behavior applies only to RXE, and
> > include examples showing when and how it is invoked. In particular, explain
> > how the socket is cleaned up if delink is not called.
> 
> Hi, Leon
> 
> You are correct that this logic should be driver-specific. I will add an
> explicit check for RDMA_DRIVER_RXE in the nldev path to ensure this behavior
> is strictly scoped to RXE and does not impact other drivers (like iWARP).

No, you don't need this driver_id check, because iWARP doesn't have 
link_ops->dellink,
but you should document the rationale and how it is triggered for RXE.

Thanks

> 
> This function path is primarily invoked when a user executes the
> administrative command: rdma link delete <dev>.
> 
> Regarding socket cleanup: RXE does not rely solely on this path for resource
> management. It monitors the underlying net_device state via a registered
> netdev_notifier. Even if delink is not explicitly called (e.g., if the
> parent interface is removed or the driver is forcefully unloaded), the
> rxe_net_event callback ensures that the transport sockets are forcibly
> closed and all allocated resources are released when the parent net_device
> is destroyed.
> 
> The code diff is as below:
> 
> --- a/drivers/infiniband/core/nldev.c
> +++ b/drivers/infiniband/core/nldev.c
> @@ -1824,6 +1824,12 @@ static int nldev_dellink(struct sk_buff *skb, struct
> nlmsghdr *nlh,
>                 return -EINVAL;
>         }
> 
> +       if (device->link_ops && device->ops.driver_id == RDMA_DRIVER_RXE) {
> +               err = device->link_ops->dellink(device);
> +               if (err)
> +                       return err;
> +       }
> +
>         ib_unregister_device_and_put(device);
>         return 0;
>  }
> 
> Zhu Yanjun
> 
> 

Reply via email to