Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH net-next] net: bridge: fix build when setting skb->offload_fwd_mark with CONFIG_NET_SWITCHDEV=n
@ 2021-07-23 20:49 Vladimir Oltean
2021-07-24 20:50 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Vladimir Oltean @ 2021-07-23 20:49 UTC (permalink / raw)
To: netdev, Jakub Kicinski, David S. Miller
Cc: Florian Fainelli, Tobias Waldekranz, Roopa Prabhu,
Nikolay Aleksandrov, Stephen Hemminger, bridge,
kernel test robot
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: kernel test robot <lkp@intel.com>
Fixes: 472111920f1c ("net: bridge: switchdev: allow the TX data plane forwarding to be offloaded")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
net/bridge/br_forward.c | 2 +-
net/bridge/br_private.h | 6 ++++++
net/bridge/br_switchdev.c | 5 +++++
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c
index bc14b1b384e9..ec646656dbf1 100644
--- a/net/bridge/br_forward.c
+++ b/net/bridge/br_forward.c
@@ -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->offload_fwd_mark = br_switchdev_frame_uses_tx_fwd_offload(skb);
+ br_switchdev_frame_set_offload_fwd_mark(skb);
dev_queue_xmit(skb);
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 86ca617fec7a..1c57877270f7 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -1881,6 +1881,8 @@ static inline void br_sysfs_delbr(struct net_device *dev) { return; }
#ifdef CONFIG_NET_SWITCHDEV
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,
struct sk_buff *skb);
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)
return false;
}
+static inline void br_switchdev_frame_set_offload_fwd_mark(struct sk_buff *skb)
+{
+}
+
static inline void
nbp_switchdev_frame_mark_tx_fwd_offload(const struct net_bridge_port *p,
struct sk_buff *skb)
diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c
index 96ce069d0c8c..9cf9ab320c48 100644
--- a/net/bridge/br_switchdev.c
+++ b/net/bridge/br_switchdev.c
@@ -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;
}
+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 */
void nbp_switchdev_frame_mark_tx_fwd_offload(const struct net_bridge_port *p,
struct sk_buff *skb)
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] net: bridge: fix build when setting skb->offload_fwd_mark with CONFIG_NET_SWITCHDEV=n
2021-07-23 20:49 [PATCH net-next] net: bridge: fix build when setting skb->offload_fwd_mark with CONFIG_NET_SWITCHDEV=n Vladimir Oltean
@ 2021-07-24 20:50 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-07-24 20:50 UTC (permalink / raw)
To: Vladimir Oltean
Cc: netdev, kuba, davem, f.fainelli, tobias, roopa, nikolay, stephen,
bridge, lkp
Hello:
This patch was applied to netdev/net-next.git (refs/heads/master):
On Fri, 23 Jul 2021 23:49:11 +0300 you wrote:
> 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.
>
> [...]
Here is the summary with links:
- [net-next] net: bridge: fix build when setting skb->offload_fwd_mark with CONFIG_NET_SWITCHDEV=n
https://git.kernel.org/netdev/net-next/c/c5381154393d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-07-24 20:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-23 20:49 [PATCH net-next] net: bridge: fix build when setting skb->offload_fwd_mark with CONFIG_NET_SWITCHDEV=n Vladimir Oltean
2021-07-24 20:50 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).