1 From 358b93e40d0c6b6d381fe0e9d2a63c45a10321b3 Mon Sep 17 00:00:00 2001
2 From: Robert Marko <robimarko@gmail.com>
3 Date: Sun, 4 Dec 2022 18:41:36 +0100
4 Subject: [PATCH] nss-dp: allow setting netdev name from DTS
6 Allow reading the desired netdev name from DTS like DSA allows and then
7 set it as the netdev name during registration.
9 If label is not defined, simply fallback to kernel ethN enumeration.
11 Signed-off-by: Robert Marko <robimarko@gmail.com>
13 nss_dp_main.c | 17 ++++++++++++++---
14 1 file changed, 14 insertions(+), 3 deletions(-)
18 @@ -685,18 +685,29 @@ static int32_t nss_dp_probe(struct platf
19 struct nss_dp_dev *dp_priv;
20 struct device_node *np = pdev->dev.of_node;
21 struct nss_gmac_hal_platform_data gmac_hal_pdata;
22 + const char *name = of_get_property(np, "label", NULL);
25 #if defined(NSS_DP_PPE_SUPPORT)
31 + assign_type = NET_NAME_PREDICTABLE;
34 + assign_type = NET_NAME_ENUM;
37 /* TODO: See if we need to do some SoC level common init */
39 - netdev = alloc_etherdev_mqs(sizeof(struct nss_dp_dev),
40 - NSS_DP_NETDEV_TX_QUEUE_NUM, NSS_DP_NETDEV_RX_QUEUE_NUM);
41 + netdev = alloc_netdev_mqs(sizeof(struct nss_dp_dev),
44 + NSS_DP_NETDEV_TX_QUEUE_NUM, NSS_DP_NETDEV_RX_QUEUE_NUM);
46 - pr_info("alloc_etherdev() failed\n");
47 + dev_err(&pdev->dev, "alloc_netdev_mqs() failed\n");