mirror of
https://github.com/xcat2/xNBA.git
synced 2024-11-26 03:09:12 +00:00
[arbel] Randomise the high-order bits of queue pair numbers
This is a backport of commit 0b1222f
("[hermon] Randomise the
high-order bits of queue pair numbers") to the Arbel driver.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
parent
40d7c70438
commit
4cb157a3b7
@ -725,7 +725,8 @@ static int arbel_alloc_qpn ( struct ib_device *ibdev,
|
||||
arbel );
|
||||
return qpn_offset;
|
||||
}
|
||||
qp->qpn = ( arbel->qpn_base + qpn_offset );
|
||||
qp->qpn = ( ( random() & ARBEL_QPN_RANDOM_MASK ) |
|
||||
( arbel->qpn_base + qpn_offset ) );
|
||||
return 0;
|
||||
default:
|
||||
DBGC ( arbel, "Arbel %p unsupported QP type %d\n",
|
||||
@ -745,7 +746,7 @@ static void arbel_free_qpn ( struct ib_device *ibdev,
|
||||
struct arbel *arbel = ib_get_drvdata ( ibdev );
|
||||
int qpn_offset;
|
||||
|
||||
qpn_offset = ( qp->qpn - arbel->qpn_base );
|
||||
qpn_offset = ( ( qp->qpn & ~ARBEL_QPN_RANDOM_MASK ) - arbel->qpn_base );
|
||||
if ( qpn_offset >= 0 )
|
||||
arbel_bitmask_free ( arbel->qp_inuse, qpn_offset );
|
||||
}
|
||||
|
@ -360,8 +360,8 @@ struct arbel_recv_work_queue {
|
||||
*/
|
||||
#define ARBEL_MAX_QPS 8
|
||||
|
||||
/** Base queue pair number */
|
||||
#define ARBEL_QPN_BASE 0x550000
|
||||
/** Queue pair number randomisation mask */
|
||||
#define ARBEL_QPN_RANDOM_MASK 0xfff000
|
||||
|
||||
/** An Arbel queue pair */
|
||||
struct arbel_queue_pair {
|
||||
@ -564,7 +564,9 @@ arbel_cq_arm_doorbell_idx ( struct arbel *arbel,
|
||||
*/
|
||||
static inline unsigned int
|
||||
arbel_send_doorbell_idx ( struct arbel *arbel, struct ib_queue_pair *qp ) {
|
||||
return ( ARBEL_MAX_CQS + ( qp->qpn - arbel->special_qpn_base ) );
|
||||
return ( ARBEL_MAX_CQS +
|
||||
( ( qp->qpn & ~ARBEL_QPN_RANDOM_MASK ) -
|
||||
arbel->special_qpn_base ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -577,7 +579,8 @@ arbel_send_doorbell_idx ( struct arbel *arbel, struct ib_queue_pair *qp ) {
|
||||
static inline unsigned int
|
||||
arbel_recv_doorbell_idx ( struct arbel *arbel, struct ib_queue_pair *qp ) {
|
||||
return ( ARBEL_MAX_DOORBELL_RECORDS - ARBEL_MAX_CQS -
|
||||
( qp->qpn - arbel->special_qpn_base ) - 1 );
|
||||
( ( qp->qpn & ~ARBEL_QPN_RANDOM_MASK ) -
|
||||
arbel->special_qpn_base ) - 1 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user