Skip to contentSkip to conversation

net/af_xdp: fix xdp_get_channels_info return value

PATCH Applied Július Milan 4 participants 8 messages Jul 12, 2019 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/af_xdp: fix xdp_get_channels_info return value

Procedure xdp_get_channels_info was returning error code -1 in case of ioctl command SIOCETHTOOL was not supported. This patch sets return value back to 0 as it is valid case.

Fixes 339b88c6a9 ("net/af_xdp: support multi-queue")
---
 drivers/net/af_xdp/rte_eth_af_xdp.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/af_xdp/rte_eth_af_xdp.c +7 -3
index ff8e90589..33352e10a 100644
@@ -852,9 +852,13 @@ xdp_get_channels_info(const char *if_name, int *max_queues,
 	ifr.ifr_data = (void *)&channels;
 	strncpy(ifr.ifr_name, if_name, IFNAMSIZ);
 	ret = ioctl(fd, SIOCETHTOOL, &ifr);
-	if (ret && errno != EOPNOTSUPP) {
-		ret = -errno;
-		goto out;
+	if (ret) {
+		if (errno == EOPNOTSUPP) {
+			ret = 0;
+		} else {
+			ret = -errno;
+			goto out;
+		}
 	}
 
 	if (channels.max_combined == 0 || errno == EOPNOTSUPP) {
Signature · 1 line
2.21.0
Reviewed-by on v1 1/1
#1 lore raw

Hi,

Thanks for the patch.

Quoted 35 lines · Július Milan

Procedure xdp_get_channels_info was returning error code -1 in case of ioctl command SIOCETHTOOL was not supported. This patch sets return value back to 0 as it is valid case.

Fixes 339b88c6a9 ("net/af_xdp: support multi-queue")

---
drivers/net/af_xdp/rte_eth_af_xdp.c | 10 +++++++---

1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/af_xdp/rte_eth_af_xdp.c +7 -3
index ff8e90589..33352e10a 100644
@@ -852,9 +852,13 @@ xdp_get_channels_info(const char *if_name, int *max_queues,
 	ifr.ifr_data = (void *)&channels;
 	strncpy(ifr.ifr_name, if_name, IFNAMSIZ);
 	ret = ioctl(fd, SIOCETHTOOL, &ifr);
-	if (ret && errno != EOPNOTSUPP) {
-		ret = -errno;
-		goto out;
+	if (ret) {
+		if (errno == EOPNOTSUPP) {
+			ret = 0;
+		} else {
+			ret = -errno;
+			goto out;
+		}
 	}
 
 	if (channels.max_combined == 0 || errno == EOPNOTSUPP) {
Signature · 1 line
2.21.0

Thanks,
Xiaolong

Applied
#2 lore raw
Quoted 9 lines · Ye Xiaolong

Hi,

Thanks for the patch.

Quoted 4 lines · Július Milan

Procedure xdp_get_channels_info was returning error code -1 in case of ioctl command SIOCETHTOOL was not supported. This patch sets return value back to 0 as it is valid case.

Quoted 6 lines
Quoted 3 lines
Fixes 339b88c6a9 ("net/af_xdp: support multi-queue")

Applied to dpdk-next-net/master, thanks.

#3 lore raw
Quoted 10 lines · On Fri, 12 Jul 2019 16:01:39 +0100 Ferruh Yigit <[email protected]> wrote:
Quoted 9 lines · Ye Xiaolong

Hi,

Thanks for the patch.

Quoted 4 lines · Július Milan

Procedure xdp_get_channels_info was returning error code -1 in case of ioctl command SIOCETHTOOL was not supported. This patch sets return value back to 0 as it is valid case.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Fixes 339b88c6a9 ("net/af_xdp: support multi-queue")

Applied to dpdk-next-net/master, thanks.

The patch was broken. It would not set channel values correctly

#4 lore raw
In reply to Július Milan
Quoted 22 lines · On Fri, 12 Jul 2019 09:55:46 +0200 Július Milan <[email protected]> wrote:

Procedure xdp_get_channels_info was returning error code -1 in case of ioctl command SIOCETHTOOL was not supported. This patch sets return value back to 0 as it is valid case.

Fixes 339b88c6a9 ("net/af_xdp: support multi-queue")
---
 drivers/net/af_xdp/rte_eth_af_xdp.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/af_xdp/rte_eth_af_xdp.c +0 -3
index ff8e90589..33352e10a 100644
@@ -852,9 +852,13 @@ xdp_get_channels_info(const char *if_name, int *max_queues,
 	ifr.ifr_data = (void *)&channels;
 	strncpy(ifr.ifr_name, if_name, IFNAMSIZ);
 	ret = ioctl(fd, SIOCETHTOOL, &ifr);
-	if (ret && errno != EOPNOTSUPP) {
-		ret = -errno;
-		goto out;

drivers/net/af_xdp/rte_eth_af_xdp.c xdp_get_channels_info(const char *if_name, int *max_queues, · line 864

Quoted 10 lines
drivers/net/af_xdp/rte_eth_af_xdp.c +7 -0
+	if (ret) {
+		if (errno == EOPNOTSUPP) {
+			ret = 0;
+		} else {
+			ret = -errno;
+			goto out;
+		}
 	}
 
 	if (channels.max_combined == 0 || errno == EOPNOTSUPP) {

Still wrong, it doesn't set max_queues/combined_queues if errno == EOPNOTSUPP

#5 lore raw
Quoted 34 lines · Stephen Hemminger
Quoted 31 lines · On Fri, 12 Jul 2019 09:55:46 +0200 Július Milan <[email protected]> wrote:

Procedure xdp_get_channels_info was returning error code -1 in case of ioctl command SIOCETHTOOL was not supported. This patch sets return value back to 0 as it is valid case.

Fixes 339b88c6a9 ("net/af_xdp: support multi-queue")
---
 drivers/net/af_xdp/rte_eth_af_xdp.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/af_xdp/rte_eth_af_xdp.c +7 -3
index ff8e90589..33352e10a 100644
@@ -852,9 +852,13 @@ xdp_get_channels_info(const char *if_name, int *max_queues,
 	ifr.ifr_data = (void *)&channels;
 	strncpy(ifr.ifr_name, if_name, IFNAMSIZ);
 	ret = ioctl(fd, SIOCETHTOOL, &ifr);
-	if (ret && errno != EOPNOTSUPP) {
-		ret = -errno;
-		goto out;
+	if (ret) {
+		if (errno == EOPNOTSUPP) {
+			ret = 0;
+		} else {
+			ret = -errno;
+			goto out;
+		}
 	}
 
Quoted 4 lines

drivers/net/af_xdp/rte_eth_af_xdp.c xdp_get_channels_info(const char *if_name, int *max_queues, · line 864

Quoted 1 line
drivers/net/af_xdp/rte_eth_af_xdp.c +0 -0
 	if (channels.max_combined == 0 || errno == EOPNOTSUPP) {

Still wrong, it doesn't set max_queues/combined_queues if errno == EOPNOTSUPP

Looks like code only fixes the return value, which was 'ret' before, now '0', the remaining logic should be same.

as far as I can see, if errno == EOPNOTSUPP, it sets
*max_queues = 1;
*combined_queues = channels.combined_count;

Am I missing something?

#6 lore raw
Quoted 40 lines · On Fri, 12 Jul 2019 16:35:55 +0100 Ferruh Yigit <[email protected]> wrote:
Quoted 34 lines · Stephen Hemminger
Quoted 31 lines · On Fri, 12 Jul 2019 09:55:46 +0200 Július Milan <[email protected]> wrote:

Procedure xdp_get_channels_info was returning error code -1 in case of ioctl command SIOCETHTOOL was not supported. This patch sets return value back to 0 as it is valid case.

Fixes 339b88c6a9 ("net/af_xdp: support multi-queue")
---
 drivers/net/af_xdp/rte_eth_af_xdp.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/af_xdp/rte_eth_af_xdp.c +7 -3
index ff8e90589..33352e10a 100644
@@ -852,9 +852,13 @@ xdp_get_channels_info(const char *if_name, int *max_queues,
 	ifr.ifr_data = (void *)&channels;
 	strncpy(ifr.ifr_name, if_name, IFNAMSIZ);
 	ret = ioctl(fd, SIOCETHTOOL, &ifr);
-	if (ret && errno != EOPNOTSUPP) {
-		ret = -errno;
-		goto out;
+	if (ret) {
+		if (errno == EOPNOTSUPP) {
+			ret = 0;
+		} else {
+			ret = -errno;
+			goto out;
+		}
 	}
 
Quoted 4 lines

drivers/net/af_xdp/rte_eth_af_xdp.c xdp_get_channels_info(const char *if_name, int *max_queues, · line 864

Quoted 1 line
drivers/net/af_xdp/rte_eth_af_xdp.c +0 -0
 	if (channels.max_combined == 0 || errno == EOPNOTSUPP) {  

Still wrong, it doesn't set max_queues/combined_queues if errno == EOPNOTSUPP

Quoted 6 lines

Looks like code only fixes the return value, which was 'ret' before, now '0', the remaining logic should be same.

as far as I can see, if errno == EOPNOTSUPP, it sets
*max_queues = 1;
*combined_queues = channels.combined_count;

OK, it does return correctly, just the hard way to do it. Keep it for now, I will do a cleanup pass over AF_XDP later. Lots of things could be done simpler

#7 lore raw
Quoted 46 lines · Stephen Hemminger
Quoted 43 lines · On Fri, 12 Jul 2019 16:35:55 +0100 Ferruh Yigit <[email protected]> wrote:
Quoted 34 lines · Stephen Hemminger
Quoted 31 lines · On Fri, 12 Jul 2019 09:55:46 +0200 Július Milan <[email protected]> wrote:

Procedure xdp_get_channels_info was returning error code -1 in case of ioctl command SIOCETHTOOL was not supported. This patch sets return value back to 0 as it is valid case.

Fixes 339b88c6a9 ("net/af_xdp: support multi-queue")
---
 drivers/net/af_xdp/rte_eth_af_xdp.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/af_xdp/rte_eth_af_xdp.c +7 -3
index ff8e90589..33352e10a 100644
@@ -852,9 +852,13 @@ xdp_get_channels_info(const char *if_name, int *max_queues,
 	ifr.ifr_data = (void *)&channels;
 	strncpy(ifr.ifr_name, if_name, IFNAMSIZ);
 	ret = ioctl(fd, SIOCETHTOOL, &ifr);
-	if (ret && errno != EOPNOTSUPP) {
-		ret = -errno;
-		goto out;
+	if (ret) {
+		if (errno == EOPNOTSUPP) {
+			ret = 0;
+		} else {
+			ret = -errno;
+			goto out;
+		}
 	}
 
Quoted 4 lines

drivers/net/af_xdp/rte_eth_af_xdp.c xdp_get_channels_info(const char *if_name, int *max_queues, · line 864

Quoted 1 line
drivers/net/af_xdp/rte_eth_af_xdp.c +0 -0
 	if (channels.max_combined == 0 || errno == EOPNOTSUPP) {  

Still wrong, it doesn't set max_queues/combined_queues if errno == EOPNOTSUPP

Looks like code only fixes the return value, which was 'ret' before, now '0', the remaining logic should be same.

Quoted 8 lines
Quoted 3 lines

as far as I can see, if errno == EOPNOTSUPP, it sets
*max_queues = 1;
*combined_queues = channels.combined_count;

OK, it does return correctly, just the hard way to do it. Keep it for now, I will do a cleanup pass over AF_XDP later. Lots of things could be done simpler

ok