[hermon] Use correct alignment for doorbell records
Doorbell records are currently embedded within the completion queue and receive work queue strucures, which are allocated using zalloc() and so have an alignment guarantee of only sizeof(void*), i.e. four bytes. This is sufficient for the receive work queue, but not for the completion queue, which requires an alignment guarantee of eight bytes. Though not guaranteed, it so happens that zalloc() will always return a pointer that is exactly four bytes above a sixteen-byte boundary. The completion queue doorbell record is therefore always misaligned, and the value passed to the hardware via SW2HW_CQ is actually always pointing to the page_offset value within the MTT descriptor (which directly precedes the inline doorbell record). Provided that the page offset is greater than 0x100, this looks to the hardware like an update_ci value of greater than 0x010000 (taking into account endianness differences), and so the hardware will happily deliver more than 0x010000 completions before stopping. Hence this problem is rarely observable. Fix by allocating the doorbell records separately and using the correct alignment constraints. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -408,8 +408,8 @@ struct hermon_recv_work_queue {
|
||||
union hermon_recv_wqe *wqe;
|
||||
/** Size of work queue */
|
||||
size_t wqe_size;
|
||||
/** Doorbell */
|
||||
struct hermonprm_qp_db_record doorbell __attribute__ (( aligned (4) ));
|
||||
/** Doorbell record */
|
||||
struct hermonprm_qp_db_record *doorbell;
|
||||
};
|
||||
|
||||
/** Number of special queue pairs */
|
||||
@@ -469,8 +469,8 @@ struct hermon_completion_queue {
|
||||
size_t cqe_size;
|
||||
/** MTT descriptor */
|
||||
struct hermon_mtt mtt;
|
||||
/** Doorbell */
|
||||
struct hermonprm_cq_db_record doorbell __attribute__ (( aligned (8) ));
|
||||
/** Doorbell record */
|
||||
struct hermonprm_cq_db_record *doorbell;
|
||||
};
|
||||
|
||||
/** Maximum number of allocatable event queues
|
||||
|
||||
Reference in New Issue
Block a user