All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] net: mhi: Add raw IP mode support
@ 2020-12-17 15:34 Loic Poulain
  2020-12-17 16:58 ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: Loic Poulain @ 2020-12-17 15:34 UTC (permalink / raw)
  To: kuba, davem; +Cc: linux-kernel, Loic Poulain

MHI net is protocol agnostic, the payload protocol depends on the modem
configuration, which can be either RMNET (IP muxing and aggregation) or
raw IP. This patch adds support for incomming IPv4/IPv6 packets, that
was previously unconditionnaly reported as RMNET packets.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
---
 v2: - mhi-net rebase
     - Set device type to RAWIP

 drivers/net/mhi_net.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mhi_net.c b/drivers/net/mhi_net.c
index e3f9c0d..478e78f 100644
--- a/drivers/net/mhi_net.c
+++ b/drivers/net/mhi_net.c
@@ -121,7 +121,7 @@ static const struct net_device_ops mhi_netdev_ops = {
 static void mhi_net_setup(struct net_device *ndev)
 {
 	ndev->header_ops = NULL;  /* No header */
-	ndev->type = ARPHRD_NONE; /* QMAP... */
+	ndev->type = ARPHRD_RAWIP;
 	ndev->hard_header_len = 0;
 	ndev->addr_len = 0;
 	ndev->flags = IFF_POINTOPOINT | IFF_NOARP;
@@ -157,7 +157,18 @@ static void mhi_net_dl_callback(struct mhi_device *mhi_dev,
 		u64_stats_add(&mhi_netdev->stats.rx_bytes, mhi_res->bytes_xferd);
 		u64_stats_update_end(&mhi_netdev->stats.rx_syncp);
 
-		skb->protocol = htons(ETH_P_MAP);
+		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;
+		}
+
 		skb_put(skb, mhi_res->bytes_xferd);
 		netif_rx(skb);
 	}
-- 
2.7.4


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

* Re: [PATCH v2] net: mhi: Add raw IP mode support
  2020-12-17 15:34 [PATCH v2] net: mhi: Add raw IP mode support Loic Poulain
@ 2020-12-17 16:58 ` Jakub Kicinski
  2020-12-18  8:01   ` Loic Poulain
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2020-12-17 16:58 UTC (permalink / raw)
  To: Loic Poulain; +Cc: davem, linux-kernel

On Thu, 17 Dec 2020 16:34:09 +0100 Loic Poulain wrote:
> MHI net is protocol agnostic, the payload protocol depends on the modem
> configuration, which can be either RMNET (IP muxing and aggregation) or
> raw IP. This patch adds support for incomming IPv4/IPv6 packets, that
> was previously unconditionnaly reported as RMNET packets.

Now it sounds a lot more like an extension than a fix. Is the interface
usable without this change? If it is we should merge this into net-next
after the merge window.

Either way you need to cc netdev for this patch to get into patchwork. 

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

* Re: [PATCH v2] net: mhi: Add raw IP mode support
  2020-12-17 16:58 ` Jakub Kicinski
@ 2020-12-18  8:01   ` Loic Poulain
  0 siblings, 0 replies; 3+ messages in thread
From: Loic Poulain @ 2020-12-18  8:01 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: David Miller, open list

Hi Jakub,

On Thu, 17 Dec 2020 at 17:58, Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Thu, 17 Dec 2020 16:34:09 +0100 Loic Poulain wrote:
> > MHI net is protocol agnostic, the payload protocol depends on the modem
> > configuration, which can be either RMNET (IP muxing and aggregation) or
> > raw IP. This patch adds support for incomming IPv4/IPv6 packets, that
> > was previously unconditionnaly reported as RMNET packets.
>
> Now it sounds a lot more like an extension than a fix. Is the interface
> usable without this change? If it is we should merge this into net-next
> after the merge window.

Yes, without this change, interface is usable when modem is configured
with RMNET protocol, it's an extension to raw ip support.

>
> Either way you need to cc netdev for this patch to get into patchwork.

I'll resubmit after the merge window.

Thanks,
Loic

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

end of thread, other threads:[~2020-12-18  7:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-17 15:34 [PATCH v2] net: mhi: Add raw IP mode support Loic Poulain
2020-12-17 16:58 ` Jakub Kicinski
2020-12-18  8:01   ` Loic Poulain

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.