Commit c5381154 authored by Vladimir Oltean's avatar Vladimir Oltean Committed by David S. Miller

net: bridge: fix build when setting skb->offload_fwd_mark with CONFIG_NET_SWITCHDEV=n

Switchdev support can be disabled at compile time, and in that case,
struct sk_buff will not contain the offload_fwd_mark field.

To make the code in br_forward.c work in both cases, we do what is done
in other places and we create a helper function, with an empty shim
definition, that is implemented by the br_switchdev.o translation module.
This is always compiled if and only if CONFIG_NET_SWITCHDEV is y or m.
Reported-by: default avatarkernel test robot <lkp@intel.com>
Fixes: 47211192 ("net: bridge: switchdev: allow the TX data plane forwarding to be offloaded")
Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent facfbf4f
...@@ -48,7 +48,7 @@ int br_dev_queue_push_xmit(struct net *net, struct sock *sk, struct sk_buff *skb ...@@ -48,7 +48,7 @@ int br_dev_queue_push_xmit(struct net *net, struct sock *sk, struct sk_buff *skb
skb_set_network_header(skb, depth); skb_set_network_header(skb, depth);
} }
skb->offload_fwd_mark = br_switchdev_frame_uses_tx_fwd_offload(skb); br_switchdev_frame_set_offload_fwd_mark(skb);
dev_queue_xmit(skb); dev_queue_xmit(skb);
......
...@@ -1881,6 +1881,8 @@ static inline void br_sysfs_delbr(struct net_device *dev) { return; } ...@@ -1881,6 +1881,8 @@ static inline void br_sysfs_delbr(struct net_device *dev) { return; }
#ifdef CONFIG_NET_SWITCHDEV #ifdef CONFIG_NET_SWITCHDEV
bool br_switchdev_frame_uses_tx_fwd_offload(struct sk_buff *skb); bool br_switchdev_frame_uses_tx_fwd_offload(struct sk_buff *skb);
void br_switchdev_frame_set_offload_fwd_mark(struct sk_buff *skb);
void nbp_switchdev_frame_mark_tx_fwd_offload(const struct net_bridge_port *p, void nbp_switchdev_frame_mark_tx_fwd_offload(const struct net_bridge_port *p,
struct sk_buff *skb); struct sk_buff *skb);
void nbp_switchdev_frame_mark_tx_fwd_to_hwdom(const struct net_bridge_port *p, void nbp_switchdev_frame_mark_tx_fwd_to_hwdom(const struct net_bridge_port *p,
...@@ -1910,6 +1912,10 @@ static inline bool br_switchdev_frame_uses_tx_fwd_offload(struct sk_buff *skb) ...@@ -1910,6 +1912,10 @@ static inline bool br_switchdev_frame_uses_tx_fwd_offload(struct sk_buff *skb)
return false; return false;
} }
static inline void br_switchdev_frame_set_offload_fwd_mark(struct sk_buff *skb)
{
}
static inline void static inline void
nbp_switchdev_frame_mark_tx_fwd_offload(const struct net_bridge_port *p, nbp_switchdev_frame_mark_tx_fwd_offload(const struct net_bridge_port *p,
struct sk_buff *skb) struct sk_buff *skb)
......
...@@ -28,6 +28,11 @@ bool br_switchdev_frame_uses_tx_fwd_offload(struct sk_buff *skb) ...@@ -28,6 +28,11 @@ bool br_switchdev_frame_uses_tx_fwd_offload(struct sk_buff *skb)
return BR_INPUT_SKB_CB(skb)->tx_fwd_offload; return BR_INPUT_SKB_CB(skb)->tx_fwd_offload;
} }
void br_switchdev_frame_set_offload_fwd_mark(struct sk_buff *skb)
{
skb->offload_fwd_mark = br_switchdev_frame_uses_tx_fwd_offload(skb);
}
/* Mark the frame for TX forwarding offload if this egress port supports it */ /* Mark the frame for TX forwarding offload if this egress port supports it */
void nbp_switchdev_frame_mark_tx_fwd_offload(const struct net_bridge_port *p, void nbp_switchdev_frame_mark_tx_fwd_offload(const struct net_bridge_port *p,
struct sk_buff *skb) struct sk_buff *skb)
......
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