Patchwork qla3xxx: Ensure req_q_phy_addr writes to the register

login
register
mail settings
Submitter Joe Jin
Date Oct. 17, 2012, 6:32 a.m.
Message ID <507E50E5.5040201@oracle.com>
Download mbox | patch
Permalink /patch/191973/
State Changes Requested
Delegated to: David Miller
Headers show

Comments

Joe Jin - Oct. 17, 2012, 6:32 a.m.
Make sure req_q_phy_addr write to the register.

Signed-off-by: Joe Jin <joe.jin@oracle.com>
Cc: Ron Mercer <ron.mercer@qlogic.com>
Cc: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
---
 drivers/net/ethernet/qlogic/qla3xxx.c | 6 ++++++
 1 file changed, 6 insertions(+)
Joe Jin - Oct. 18, 2012, 2:18 a.m.
On 10/18/12 01:45, Jitendra Kalsaria wrote:
> 
> 
>> -----Original Message-----
>> From: Joe Jin [mailto:joe.jin@oracle.com] 
>> Sent: Tuesday, October 16, 2012 11:32 PM
>> To: Ron Mercer; Jitendra Kalsaria; Dept-Eng Linux Driver
>> Cc: netdev; linux-kernel; Greg Marsden
>> Subject: [PATCH] qla3xxx: Ensure req_q_phy_addr writes to the register
>>
>> Make sure req_q_phy_addr write to the register.
>>
>> Signed-off-by: Joe Jin <joe.jin@oracle.com>
>> Cc: Ron Mercer <ron.mercer@qlogic.com>
>> Cc: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
>> ---
>> drivers/net/ethernet/qlogic/qla3xxx.c | 6 ++++++
>> 1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c
>> index df09b1c..78b4cba 100644
>> --- a/drivers/net/ethernet/qlogic/qla3xxx.c
>> +++ b/drivers/net/ethernet/qlogic/qla3xxx.c
>> @@ -2525,6 +2525,12 @@ static int ql_alloc_net_req_rsp_queues(struct ql3_adapter *qdev)
>> 	qdev->req_q_size =
>> 	    (u32) (NUM_REQ_Q_ENTRIES * sizeof(struct ob_mac_iocb_req));
>>
>> +	/*
>> +	 * The barrier is required to ensure that req_q_phy_addr writes to
>> +	 * the memory.
>> +	 */
>> +	wmb();
>> +
>> 	qdev->req_q_virt_addr =
>> 	    pci_alloc_consistent(qdev->pdev,
>> 				 (size_t) qdev->req_q_size,
> 
> Your changes only take care of request queue but not response queue which also need barrier.

Jiten,

Thanks for review!
The barrier to make sure writel() call for req_q_phy_addr and rsp_q_phy_addr in 
ql_adapter_initialize(), so I think call once wmb() is enough but I need to update
the comment, any idea?

Thanks,
Joe

> 
> 	qdev->req_q_size =
> 		(u32) (NUM_REQ_Q_ENTRIES * sizeof(struct ob_mac_iocb_req));
> 
> 	qdev->rsp_q_size = NUM_RSP_Q_ENTRIES * sizeof(struct net_rsp_iocb);
> 
> 	wmb();
> 
> thanks,
> 	Jiten
>
Jitendra Kalsaria - Oct. 18, 2012, 5:10 p.m.
>>> -----Original Message-----

>>> From: Joe Jin [mailto:joe.jin@oracle.com] 

>>> Sent: Tuesday, October 16, 2012 11:32 PM

>>> To: Ron Mercer; Jitendra Kalsaria; Dept-Eng Linux Driver

>>> Cc: netdev; linux-kernel; Greg Marsden

>>> Subject: [PATCH] qla3xxx: Ensure req_q_phy_addr writes to the register

>>>

>>> Make sure req_q_phy_addr write to the register.

>>>

>>> Signed-off-by: Joe Jin <joe.jin@oracle.com>

>>> Cc: Ron Mercer <ron.mercer@qlogic.com>

>>> Cc: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>

>>> ---

>>> drivers/net/ethernet/qlogic/qla3xxx.c | 6 ++++++

>>> 1 file changed, 6 insertions(+)

>>>

>>> diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c

>>> index df09b1c..78b4cba 100644

>>> --- a/drivers/net/ethernet/qlogic/qla3xxx.c

>>> +++ b/drivers/net/ethernet/qlogic/qla3xxx.c

>>> @@ -2525,6 +2525,12 @@ static int ql_alloc_net_req_rsp_queues(struct ql3_adapter *qdev)

>>> 	qdev->req_q_size =

>>> 	    (u32) (NUM_REQ_Q_ENTRIES * sizeof(struct ob_mac_iocb_req));

>>>

>>> +	/*

>>> +	 * The barrier is required to ensure that req_q_phy_addr writes to

>>> +	 * the memory.

>>> +	 */

>>> +	wmb();

>>> +

>>> 	qdev->req_q_virt_addr =

>>> 	    pci_alloc_consistent(qdev->pdev,

>>> 				 (size_t) qdev->req_q_size,

>> 

>> Your changes only take care of request queue but not response queue which also need barrier.

>

>Jiten,

>

>Thanks for review!

>The barrier to make sure writel() call for req_q_phy_addr and rsp_q_phy_addr in 

>ql_adapter_initialize(), so I think call once wmb() is enough but I need to update

>the comment, any idea?


Yes and something like "ensure request/response queue addr writes to the register"

Patch

diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c
index df09b1c..78b4cba 100644
--- a/drivers/net/ethernet/qlogic/qla3xxx.c
+++ b/drivers/net/ethernet/qlogic/qla3xxx.c
@@ -2525,6 +2525,12 @@  static int ql_alloc_net_req_rsp_queues(struct ql3_adapter *qdev)
 	qdev->req_q_size =
 	    (u32) (NUM_REQ_Q_ENTRIES * sizeof(struct ob_mac_iocb_req));
 
+	/*
+	 * The barrier is required to ensure that req_q_phy_addr writes to
+	 * the memory.
+	 */
+	wmb();
+
 	qdev->req_q_virt_addr =
 	    pci_alloc_consistent(qdev->pdev,
 				 (size_t) qdev->req_q_size,