* [PATCH net v1] ipvlan: Fix return value of ipvlan_queue_xmit()
@ 2023-06-16 6:34 Cambda Zhu
2023-06-16 9:03 ` Cambda Zhu
2023-06-16 9:11 ` Simon Horman
0 siblings, 2 replies; 5+ messages in thread
From: Cambda Zhu @ 2023-06-16 6:34 UTC (permalink / raw)
To: netdev
Cc: Eric Dumazet, Paolo Abeni, David S. Miller, David Ahern,
Jakub Kicinski, Lu Wei, t.feng, Xin Long, Xuan Zhuo, Dust Li,
Tony Lu, Cambda Zhu
The 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. The skb to forward could be treated as xmitted
successfully.
Fixes: 2ad7bf363841 ("ipvlan: Initial check-in of the IPVLAN driver.")
Signed-off-by: Cambda Zhu <cambda@linux.alibaba.com>
---
v1:
- Add Fixes tag.
---
drivers/net/ipvlan/ipvlan_core.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_core.c
index ab5133eb1d51..e45817caaee8 100644
--- a/drivers/net/ipvlan/ipvlan_core.c
+++ b/drivers/net/ipvlan/ipvlan_core.c
@@ -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);
--
2.16.6
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net v1] ipvlan: Fix return value of ipvlan_queue_xmit()
2023-06-16 6:34 [PATCH net v1] ipvlan: Fix return value of ipvlan_queue_xmit() Cambda Zhu
@ 2023-06-16 9:03 ` Cambda Zhu
2023-06-16 9:11 ` Simon Horman
1 sibling, 0 replies; 5+ messages in thread
From: Cambda Zhu @ 2023-06-16 9:03 UTC (permalink / raw)
To: netdev, Mahesh Bandewar
Cc: Eric Dumazet, Paolo Abeni, David S. Miller, David Ahern,
Jakub Kicinski, Lu Wei, t.feng, Xin Long, Xuan Zhuo, Dust Li,
Tony Lu
> On Jun 16, 2023, at 14:34, Cambda Zhu <cambda@linux.alibaba.com> wrote:
>
> The 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. The skb to forward could be treated as xmitted
> successfully.
>
> Fixes: 2ad7bf363841 ("ipvlan: Initial check-in of the IPVLAN driver.")
> Signed-off-by: Cambda Zhu <cambda@linux.alibaba.com>
> ---
> v1:
> - Add Fixes tag.
> ---
> drivers/net/ipvlan/ipvlan_core.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_core.c
> index ab5133eb1d51..e45817caaee8 100644
> --- a/drivers/net/ipvlan/ipvlan_core.c
> +++ b/drivers/net/ipvlan/ipvlan_core.c
> @@ -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);
> --
> 2.16.6
Add CC Mahesh.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net v1] ipvlan: Fix return value of ipvlan_queue_xmit()
2023-06-16 6:34 [PATCH net v1] ipvlan: Fix return value of ipvlan_queue_xmit() Cambda Zhu
2023-06-16 9:03 ` Cambda Zhu
@ 2023-06-16 9:11 ` Simon Horman
2023-06-16 9:40 ` Cambda Zhu
1 sibling, 1 reply; 5+ messages in thread
From: Simon Horman @ 2023-06-16 9:11 UTC (permalink / raw)
To: Cambda Zhu
Cc: netdev, Eric Dumazet, Paolo Abeni, David S. Miller, David Ahern,
Jakub Kicinski, Lu Wei, t.feng, Xin Long, Xuan Zhuo, Dust Li,
Tony Lu
On Fri, Jun 16, 2023 at 02:34:36PM +0800, Cambda Zhu wrote:
> The 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. The skb to forward could be treated as xmitted
> successfully.
>
> Fixes: 2ad7bf363841 ("ipvlan: Initial check-in of the IPVLAN driver.")
> Signed-off-by: Cambda Zhu <cambda@linux.alibaba.com>
Hi Cambda Zhu,
ipvlan_rcv_frame can return two distinct values - RX_HANDLER_CONSUMED and
RX_HANDLER_ANOTHER. Is it correct to treat these both as NET_XMIT_SUCCESS
in the xmit path? If so, perhaps it would be useful to explain why
in the commit message.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net v1] ipvlan: Fix return value of ipvlan_queue_xmit()
2023-06-16 9:11 ` Simon Horman
@ 2023-06-16 9:40 ` Cambda Zhu
2023-06-20 18:33 ` Jakub Kicinski
0 siblings, 1 reply; 5+ messages in thread
From: Cambda Zhu @ 2023-06-16 9:40 UTC (permalink / raw)
To: Simon Horman
Cc: netdev, Eric Dumazet, Paolo Abeni, David S. Miller, David Ahern,
Jakub Kicinski, Lu Wei, t.feng, Xin Long, Xuan Zhuo, Dust Li,
Tony Lu
> On Jun 16, 2023, at 17:11, Simon Horman <simon.horman@corigine.com> wrote:
>
> On Fri, Jun 16, 2023 at 02:34:36PM +0800, Cambda Zhu wrote:
>> The 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. The skb to forward could be treated as xmitted
>> successfully.
>>
>> Fixes: 2ad7bf363841 ("ipvlan: Initial check-in of the IPVLAN driver.")
>> Signed-off-by: Cambda Zhu <cambda@linux.alibaba.com>
>
> Hi Cambda Zhu,
>
> ipvlan_rcv_frame can return two distinct values - RX_HANDLER_CONSUMED and
> RX_HANDLER_ANOTHER. Is it correct to treat these both as NET_XMIT_SUCCESS
> in the xmit path? If so, perhaps it would be useful to explain why
> in the commit message.
The ipvlan_rcv_frame() will only return RX_HANDLER_CONSUMED in
ipvlan_xmit_mode_l2/l3() for local is true. It's equal to NET_XMIT_SUCCESS.
The dev_forward_skb() can return NET_RX_SUCCESS and NET_RX_DROP, and
returning NET_RX_DROP(NET_XMIT_DROP) will increase both ipvlan and
ipvlan->phy_dev drops counter. I think the drops should belong to
the rcv side, and the xmit side should return NET_XMIT_SUCCESS even
if rcv failed. However, I'm not sure if my opinion is right.
Thanks,
Cambda
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net v1] ipvlan: Fix return value of ipvlan_queue_xmit()
2023-06-16 9:40 ` Cambda Zhu
@ 2023-06-20 18:33 ` Jakub Kicinski
0 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2023-06-20 18:33 UTC (permalink / raw)
To: Cambda Zhu
Cc: Simon Horman, netdev, Eric Dumazet, Paolo Abeni, David S. Miller,
David Ahern, Lu Wei, t.feng, Xin Long, Xuan Zhuo, Dust Li,
Tony Lu
On Fri, 16 Jun 2023 17:40:29 +0800 Cambda Zhu wrote:
> > ipvlan_rcv_frame can return two distinct values - RX_HANDLER_CONSUMED and
> > RX_HANDLER_ANOTHER. Is it correct to treat these both as NET_XMIT_SUCCESS
> > in the xmit path? If so, perhaps it would be useful to explain why
> > in the commit message.
>
> The ipvlan_rcv_frame() will only return RX_HANDLER_CONSUMED in
> ipvlan_xmit_mode_l2/l3() for local is true. It's equal to NET_XMIT_SUCCESS.
> The dev_forward_skb() can return NET_RX_SUCCESS and NET_RX_DROP, and
> returning NET_RX_DROP(NET_XMIT_DROP) will increase both ipvlan and
> ipvlan->phy_dev drops counter. I think the drops should belong to
> the rcv side, and the xmit side should return NET_XMIT_SUCCESS even
> if rcv failed. However, I'm not sure if my opinion is right.
Please add the explanation to the commit msg and CC Mahesh on the v2.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-06-20 18:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-16 6:34 [PATCH net v1] ipvlan: Fix return value of ipvlan_queue_xmit() Cambda Zhu
2023-06-16 9:03 ` Cambda Zhu
2023-06-16 9:11 ` Simon Horman
2023-06-16 9:40 ` Cambda Zhu
2023-06-20 18:33 ` Jakub Kicinski
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).