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 (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series Fixes for ENA driver | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net
netdev/subject_prefix success Link
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 26 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link
netdev/stable success Stable not CCed

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,