Skip to contentSkip to conversation

dpaa_eth: fix XDP queue index

PATCH Superseded David Gouarin 5 participants 12 messages Mar 6, 2024 – Apr 18, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dpaa_eth: fix XDP queue index

Make it possible to bind a XDP socket to a queue id.
The DPAA FQ Id was passed to the XDP program in the XDP packet metadata which made it unusable with bpf_map_redirect.
Instead of the DPAA FQ Id, initialise the XDP rx queue with the channel id.

---
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +1 -1
index dcbc598b11c6..988dc9237368 100644
@@ -1154,7 +1154,7 @@ static int dpaa_fq_init(struct dpaa_fq *dpaa_fq, bool td_enable)
 	if (dpaa_fq->fq_type == FQ_TYPE_RX_DEFAULT ||
 	    dpaa_fq->fq_type == FQ_TYPE_RX_PCD) {
 		err = xdp_rxq_info_reg(&dpaa_fq->xdp_rxq, dpaa_fq->net_dev,
-				       dpaa_fq->fqid, 0);
+				       dpaa_fq->channel, 0);
 		if (err) {
 			dev_err(dev, "xdp_rxq_info_reg() = %d\n", err);
 			return err;
Signature · 1 line
2.34.1
#1 lore raw
Quoted 5 lines · David Gouarin

Make it possible to bind a XDP socket to a queue id.
The DPAA FQ Id was passed to the XDP program in the XDP packet metadata which made it unusable with bpf_map_redirect.
Instead of the DPAA FQ Id, initialise the XDP rx queue with the channel id.

Fixes tag, please.

Also you have doubled [PATCH] [PATCH...] in your subject.

Quoted 22 lines
---
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +1 -1
index dcbc598b11c6..988dc9237368 100644
@@ -1154,7 +1154,7 @@ static int dpaa_fq_init(struct dpaa_fq *dpaa_fq, bool td_enable)
 	if (dpaa_fq->fq_type == FQ_TYPE_RX_DEFAULT ||
 	    dpaa_fq->fq_type == FQ_TYPE_RX_PCD) {
 		err = xdp_rxq_info_reg(&dpaa_fq->xdp_rxq, dpaa_fq->net_dev,
-				       dpaa_fq->fqid, 0);
+				       dpaa_fq->channel, 0);
 		if (err) {
 			dev_err(dev, "xdp_rxq_info_reg() = %d\n", err);
 			return err;
Signature · 1 line
2.34.1
#2 lore raw

PATCH v2 1/1 dpaa_eth: fix XDP queue index

Make it possible to bind a XDP socket to a queue id.
The DPAA FQ Id was passed to the XDP program in the XDP packet metadata which made it unusable with bpf_map_redirect.
Instead of the DPAA FQ Id, initialise the XDP rx queue with the channel id.

Fixes d57e57d0cd04 ("dpaa_eth: add XDP_TX support")

---
v2: add Fixes: in description

---
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +1 -1
index dcbc598b11c6..988dc9237368 100644
@@ -1154,7 +1154,7 @@ static int dpaa_fq_init(struct dpaa_fq *dpaa_fq, bool td_enable)
 	if (dpaa_fq->fq_type == FQ_TYPE_RX_DEFAULT ||
 	    dpaa_fq->fq_type == FQ_TYPE_RX_PCD) {
 		err = xdp_rxq_info_reg(&dpaa_fq->xdp_rxq, dpaa_fq->net_dev,
-				       dpaa_fq->fqid, 0);
+				       dpaa_fq->channel, 0);
 		if (err) {
 			dev_err(dev, "xdp_rxq_info_reg() = %d\n", err);
 			return err;
Signature · 1 line
2.34.1
#3 lore raw
Quoted 3 lines · David Gouarin

Make it possible to bind a XDP socket to a queue id.
The DPAA FQ Id was passed to the XDP program in the XDP packet metadata which made it unusable with bpf_map_redirect.

I think that referring to a member from xdp_rxq_info struct as 'packet metadata' is confusing. I was trying to find a place where you are actually storing this id at xdp_buff::data_meta. This is not happening AFAICT. Thing is that xsk_rcv_check() picks xdp->rxq->queue_index which holds fqid which is not related to queue number, right?

Quoted 27 lines

Instead of the DPAA FQ Id, initialise the XDP rx queue with the channel id.

Fixes d57e57d0cd04 ("dpaa_eth: add XDP_TX support")

---
v2: add Fixes: in description

---
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +1 -1
index dcbc598b11c6..988dc9237368 100644
@@ -1154,7 +1154,7 @@ static int dpaa_fq_init(struct dpaa_fq *dpaa_fq, bool td_enable)
 	if (dpaa_fq->fq_type == FQ_TYPE_RX_DEFAULT ||
 	    dpaa_fq->fq_type == FQ_TYPE_RX_PCD) {
 		err = xdp_rxq_info_reg(&dpaa_fq->xdp_rxq, dpaa_fq->net_dev,
-				       dpaa_fq->fqid, 0);
+				       dpaa_fq->channel, 0);
 		if (err) {
 			dev_err(dev, "xdp_rxq_info_reg() = %d\n", err);
 			return err;
Signature · 1 line
2.34.1
#4 lore raw
Quoted 11 lines · Maciej Fijalkowski
Quoted 3 lines · David Gouarin

Make it possible to bind a XDP socket to a queue id.
The DPAA FQ Id was passed to the XDP program in the XDP packet metadata which made it unusable with bpf_map_redirect.

I think that referring to a member from xdp_rxq_info struct as 'packet metadata' is confusing. I was trying to find a place where you are actually storing this id at xdp_buff::data_meta. This is not happening AFAICT. Thing is that xsk_rcv_check() picks xdp->rxq->queue_index which holds fqid which is not related to queue number, right?

Correct. I have used the term xdp metadata because that is the terminology used in the xdp program (struct xdp_md).
I should have said instead :
The DPAA FQ Id was passed to the XDP program in the xdp_rxq_info->queue_index instead of the queue number [...]

Maciej please forgive me for the double send and formatting mistakes, kernel mailing lists are new to me.

Quoted 28 lines
Quoted 28 lines

Instead of the DPAA FQ Id, initialise the XDP rx queue with the channel id.

Fixes d57e57d0cd04 ("dpaa_eth: add XDP_TX support")

---
v2: add Fixes: in description

---
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +1 -2
index dcbc598b11c6..988dc9237368 100644
@@ -1154,7 +1154,7 @@ static int dpaa_fq_init(struct dpaa_fq *dpaa_fq, bool td_enable)
      if (dpaa_fq->fq_type == FQ_TYPE_RX_DEFAULT ||
          dpaa_fq->fq_type == FQ_TYPE_RX_PCD) {
              err = xdp_rxq_info_reg(&dpaa_fq->xdp_rxq, dpaa_fq->net_dev,
-                                    dpaa_fq->fqid, 0);
+                                    dpaa_fq->channel, 0);
              if (err) {
                      dev_err(dev, "xdp_rxq_info_reg() = %d\n", err);
                      return err;
--

2.34.1

#5 lore raw

PATCH v3 1/1 dpaa_eth: fix XDP queue index

In reply to Maciej Fijalkowski

Make it possible to bind a XDP socket to a queue id.
The DPAA FQ Id was passed to the XDP program in the xdp_rxq_info->queue_index instead of the Ethernet device queue number, which made it unusable with bpf_map_redirect.
Instead of the DPAA FQ Id, initialise the XDP rx queue with the queue number.

Fixes d57e57d0cd04 ("dpaa_eth: add XDP_TX support")

---
v3: reword commit message
v2: add Fixes: in description

---
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +1 -1
index dcbc598b11c6..988dc9237368 100644
@@ -1154,7 +1154,7 @@ static int dpaa_fq_init(struct dpaa_fq *dpaa_fq, bool td_enable)
 	if (dpaa_fq->fq_type == FQ_TYPE_RX_DEFAULT ||
 	    dpaa_fq->fq_type == FQ_TYPE_RX_PCD) {
 		err = xdp_rxq_info_reg(&dpaa_fq->xdp_rxq, dpaa_fq->net_dev,
-				       dpaa_fq->fqid, 0);
+				       dpaa_fq->channel, 0);
 		if (err) {
 			dev_err(dev, "xdp_rxq_info_reg() = %d\n", err);
 			return err;
Signature · 1 line
2.34.1
maintainer
#6 lore raw
Quoted 9 lines · David Gouarin

Make it possible to bind a XDP socket to a queue id.
The DPAA FQ Id was passed to the XDP program in the xdp_rxq_info->queue_index instead of the Ethernet device queue number, which made it unusable with bpf_map_redirect.
Instead of the DPAA FQ Id, initialise the XDP rx queue with the queue number.

Fixes d57e57d0cd04 ("dpaa_eth: add XDP_TX support")

The patch LGTM, but you must avoid empty lines in after the 'Fixes' tag.

Please have an accurate reading of the process documentation.

Thanks,

Paolo

#7 lore raw

PATCH v4 1/1 dpaa_eth: fix XDP queue index

Make it possible to bind a XDP socket to a queue id.
The DPAA FQ Id was passed to the XDP program in the xdp_rxq_info->queue_index instead of the Ethernet device queue number, which made it unusable with bpf_map_redirect.
Instead of the DPAA FQ Id, initialise the XDP rx queue with the queue number.

Fixes d57e57d0cd04 ("dpaa_eth: add XDP_TX support")

---
v4: fix patch formatting
v3: reword commit message
v2: add Fixes: in description

---
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +1 -1
index dcbc598b11c6..988dc9237368 100644
@@ -1154,7 +1154,7 @@ static int dpaa_fq_init(struct dpaa_fq *dpaa_fq, bool td_enable)
 	if (dpaa_fq->fq_type == FQ_TYPE_RX_DEFAULT ||
 	    dpaa_fq->fq_type == FQ_TYPE_RX_PCD) {
 		err = xdp_rxq_info_reg(&dpaa_fq->xdp_rxq, dpaa_fq->net_dev,
-				       dpaa_fq->fqid, 0);
+				       dpaa_fq->channel, 0);
 		if (err) {
 			dev_err(dev, "xdp_rxq_info_reg() = %d\n", err);
 			return err;
Signature · 1 line
2.34.1
maintainer
#8 lore raw
Quoted 5 lines · On Tue, 9 Apr 2024 11:30:46 +0200 David Gouarin wrote:

Make it possible to bind a XDP socket to a queue id.
The DPAA FQ Id was passed to the XDP program in the xdp_rxq_info->queue_index instead of the Ethernet device queue number, which made it unusable with bpf_map_redirect.
Instead of the DPAA FQ Id, initialise the XDP rx queue with the queue number.

Camelia, looks good?

#9 lore raw
Quoted 8 lines · Jakub Kicinski
Quoted 5 lines · On Tue, 9 Apr 2024 11:30:46 +0200 David Gouarin wrote:

Make it possible to bind a XDP socket to a queue id.
The DPAA FQ Id was passed to the XDP program in the xdp_rxq_info->queue_index instead of the Ethernet device queue number, which made it unusable with bpf_map_redirect.
Instead of the DPAA FQ Id, initialise the XDP rx queue with the queue number.

Camelia, looks good?

Please allow me some time to prepare a response, even if this means the patch misses this week's 'net' pull request.

maintainer
#10 lore raw
Quoted 8 lines · On Thu, 11 Apr 2024 14:34:33 +0300 Vladimir Oltean wrote:
Quoted 7 lines · Jakub Kicinski
Quoted 5 lines · On Tue, 9 Apr 2024 11:30:46 +0200 David Gouarin wrote:

Make it possible to bind a XDP socket to a queue id.
The DPAA FQ Id was passed to the XDP program in the xdp_rxq_info->queue_index instead of the Ethernet device queue number, which made it unusable with bpf_map_redirect.
Instead of the DPAA FQ Id, initialise the XDP rx queue with the queue number.

Quoted 4 lines
Quoted 1 line

Camelia, looks good?

Please allow me some time to prepare a response, even if this means the patch misses this week's 'net' pull request.

We're getting close to the 'net' pull request of the following week :) The bug has been around for a while so no huge rush, but would be nice to get rid of this from patchwork. If you don't have time - would you be willing to repost it once you found the time to investigate?

#11 lore raw
Quoted 11 lines · Jakub Kicinski
Quoted 10 lines · On Thu, 11 Apr 2024 14:34:33 +0300 Vladimir Oltean wrote:
Quoted 8 lines · Jakub Kicinski
Quoted 5 lines · On Tue, 9 Apr 2024 11:30:46 +0200 David Gouarin wrote:

Make it possible to bind a XDP socket to a queue id.
The DPAA FQ Id was passed to the XDP program in the xdp_rxq_info->queue_index instead of the Ethernet device queue number, which made it unusable with bpf_map_redirect.
Instead of the DPAA FQ Id, initialise the XDP rx queue with the queue number.

Camelia, looks good?

Quoted 7 lines
Quoted 2 lines

Please allow me some time to prepare a response, even if this means the patch misses this week's 'net' pull request.

We're getting close to the 'net' pull request of the following week :) The bug has been around for a while so no huge rush, but would be nice to get rid of this from patchwork. If you don't have time - would you be willing to repost it once you found the time to investigate?

I have been looking into this, but I do not have a definitive response yet. The dpaa_fq->channel replacement is not the zero-based RX queue number that David is looking for, either.

We will work this out. Please remove this patch from patchwork for now.