Skip to contentSkip to conversation

drivers: net: ldpaa_eth: Correct error handler for qbman_swp_acquire()

PATCH New Ashish Kumar 2 participants 6 messages Oct 26, 2017 – Nov 17, 2017 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: net: ldpaa_eth: Correct error handler for qbman_swp_acquire()

Correcting error handing for qbman_swp_acquire. The return value is zero is an error condition since number of buffer copied is zero meaning there are no free buffers for allocation.

---
 drivers/net/ldpaa_eth/ldpaa_eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ldpaa_eth/ldpaa_eth.c +1 -1
index f235b62..21be79a 100644
@@ -334,7 +334,7 @@ static int ldpaa_eth_tx(struct eth_device *net_dev, void *buf, int len)
 					&buffer_start, 1);
 	} while (err == -EBUSY);
 
-	if (err < 0) {
+	if (err <= 0) {
 		printf("qbman_swp_acquire() failed\n");
 		return -ENOMEM;
 	}
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 drivers: net: ldpaa_eth: Correct error handler for qbman_swp_acquire()

Quoted 16 lines · Ashish Kumar

Correcting error handing for qbman_swp_acquire. The return value is zero is an error condition since number of buffer copied is zero meaning there are no free buffers for allocation.

---
 drivers/net/ldpaa_eth/ldpaa_eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ldpaa_eth/ldpaa_eth.c +0 -0
index f235b62..21be79a 100644

drivers/net/ldpaa_eth/ldpaa_eth.c static int ldpaa_eth_tx(struct eth_device *net_dev, void *buf, int len) · line 340

Quoted 8 lines
drivers/net/ldpaa_eth/ldpaa_eth.c +1 -1
@@ -334,7 +334,7 @@ static int ldpaa_eth_tx(struct eth_device *net_dev, void *buf, int len)
 					&buffer_start, 1);
 	} while (err == -EBUSY);
 
-	if (err < 0) {
+	if (err <= 0) {
 		printf("qbman_swp_acquire() failed\n");
 		return -ENOMEM;
 	}

Since you already check for errors in qbman_swp_acquire(), would it be better to check if "num" is zero there?

York

#2 lore raw

PATCH 1/1 drivers: net: ldpaa_eth: Correct error handler for qbman_swp_acquire()

Hello York,

The definition of qbman_swp_acquire(), is not owned by u-boot, it is part of qbman drivers which is owned by Roy. u-boot gets this definition from flib code and same is used in u-boot as it is.

So, moving this error handler in qbman_swp_acquire for num == 0, may result in inconsistency in flib code that was provided at the time of integration.

Please suggest.

Regards
Ashish

-----Original Message-----
From: York Sun
Sent: Thursday, October 26, 2017 8:49 PM
To: Ashish Kumar <[email protected]>; u-boot at lists.denx.de
Cc: joe.hershberger at gmail.com; Kushwaha Prabhakar <[email protected]>
Subject: Re: [PATCH] drivers: net: ldpaa_eth: Correct error handler for qbman_swp_acquire()

Quoted 17 lines · Ashish Kumar

Correcting error handing for qbman_swp_acquire. The return value is zero is an error condition since number of buffer copied is zero meaning there are no free buffers for allocation.

---
 drivers/net/ldpaa_eth/ldpaa_eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ldpaa_eth/ldpaa_eth.c +0 -0
index f235b62..21be79a 100644

drivers/net/ldpaa_eth/ldpaa_eth.c static int ldpaa_eth_tx(struct eth_device *net_dev, void *buf, int len) · line 340

Quoted 8 lines
drivers/net/ldpaa_eth/ldpaa_eth.c +1 -1
@@ -334,7 +334,7 @@ static int ldpaa_eth_tx(struct eth_device *net_dev, void *buf, int len)
 					&buffer_start, 1);
 	} while (err == -EBUSY);
 
-	if (err < 0) {
+	if (err <= 0) {
 		printf("qbman_swp_acquire() failed\n");
 		return -ENOMEM;
 	}

Since you already check for errors in qbman_swp_acquire(), would it be better to check if "num" is zero there?

York

#3 lore raw

PATCH 1/1 drivers: net: ldpaa_eth: Correct error handler for qbman_swp_acquire()

Quoted 7 lines · Ashish Kumar

Hello York,

The definition of qbman_swp_acquire(), is not owned by u-boot, it is part of qbman drivers which is owned by Roy. u-boot gets this definition from flib code and same is used in u-boot as it is.

So, moving this error handler in qbman_swp_acquire for num == 0, may result in inconsistency in flib code that was provided at the time of integration.

OK. Let's keep it that way.
BTW, please do not top post if you can avoid it. Please always use common quotation style when you reply.

York

#4 lore raw

PATCH 1/1 drivers: net: ldpaa_eth: Correct error handler for qbman_swp_acquire()

Please see inline.

-----Original Message-----
From: York Sun
Sent: Tuesday, October 31, 2017 12:32 AM
To: Ashish Kumar <[email protected]>; Roy Pledge <[email protected]>
Cc: joe.hershberger at gmail.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de
Subject: Re: [PATCH] drivers: net: ldpaa_eth: Correct error handler for qbman_swp_acquire()

Quoted 7 lines · Ashish Kumar

Hello York,

The definition of qbman_swp_acquire(), is not owned by u-boot, it is part of qbman drivers which is owned by Roy. u-boot gets this definition from flib code and same is used in u-boot as it is.

So, moving this error handler in qbman_swp_acquire for num == 0, may result in inconsistency in flib code that was provided at the time of integration.

OK. Let's keep it that way.
BTW, please do not top post if you can avoid it. Please always use common quotation style when you reply.

Sure, I will take care.

York

Applied
#5 lore raw

PATCH 1/1 drivers: net: ldpaa_eth: Correct error handler for qbman_swp_acquire()

In reply to Ashish Kumar
Quoted 7 lines · Ashish Kumar

Correcting error handing for qbman_swp_acquire. The return value is zero is an error condition since number of buffer copied is zero meaning there are no free buffers for allocation.

---

Applied to fsl-qoriq master. Thanks.

York