mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-07 15:01:44 +00:00
qmi_wwan: Fix qmap header retrieval in qmimux_rx_fixup
This patch fixes qmap header retrieval when modem is configured for dl data aggregation. Signed-off-by: Daniele Palmas <dnlplm@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
7c3db4105c
commit
d667044f49
1 changed files with 8 additions and 7 deletions
|
@ -151,17 +151,18 @@ static bool qmimux_has_slaves(struct usbnet *dev)
|
||||||
|
|
||||||
static int qmimux_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
|
static int qmimux_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
unsigned int len, offset = sizeof(struct qmimux_hdr);
|
unsigned int len, offset = 0;
|
||||||
struct qmimux_hdr *hdr;
|
struct qmimux_hdr *hdr;
|
||||||
struct net_device *net;
|
struct net_device *net;
|
||||||
struct sk_buff *skbn;
|
struct sk_buff *skbn;
|
||||||
|
u8 qmimux_hdr_sz = sizeof(*hdr);
|
||||||
|
|
||||||
while (offset < skb->len) {
|
while (offset + qmimux_hdr_sz < skb->len) {
|
||||||
hdr = (struct qmimux_hdr *)skb->data;
|
hdr = (struct qmimux_hdr *)(skb->data + offset);
|
||||||
len = be16_to_cpu(hdr->pkt_len);
|
len = be16_to_cpu(hdr->pkt_len);
|
||||||
|
|
||||||
/* drop the packet, bogus length */
|
/* drop the packet, bogus length */
|
||||||
if (offset + len > skb->len)
|
if (offset + len + qmimux_hdr_sz > skb->len)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* control packet, we do not know what to do */
|
/* control packet, we do not know what to do */
|
||||||
|
@ -176,7 +177,7 @@ static int qmimux_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
|
||||||
return 0;
|
return 0;
|
||||||
skbn->dev = net;
|
skbn->dev = net;
|
||||||
|
|
||||||
switch (skb->data[offset] & 0xf0) {
|
switch (skb->data[offset + qmimux_hdr_sz] & 0xf0) {
|
||||||
case 0x40:
|
case 0x40:
|
||||||
skbn->protocol = htons(ETH_P_IP);
|
skbn->protocol = htons(ETH_P_IP);
|
||||||
break;
|
break;
|
||||||
|
@ -188,12 +189,12 @@ static int qmimux_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
|
||||||
goto skip;
|
goto skip;
|
||||||
}
|
}
|
||||||
|
|
||||||
skb_put_data(skbn, skb->data + offset, len);
|
skb_put_data(skbn, skb->data + offset + qmimux_hdr_sz, len);
|
||||||
if (netif_rx(skbn) != NET_RX_SUCCESS)
|
if (netif_rx(skbn) != NET_RX_SUCCESS)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
skip:
|
skip:
|
||||||
offset += len + sizeof(struct qmimux_hdr);
|
offset += len + qmimux_hdr_sz;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue