From: Lijun Pan <hidden> Date: 2021-01-25 23:21:46
Ensure that received Command-Response Queue (CRQ) entries are
properly read in order by the driver. dma_rmb barrier has
been added before accessing the CRQ descriptor to ensure
the entire descriptor is read before processing.
Fixes: 032c5e82847a ("Driver for IBM System i/p VNIC protocol")
Signed-off-by: Lijun Pan <redacted>
---
v2: drop dma_wmb according to Jakub's opinion
drivers/net/ethernet/ibm/ibmvnic.c | 8 ++++++++
1 file changed, 8 insertions(+)
@@ -5084,6 +5084,14 @@ static void ibmvnic_tasklet(struct tasklet_struct *t)while(!done){/* Pull all the valid messages off the CRQ */while((crq=ibmvnic_next_crq(adapter))!=NULL){+/* Ensure that the entire CRQ descriptor queue->msgs+*hasbeenloadedbeforereadingitscontents.+*Thisbarriermakessureibmvnic_next_crq()'s+*crq->generic.first&IBMVNIC_CRQ_CMD_RSPisloaded+*beforeibmvnic_handle_crq()'s+*switch(gen_crq->first)andswitch(gen_crq->cmd).+*/+dma_rmb();ibmvnic_handle_crq(crq,adapter);crq->generic.first=0;}
From: Jakub Kicinski <kuba@kernel.org> Date: 2021-01-28 01:04:23
On Mon, 25 Jan 2021 17:20:23 -0600 Lijun Pan wrote:
quoted hunk
Ensure that received Command-Response Queue (CRQ) entries are
properly read in order by the driver. dma_rmb barrier has
been added before accessing the CRQ descriptor to ensure
the entire descriptor is read before processing.
Fixes: 032c5e82847a ("Driver for IBM System i/p VNIC protocol")
Signed-off-by: Lijun Pan <redacted>
---
v2: drop dma_wmb according to Jakub's opinion
drivers/net/ethernet/ibm/ibmvnic.c | 8 ++++++++
1 file changed, 8 insertions(+)
@@ -5084,6 +5084,14 @@ static void ibmvnic_tasklet(struct tasklet_struct *t)while(!done){/* Pull all the valid messages off the CRQ */while((crq=ibmvnic_next_crq(adapter))!=NULL){+/* Ensure that the entire CRQ descriptor queue->msgs+*hasbeenloadedbeforereadingitscontents.
I still find this sentence confusing, maybe you mean to say stored
instead of loaded?
+ * This barrier makes sure ibmvnic_next_crq()'s
+ * crq->generic.first & IBMVNIC_CRQ_CMD_RSP is loaded
+ * before ibmvnic_handle_crq()'s
+ * switch(gen_crq->first) and switch(gen_crq->cmd).
Yup, that makes perfect sense. It's about ordering of the loads.
From: Lijun Pan <hidden> Date: 2021-01-28 01:23:30
On Wed, Jan 27, 2021 at 7:06 PM Jakub Kicinski [off-list ref] wrote:
On Mon, 25 Jan 2021 17:20:23 -0600 Lijun Pan wrote:
quoted
Ensure that received Command-Response Queue (CRQ) entries are
properly read in order by the driver. dma_rmb barrier has
been added before accessing the CRQ descriptor to ensure
the entire descriptor is read before processing.
Fixes: 032c5e82847a ("Driver for IBM System i/p VNIC protocol")
Signed-off-by: Lijun Pan <redacted>
---
v2: drop dma_wmb according to Jakub's opinion
drivers/net/ethernet/ibm/ibmvnic.c | 8 ++++++++
1 file changed, 8 insertions(+)
@@ -5084,6 +5084,14 @@ static void ibmvnic_tasklet(struct tasklet_struct *t)while(!done){/* Pull all the valid messages off the CRQ */while((crq=ibmvnic_next_crq(adapter))!=NULL){+/* Ensure that the entire CRQ descriptor queue->msgs+*hasbeenloadedbeforereadingitscontents.
I still find this sentence confusing, maybe you mean to say stored
instead of loaded?
The above 2 lines are the general description. The below 4 lines are
detailed explanations. If it is still confusing, we can delete the above
2 lines of comments.
quoted
+ * This barrier makes sure ibmvnic_next_crq()'s
+ * crq->generic.first & IBMVNIC_CRQ_CMD_RSP is loaded
+ * before ibmvnic_handle_crq()'s
+ * switch(gen_crq->first) and switch(gen_crq->cmd).
Yup, that makes perfect sense. It's about ordering of the loads.
From: Jakub Kicinski <kuba@kernel.org> Date: 2021-01-28 01:33:24
On Wed, 27 Jan 2021 19:22:25 -0600 Lijun Pan wrote:
On Wed, Jan 27, 2021 at 7:06 PM Jakub Kicinski [off-list ref] wrote:
quoted
On Mon, 25 Jan 2021 17:20:23 -0600 Lijun Pan wrote:
quoted
Ensure that received Command-Response Queue (CRQ) entries are
properly read in order by the driver. dma_rmb barrier has
been added before accessing the CRQ descriptor to ensure
the entire descriptor is read before processing.
Fixes: 032c5e82847a ("Driver for IBM System i/p VNIC protocol")
Signed-off-by: Lijun Pan <redacted>
---
v2: drop dma_wmb according to Jakub's opinion
drivers/net/ethernet/ibm/ibmvnic.c | 8 ++++++++
1 file changed, 8 insertions(+)
@@ -5084,6 +5084,14 @@ static void ibmvnic_tasklet(struct tasklet_struct *t)while(!done){/* Pull all the valid messages off the CRQ */while((crq=ibmvnic_next_crq(adapter))!=NULL){+/* Ensure that the entire CRQ descriptor queue->msgs+*hasbeenloadedbeforereadingitscontents.
I still find this sentence confusing, maybe you mean to say stored
instead of loaded?
The above 2 lines are the general description. The below 4 lines are
detailed explanations. If it is still confusing, we can delete the above
2 lines of comments.
Yes, I'd find the comment clearer without them, thanks.
From: Lijun Pan <hidden> Date: 2021-01-28 01:40:57
On Wed, Jan 27, 2021 at 7:31 PM Jakub Kicinski [off-list ref] wrote:
On Wed, 27 Jan 2021 19:22:25 -0600 Lijun Pan wrote:
quoted
On Wed, Jan 27, 2021 at 7:06 PM Jakub Kicinski [off-list ref] wrote:
quoted
On Mon, 25 Jan 2021 17:20:23 -0600 Lijun Pan wrote:
quoted
Ensure that received Command-Response Queue (CRQ) entries are
properly read in order by the driver. dma_rmb barrier has
been added before accessing the CRQ descriptor to ensure
the entire descriptor is read before processing.
Fixes: 032c5e82847a ("Driver for IBM System i/p VNIC protocol")
Signed-off-by: Lijun Pan <redacted>
---
v2: drop dma_wmb according to Jakub's opinion
drivers/net/ethernet/ibm/ibmvnic.c | 8 ++++++++
1 file changed, 8 insertions(+)
@@ -5084,6 +5084,14 @@ static void ibmvnic_tasklet(struct tasklet_struct *t)while(!done){/* Pull all the valid messages off the CRQ */while((crq=ibmvnic_next_crq(adapter))!=NULL){+/* Ensure that the entire CRQ descriptor queue->msgs+*hasbeenloadedbeforereadingitscontents.
I still find this sentence confusing, maybe you mean to say stored
instead of loaded?
The above 2 lines are the general description. The below 4 lines are
detailed explanations. If it is still confusing, we can delete the above
2 lines of comments.
Yes, I'd find the comment clearer without them, thanks.