Re: [PATCH v5 1/3] net: mhi : Add support to enable ethernet interface

From
Simon Horman <horms@kernel.org>
Date
2025-11-07 08:30:36
Also in
linux-arm-msm, lkml
Reply to
Vivek Pernamitta, 2025-11-06
On Thu, Nov 06, 2025 at 06:58:08PM +0530, Vivek Pernamitta wrote:
From: Vivek Pernamitta <redacted>

Currently, we only have support for the NET driver. This update allows a
new client to be configured as an Ethernet type over MHI by setting
"mhi_device_info.ethernet_if = true". A new interface for Ethernet will
be created with eth%d.

Signed-off-by: Vivek Pernamitta <redacted>
...
quoted hunk ↗ jump to hunk
@@ -119,11 +122,37 @@ static void mhi_ndo_get_stats64(struct net_device *ndev,
 	} while (u64_stats_fetch_retry(&mhi_netdev->stats.tx_syncp, start));
 }
 
+static int mhi_mac_address(struct net_device *dev, void *p)
+{
+	int ret;
+
+	if (dev->type == ARPHRD_ETHER) {
+		ret = eth_mac_addr(dev, p);
+	return ret;
nit: the indentation for the line above seems incorrect.
+	}
But I wonder if we can simplify this slightly, like this:

	if (dev->type == ARPHRD_ETHER)
		return eth_mac_addr(dev, p);

Which would allow ret to be entirely removed from this function.
quoted hunk ↗ jump to hunk
+
+	return 0;
+}
+
+static int mhi_validate_address(struct net_device *dev)
+{
+	int ret;
+
+	if (dev->type == ARPHRD_ETHER) {
+		ret = eth_validate_addr(dev);
+		return ret;
+	}
Likewise here.
quoted hunk ↗ jump to hunk
+
+	return 0;
+}
...
quoted hunk ↗ jump to hunk
@@ -140,6 +169,14 @@ static void mhi_net_setup(struct net_device *ndev)
 	ndev->tx_queue_len = 1000;
 }
 
+static void mhi_ethernet_setup(struct net_device *ndev)
+{
+	ndev->netdev_ops = &mhi_netdev_ops;
+	ether_setup(ndev);
+	ndev->min_mtu = ETH_MIN_MTU;
nit: The configuration on the line above is included in ether_setup.
quoted hunk ↗ jump to hunk
+	ndev->max_mtu = ETH_MAX_MTU;
+}
+
 static struct sk_buff *mhi_net_skb_agg(struct mhi_net_dev *mhi_netdev,
 				       struct sk_buff *skb)
 {
...
quoted hunk ↗ jump to hunk
@@ -380,10 +431,17 @@ static void mhi_net_remove(struct mhi_device *mhi_dev)
 
 static const struct mhi_device_info mhi_hwip0 = {
 	.netname = "mhi_hwip%d",
+	.ethernet_if = false,
 };
 
 static const struct mhi_device_info mhi_swip0 = {
 	.netname = "mhi_swip%d",
+	.ethernet_if = false,
+};
+
+static const struct mhi_device_info mhi_eth0 = {
+	.netname = "eth%d",
+	.ethernet_if = true,
 };
W=1 builds warn that mhi_eth0 is unused.
I think this can be addressed by squashing patches 1/2 and 2/2.

...

-- 
pw-bot: changes-requested
Thread (7 messages) 7 messages, 3 authors, last reply 2025-11-11
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help