public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v8 0/2] net: mhi: Add support to enable ethernet interface
@ 2026-02-12 11:00 Vivek Pernamitta
  2026-02-12 11:00 ` [PATCH v8 1/2] net: mhi: Enable Ethernet interface support Vivek Pernamitta
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Vivek Pernamitta @ 2026-02-12 11:00 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Manivannan Sadhasivam
  Cc: netdev, linux-kernel, mhi, linux-arm-msm, Vivek Pernamitta

Add support to configure a new client as Ethernet type over MHI
by setting "mhi_device_info.ethernet_if = true". Create a new
Ethernet interface named eth%d. This complements existing NET
driver support.

Enable IP_SW1 (ch:48/49), IP_ETH0 (ch:50,51) and IP_ETH1 (ch:52,
53) channels over MHI for M-plane, NETCONF and S-plane interface
for QDU100.

M-plane:
Implement DU M-Plane software for non-real-time O-RAN
management between O-DU and O-RU using NETCONF/YANG and
O-RAN WG4 M-Plane YANG models. Provide capability exchange,
configuration management, performance monitoring, and fault
management per O-RAN.WG4.TS.MP.0-R004-v18.00.
YANG model based interface aligned with O-RAN WG4 M-Plane
specifications over TCP between the OAM application on the
host and the DU M-Plane software running on the X100 platform.

Netconf:
Use NETCONF protocol for configuration operations such as
fetching, modifying, and deleting network device
configurations.
This interface is used for IETF Netconf communication,
enabling a Netconf server on the ORU to interact with a
Netconf client running on the host.

S-plane:
Support frequency and time synchronization between O-DUs and
O-RUs using Synchronous Ethernet and IEEE 1588. Assume PTP
transport over L2 Ethernet (ITU-T G.8275.1) for full timing
support; allow PTP over UDP/IP (ITU-T G.8275.2) with reduced
reliability, as per ORAN spec O-RAN.WG4.CUS.0-R003-v12.00.
To support accurate phase and time synchronization between
the host (L2) and device (L1-High), the system must exchange
PTP messages as raw Layer-2 Ethernet frames, because the
ITU-T G.8275.1 profile operates strictly over Ethernet
multicast and not over IP networks. This means the device’s
PTP stack can only send and receive PTP Announce, Sync,
Follow-Up, and Delay messages in native Ethernet format, not
as IPv4/IPv6 packets. However, the host and device communicate
only through MHI/PCIe, which provides no native Ethernet
interface. Therefore, the system must implement a virtual
Ethernet interface over MHI on both sides. This virtual
Layer-2 link enables true Ethernet-frame transport, ensuring
the device’s PTP implementation remains fully compliant with
the G.8275.1 Ethernet-based timing model.

The actual link between the device (QDU100) and the host is
PCIe/MHI. The device has the Ethernet interface and is exposed
as the MHI channel to the host. So this patch creates the
Ethernet interface on the host based on the 'IP_ETH' channel
so that the host can use this interface for exchanging the
NETCONF packets.

The patch primarily addresses host-to-DU(QDU100) communication.
However, the NETCONF/M-Plane packets originating from the host
will eventually be transmitted from the DU to the RU over the
fronthaul, which uses Ethernet. For additional details on this
architecture and data flow, refer to the O-RAN Management
Plane Specification:

O-RAN.WG4.MP.0-v07.00
O-RAN Alliance Working Group 4 – Management Plane
Specification
Chapter 4: O-RU to O-DU Interface Management

MHI_CHANNEL_CONFIG defines channel attributes for the host
controller to set up channel rings. These entries are part of
the MHI controller’s configuration so that client drivers, such
as the MHI network driver, can attach to them. Each interface is
mapped to an MHI channel (for example, eth0 → IP_ETH0 channels
50/51), which is why this configuration resides in the bus code.

Allocate MHI netdev's using NET_NAME_ENUM to reflect kernel-enumerated
naming. This updates the reported name_assign_type for MHI net
interfaces created by this driver, aligning naming semantics across
existing and new devices. No functional or interface naming changes
are introduced.

Signed-off-by: Vivek Pernamitta <vivek.pernamitta@oss.qualcomm.com>
---
patchset link for V7 : https://lore.kernel.org/all/20260205-eth_vdev_next-20260204_eth-v7-0-f85645210f81@qti.qualcomm.com/
patchset link for V6 : https://lore.kernel.org/all/20251209-vdev_next-20251208_eth_v6-v6-0-80898204f5d8@quicinc.com/
patchset link for V1 (first post) : https://lore.kernel.org/all/20250724-b4-eth_us-v1-0-4dff04a9a128@quicinc.com/

changes to v8:
- Removed skb_copy_to_linear_data call as it is not needed, updated
  as per Loic Poulain and Paolo Abeni.
- Removed ethernet_if member in struct mhi_net_dev instead used
  !!ndev->header_ops check for ethernet protocol as per paolo Abeni.
- Updated more infromation in commit text for change from
  NET_NAME_PREDICTABLE to NET_NAME_ENUM.

changes to v7:
- Updated to NET_NAME_ENUM while allocating netdev as per Andrew
- Updated more information as per comments from Jakub and Mani

changes to v6:
- Removed interm variable useage as per comments from Simon and Dmirty.
- Squashed gerrits 1 and 2 in single gerrit.
- Added more description for M-plane, Netconf and S-plane.

changes to v5:
- change in email ID from "quic_vpernami@quicinc.com" to "vivek.pernamitta@oss.qualcomm.com"
- Renamed to patch v5 as per comments from Manivannan
- Restored to original name as per comments from Jakub
- Renamed the ethernet interfce to eth%d as per Jakub
---

---
Vivek Pernamitta (2):
      net: mhi: Enable Ethernet interface support
      bus: mhi: host: pci: Enable IP_SW1, IP_ETH0 and IP_ETH1 channels for QDU100

 drivers/bus/mhi/host/pci_generic.c |  8 +++++
 drivers/net/mhi_net.c              | 67 +++++++++++++++++++++++++++++++-------
 2 files changed, 64 insertions(+), 11 deletions(-)
---
base-commit: 9152bc8cebcb14dc16b03ec81f2377ee8ce12268
change-id: 20260212-eth_vdev_next-20260211-bc83e286fb52

Best regards,
-- 
Vivek Pernamitta <vpernami@qti.qualcomm.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v8 1/2] net: mhi: Enable Ethernet interface support
  2026-02-12 11:00 [PATCH v8 0/2] net: mhi: Add support to enable ethernet interface Vivek Pernamitta
@ 2026-02-12 11:00 ` Vivek Pernamitta
  2026-02-13  3:02   ` Jakub Kicinski
  2026-03-06  5:54   ` Manivannan Sadhasivam
  2026-02-12 11:00 ` [PATCH v8 2/2] bus: mhi: host: pci: Enable IP_SW1, IP_ETH0 and IP_ETH1 channels for QDU100 Vivek Pernamitta
  2026-03-06  6:01 ` (subset) [PATCH v8 0/2] net: mhi: Add support to enable ethernet interface Manivannan Sadhasivam
  2 siblings, 2 replies; 7+ messages in thread
From: Vivek Pernamitta @ 2026-02-12 11:00 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Manivannan Sadhasivam
  Cc: netdev, linux-kernel, mhi, linux-arm-msm, Vivek Pernamitta

From: Vivek Pernamitta <vivek.pernamitta@oss.qualcomm.com>

Add support to configure a new client as Ethernet type over MHI by
setting "mhi_device_info.ethernet_if = true". Create a new Ethernet
interface named eth%d. This complements existing NET driver support.

Allocate MHI netdevs using NET_NAME_ENUM to reflect kernel-enumerated
naming. This updates the reported name_assign_type for MHI net
interfaces created by this driver, aligning naming semantics across
existing and new devices. No functional or interface naming changes
are introduced

Introduce IP_SW1, ETH0, and ETH1 network interfaces required for
M-plane, NETCONF, and S-plane components.

M-plane:
Implement DU M-Plane software for non-real-time O-RAN management
between O-DU and O-RU using NETCONF/YANG and O-RAN WG4 M-Plane YANG
models. Provide capability exchange, configuration management,
performance monitoring, and fault management per O-RAN.WG4.TS.MP.0-
R004-v18.00.

NETCONF:
Use NETCONF protocol for configuration operations such as fetching,
modifying, and deleting network device configurations.

S-plane:
Support frequency and time synchronization between O-DUs and O-RUs
using Synchronous Ethernet and IEEE 1588. Assume PTP transport over
L2 Ethernet (ITU-T G.8275.1) for full timing support; allow PTP over
UDP/IP (ITU-T G.8275.2) with reduced reliability. as per ORAN spec
O-RAN.WG4.CUS.0-R003-v12.00.

Signed-off-by: Vivek Pernamitta <vivek.pernamitta@oss.qualcomm.com>
---
 drivers/net/mhi_net.c | 67 ++++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 56 insertions(+), 11 deletions(-)

diff --git a/drivers/net/mhi_net.c b/drivers/net/mhi_net.c
index ae169929a9d8e449b5a427993abf68e8d032fae2..aa65b267d5c06c76482eaede097c500edc1cdf7f 100644
--- a/drivers/net/mhi_net.c
+++ b/drivers/net/mhi_net.c
@@ -4,6 +4,7 @@
  * Copyright (C) 2020 Linaro Ltd <loic.poulain@linaro.org>
  */
 
+#include <linux/etherdevice.h>
 #include <linux/if_arp.h>
 #include <linux/mhi.h>
 #include <linux/mod_devicetable.h>
@@ -42,6 +43,7 @@ struct mhi_net_dev {
 
 struct mhi_device_info {
 	const char *netname;
+	bool ethernet_if;
 };
 
 static int mhi_ndo_open(struct net_device *ndev)
@@ -119,11 +121,29 @@ 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)
+{
+	if (dev->type == ARPHRD_ETHER)
+		return eth_mac_addr(dev, p);
+
+	return 0;
+}
+
+static int mhi_validate_address(struct net_device *dev)
+{
+	if (dev->type == ARPHRD_ETHER)
+		return eth_validate_addr(dev);
+
+	return 0;
+}
+
 static const struct net_device_ops mhi_netdev_ops = {
 	.ndo_open               = mhi_ndo_open,
 	.ndo_stop               = mhi_ndo_stop,
 	.ndo_start_xmit         = mhi_ndo_xmit,
 	.ndo_get_stats64	= mhi_ndo_get_stats64,
+	.ndo_set_mac_address    = mhi_mac_address,
+	.ndo_validate_addr      = mhi_validate_address,
 };
 
 static void mhi_net_setup(struct net_device *ndev)
@@ -140,6 +160,13 @@ 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->max_mtu = ETH_MAX_MTU;
+}
+
 static struct sk_buff *mhi_net_skb_agg(struct mhi_net_dev *mhi_netdev,
 				       struct sk_buff *skb)
 {
@@ -209,16 +236,20 @@ static void mhi_net_dl_callback(struct mhi_device *mhi_dev,
 			mhi_netdev->skbagg_head = NULL;
 		}
 
-		switch (skb->data[0] & 0xf0) {
-		case 0x40:
-			skb->protocol = htons(ETH_P_IP);
-			break;
-		case 0x60:
-			skb->protocol = htons(ETH_P_IPV6);
-			break;
-		default:
-			skb->protocol = htons(ETH_P_MAP);
-			break;
+		if (!!mhi_netdev->ndev->header_ops) {
+			skb->protocol = eth_type_trans(skb, mhi_netdev->ndev);
+		} else {
+			switch (skb->data[0] & 0xf0) {
+			case 0x40:
+				skb->protocol = htons(ETH_P_IP);
+				break;
+			case 0x60:
+				skb->protocol = htons(ETH_P_IPV6);
+				break;
+			default:
+				skb->protocol = htons(ETH_P_MAP);
+				break;
+			}
 		}
 
 		u64_stats_update_begin(&mhi_netdev->stats.rx_syncp);
@@ -306,6 +337,9 @@ static int mhi_net_newlink(struct mhi_device *mhi_dev, struct net_device *ndev)
 	struct mhi_net_dev *mhi_netdev;
 	int err;
 
+	if (!!ndev->header_ops)
+		eth_hw_addr_random(ndev);
+
 	mhi_netdev = netdev_priv(ndev);
 
 	dev_set_drvdata(&mhi_dev->dev, mhi_netdev);
@@ -356,7 +390,8 @@ static int mhi_net_probe(struct mhi_device *mhi_dev,
 	int err;
 
 	ndev = alloc_netdev(sizeof(struct mhi_net_dev), info->netname,
-			    NET_NAME_PREDICTABLE, mhi_net_setup);
+			    NET_NAME_ENUM, info->ethernet_if ?
+			    mhi_ethernet_setup : mhi_net_setup);
 	if (!ndev)
 		return -ENOMEM;
 
@@ -380,10 +415,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,
 };
 
 static const struct mhi_device_id mhi_net_id_table[] = {
@@ -391,6 +433,9 @@ static const struct mhi_device_id mhi_net_id_table[] = {
 	{ .chan = "IP_HW0", .driver_data = (kernel_ulong_t)&mhi_hwip0 },
 	/* Software data PATH (to modem CPU) */
 	{ .chan = "IP_SW0", .driver_data = (kernel_ulong_t)&mhi_swip0 },
+	{ .chan = "IP_SW1", .driver_data = (kernel_ulong_t)&mhi_swip0 },
+	{ .chan = "IP_ETH0", .driver_data = (kernel_ulong_t)&mhi_eth0 },
+	{ .chan = "IP_ETH1", .driver_data = (kernel_ulong_t)&mhi_eth0 },
 	{}
 };
 MODULE_DEVICE_TABLE(mhi, mhi_net_id_table);

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v8 2/2] bus: mhi: host: pci: Enable IP_SW1, IP_ETH0 and IP_ETH1 channels for QDU100
  2026-02-12 11:00 [PATCH v8 0/2] net: mhi: Add support to enable ethernet interface Vivek Pernamitta
  2026-02-12 11:00 ` [PATCH v8 1/2] net: mhi: Enable Ethernet interface support Vivek Pernamitta
@ 2026-02-12 11:00 ` Vivek Pernamitta
  2026-03-06  6:01 ` (subset) [PATCH v8 0/2] net: mhi: Add support to enable ethernet interface Manivannan Sadhasivam
  2 siblings, 0 replies; 7+ messages in thread
From: Vivek Pernamitta @ 2026-02-12 11:00 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Manivannan Sadhasivam
  Cc: netdev, linux-kernel, mhi, linux-arm-msm, Vivek Pernamitta

From: Vivek Pernamitta <vivek.pernamitta@oss.qualcomm.com>

Enable IP_SW1 (ch:48/49), IP_ETH0 (ch:50,51) and IP_ETH1 (ch:52,
53) channels over MHI for M-plane, NETCONF and S-plane interface
for QDU100.

M-plane:
Implement DU M-Plane software for non-real-time O-RAN
management between O-DU and O-RU using NETCONF/YANG and
O-RAN WG4 M-Plane YANG models. Provide capability exchange,
configuration management, performance monitoring, and fault
management per O-RAN.WG4.TS.MP.0-R004-v18.00.

YANG model based interface aligned with O-RAN WG4 M-Plane
specifications over TCP between the OAM application on the
host and the DU M-Plane software running on the X100 platform.

Netconf:
Use NETCONF protocol for configuration operations such as
fetching, modifying, and deleting network device
configurations.

This interface is used for IETF Netconf communication,
enabling a Netconf server on the ORU to interact with a
Netconf client running on the host.

S-plane:
Support frequency and time synchronization between O-DUs and
O-RUs using Synchronous Ethernet and IEEE 1588. Assume PTP
transport over L2 Ethernet (ITU-T G.8275.1) for full timing
support; allow PTP over UDP/IP (ITU-T G.8275.2) with reduced
reliability, as per ORAN spec O-RAN.WG4.CUS.0-R003-v12.00.

To support accurate phase and time synchronization between
the host (L2) and device (L1-High), the system must exchange
PTP messages as raw Layer-2 Ethernet frames, because the
ITU-T G.8275.1 profile operates strictly over Ethernet
multicast and not over IP networks. This means the device’s
PTP stack can only send and receive PTP Announce, Sync,
Follow-Up, and Delay messages in native Ethernet format, not
as IPv4/IPv6 packets. However, the host and device communicate
only through MHI/PCIe, which provides no native Ethernet
interface. Therefore, the system must implement a virtual
Ethernet interface over MHI on both sides. This virtual
Layer-2 link enables true Ethernet-frame transport, ensuring
the device’s PTP implementation remains fully compliant with
the G.8275.1 Ethernet-based timing model.

Signed-off-by: Vivek Pernamitta <vivek.pernamitta@oss.qualcomm.com>
---
 drivers/bus/mhi/host/pci_generic.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_generic.c
index 0884a384b77fc3f56fa62a12351933132ffc9293..6affef34ffc449eb48cd254bf3d8d69a49aeafdb 100644
--- a/drivers/bus/mhi/host/pci_generic.c
+++ b/drivers/bus/mhi/host/pci_generic.c
@@ -253,6 +253,13 @@ static const struct mhi_channel_config mhi_qcom_qdu100_channels[] = {
 	MHI_CHANNEL_CONFIG_DL(41, "MHI_PHC", 32, 4),
 	MHI_CHANNEL_CONFIG_UL(46, "IP_SW0", 256, 5),
 	MHI_CHANNEL_CONFIG_DL(47, "IP_SW0", 256, 5),
+	MHI_CHANNEL_CONFIG_UL(48, "IP_SW1", 256, 6),
+	MHI_CHANNEL_CONFIG_DL(49, "IP_SW1", 256, 6),
+	MHI_CHANNEL_CONFIG_UL(50, "IP_ETH0", 256, 7),
+	MHI_CHANNEL_CONFIG_DL(51, "IP_ETH0", 256, 7),
+	MHI_CHANNEL_CONFIG_UL(52, "IP_ETH1", 256, 8),
+	MHI_CHANNEL_CONFIG_DL(53, "IP_ETH1", 256, 8),
+
 };
 
 static struct mhi_event_config mhi_qcom_qdu100_events[] = {
@@ -268,6 +275,7 @@ static struct mhi_event_config mhi_qcom_qdu100_events[] = {
 	MHI_EVENT_CONFIG_SW_DATA(5, 512),
 	MHI_EVENT_CONFIG_SW_DATA(6, 512),
 	MHI_EVENT_CONFIG_SW_DATA(7, 512),
+	MHI_EVENT_CONFIG_SW_DATA(8, 512),
 };
 
 static const struct mhi_controller_config mhi_qcom_qdu100_config = {

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v8 1/2] net: mhi: Enable Ethernet interface support
  2026-02-12 11:00 ` [PATCH v8 1/2] net: mhi: Enable Ethernet interface support Vivek Pernamitta
@ 2026-02-13  3:02   ` Jakub Kicinski
  2026-03-06  5:54   ` Manivannan Sadhasivam
  1 sibling, 0 replies; 7+ messages in thread
From: Jakub Kicinski @ 2026-02-13  3:02 UTC (permalink / raw)
  To: Vivek Pernamitta
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Paolo Abeni,
	Manivannan Sadhasivam, netdev, linux-kernel, mhi, linux-arm-msm

On Thu, 12 Feb 2026 16:30:22 +0530 Vivek Pernamitta wrote:
> Add support to configure a new client as Ethernet type over MHI by
> setting "mhi_device_info.ethernet_if = true". Create a new Ethernet
> interface named eth%d. This complements existing NET driver support.

## Form letter - net-next-closed

We have already submitted our pull request with net-next material for v7.0,
and therefore net-next is closed for new drivers, features, code refactoring
and optimizations. We are currently accepting bug fixes only.

Please repost when net-next reopens after Feb 23rd.

RFC patches sent for review only are obviously welcome at any time.

See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#development-cycle
-- 
pw-bot: defer
pv-bot: closed

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v8 1/2] net: mhi: Enable Ethernet interface support
  2026-02-12 11:00 ` [PATCH v8 1/2] net: mhi: Enable Ethernet interface support Vivek Pernamitta
  2026-02-13  3:02   ` Jakub Kicinski
@ 2026-03-06  5:54   ` Manivannan Sadhasivam
  2026-03-23  6:11     ` vivek pernamitta
  1 sibling, 1 reply; 7+ messages in thread
From: Manivannan Sadhasivam @ 2026-03-06  5:54 UTC (permalink / raw)
  To: Vivek Pernamitta
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, netdev, linux-kernel, mhi, linux-arm-msm

On Thu, Feb 12, 2026 at 04:30:22PM +0530, Vivek Pernamitta wrote:
> From: Vivek Pernamitta <vivek.pernamitta@oss.qualcomm.com>
> 
> Add support to configure a new client as Ethernet type over MHI by
> setting "mhi_device_info.ethernet_if = true". Create a new Ethernet
> interface named eth%d. This complements existing NET driver support.
> 
> Allocate MHI netdevs using NET_NAME_ENUM to reflect kernel-enumerated
> naming. This updates the reported name_assign_type for MHI net
> interfaces created by this driver, aligning naming semantics across
> existing and new devices. No functional or interface naming changes
> are introduced
> 
> Introduce IP_SW1, ETH0, and ETH1 network interfaces required for

IP_SW1 is not related to this patch.

> M-plane, NETCONF, and S-plane components.
> 

The main thing you want to describe in description is that IP_ETH channels are
representing the Ethernet interface of the MHI device for which the driver is
also creating the netdev interface so that the host can access the Ethernet
interface of the device.

> M-plane:
> Implement DU M-Plane software for non-real-time O-RAN management
> between O-DU and O-RU using NETCONF/YANG and O-RAN WG4 M-Plane YANG
> models. Provide capability exchange, configuration management,
> performance monitoring, and fault management per O-RAN.WG4.TS.MP.0-
> R004-v18.00.
> 
> NETCONF:
> Use NETCONF protocol for configuration operations such as fetching,
> modifying, and deleting network device configurations.
> 
> S-plane:
> Support frequency and time synchronization between O-DUs and O-RUs
> using Synchronous Ethernet and IEEE 1588. Assume PTP transport over
> L2 Ethernet (ITU-T G.8275.1) for full timing support; allow PTP over
> UDP/IP (ITU-T G.8275.2) with reduced reliability. as per ORAN spec
> O-RAN.WG4.CUS.0-R003-v12.00.
> 
> Signed-off-by: Vivek Pernamitta <vivek.pernamitta@oss.qualcomm.com>
> ---
>  drivers/net/mhi_net.c | 67 ++++++++++++++++++++++++++++++++++++++++++---------
>  1 file changed, 56 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/mhi_net.c b/drivers/net/mhi_net.c
> index ae169929a9d8e449b5a427993abf68e8d032fae2..aa65b267d5c06c76482eaede097c500edc1cdf7f 100644
> --- a/drivers/net/mhi_net.c
> +++ b/drivers/net/mhi_net.c
> @@ -4,6 +4,7 @@
>   * Copyright (C) 2020 Linaro Ltd <loic.poulain@linaro.org>
>   */
>  
> +#include <linux/etherdevice.h>
>  #include <linux/if_arp.h>
>  #include <linux/mhi.h>
>  #include <linux/mod_devicetable.h>
> @@ -42,6 +43,7 @@ struct mhi_net_dev {
>  
>  struct mhi_device_info {
>  	const char *netname;
> +	bool ethernet_if;
>  };
>  
>  static int mhi_ndo_open(struct net_device *ndev)
> @@ -119,11 +121,29 @@ 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)
> +{
> +	if (dev->type == ARPHRD_ETHER)
> +		return eth_mac_addr(dev, p);
> +
> +	return 0;
> +}
> +
> +static int mhi_validate_address(struct net_device *dev)
> +{
> +	if (dev->type == ARPHRD_ETHER)
> +		return eth_validate_addr(dev);
> +
> +	return 0;
> +}
> +
>  static const struct net_device_ops mhi_netdev_ops = {
>  	.ndo_open               = mhi_ndo_open,
>  	.ndo_stop               = mhi_ndo_stop,
>  	.ndo_start_xmit         = mhi_ndo_xmit,
>  	.ndo_get_stats64	= mhi_ndo_get_stats64,
> +	.ndo_set_mac_address    = mhi_mac_address,
> +	.ndo_validate_addr      = mhi_validate_address,
>  };
>  
>  static void mhi_net_setup(struct net_device *ndev)
> @@ -140,6 +160,13 @@ 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->max_mtu = ETH_MAX_MTU;
> +}
> +
>  static struct sk_buff *mhi_net_skb_agg(struct mhi_net_dev *mhi_netdev,
>  				       struct sk_buff *skb)
>  {
> @@ -209,16 +236,20 @@ static void mhi_net_dl_callback(struct mhi_device *mhi_dev,
>  			mhi_netdev->skbagg_head = NULL;
>  		}
>  
> -		switch (skb->data[0] & 0xf0) {
> -		case 0x40:
> -			skb->protocol = htons(ETH_P_IP);
> -			break;
> -		case 0x60:
> -			skb->protocol = htons(ETH_P_IPV6);
> -			break;
> -		default:
> -			skb->protocol = htons(ETH_P_MAP);
> -			break;
> +		if (!!mhi_netdev->ndev->header_ops) {

Why not just if (mhi_netdev->ndev->header_ops)?

But you should really check ARPHRD_ETHER type here and below.

> +			skb->protocol = eth_type_trans(skb, mhi_netdev->ndev);
> +		} else {
> +			switch (skb->data[0] & 0xf0) {
> +			case 0x40:
> +				skb->protocol = htons(ETH_P_IP);
> +				break;
> +			case 0x60:
> +				skb->protocol = htons(ETH_P_IPV6);
> +				break;
> +			default:
> +				skb->protocol = htons(ETH_P_MAP);
> +				break;
> +			}
>  		}
>  
>  		u64_stats_update_begin(&mhi_netdev->stats.rx_syncp);
> @@ -306,6 +337,9 @@ static int mhi_net_newlink(struct mhi_device *mhi_dev, struct net_device *ndev)
>  	struct mhi_net_dev *mhi_netdev;
>  	int err;
>  
> +	if (!!ndev->header_ops)
> +		eth_hw_addr_random(ndev);
> +
>  	mhi_netdev = netdev_priv(ndev);
>  
>  	dev_set_drvdata(&mhi_dev->dev, mhi_netdev);
> @@ -356,7 +390,8 @@ static int mhi_net_probe(struct mhi_device *mhi_dev,
>  	int err;
>  
>  	ndev = alloc_netdev(sizeof(struct mhi_net_dev), info->netname,
> -			    NET_NAME_PREDICTABLE, mhi_net_setup);
> +			    NET_NAME_ENUM, info->ethernet_if ?
> +			    mhi_ethernet_setup : mhi_net_setup);
>  	if (!ndev)
>  		return -ENOMEM;
>  
> @@ -380,10 +415,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,

Default state is false isn't it? No need to set it explicitly.

- Mani

-- 
மணிவண்ணன் சதாசிவம்

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: (subset) [PATCH v8 0/2] net: mhi: Add support to enable ethernet interface
  2026-02-12 11:00 [PATCH v8 0/2] net: mhi: Add support to enable ethernet interface Vivek Pernamitta
  2026-02-12 11:00 ` [PATCH v8 1/2] net: mhi: Enable Ethernet interface support Vivek Pernamitta
  2026-02-12 11:00 ` [PATCH v8 2/2] bus: mhi: host: pci: Enable IP_SW1, IP_ETH0 and IP_ETH1 channels for QDU100 Vivek Pernamitta
@ 2026-03-06  6:01 ` Manivannan Sadhasivam
  2 siblings, 0 replies; 7+ messages in thread
From: Manivannan Sadhasivam @ 2026-03-06  6:01 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Manivannan Sadhasivam, Vivek Pernamitta
  Cc: netdev, linux-kernel, mhi, linux-arm-msm


On Thu, 12 Feb 2026 16:30:21 +0530, Vivek Pernamitta wrote:
> Add support to configure a new client as Ethernet type over MHI
> by setting "mhi_device_info.ethernet_if = true". Create a new
> Ethernet interface named eth%d. This complements existing NET
> driver support.
> 
> Enable IP_SW1 (ch:48/49), IP_ETH0 (ch:50,51) and IP_ETH1 (ch:52,
> 53) channels over MHI for M-plane, NETCONF and S-plane interface
> for QDU100.
> 
> [...]

Applied, thanks!

[2/2] bus: mhi: host: pci: Enable IP_SW1, IP_ETH0 and IP_ETH1 channels for QDU100
      commit: 3cdd83ccd7d0d990ec55b35c8a794d84b22a9fd0

Best regards,
-- 
Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v8 1/2] net: mhi: Enable Ethernet interface support
  2026-03-06  5:54   ` Manivannan Sadhasivam
@ 2026-03-23  6:11     ` vivek pernamitta
  0 siblings, 0 replies; 7+ messages in thread
From: vivek pernamitta @ 2026-03-23  6:11 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, netdev, linux-kernel, mhi, linux-arm-msm



On 3/6/2026 11:24 AM, Manivannan Sadhasivam wrote:
> On Thu, Feb 12, 2026 at 04:30:22PM +0530, Vivek Pernamitta wrote:
>> From: Vivek Pernamitta <vivek.pernamitta@oss.qualcomm.com>
>>
>> Add support to configure a new client as Ethernet type over MHI by
>> setting "mhi_device_info.ethernet_if = true". Create a new Ethernet
>> interface named eth%d. This complements existing NET driver support.
>>
>> Allocate MHI netdevs using NET_NAME_ENUM to reflect kernel-enumerated
>> naming. This updates the reported name_assign_type for MHI net
>> interfaces created by this driver, aligning naming semantics across
>> existing and new devices. No functional or interface naming changes
>> are introduced
>>
>> Introduce IP_SW1, ETH0, and ETH1 network interfaces required for
> 
> IP_SW1 is not related to this patch.
Will create an new patch for IP_SW1 alone in the same series.
> 
>> M-plane, NETCONF, and S-plane components.
>>
> 
> The main thing you want to describe in description is that IP_ETH channels are
> representing the Ethernet interface of the MHI device for which the driver is
> also creating the netdev interface so that the host can access the Ethernet
> interface of the device.
Will add this information in commit message.
> 
>> M-plane:
>> Implement DU M-Plane software for non-real-time O-RAN management
>> between O-DU and O-RU using NETCONF/YANG and O-RAN WG4 M-Plane YANG
>> models. Provide capability exchange, configuration management,
>> performance monitoring, and fault management per O-RAN.WG4.TS.MP.0-
>> R004-v18.00.
>>
>> NETCONF:
>> Use NETCONF protocol for configuration operations such as fetching,
>> modifying, and deleting network device configurations.
>>
>> S-plane:
>> Support frequency and time synchronization between O-DUs and O-RUs
>> using Synchronous Ethernet and IEEE 1588. Assume PTP transport over
>> L2 Ethernet (ITU-T G.8275.1) for full timing support; allow PTP over
>> UDP/IP (ITU-T G.8275.2) with reduced reliability. as per ORAN spec
>> O-RAN.WG4.CUS.0-R003-v12.00.
>>
>> Signed-off-by: Vivek Pernamitta <vivek.pernamitta@oss.qualcomm.com>
>> ---
>>   drivers/net/mhi_net.c | 67 ++++++++++++++++++++++++++++++++++++++++++---------
>>   1 file changed, 56 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/net/mhi_net.c b/drivers/net/mhi_net.c
>> index ae169929a9d8e449b5a427993abf68e8d032fae2..aa65b267d5c06c76482eaede097c500edc1cdf7f 100644
>> --- a/drivers/net/mhi_net.c
>> +++ b/drivers/net/mhi_net.c
>> @@ -4,6 +4,7 @@
>>    * Copyright (C) 2020 Linaro Ltd <loic.poulain@linaro.org>
>>    */
>>   
>> +#include <linux/etherdevice.h>
>>   #include <linux/if_arp.h>
>>   #include <linux/mhi.h>
>>   #include <linux/mod_devicetable.h>
>> @@ -42,6 +43,7 @@ struct mhi_net_dev {
>>   
>>   struct mhi_device_info {
>>   	const char *netname;
>> +	bool ethernet_if;
>>   };
>>   
>>   static int mhi_ndo_open(struct net_device *ndev)
>> @@ -119,11 +121,29 @@ 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)
>> +{
>> +	if (dev->type == ARPHRD_ETHER)
>> +		return eth_mac_addr(dev, p);
>> +
>> +	return 0;
>> +}
>> +
>> +static int mhi_validate_address(struct net_device *dev)
>> +{
>> +	if (dev->type == ARPHRD_ETHER)
>> +		return eth_validate_addr(dev);
>> +
>> +	return 0;
>> +}
>> +
>>   static const struct net_device_ops mhi_netdev_ops = {
>>   	.ndo_open               = mhi_ndo_open,
>>   	.ndo_stop               = mhi_ndo_stop,
>>   	.ndo_start_xmit         = mhi_ndo_xmit,
>>   	.ndo_get_stats64	= mhi_ndo_get_stats64,
>> +	.ndo_set_mac_address    = mhi_mac_address,
>> +	.ndo_validate_addr      = mhi_validate_address,
>>   };
>>   
>>   static void mhi_net_setup(struct net_device *ndev)
>> @@ -140,6 +160,13 @@ 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->max_mtu = ETH_MAX_MTU;
>> +}
>> +
>>   static struct sk_buff *mhi_net_skb_agg(struct mhi_net_dev *mhi_netdev,
>>   				       struct sk_buff *skb)
>>   {
>> @@ -209,16 +236,20 @@ static void mhi_net_dl_callback(struct mhi_device *mhi_dev,
>>   			mhi_netdev->skbagg_head = NULL;
>>   		}
>>   
>> -		switch (skb->data[0] & 0xf0) {
>> -		case 0x40:
>> -			skb->protocol = htons(ETH_P_IP);
>> -			break;
>> -		case 0x60:
>> -			skb->protocol = htons(ETH_P_IPV6);
>> -			break;
>> -		default:
>> -			skb->protocol = htons(ETH_P_MAP);
>> -			break;
>> +		if (!!mhi_netdev->ndev->header_ops) {
> 
> Why not just if (mhi_netdev->ndev->header_ops)?
sure , will make changes accordingly.

> 
> But you should really check ARPHRD_ETHER type here and below.
Sure, Will add an check for ARPHRD_ETHER type before assigning protocol.

> 
>> +			skb->protocol = eth_type_trans(skb, mhi_netdev->ndev);
>> +		} else {
>> +			switch (skb->data[0] & 0xf0) {
>> +			case 0x40:
>> +				skb->protocol = htons(ETH_P_IP);
>> +				break;
>> +			case 0x60:
>> +				skb->protocol = htons(ETH_P_IPV6);
>> +				break;
>> +			default:
>> +				skb->protocol = htons(ETH_P_MAP);
>> +				break;
>> +			}
>>   		}
>>   
>>   		u64_stats_update_begin(&mhi_netdev->stats.rx_syncp);
>> @@ -306,6 +337,9 @@ static int mhi_net_newlink(struct mhi_device *mhi_dev, struct net_device *ndev)
>>   	struct mhi_net_dev *mhi_netdev;
>>   	int err;
>>   
>> +	if (!!ndev->header_ops)
>> +		eth_hw_addr_random(ndev);
>> +
>>   	mhi_netdev = netdev_priv(ndev);
>>   
>>   	dev_set_drvdata(&mhi_dev->dev, mhi_netdev);
>> @@ -356,7 +390,8 @@ static int mhi_net_probe(struct mhi_device *mhi_dev,
>>   	int err;
>>   
>>   	ndev = alloc_netdev(sizeof(struct mhi_net_dev), info->netname,
>> -			    NET_NAME_PREDICTABLE, mhi_net_setup);
>> +			    NET_NAME_ENUM, info->ethernet_if ?
>> +			    mhi_ethernet_setup : mhi_net_setup);
>>   	if (!ndev)
>>   		return -ENOMEM;
>>   
>> @@ -380,10 +415,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,
> 
> Default state is false isn't it? No need to set it explicitly.\
> 
> - Mani
> 
ok, will make changes in next patchset.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-03-23  6:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-12 11:00 [PATCH v8 0/2] net: mhi: Add support to enable ethernet interface Vivek Pernamitta
2026-02-12 11:00 ` [PATCH v8 1/2] net: mhi: Enable Ethernet interface support Vivek Pernamitta
2026-02-13  3:02   ` Jakub Kicinski
2026-03-06  5:54   ` Manivannan Sadhasivam
2026-03-23  6:11     ` vivek pernamitta
2026-02-12 11:00 ` [PATCH v8 2/2] bus: mhi: host: pci: Enable IP_SW1, IP_ETH0 and IP_ETH1 channels for QDU100 Vivek Pernamitta
2026-03-06  6:01 ` (subset) [PATCH v8 0/2] net: mhi: Add support to enable ethernet interface Manivannan Sadhasivam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox