Commit c134db89 authored by Loic Poulain's avatar Loic Poulain Committed by David S. Miller

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: default avatarLoic Poulain <loic.poulain@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3ccdcb79
...@@ -122,7 +122,7 @@ static const struct net_device_ops mhi_netdev_ops = { ...@@ -122,7 +122,7 @@ static const struct net_device_ops mhi_netdev_ops = {
static void mhi_net_setup(struct net_device *ndev) static void mhi_net_setup(struct net_device *ndev)
{ {
ndev->header_ops = NULL; /* No header */ ndev->header_ops = NULL; /* No header */
ndev->type = ARPHRD_NONE; /* QMAP... */ ndev->type = ARPHRD_RAWIP;
ndev->hard_header_len = 0; ndev->hard_header_len = 0;
ndev->addr_len = 0; ndev->addr_len = 0;
ndev->flags = IFF_POINTOPOINT | IFF_NOARP; ndev->flags = IFF_POINTOPOINT | IFF_NOARP;
...@@ -158,7 +158,18 @@ static void mhi_net_dl_callback(struct mhi_device *mhi_dev, ...@@ -158,7 +158,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_add(&mhi_netdev->stats.rx_bytes, mhi_res->bytes_xferd);
u64_stats_update_end(&mhi_netdev->stats.rx_syncp); 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); skb_put(skb, mhi_res->bytes_xferd);
netif_rx(skb); netif_rx(skb);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment