Endianess in cxgb4
Hi Steve,
I reviewed my reports from various static checkers and saw strange code in build_tpte_memreg() function that in drivers/infiniband/hw/cxgb4/qp.c.
That function has following code:
614 fr->r2 = cpu_to_be32(0);
615 fr->stag = cpu_to_be32(mhp->ibmr.rkey);
The r2, stag and rkey are u32, why do you need cpu_to_be32() conversion?
The error report which I got is:
134 drivers/infiniband/hw/cxgb4/qp.c:614:16: warning: incorrect type in assignment (different base types)
135 drivers/infiniband/hw/cxgb4/qp.c:614:16: expected unsigned int [unsigned] [usertype] r2
136 drivers/infiniband/hw/cxgb4/qp.c:614:16: got restricted __be32 [usertype] <noident>
137 drivers/infiniband/hw/cxgb4/qp.c:615:18: warning: incorrect type in assignment (different base types)
138 drivers/infiniband/hw/cxgb4/qp.c:615:18: expected unsigned int [unsigned] [usertype] stag
139 drivers/infiniband/hw/cxgb4/qp.c:615:18: got restricted __be32 [usertype] <noident>
Thanks
Quoted 12 lines
Hi Steve,
I reviewed my reports from various static checkers and saw strange code in
build_tpte_memreg()function that indrivers/infiniband/hw/cxgb4/qp.c.That function has following code:
614fr->r2=cpu_to_be32(0);
615fr->stag=cpu_to_be32(mhp->ibmr.rkey);The r2, stag and rkey are u32, why do you need
cpu_to_be32()conversion?
Hey Leon,
The r2 and stag fields in struct fw_ri_fr_nsmr_tpte_wr should be __be32.
Steve.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 11 lines · Leon Romanovsky
Hi Steve,
I reviewed my reports from various static checkers and saw strange code in
build_tpte_memreg()function that indrivers/infiniband/hw/cxgb4/qp.c.That function has following code:
614fr->r2=cpu_to_be32(0);
615fr->stag=cpu_to_be32(mhp->ibmr.rkey);The r2, stag and rkey are u32, why do you need
cpu_to_be32()conversion?
Quoted 8 lines
The error report which I got is:
134
drivers/infiniband/hw/cxgb4/qp.c:614:16: warning: incorrect type in assignment (different base types)
135drivers/infiniband/hw/cxgb4/qp.c:614:16: expected unsigned int [unsigned] [usertype] r2
136drivers/infiniband/hw/cxgb4/qp.c:614:16: got restricted__be32[usertype] <noident>
137drivers/infiniband/hw/cxgb4/qp.c:615:18: warning: incorrect type in assignment (different base types)
138drivers/infiniband/hw/cxgb4/qp.c:615:18: expected unsigned int [unsigned] [usertype] stag
139drivers/infiniband/hw/cxgb4/qp.c:615:18: got restricted__be32[usertype] <noident>
I looked at cxgb in userspace and gave up. It seemed to be storing be and host values in the same memory locations :(
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 10 lines · Steve Wise
Quoted 10 lines
Hi Steve,
I reviewed my reports from various static checkers and saw strange code in
build_tpte_memreg()function that indrivers/infiniband/hw/cxgb4/qp.c.That function has following code:
614fr->r2=cpu_to_be32(0);
615fr->stag=cpu_to_be32(mhp->ibmr.rkey);
Quoted 6 lines
Quoted 2 lines
The r2, stag and rkey are u32, why do you need
cpu_to_be32()conversion?Hey Leon,
The r2 and stag fields in struct
fw_ri_fr_nsmr_tpte_wrshould be__be32.
it is not how it is declared in drivers/infiniband/hw/cxgb4/t4fw_ri_api.h
672 struct fw_ri_fr_nsmr_tpte_wr {
673 __u8 opcode; 674 __u8 flags; 675 __u16 wrid; 676 __u8 r1[3]; 677 __u8 len16; 678 __u32 r2; 679 __u32 stag; 680 struct fw_ri_tpte tpte; 681 __u64 pbl[2];
682 };
Thanks
Quoted 3 lines
Steve.
Quoted 10 lines · Leon Romanovsky
Quoted 9 lines
Hi Steve,
I reviewed my reports from various static checkers and saw strange code in
build_tpte_memreg()function that indrivers/infiniband/hw/cxgb4/qp.c.That function has following code:
614fr->r2=cpu_to_be32(0);
615fr->stag=cpu_to_be32(mhp->ibmr.rkey);
Quoted 7 lines
Quoted 5 lines
The r2, stag and rkey are u32, why do you need
cpu_to_be32()conversion?The error report which I got is:
134
drivers/infiniband/hw/cxgb4/qp.c:614:16: warning: incorrect type inassignment (different base types)
Quoted 1 line
135
drivers/infiniband/hw/cxgb4/qp.c:614:16: expected unsigned int
[unsigned]
Quoted 2 lines
[usertype] r2
Quoted 1 line
136
drivers/infiniband/hw/cxgb4/qp.c:614:16: got restricted__be32
[usertype]
Quoted 4 lines
<noident>
Quoted 1 line
137
drivers/infiniband/hw/cxgb4/qp.c:615:18: warning: incorrect type inassignment (different base types)
Quoted 1 line
138
drivers/infiniband/hw/cxgb4/qp.c:615:18: expected unsigned int
[unsigned]
Quoted 2 lines
[usertype] stag
Quoted 1 line
139
drivers/infiniband/hw/cxgb4/qp.c:615:18: got restricted__be32
[usertype]
Quoted 4 lines
<noident>
I looked at cxgb in userspace and gave up. It seemed to be storing be and host values in the same memory locations :(
The Terminator HW/FW WRs are in BE always, with the exception that something "opaque and owned by the host" is in HBO. The only one I can think of is the wrid field in each Terminator SQE. It is provided by the host in each WR, and is opaque to the HW/FW. That is, the HW/FW does not interpret this 16b field, but simply reflects it in the corresponding CQE.
See my reply to Leon regarding the above issue...
Steve.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 30 lines · Steve Wise
Quoted 10 lines
Quoted 10 lines
Hi Steve,
I reviewed my reports from various static checkers and saw strange code in
build_tpte_memreg()function that indrivers/infiniband/hw/cxgb4/qp.c.That function has following code:
614fr->r2=cpu_to_be32(0);
615fr->stag=cpu_to_be32(mhp->ibmr.rkey);Quoted 6 lines
Quoted 2 lines
The r2, stag and rkey are u32, why do you need
cpu_to_be32()conversion?Hey Leon,
The r2 and stag fields in struct
fw_ri_fr_nsmr_tpte_wrshould be__be32.it is not how it is declared in
drivers/infiniband/hw/cxgb4/t4fw_ri_api.h672 struct
fw_ri_fr_nsmr_tpte_wr{673 __u8 opcode; 674 __u8 flags; 675 __u16 wrid; 676 __u8 r1[3]; 677 __u8 len16; 678 __u32 r2; 679 __u32 stag; 680 struct fw_ri_tpte tpte; 681 __u64 pbl[2];
Quoted 4 lines
682 };
Thanks
I'm not communicating effectively. Sorry.
This is a bug in t4fw_ri_api.h. You need create a patch to change fw_ri_fr_nsmr_tpte_wr to make the stag and r2 fields to be __be32.
Steve.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 32 lines · Steve Wise
Quoted 32 lines · Steve Wise
Quoted 10 lines
Quoted 10 lines
Hi Steve,
I reviewed my reports from various static checkers and saw strange code in
build_tpte_memreg()function that indrivers/infiniband/hw/cxgb4/qp.c.That function has following code:
614fr->r2=cpu_to_be32(0);
615fr->stag=cpu_to_be32(mhp->ibmr.rkey);Quoted 6 lines
Quoted 2 lines
The r2, stag and rkey are u32, why do you need
cpu_to_be32()conversion?Hey Leon,
The r2 and stag fields in struct
fw_ri_fr_nsmr_tpte_wrshould be__be32.it is not how it is declared in
drivers/infiniband/hw/cxgb4/t4fw_ri_api.h672 struct
fw_ri_fr_nsmr_tpte_wr{673 __u8 opcode; 674 __u8 flags; 675 __u16 wrid; 676 __u8 r1[3]; 677 __u8 len16; 678 __u32 r2; 679 __u32 stag; 680 struct fw_ri_tpte tpte; 681 __u64 pbl[2];682 };
Quoted 7 lines
Quoted 2 lines
Thanks
I'm not communicating effectively. Sorry.
This is a bug in
t4fw_ri_api.h. You need create a patch to changefw_ri_fr_nsmr_tpte_wrto make the stag and r2 fields to be__be32.
Thanks, I'll send a fix.
Quoted 5 lines
Steve.
Quoted 7 lines
Quoted 4 lines
I'm not communicating effectively. Sorry.
This is a bug in
t4fw_ri_api.h. You need create a patch to changefw_ri_fr_nsmr_tpte_wrto make the stag and r2 fields to be__be32.Thanks, I'll send a fix.
Thanks for doing this work!
Steve.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html