Commit d7aa9d0b authored by Julian Wiedmann's avatar Julian Wiedmann Committed by David S. Miller

s390/qeth: fold VLAN handling into l3_rebuild_skb()

Move the overly complicated VLAN processing from the L3 RX handler into
its l3_rebuild_skb() helper. No change in functionality.
Signed-off-by: default avatarJulian Wiedmann <jwi@linux.vnet.ibm.com>
Reviewed-by: default avatarUrsula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2aa48671
...@@ -1646,13 +1646,12 @@ static int qeth_l3_vlan_rx_kill_vid(struct net_device *dev, ...@@ -1646,13 +1646,12 @@ static int qeth_l3_vlan_rx_kill_vid(struct net_device *dev,
return 0; return 0;
} }
static int qeth_l3_rebuild_skb(struct qeth_card *card, struct sk_buff *skb, static void qeth_l3_rebuild_skb(struct qeth_card *card, struct sk_buff *skb,
struct qeth_hdr *hdr, unsigned short *vlan_id) struct qeth_hdr *hdr)
{ {
__u16 prot; __u16 prot;
struct iphdr *ip_hdr; struct iphdr *ip_hdr;
unsigned char tg_addr[MAX_ADDR_LEN]; unsigned char tg_addr[MAX_ADDR_LEN];
int is_vlan = 0;
if (!(hdr->hdr.l3.flags & QETH_HDR_PASSTHRU)) { if (!(hdr->hdr.l3.flags & QETH_HDR_PASSTHRU)) {
prot = (hdr->hdr.l3.flags & QETH_HDR_IPV6) ? ETH_P_IPV6 : prot = (hdr->hdr.l3.flags & QETH_HDR_IPV6) ? ETH_P_IPV6 :
...@@ -1706,11 +1705,14 @@ static int qeth_l3_rebuild_skb(struct qeth_card *card, struct sk_buff *skb, ...@@ -1706,11 +1705,14 @@ static int qeth_l3_rebuild_skb(struct qeth_card *card, struct sk_buff *skb,
skb->protocol = eth_type_trans(skb, card->dev); skb->protocol = eth_type_trans(skb, card->dev);
if (hdr->hdr.l3.ext_flags & /* copy VLAN tag from hdr into skb */
(QETH_HDR_EXT_VLAN_FRAME | QETH_HDR_EXT_INCLUDE_VLAN_TAG)) { if (!card->options.sniffer &&
*vlan_id = (hdr->hdr.l3.ext_flags & QETH_HDR_EXT_VLAN_FRAME) ? (hdr->hdr.l3.ext_flags & (QETH_HDR_EXT_VLAN_FRAME |
hdr->hdr.l3.vlan_id : *((u16 *)&hdr->hdr.l3.dest_addr[12]); QETH_HDR_EXT_INCLUDE_VLAN_TAG))) {
is_vlan = 1; u16 tag = (hdr->hdr.l3.ext_flags & QETH_HDR_EXT_VLAN_FRAME) ?
hdr->hdr.l3.vlan_id :
*((u16 *)&hdr->hdr.l3.dest_addr[12]);
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), tag);
} }
if (card->dev->features & NETIF_F_RXCSUM) { if (card->dev->features & NETIF_F_RXCSUM) {
...@@ -1724,7 +1726,6 @@ static int qeth_l3_rebuild_skb(struct qeth_card *card, struct sk_buff *skb, ...@@ -1724,7 +1726,6 @@ static int qeth_l3_rebuild_skb(struct qeth_card *card, struct sk_buff *skb,
skb->ip_summed = CHECKSUM_NONE; skb->ip_summed = CHECKSUM_NONE;
} else } else
skb->ip_summed = CHECKSUM_NONE; skb->ip_summed = CHECKSUM_NONE;
return is_vlan;
} }
static int qeth_l3_process_inbound_buffer(struct qeth_card *card, static int qeth_l3_process_inbound_buffer(struct qeth_card *card,
...@@ -1733,8 +1734,6 @@ static int qeth_l3_process_inbound_buffer(struct qeth_card *card, ...@@ -1733,8 +1734,6 @@ static int qeth_l3_process_inbound_buffer(struct qeth_card *card,
int work_done = 0; int work_done = 0;
struct sk_buff *skb; struct sk_buff *skb;
struct qeth_hdr *hdr; struct qeth_hdr *hdr;
__u16 vlan_tag = 0;
int is_vlan;
unsigned int len; unsigned int len;
__u16 magic; __u16 magic;
...@@ -1764,12 +1763,8 @@ static int qeth_l3_process_inbound_buffer(struct qeth_card *card, ...@@ -1764,12 +1763,8 @@ static int qeth_l3_process_inbound_buffer(struct qeth_card *card,
card->dev->addr_len); card->dev->addr_len);
netif_receive_skb(skb); netif_receive_skb(skb);
} else { } else {
is_vlan = qeth_l3_rebuild_skb(card, skb, hdr, qeth_l3_rebuild_skb(card, skb, hdr);
&vlan_tag);
len = skb->len; len = skb->len;
if (is_vlan && !card->options.sniffer)
__vlan_hwaccel_put_tag(skb,
htons(ETH_P_8021Q), vlan_tag);
napi_gro_receive(&card->napi, skb); napi_gro_receive(&card->napi, skb);
} }
break; break;
......
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