Skip to content

Commit d7aa9d0

Browse files
julianwiedmanndavem330
authored andcommitted
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: Julian Wiedmann <jwi@linux.vnet.ibm.com> Reviewed-by: Ursula Braun <ubraun@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 2aa4867 commit d7aa9d0

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

drivers/s390/net/qeth_l3_main.c

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1646,13 +1646,12 @@ static int qeth_l3_vlan_rx_kill_vid(struct net_device *dev,
16461646
return 0;
16471647
}
16481648

1649-
static int qeth_l3_rebuild_skb(struct qeth_card *card, struct sk_buff *skb,
1650-
struct qeth_hdr *hdr, unsigned short *vlan_id)
1649+
static void qeth_l3_rebuild_skb(struct qeth_card *card, struct sk_buff *skb,
1650+
struct qeth_hdr *hdr)
16511651
{
16521652
__u16 prot;
16531653
struct iphdr *ip_hdr;
16541654
unsigned char tg_addr[MAX_ADDR_LEN];
1655-
int is_vlan = 0;
16561655

16571656
if (!(hdr->hdr.l3.flags & QETH_HDR_PASSTHRU)) {
16581657
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,
17061705

17071706
skb->protocol = eth_type_trans(skb, card->dev);
17081707

1709-
if (hdr->hdr.l3.ext_flags &
1710-
(QETH_HDR_EXT_VLAN_FRAME | QETH_HDR_EXT_INCLUDE_VLAN_TAG)) {
1711-
*vlan_id = (hdr->hdr.l3.ext_flags & QETH_HDR_EXT_VLAN_FRAME) ?
1712-
hdr->hdr.l3.vlan_id : *((u16 *)&hdr->hdr.l3.dest_addr[12]);
1713-
is_vlan = 1;
1708+
/* copy VLAN tag from hdr into skb */
1709+
if (!card->options.sniffer &&
1710+
(hdr->hdr.l3.ext_flags & (QETH_HDR_EXT_VLAN_FRAME |
1711+
QETH_HDR_EXT_INCLUDE_VLAN_TAG))) {
1712+
u16 tag = (hdr->hdr.l3.ext_flags & QETH_HDR_EXT_VLAN_FRAME) ?
1713+
hdr->hdr.l3.vlan_id :
1714+
*((u16 *)&hdr->hdr.l3.dest_addr[12]);
1715+
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), tag);
17141716
}
17151717

17161718
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,
17241726
skb->ip_summed = CHECKSUM_NONE;
17251727
} else
17261728
skb->ip_summed = CHECKSUM_NONE;
1727-
return is_vlan;
17281729
}
17291730

17301731
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,
17331734
int work_done = 0;
17341735
struct sk_buff *skb;
17351736
struct qeth_hdr *hdr;
1736-
__u16 vlan_tag = 0;
1737-
int is_vlan;
17381737
unsigned int len;
17391738
__u16 magic;
17401739

@@ -1764,12 +1763,8 @@ static int qeth_l3_process_inbound_buffer(struct qeth_card *card,
17641763
card->dev->addr_len);
17651764
netif_receive_skb(skb);
17661765
} else {
1767-
is_vlan = qeth_l3_rebuild_skb(card, skb, hdr,
1768-
&vlan_tag);
1766+
qeth_l3_rebuild_skb(card, skb, hdr);
17691767
len = skb->len;
1770-
if (is_vlan && !card->options.sniffer)
1771-
__vlan_hwaccel_put_tag(skb,
1772-
htons(ETH_P_8021Q), vlan_tag);
17731768
napi_gro_receive(&card->napi, skb);
17741769
}
17751770
break;

0 commit comments

Comments
 (0)