lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250724-b4-eth_us-v1-1-4dff04a9a128@quicinc.com>
Date: Thu, 24 Jul 2025 19:21:17 +0530
From: Vivek.Pernamitta@...cinc.com
To: Andrew Lunn <andrew+netdev@...n.ch>,
        "David S. Miller"
	<davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski
	<kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Manivannan Sadhasivam
	<mani@...nel.org>
CC: <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <mhi@...ts.linux.dev>, <linux-arm-msm@...r.kernel.org>,
        Vivek Pernamitta
	<quic_vpernami@...cinc.com>
Subject: [PATCH 1/4] net: mhi: Rename MHI interface to improve clarity

From: Vivek Pernamitta <quic_vpernami@...cinc.com>

Rename the MHI network interface to include the device name, improving
clarity when multiple MHI controllers are connected.

Currently, MHI NET device interfaces are created as mhi_swip<n>/
mhi_hwip<n> for each channel, making it difficult to distinguish between
channels when multiple EP/MHI controllers are connected.

Rename the MHI interface to include the device name, for example:
- Channel IP_SW0 for the 1st MHI controller will be named mhi0_IP_SW0.
- Channel IP_SW0 for the 2nd MHI controller will be named mhi1_IP_SW0.
- Channel IP_HW0 for the 1st MHI controller will be named mhi0_IP_HW0.
Signed-off-by: Vivek Pernamitta <quic_vpernami@...cinc.com>
---
 drivers/net/mhi_net.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mhi_net.c b/drivers/net/mhi_net.c
index ae169929a9d8e449b5a427993abf68e8d032fae2..08ab67f9a769ec64e1007853e47743003a197ec4 100644
--- a/drivers/net/mhi_net.c
+++ b/drivers/net/mhi_net.c
@@ -351,11 +351,20 @@ static void mhi_net_dellink(struct mhi_device *mhi_dev, struct net_device *ndev)
 static int mhi_net_probe(struct mhi_device *mhi_dev,
 			 const struct mhi_device_id *id)
 {
-	const struct mhi_device_info *info = (struct mhi_device_info *)id->driver_data;
+	const struct mhi_device_info *info;
+	struct device *dev = &mhi_dev->dev;
+	char netname[IFNAMSIZ] = {0};
 	struct net_device *ndev;
 	int err;
 
-	ndev = alloc_netdev(sizeof(struct mhi_net_dev), info->netname,
+	info = (struct mhi_device_info *)id->driver_data;
+
+	if (snprintf(netname, sizeof(netname), "%s", dev_name(dev)) >= IFNAMSIZ) {
+		dev_err(dev, "Invalid interface name: '%s'\n", netname);
+		return -EINVAL;
+	}
+
+	ndev = alloc_netdev(sizeof(struct mhi_net_dev), netname,
 			    NET_NAME_PREDICTABLE, mhi_net_setup);
 	if (!ndev)
 		return -ENOMEM;

-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ