Skip to content

Commit 689971b

Browse files
Amerigo Wangdavem330
authored andcommitted
netpoll: handle vlan tags in netpoll tx and rx path
Without this patch, I can't get netconsole logs remotely over vlan. The reason is probably we don't handle vlan tags in either netpoll tx or rx path. I am not sure if I use these vlan functions correctly, at least this patch works. Cc: Benjamin LaHaise <[email protected]> Cc: Patrick McHardy <[email protected]> Cc: David Miller <[email protected]> Signed-off-by: Cong Wang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6eacf8a commit 689971b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

net/core/netpoll.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <linux/workqueue.h>
2727
#include <linux/slab.h>
2828
#include <linux/export.h>
29+
#include <linux/if_vlan.h>
2930
#include <net/tcp.h>
3031
#include <net/udp.h>
3132
#include <asm/unaligned.h>
@@ -334,6 +335,14 @@ void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb,
334335
tries > 0; --tries) {
335336
if (__netif_tx_trylock(txq)) {
336337
if (!netif_xmit_stopped(txq)) {
338+
if (vlan_tx_tag_present(skb) &&
339+
!(netif_skb_features(skb) & NETIF_F_HW_VLAN_TX)) {
340+
skb = __vlan_put_tag(skb, vlan_tx_tag_get(skb));
341+
if (unlikely(!skb))
342+
break;
343+
skb->vlan_tci = 0;
344+
}
345+
337346
status = ops->ndo_start_xmit(skb, dev);
338347
if (status == NETDEV_TX_OK)
339348
txq_trans_update(txq);
@@ -567,6 +576,12 @@ int __netpoll_rx(struct sk_buff *skb, struct netpoll_info *npinfo)
567576
return 1;
568577
}
569578

579+
if (skb->protocol == cpu_to_be16(ETH_P_8021Q)) {
580+
skb = vlan_untag(skb);
581+
if (unlikely(!skb))
582+
goto out;
583+
}
584+
570585
proto = ntohs(eth_hdr(skb)->h_proto);
571586
if (proto != ETH_P_IP)
572587
goto out;

0 commit comments

Comments
 (0)