diff mbox series

[V2,net,4/4] net: ena: return error code from ena_xdp_xmit_buff

Message ID 20201119202851.28077-5-shayagr@amazon.com
State Superseded
Headers show
Series Fixes for ENA driver | expand

Commit Message

Shay Agroskin Nov. 19, 2020, 8:28 p.m. UTC
The function mistakenly returns NETDEV_TX_OK regardless of the
transmission success. This patch fixes this behavior by returning the
error code from the function.

Fixes: 548c4940b9f1 ("net: ena: Implement XDP_TX action")
Signed-off-by: Shay Agroskin <shayagr@amazon.com>
---
 drivers/net/ethernet/amazon/ena/ena_netdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Jakub Kicinski Nov. 21, 2020, 11:53 p.m. UTC | #1
On Thu, 19 Nov 2020 22:28:51 +0200 Shay Agroskin wrote:
> The function mistakenly returns NETDEV_TX_OK regardless of the
> transmission success. This patch fixes this behavior by returning the
> error code from the function.
> 
> Fixes: 548c4940b9f1 ("net: ena: Implement XDP_TX action")
> Signed-off-by: Shay Agroskin <shayagr@amazon.com>

Doesn't seem like a legitimate bug fix, since the only caller of this
function ignores its return value.
Shay Agroskin Nov. 22, 2020, 7:19 a.m. UTC | #2
Jakub Kicinski <kuba@kernel.org> writes:

> On Thu, 19 Nov 2020 22:28:51 +0200 Shay Agroskin wrote:
>> The function mistakenly returns NETDEV_TX_OK regardless of the
>> transmission success. This patch fixes this behavior by 
>> returning the
>> error code from the function.
>> 
>> Fixes: 548c4940b9f1 ("net: ena: Implement XDP_TX action")
>> Signed-off-by: Shay Agroskin <shayagr@amazon.com>
>
> Doesn't seem like a legitimate bug fix, since the only caller of 
> this
> function ignores its return value.

Hi,
I plan to use the return value from this function in future patch 
(next-net series), do you think we better send this fix with
this future patch?

Shay
Jakub Kicinski Nov. 23, 2020, 4:18 p.m. UTC | #3
On Sun, 22 Nov 2020 09:19:05 +0200 Shay Agroskin wrote:
> Jakub Kicinski <kuba@kernel.org> writes:
> 
> > On Thu, 19 Nov 2020 22:28:51 +0200 Shay Agroskin wrote:  
> >> The function mistakenly returns NETDEV_TX_OK regardless of the
> >> transmission success. This patch fixes this behavior by 
> >> returning the
> >> error code from the function.
> >> 
> >> Fixes: 548c4940b9f1 ("net: ena: Implement XDP_TX action")
> >> Signed-off-by: Shay Agroskin <shayagr@amazon.com>  
> >
> > Doesn't seem like a legitimate bug fix, since the only caller of 
> > this
> > function ignores its return value.  
> 
> Hi,
> I plan to use the return value from this function in future patch 
> (next-net series), do you think we better send this fix with
> this future patch?

Yes, it's fine to include this in a net-next series. It doesn't fix any
bug that could cause trouble to the users. If you had a fix that
depended on it then maybe, but if you only need it in net-next we can
put it there with clear conscience.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index df1884d57d1a..66b67ab51478 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -284,9 +284,9 @@  static int ena_xdp_xmit_buff(struct net_device *dev,
 	struct ena_tx_buffer *tx_info;
 	struct ena_ring *xdp_ring;
 	u16 next_to_use, req_id;
-	int rc;
 	void *push_hdr;
 	u32 push_len;
+	int rc;
 
 	xdp_ring = &adapter->tx_ring[qid];
 	next_to_use = xdp_ring->next_to_use;
@@ -322,14 +322,14 @@  static int ena_xdp_xmit_buff(struct net_device *dev,
 	xdp_ring->tx_stats.doorbells++;
 	u64_stats_update_end(&xdp_ring->syncp);
 
-	return NETDEV_TX_OK;
+	return rc;
 
 error_unmap_dma:
 	ena_unmap_tx_buff(xdp_ring, tx_info);
 	tx_info->xdpf = NULL;
 error_drop_packet:
 	__free_page(tx_info->xdp_rx_page);
-	return NETDEV_TX_OK;
+	return rc;
 }
 
 static int ena_xdp_execute(struct ena_ring *rx_ring,