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

From: Simon Horman

Date: Fri Nov 07 2025 - 03:30:36 EST


On Thu, Nov 06, 2025 at 06:58:08PM +0530, Vivek Pernamitta wrote:
> From: Vivek Pernamitta <vivek.pernamitta@xxxxxxxxxxxxxxxx>
>
> 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 <vivek.pernamitta@xxxxxxxxxxxxxxxx>

...

> @@ -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.

> +
> + 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.

> +
> + return 0;
> +}

...

> @@ -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.

> + ndev->max_mtu = ETH_MAX_MTU;
> +}
> +
> static struct sk_buff *mhi_net_skb_agg(struct mhi_net_dev *mhi_netdev,
> struct sk_buff *skb)
> {

...

> @@ -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