aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/netdevice.h6
-rw-r--r--include/linux/skbuff.h9
-rw-r--r--net/core/dev.c10
3 files changed, 24 insertions, 1 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 45cfd797eb77..8364f29e08be 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1456,6 +1456,8 @@ enum netdev_priv_flags {
1456 * 1456 *
1457 * @xps_maps: XXX: need comments on this one 1457 * @xps_maps: XXX: need comments on this one
1458 * 1458 *
1459 * @offload_fwd_mark: Offload device fwding mark
1460 *
1459 * @trans_start: Time (in jiffies) of last Tx 1461 * @trans_start: Time (in jiffies) of last Tx
1460 * @watchdog_timeo: Represents the timeout that is used by 1462 * @watchdog_timeo: Represents the timeout that is used by
1461 * the watchdog ( see dev_watchdog() ) 1463 * the watchdog ( see dev_watchdog() )
@@ -1697,6 +1699,10 @@ struct net_device {
1697 struct xps_dev_maps __rcu *xps_maps; 1699 struct xps_dev_maps __rcu *xps_maps;
1698#endif 1700#endif
1699 1701
1702#ifdef CONFIG_NET_SWITCHDEV
1703 u32 offload_fwd_mark;
1704#endif
1705
1700 /* These may be needed for future network-power-down code. */ 1706 /* These may be needed for future network-power-down code. */
1701 1707
1702 /* 1708 /*
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index d6cdd6e87d53..af7a09650fa2 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -506,6 +506,7 @@ static inline u32 skb_mstamp_us_delta(const struct skb_mstamp *t1,
506 * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS 506 * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS
507 * @napi_id: id of the NAPI struct this skb came from 507 * @napi_id: id of the NAPI struct this skb came from
508 * @secmark: security marking 508 * @secmark: security marking
509 * @offload_fwd_mark: fwding offload mark
509 * @mark: Generic packet mark 510 * @mark: Generic packet mark
510 * @vlan_proto: vlan encapsulation protocol 511 * @vlan_proto: vlan encapsulation protocol
511 * @vlan_tci: vlan tag control information 512 * @vlan_tci: vlan tag control information
@@ -650,9 +651,15 @@ struct sk_buff {
650 unsigned int sender_cpu; 651 unsigned int sender_cpu;
651 }; 652 };
652#endif 653#endif
654 union {
653#ifdef CONFIG_NETWORK_SECMARK 655#ifdef CONFIG_NETWORK_SECMARK
654 __u32 secmark; 656 __u32 secmark;
657#endif
658#ifdef CONFIG_NET_SWITCHDEV
659 __u32 offload_fwd_mark;
655#endif 660#endif
661 };
662
656 union { 663 union {
657 __u32 mark; 664 __u32 mark;
658 __u32 reserved_tailroom; 665 __u32 reserved_tailroom;
diff --git a/net/core/dev.c b/net/core/dev.c
index 8810b6bbebfe..2ee15afb412d 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3061,6 +3061,16 @@ static int __dev_queue_xmit(struct sk_buff *skb, void *accel_priv)
3061 else 3061 else
3062 skb_dst_force(skb); 3062 skb_dst_force(skb);
3063 3063
3064#ifdef CONFIG_NET_SWITCHDEV
3065 /* Don't forward if offload device already forwarded */
3066 if (skb->offload_fwd_mark &&
3067 skb->offload_fwd_mark == dev->offload_fwd_mark) {
3068 consume_skb(skb);
3069 rc = NET_XMIT_SUCCESS;
3070 goto out;
3071 }
3072#endif
3073
3064 txq = netdev_pick_tx(dev, skb, accel_priv); 3074 txq = netdev_pick_tx(dev, skb, accel_priv);
3065 q = rcu_dereference_bh(txq->qdisc); 3075 q = rcu_dereference_bh(txq->qdisc);
3066 3076