xsk_get_pool_from_qid() fails not because the device's queues are busy,
but because the queue_id exceeds the current number of queues.
So when it fails, it is better to return -EINVAL instead of -EBUSY.
Signed-off-by: Wang Hai <redacted>
---
net/xdp/xsk_buff_pool.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Magnus Karlsson <hidden> Date: 2021-06-02 08:30:16
On Wed, Jun 2, 2021 at 6:02 AM Wang Hai [off-list ref] wrote:
quoted hunk
xsk_get_pool_from_qid() fails not because the device's queues are busy,
but because the queue_id exceeds the current number of queues.
So when it fails, it is better to return -EINVAL instead of -EBUSY.
Signed-off-by: Wang Hai <redacted>
---
net/xdp/xsk_buff_pool.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -135,7 +135,7 @@ int xp_assign_dev(struct xsk_buff_pool *pool,return-EINVAL;if(xsk_get_pool_from_qid(netdev,queue_id))-return-EBUSY;+return-EINVAL;
I guess your intent here is to return -EINVAL only when the queue_id
is larger than the number of active queues. But this patch also
changes the return code when the queue id is already in use and in
that case we should continue to return -EBUSY. As this function is
used by a number of drivers, the easiest way to accomplish this is to
introduce a test for queue_id out of bounds before this if-statement
and return -EINVAL there.
On Wed, Jun 2, 2021 at 6:02 AM Wang Hai [off-list ref] wrote:
quoted
xsk_get_pool_from_qid() fails not because the device's queues are busy,
but because the queue_id exceeds the current number of queues.
So when it fails, it is better to return -EINVAL instead of -EBUSY.
Signed-off-by: Wang Hai <redacted>
---
net/xdp/xsk_buff_pool.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -135,7 +135,7 @@ int xp_assign_dev(struct xsk_buff_pool *pool,return-EINVAL;if(xsk_get_pool_from_qid(netdev,queue_id))-return-EBUSY;+return-EINVAL;
I guess your intent here is to return -EINVAL only when the queue_id
is larger than the number of active queues. But this patch also
changes the return code when the queue id is already in use and in
that case we should continue to return -EBUSY. As this function is
used by a number of drivers, the easiest way to accomplish this is to
introduce a test for queue_id out of bounds before this if-statement
and return -EINVAL there.
From: Magnus Karlsson <hidden> Date: 2021-06-02 08:54:14
On Wed, Jun 2, 2021 at 10:38 AM Toke Høiland-Jørgensen [off-list ref] wrote:
Magnus Karlsson [off-list ref] writes:
quoted
On Wed, Jun 2, 2021 at 6:02 AM Wang Hai [off-list ref] wrote:
quoted
xsk_get_pool_from_qid() fails not because the device's queues are busy,
but because the queue_id exceeds the current number of queues.
So when it fails, it is better to return -EINVAL instead of -EBUSY.
Signed-off-by: Wang Hai <redacted>
---
net/xdp/xsk_buff_pool.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -135,7 +135,7 @@ int xp_assign_dev(struct xsk_buff_pool *pool,return-EINVAL;if(xsk_get_pool_from_qid(netdev,queue_id))-return-EBUSY;+return-EINVAL;
I guess your intent here is to return -EINVAL only when the queue_id
is larger than the number of active queues. But this patch also
changes the return code when the queue id is already in use and in
that case we should continue to return -EBUSY. As this function is
used by a number of drivers, the easiest way to accomplish this is to
introduce a test for queue_id out of bounds before this if-statement
and return -EINVAL there.
Isn't the return code ABI by now, though?
You are probably right and in that case this should not change at all.
It has been returning this for quite a while too as it is nothing new.
But I leave the final decision to other people on the list.
Sorry, I misunderstood here, this is a faulty patch and no changes are
needed here. Please ignore this patch
在 2021/6/2 16:29, Magnus Karlsson 写道:
On Wed, Jun 2, 2021 at 6:02 AM Wang Hai [off-list ref] wrote:
quoted
xsk_get_pool_from_qid() fails not because the device's queues are busy,
but because the queue_id exceeds the current number of queues.
So when it fails, it is better to return -EINVAL instead of -EBUSY.
Signed-off-by: Wang Hai <redacted>
---
net/xdp/xsk_buff_pool.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -135,7 +135,7 @@ int xp_assign_dev(struct xsk_buff_pool *pool,return-EINVAL;if(xsk_get_pool_from_qid(netdev,queue_id))-return-EBUSY;+return-EINVAL;
I guess your intent here is to return -EINVAL only when the queue_id
is larger than the number of active queues.
Yes, I just confirmed that this has been implemented in xp_assign_dev().
int xp_assign_dev()
{
...
err = xsk_reg_pool_at_qid(netdev, pool, queue_id);
if (err)
return err; //return -EINVAL;
...
}
But this patch also
changes the return code when the queue id is already in use and in
that case we should continue to return -EBUSY. As this function is
used by a number of drivers, the easiest way to accomplish this is to
introduce a test for queue_id out of bounds before this if-statement
and return -EINVAL there.