All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: mhi: Add raw IP mode support
@ 2020-12-14 16:12 Loic Poulain
  2020-12-16 19:20 ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: Loic Poulain @ 2020-12-14 16:12 UTC (permalink / raw)
  To: kuba, davem; +Cc: netdev, 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>
---
 drivers/net/mhi_net.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mhi_net.c b/drivers/net/mhi_net.c
index 5af6247..a1fb2b8 100644
--- a/drivers/net/mhi_net.c
+++ b/drivers/net/mhi_net.c
@@ -260,7 +260,18 @@ static void mhi_net_dl_callback(struct mhi_device *mhi_dev,
 		u64_stats_add(&mhi_netdev->stats.rx_bytes, skb->len);
 		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;
+		}
+
 		netif_rx(skb);
 	}
 
-- 
2.7.4


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

* Re: [PATCH] net: mhi: Add raw IP mode support
  2020-12-14 16:12 [PATCH] net: mhi: Add raw IP mode support Loic Poulain
@ 2020-12-16 19:20 ` Jakub Kicinski
  2020-12-17 14:16   ` Loic Poulain
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2020-12-16 19:20 UTC (permalink / raw)
  To: Loic Poulain; +Cc: davem, netdev

On Mon, 14 Dec 2020 17:12:24 +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.
> 
> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
> ---
>  drivers/net/mhi_net.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/mhi_net.c b/drivers/net/mhi_net.c
> index 5af6247..a1fb2b8 100644
> --- a/drivers/net/mhi_net.c
> +++ b/drivers/net/mhi_net.c
> @@ -260,7 +260,18 @@ static void mhi_net_dl_callback(struct mhi_device *mhi_dev,
>  		u64_stats_add(&mhi_netdev->stats.rx_bytes, skb->len);
>  		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;
> +		}

This doesn't apply, there is a skb_put() right here in the networking
tree :S Are we missing some other fix?

>  		netif_rx(skb);
>  	}
>  


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

* Re: [PATCH] net: mhi: Add raw IP mode support
  2020-12-16 19:20 ` Jakub Kicinski
@ 2020-12-17 14:16   ` Loic Poulain
  0 siblings, 0 replies; 3+ messages in thread
From: Loic Poulain @ 2020-12-17 14:16 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: David Miller, Network Development

On Wed, 16 Dec 2020 at 20:20, Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Mon, 14 Dec 2020 17:12:24 +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.
> >
> > Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
> > ---
> >  drivers/net/mhi_net.c | 13 ++++++++++++-
> >  1 file changed, 12 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/mhi_net.c b/drivers/net/mhi_net.c
> > index 5af6247..a1fb2b8 100644
> > --- a/drivers/net/mhi_net.c
> > +++ b/drivers/net/mhi_net.c
> > @@ -260,7 +260,18 @@ static void mhi_net_dl_callback(struct mhi_device *mhi_dev,
> >               u64_stats_add(&mhi_netdev->stats.rx_bytes, skb->len);
> >               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;
> > +             }
>
> This doesn't apply, there is a skb_put() right here in the networking
> tree :S Are we missing some other fix?

Yes, my bad, going to rebase that.

Regards,
Loic

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

end of thread, other threads:[~2020-12-17 14:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-14 16:12 [PATCH] net: mhi: Add raw IP mode support Loic Poulain
2020-12-16 19:20 ` Jakub Kicinski
2020-12-17 14:16   ` 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.