common/sfc_efx/base: remove VQ index check during VQ start
PATCH 1/1 common/sfc_efx/base: remove VQ index check during VQ start
From: Abhimanyu Saini <[email protected]>
The used/avail queue indexes are not bound by queue size, because the descriptor entry index is calculated by a simple modulo between queue index and queue_size
So, do not check initial used and avail queue indexes against queue size because it is possible for these indexes to be greater than queue size in the following cases:
1) The queue is created to be migrated into, or
2) The client issues a qstop/qstart after running datapath
--- drivers/common/sfc_efx/base/rhead_virtio.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/common/sfc_efx/base/rhead_virtio.c +1 -11
@@ -47,14 +47,6 @@ goto fail2; } -if (evvdp !=NULL ) { -if ((evvdp->evvd_vq_cidx > evvcp->evvc_vq_size) || - (evvdp->evvd_vq_pidx > evvcp->evvc_vq_size)) { - rc =EINVAL ; - goto fail3; - } - } - req.emr_cmd =MC_CMD_VIRTIO_INIT_QUEUE ; req.emr_in_buf = payload; req.emr_in_length =MC_CMD_VIRTIO_INIT_QUEUE_REQ_LEN ;
@@ -116,15 +108,13 @@if (req.emr_rc !=0 ) { rc = req.emr_rc; - goto fail4; + goto fail3; } evvp->evv_vi_index = vi_index;return (0 ); -fail4: -EFSYS_PROBE (fail4); fail3:EFSYS_PROBE (fail3); fail2:
Signature · 1 line
1.8.3.1
A message that is not in the archive (sent off-list or not yet received): SA0PR12MB43523906A4BF7F13DF9B9D0FE3829@SA0PR12MB4352.namprd12.prod.outlook.com
Srivastava, Vijay
Acked-by Vijay SrivastavaQuoted 56 lines
From: Abhimanyu Saini <[email protected]>
The used/avail queue indexes are not bound by queue size, because the descriptor entry index is calculated by a simple modulo between queue index and
queue_sizeSo, do not check initial used and avail queue indexes against queue size because it is possible for these indexes to be greater than queue size in the following cases:
1) The queue is created to be migrated into, or
2) The client issues a qstop/qstart after running datapathFixes 4dda72dbdeab3 ("common/sfc_efx/base: add base virtio support forvDPA")
Cc: [email protected]Signed-off-by Abhimanyu Saini <[email protected]>---
drivers/common/sfc_efx/base/rhead_virtio.c| 12 +-----------1 file changed, 1 insertion(+), 11 deletions(-)drivers/common/sfc_efx/base/rhead_virtio.c +0
-8@@ -47,14 +47,6 @@ goto fail2; } -if (evvdp !=NULL ) { -if ((evvdp->evvd_vq_cidx > evvcp->evvc_vq_size) || - (evvdp->evvd_vq_pidx > evvcp->evvc_vq_size)) { - rc =EINVAL ; - goto fail3; - } - } - req.emr_cmd =MC_CMD_VIRTIO_INIT_QUEUE ; req.emr_in_buf = payload; req.emr_in_length = MC_CMD_VIRTIO_INIT_QUEUE_REQ_LEN; @@ -116,15 +108,13 @@
if (req.emr_rc != 0) { rc = req.emr_rc;drivers/common/sfc_efx/base/rhead_virtio.c +1
-1- goto fail4; + goto fail3;} evvp->evv_vi_index = vi_index; return (0);drivers/common/sfc_efx/base/rhead_virtio.c +0
-2-fail4: -EFSYS_PROBE (fail4);fail3:
Quoted 4 lines
EFSYS_PROBE(fail3);fail2:
--
1.8.3.1
Hi Vijay,
Quoted 1 line · Vijay
Acked-by Vijay Srivastava <[email protected]>
Please, send a patch to MAINTAINERS to update your E-mail address from Xilinx to AMD domain.
Andrew.
Hello,
Quoted 7 lines · Andrew Rybchenko
Quoted 1 line · Vijay
Acked-by Vijay Srivastava <[email protected]>Please, send a patch to
MAINTAINERSto update your E-mail address from Xilinx to AMD domain.
Please register this mail address to the mailing list, too. Your recent messages from @amd.com were waiting in the moderation queue.
Signature · 1 line
David Marchand
Quoted 5 lines · On 7/8/22 10:37, [email protected] wrote:
From: Abhimanyu Saini <[email protected]>
The used/avail queue indexes are not bound by queue size, because the descriptor entry index is calculated by a simple modulo between queue index and
queue_size
"is calculated" is a bit vague since looking at the code I've failed to find the place where modulo operation is done. Don't we need to apply it these values are put into MCDI message?
Quoted 52 lines
So, do not check initial used and avail queue indexes against queue size because it is possible for these indexes to be greater than queue size in the following cases:
1) The queue is created to be migrated into, or
2) The client issues a qstop/qstart after running datapathFixes 4dda72dbdeab3 ("common/sfc_efx/base: add base virtio support for vDPA")Signed-off-by Abhimanyu Saini <[email protected]>--- drivers/common/sfc_efx/base/rhead_virtio.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)drivers/common/sfc_efx/base/rhead_virtio.c +1
-11@@ -47,14 +47,6 @@ goto fail2; } -if (evvdp !=NULL ) { -if ((evvdp->evvd_vq_cidx > evvcp->evvc_vq_size) || - (evvdp->evvd_vq_pidx > evvcp->evvc_vq_size)) { - rc =EINVAL ; - goto fail3; - } - } - req.emr_cmd =MC_CMD_VIRTIO_INIT_QUEUE ; req.emr_in_buf = payload; req.emr_in_length =MC_CMD_VIRTIO_INIT_QUEUE_REQ_LEN ;@@ -116,15 +108,13 @@if (req.emr_rc !=0 ) { rc = req.emr_rc; - goto fail4; + goto fail3; } evvp->evv_vi_index = vi_index;return (0 ); -fail4: -EFSYS_PROBE (fail4); fail3:EFSYS_PROBE (fail3); fail2:
[AMD Official Use Only - General]
Quoted 11 lines · On 7/8/22 10:37, [email protected] wrote:
Quoted 5 lines
From: Abhimanyu Saini <[email protected]>
The used/avail queue indexes are not bound by queue size, because the descriptor entry index is calculated by a simple modulo between queue index and
queue_size"is calculated" is a bit vague since looking at the code I've failed to find the place where modulo operation is done. Don't we need to apply it these values are put into MCDI message?
The values are added to the MCDI as is and,
the modulo is performed by the hardware.
I can append the commit message to reflect the same?
Quoted 54 lines
Quoted 9 lines
So, do not check initial used and avail queue indexes against queue size because it is possible for these indexes to be greater than queue size in the following cases:
1) The queue is created to be migrated into, or
2) The client issues a qstop/qstart after running datapathFixes 4dda72dbdeab3 ("common/sfc_efx/base: add base virtio support forvDPA")
Review
Quoted 8 lines
Signed-off-by Abhimanyu Saini <[email protected]>--- drivers/common/sfc_efx/base/rhead_virtio.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)(quoted diff) +0
-0
b/drivers/common/sfc_efx/base/rhead_virtio.cQuoted 35 lines
index 335cb74..7f08717 100644
drivers/common/sfc_efx/base/rhead_virtio.c +1
-11@@ -47,14 +47,6 @@ goto fail2; } -if (evvdp !=NULL ) { -if ((evvdp->evvd_vq_cidx > evvcp->evvc_vq_size) || - (evvdp->evvd_vq_pidx > evvcp->evvc_vq_size)) { - rc =EINVAL ; - goto fail3; - } - } - req.emr_cmd =MC_CMD_VIRTIO_INIT_QUEUE ; req.emr_in_buf = payload; req.emr_in_length =MC_CMD_VIRTIO_INIT_QUEUE_REQ_LEN ;@@ -116,15 +108,13 @@if (req.emr_rc !=0 ) { rc = req.emr_rc; - goto fail4; + goto fail3; } evvp->evv_vi_index = vi_index;return (0 ); -fail4: -EFSYS_PROBE (fail4); fail3:EFSYS_PROBE (fail3); fail2: