ipvlan: Fix return value of ipvlan_queue_xmit()
Subsystems (2)
PATCH v2 1/1 ipvlan: Fix return value of ipvlan_queue_xmit()
ipvlan_queue_xmit() should return NET_XMIT_XXX, but ipvlan_xmit_mode_l2/l3() returns rx_handler_result_t or NET_RX_XXX in some cases. ipvlan_rcv_frame() will only return RX_HANDLER_CONSUMED in ipvlan_xmit_mode_l2/l3() because 'local' is true. It's equal to NET_XMIT_SUCCESS. But dev_forward_skb() can return NET_RX_SUCCESS or NET_RX_DROP, and returning NET_RX_DROP(NET_XMIT_DROP) will increase both ipvlan and ipvlan->phy_dev drops counter.
The skb to forward can be treated as xmitted successfully. This patch makes ipvlan_queue_xmit() return NET_XMIT_SUCCESS for forward skb.
---
v2:
- Add explanation to commit message.
- Add CC Mahesh.
v1:
- Add Fixes tag.
--- drivers/net/ipvlan/ipvlan_core.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/ipvlan/ipvlan_core.c +6 -3
@@ -585,7 +585,8 @@ static int ipvlan_xmit_mode_l3(struct sk_buff *skb, struct net_device *dev)consume_skb (skb);return NET_XMIT_DROP ; } -return ipvlan_rcv_frame (addr, &skb, true); +ipvlan_rcv_frame (addr, &skb, true); +return NET_XMIT_SUCCESS ; } } out:
@@ -611,7 +612,8 @@ static int ipvlan_xmit_mode_l2(struct sk_buff *skb, struct net_device *dev)consume_skb (skb);return NET_XMIT_DROP ; } -return ipvlan_rcv_frame (addr, &skb, true); +ipvlan_rcv_frame (addr, &skb, true); +return NET_XMIT_SUCCESS ; } } skb =skb_share_check (skb,GFP_ATOMIC );
@@ -623,7 +625,8 @@ static int ipvlan_xmit_mode_l2(struct sk_buff *skb, struct net_device *dev)* the skb for the main-dev. At the RX side we just return * RX_PASS for it to be processed further on the stack. */ -return dev_forward_skb (ipvlan->phy_dev, skb); +dev_forward_skb (ipvlan->phy_dev, skb); +return NET_XMIT_SUCCESS ; }else if (is_multicast_ether_addr (eth->h_dest)) {skb_reset_mac_header (skb);
Signature · 1 line
2.16.6
This patch was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:
Quoted 9 lines · On Mon, 26 Jun 2023 17:33:47 +0800 you wrote:
ipvlan_queue_xmit()should returnNET_XMIT_XXX, but ipvlan_xmit_mode_l2/l3() returnsrx_handler_result_torNET_RX_XXXin some cases.ipvlan_rcv_frame()will only returnRX_HANDLER_CONSUMEDin ipvlan_xmit_mode_l2/l3() because 'local' is true. It's equal toNET_XMIT_SUCCESS. Butdev_forward_skb()can returnNET_RX_SUCCESSorNET_RX_DROP, and returningNET_RX_DROP(NET_XMIT_DROP)will increase both ipvlan andipvlan->phy_devdrops counter.[...]
Here is the summary with links:
- [net,v2] ipvlan: Fix return value of ipvlan_queue_xmit()
https://git.kernel.org/netdev/net/c/8a9922e7be6d
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html