Message ID | 1609232694-10858-1-git-send-email-loic.poulain@linaro.org (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next,v3] net: mhi: Add raw IP mode support | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | success | CCed 3 of 3 maintainers |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | warning | WARNING: 'incomming' may be misspelled - perhaps 'incoming'? |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
netdev/stable | success | Stable not CCed |
From: Loic Poulain <loic.poulain@linaro.org> Date: Tue, 29 Dec 2020 10:04:54 +0100 > 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> Applied to net-next, thanks.
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); }
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 | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)