[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1607962344-26325-1-git-send-email-loic.poulain@linaro.org>
Date: Mon, 14 Dec 2020 17:12:24 +0100
From: Loic Poulain <loic.poulain@...aro.org>
To: kuba@...nel.org, davem@...emloft.net
Cc: netdev@...r.kernel.org, Loic Poulain <loic.poulain@...aro.org>
Subject: [PATCH] net: mhi: Add raw IP mode support
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@...aro.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
Powered by blists - more mailing lists