net: mana: Record port number in netdev
authorLong Li <longli@microsoft.com>
Thu, 3 Nov 2022 19:16:24 +0000 (12:16 -0700)
committerLeon Romanovsky <leonro@nvidia.com>
Thu, 10 Nov 2022 05:57:26 +0000 (07:57 +0200)
The port number is useful for user-mode application to identify this
net device based on port index. Set to the correct value in ndev.

Reviewed-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: Long Li <longli@microsoft.com>
Link: https://lore.kernel.org/r/1667502990-2559-7-git-send-email-longli@linuxonhyperv.com
Acked-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
drivers/net/ethernet/microsoft/mana/mana_en.c

index 6ad4bc8cbc99b34bd3fd41935e31f336230a5a01..b6303a43fa7cdc051110c132b8b226d4932b7b1f 100644 (file)
@@ -2133,6 +2133,7 @@ static int mana_probe_port(struct mana_context *ac, int port_idx,
        ndev->max_mtu = ndev->mtu;
        ndev->min_mtu = ndev->mtu;
        ndev->needed_headroom = MANA_HEADROOM;
+       ndev->dev_port = port_idx;
        SET_NETDEV_DEV(ndev, gc->dev);
 
        netif_carrier_off(ndev);