david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[infiniband] Use explicit "source" and "dest" address vector parameter names

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown 2012-08-31 00:47:37 +01:00
parent f747fac3e1
commit cbe41cb31b
11 changed files with 159 additions and 153 deletions

View File

@ -1250,14 +1250,14 @@ static const union ib_gid arbel_no_gid = {
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v av Address vector
* @v dest Destination address vector
* @v iobuf I/O buffer
* @v wqe Send work queue entry
* @ret nds Work queue entry size
*/
static size_t arbel_fill_ud_send_wqe ( struct ib_device *ibdev,
struct ib_queue_pair *qp __unused,
struct ib_address_vector *av,
struct ib_address_vector *dest,
struct io_buffer *iobuf,
union arbel_send_wqe *wqe ) {
struct arbel *arbel = ib_get_drvdata ( ibdev );
@ -1269,16 +1269,16 @@ static size_t arbel_fill_ud_send_wqe ( struct ib_device *ibdev,
ud_address_vector.pd, ARBEL_GLOBAL_PD,
ud_address_vector.port_number, ibdev->port );
MLX_FILL_2 ( &wqe->ud.ud, 1,
ud_address_vector.rlid, av->lid,
ud_address_vector.g, av->gid_present );
ud_address_vector.rlid, dest->lid,
ud_address_vector.g, dest->gid_present );
MLX_FILL_2 ( &wqe->ud.ud, 2,
ud_address_vector.max_stat_rate, arbel_rate ( av ),
ud_address_vector.max_stat_rate, arbel_rate ( dest ),
ud_address_vector.msg, 3 );
MLX_FILL_1 ( &wqe->ud.ud, 3, ud_address_vector.sl, av->sl );
gid = ( av->gid_present ? &av->gid : &arbel_no_gid );
MLX_FILL_1 ( &wqe->ud.ud, 3, ud_address_vector.sl, dest->sl );
gid = ( dest->gid_present ? &dest->gid : &arbel_no_gid );
memcpy ( &wqe->ud.ud.u.dwords[4], gid, sizeof ( *gid ) );
MLX_FILL_1 ( &wqe->ud.ud, 8, destination_qp, av->qpn );
MLX_FILL_1 ( &wqe->ud.ud, 9, q_key, av->qkey );
MLX_FILL_1 ( &wqe->ud.ud, 8, destination_qp, dest->qpn );
MLX_FILL_1 ( &wqe->ud.ud, 9, q_key, dest->qkey );
MLX_FILL_1 ( &wqe->ud.data[0], 0, byte_count, iob_len ( iobuf ) );
MLX_FILL_1 ( &wqe->ud.data[0], 1, l_key, arbel->lkey );
MLX_FILL_H ( &wqe->ud.data[0], 2,
@ -1294,15 +1294,14 @@ static size_t arbel_fill_ud_send_wqe ( struct ib_device *ibdev,
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v av Address vector
* @v dest Destination address vector
* @v iobuf I/O buffer
* @v wqe Send work queue entry
* @v next Previous work queue entry's "next" field
* @ret nds Work queue entry size
*/
static size_t arbel_fill_mlx_send_wqe ( struct ib_device *ibdev,
struct ib_queue_pair *qp,
struct ib_address_vector *av,
struct ib_address_vector *dest,
struct io_buffer *iobuf,
union arbel_send_wqe *wqe ) {
struct arbel *arbel = ib_get_drvdata ( ibdev );
@ -1312,16 +1311,16 @@ static size_t arbel_fill_mlx_send_wqe ( struct ib_device *ibdev,
iob_populate ( &headers, &wqe->mlx.headers, 0,
sizeof ( wqe->mlx.headers ) );
iob_reserve ( &headers, sizeof ( wqe->mlx.headers ) );
ib_push ( ibdev, &headers, qp, iob_len ( iobuf ), av );
ib_push ( ibdev, &headers, qp, iob_len ( iobuf ), dest );
/* Construct this work queue entry */
MLX_FILL_5 ( &wqe->mlx.ctrl, 0,
c, 1 /* generate completion */,
icrc, 0 /* generate ICRC */,
max_statrate, arbel_rate ( av ),
max_statrate, arbel_rate ( dest ),
slr, 0,
v15, ( ( qp->ext_qpn == IB_QPN_SMI ) ? 1 : 0 ) );
MLX_FILL_1 ( &wqe->mlx.ctrl, 1, rlid, av->lid );
MLX_FILL_1 ( &wqe->mlx.ctrl, 1, rlid, dest->lid );
MLX_FILL_1 ( &wqe->mlx.data[0], 0,
byte_count, iob_len ( &headers ) );
MLX_FILL_1 ( &wqe->mlx.data[0], 1, l_key, arbel->lkey );
@ -1345,15 +1344,14 @@ static size_t arbel_fill_mlx_send_wqe ( struct ib_device *ibdev,
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v av Address vector
* @v dest Destination address vector
* @v iobuf I/O buffer
* @v wqe Send work queue entry
* @v next Previous work queue entry's "next" field
* @ret nds Work queue entry size
*/
static size_t arbel_fill_rc_send_wqe ( struct ib_device *ibdev,
struct ib_queue_pair *qp __unused,
struct ib_address_vector *av __unused,
struct ib_address_vector *dest __unused,
struct io_buffer *iobuf,
union arbel_send_wqe *wqe ) {
struct arbel *arbel = ib_get_drvdata ( ibdev );
@ -1374,7 +1372,7 @@ static size_t arbel_fill_rc_send_wqe ( struct ib_device *ibdev,
static size_t
( * arbel_fill_send_wqe[] ) ( struct ib_device *ibdev,
struct ib_queue_pair *qp,
struct ib_address_vector *av,
struct ib_address_vector *dest,
struct io_buffer *iobuf,
union arbel_send_wqe *wqe ) = {
[IB_QPT_SMI] = arbel_fill_mlx_send_wqe,
@ -1388,13 +1386,13 @@ static size_t
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v av Address vector
* @v dest Destination address vector
* @v iobuf I/O buffer
* @ret rc Return status code
*/
static int arbel_post_send ( struct ib_device *ibdev,
struct ib_queue_pair *qp,
struct ib_address_vector *av,
struct ib_address_vector *dest,
struct io_buffer *iobuf ) {
struct arbel *arbel = ib_get_drvdata ( ibdev );
struct arbel_queue_pair *arbel_qp = ib_qp_get_drvdata ( qp );
@ -1424,7 +1422,7 @@ static int arbel_post_send ( struct ib_device *ibdev,
assert ( qp->type < ( sizeof ( arbel_fill_send_wqe ) /
sizeof ( arbel_fill_send_wqe[0] ) ) );
assert ( arbel_fill_send_wqe[qp->type] != NULL );
nds = arbel_fill_send_wqe[qp->type] ( ibdev, qp, av, iobuf, wqe );
nds = arbel_fill_send_wqe[qp->type] ( ibdev, qp, dest, iobuf, wqe );
DBGCP ( arbel, "Arbel %p QPN %#lx posting send WQE %#lx:\n",
arbel, qp->qpn, ( wq->next_idx & wqe_idx_mask ) );
DBGCP_HDA ( arbel, virt_to_phys ( wqe ), wqe, sizeof ( *wqe ) );
@ -1527,9 +1525,9 @@ static int arbel_complete ( struct ib_device *ibdev,
struct arbel_recv_work_queue *arbel_recv_wq;
struct arbelprm_recv_wqe *recv_wqe;
struct io_buffer *iobuf;
struct ib_address_vector recv_av;
struct ib_address_vector recv_source;
struct ib_global_route_header *grh;
struct ib_address_vector *av;
struct ib_address_vector *source;
unsigned int opcode;
unsigned long qpn;
int is_send;
@ -1618,23 +1616,24 @@ static int arbel_complete ( struct ib_device *ibdev,
grh = iobuf->data;
iob_pull ( iobuf, sizeof ( *grh ) );
/* Construct address vector */
av = &recv_av;
memset ( av, 0, sizeof ( *av ) );
av->qpn = MLX_GET ( &cqe->normal, rqpn );
av->lid = MLX_GET ( &cqe->normal, rlid );
av->sl = MLX_GET ( &cqe->normal, sl );
av->gid_present = MLX_GET ( &cqe->normal, g );
memcpy ( &av->gid, &grh->sgid, sizeof ( av->gid ) );
source = &recv_source;
memset ( source, 0, sizeof ( *source ) );
source->qpn = MLX_GET ( &cqe->normal, rqpn );
source->lid = MLX_GET ( &cqe->normal, rlid );
source->sl = MLX_GET ( &cqe->normal, sl );
source->gid_present = MLX_GET ( &cqe->normal, g );
memcpy ( &source->gid, &grh->sgid,
sizeof ( source->gid ) );
break;
case IB_QPT_RC:
av = &qp->av;
source = &qp->av;
break;
default:
assert ( 0 );
return -EINVAL;
}
/* Hand off to completion handler */
ib_complete_recv ( ibdev, qp, av, iobuf, rc );
ib_complete_recv ( ibdev, qp, source, iobuf, rc );
}
return rc;

View File

@ -1364,7 +1364,7 @@ static void hermon_destroy_qp ( struct ib_device *ibdev,
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v av Address vector
* @v dest Destination address vector
* @v iobuf I/O buffer
* @v wqe Send work queue entry
* @ret opcode Control opcode
@ -1372,7 +1372,7 @@ static void hermon_destroy_qp ( struct ib_device *ibdev,
static __attribute__ (( unused )) unsigned int
hermon_fill_nop_send_wqe ( struct ib_device *ibdev __unused,
struct ib_queue_pair *qp __unused,
struct ib_address_vector *av __unused,
struct ib_address_vector *dest __unused,
struct io_buffer *iobuf __unused,
union hermon_send_wqe *wqe ) {
@ -1386,7 +1386,7 @@ hermon_fill_nop_send_wqe ( struct ib_device *ibdev __unused,
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v av Address vector
* @v dest Destination address vector
* @v iobuf I/O buffer
* @v wqe Send work queue entry
* @ret opcode Control opcode
@ -1394,7 +1394,7 @@ hermon_fill_nop_send_wqe ( struct ib_device *ibdev __unused,
static unsigned int
hermon_fill_ud_send_wqe ( struct ib_device *ibdev,
struct ib_queue_pair *qp __unused,
struct ib_address_vector *av,
struct ib_address_vector *dest,
struct io_buffer *iobuf,
union hermon_send_wqe *wqe ) {
struct hermon *hermon = ib_get_drvdata ( ibdev );
@ -1406,14 +1406,14 @@ hermon_fill_ud_send_wqe ( struct ib_device *ibdev,
ud_address_vector.pd, HERMON_GLOBAL_PD,
ud_address_vector.port_number, ibdev->port );
MLX_FILL_2 ( &wqe->ud.ud, 1,
ud_address_vector.rlid, av->lid,
ud_address_vector.g, av->gid_present );
ud_address_vector.rlid, dest->lid,
ud_address_vector.g, dest->gid_present );
MLX_FILL_1 ( &wqe->ud.ud, 2,
ud_address_vector.max_stat_rate, hermon_rate ( av ) );
MLX_FILL_1 ( &wqe->ud.ud, 3, ud_address_vector.sl, av->sl );
memcpy ( &wqe->ud.ud.u.dwords[4], &av->gid, sizeof ( av->gid ) );
MLX_FILL_1 ( &wqe->ud.ud, 8, destination_qp, av->qpn );
MLX_FILL_1 ( &wqe->ud.ud, 9, q_key, av->qkey );
ud_address_vector.max_stat_rate, hermon_rate ( dest ) );
MLX_FILL_1 ( &wqe->ud.ud, 3, ud_address_vector.sl, dest->sl );
memcpy ( &wqe->ud.ud.u.dwords[4], &dest->gid, sizeof ( dest->gid ) );
MLX_FILL_1 ( &wqe->ud.ud, 8, destination_qp, dest->qpn );
MLX_FILL_1 ( &wqe->ud.ud, 9, q_key, dest->qkey );
MLX_FILL_1 ( &wqe->ud.data[0], 0, byte_count, iob_len ( iobuf ) );
MLX_FILL_1 ( &wqe->ud.data[0], 1, l_key, hermon->lkey );
MLX_FILL_H ( &wqe->ud.data[0], 2,
@ -1428,7 +1428,7 @@ hermon_fill_ud_send_wqe ( struct ib_device *ibdev,
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v av Address vector
* @v dest Destination address vector
* @v iobuf I/O buffer
* @v wqe Send work queue entry
* @ret opcode Control opcode
@ -1436,7 +1436,7 @@ hermon_fill_ud_send_wqe ( struct ib_device *ibdev,
static unsigned int
hermon_fill_mlx_send_wqe ( struct ib_device *ibdev,
struct ib_queue_pair *qp,
struct ib_address_vector *av,
struct ib_address_vector *dest,
struct io_buffer *iobuf,
union hermon_send_wqe *wqe ) {
struct hermon *hermon = ib_get_drvdata ( ibdev );
@ -1446,7 +1446,7 @@ hermon_fill_mlx_send_wqe ( struct ib_device *ibdev,
iob_populate ( &headers, &wqe->mlx.headers, 0,
sizeof ( wqe->mlx.headers ) );
iob_reserve ( &headers, sizeof ( wqe->mlx.headers ) );
ib_push ( ibdev, &headers, qp, iob_len ( iobuf ), av );
ib_push ( ibdev, &headers, qp, iob_len ( iobuf ), dest );
/* Fill work queue entry */
MLX_FILL_1 ( &wqe->mlx.ctrl, 1, ds,
@ -1454,10 +1454,10 @@ hermon_fill_mlx_send_wqe ( struct ib_device *ibdev,
MLX_FILL_5 ( &wqe->mlx.ctrl, 2,
c, 0x03 /* generate completion */,
icrc, 0 /* generate ICRC */,
max_statrate, hermon_rate ( av ),
max_statrate, hermon_rate ( dest ),
slr, 0,
v15, ( ( qp->ext_qpn == IB_QPN_SMI ) ? 1 : 0 ) );
MLX_FILL_1 ( &wqe->mlx.ctrl, 3, rlid, av->lid );
MLX_FILL_1 ( &wqe->mlx.ctrl, 3, rlid, dest->lid );
MLX_FILL_1 ( &wqe->mlx.data[0], 0,
byte_count, iob_len ( &headers ) );
MLX_FILL_1 ( &wqe->mlx.data[0], 1, l_key, hermon->lkey );
@ -1480,7 +1480,7 @@ hermon_fill_mlx_send_wqe ( struct ib_device *ibdev,
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v av Address vector
* @v dest Destination address vector
* @v iobuf I/O buffer
* @v wqe Send work queue entry
* @ret opcode Control opcode
@ -1488,7 +1488,7 @@ hermon_fill_mlx_send_wqe ( struct ib_device *ibdev,
static unsigned int
hermon_fill_rc_send_wqe ( struct ib_device *ibdev,
struct ib_queue_pair *qp __unused,
struct ib_address_vector *av __unused,
struct ib_address_vector *dest __unused,
struct io_buffer *iobuf,
union hermon_send_wqe *wqe ) {
struct hermon *hermon = ib_get_drvdata ( ibdev );
@ -1510,7 +1510,7 @@ hermon_fill_rc_send_wqe ( struct ib_device *ibdev,
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v av Address vector
* @v dest Destination address vector
* @v iobuf I/O buffer
* @v wqe Send work queue entry
* @ret opcode Control opcode
@ -1518,7 +1518,7 @@ hermon_fill_rc_send_wqe ( struct ib_device *ibdev,
static unsigned int
hermon_fill_eth_send_wqe ( struct ib_device *ibdev,
struct ib_queue_pair *qp __unused,
struct ib_address_vector *av __unused,
struct ib_address_vector *dest __unused,
struct io_buffer *iobuf,
union hermon_send_wqe *wqe ) {
struct hermon *hermon = ib_get_drvdata ( ibdev );
@ -1543,7 +1543,7 @@ hermon_fill_eth_send_wqe ( struct ib_device *ibdev,
static unsigned int
( * hermon_fill_send_wqe[] ) ( struct ib_device *ibdev,
struct ib_queue_pair *qp,
struct ib_address_vector *av,
struct ib_address_vector *dest,
struct io_buffer *iobuf,
union hermon_send_wqe *wqe ) = {
[IB_QPT_SMI] = hermon_fill_mlx_send_wqe,
@ -1558,13 +1558,13 @@ static unsigned int
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v av Address vector
* @v dest Destination address vector
* @v iobuf I/O buffer
* @ret rc Return status code
*/
static int hermon_post_send ( struct ib_device *ibdev,
struct ib_queue_pair *qp,
struct ib_address_vector *av,
struct ib_address_vector *dest,
struct io_buffer *iobuf ) {
struct hermon *hermon = ib_get_drvdata ( ibdev );
struct hermon_queue_pair *hermon_qp = ib_qp_get_drvdata ( qp );
@ -1595,7 +1595,7 @@ static int hermon_post_send ( struct ib_device *ibdev,
assert ( qp->type < ( sizeof ( hermon_fill_send_wqe ) /
sizeof ( hermon_fill_send_wqe[0] ) ) );
assert ( hermon_fill_send_wqe[qp->type] != NULL );
opcode = hermon_fill_send_wqe[qp->type] ( ibdev, qp, av, iobuf, wqe );
opcode = hermon_fill_send_wqe[qp->type] ( ibdev, qp, dest, iobuf, wqe );
barrier();
MLX_FILL_2 ( &wqe->ctrl, 0,
opcode, opcode,
@ -1677,9 +1677,9 @@ static int hermon_complete ( struct ib_device *ibdev,
struct ib_work_queue *wq;
struct ib_queue_pair *qp;
struct io_buffer *iobuf;
struct ib_address_vector recv_av;
struct ib_address_vector recv_source;
struct ib_global_route_header *grh;
struct ib_address_vector *av;
struct ib_address_vector *source;
unsigned int opcode;
unsigned long qpn;
int is_send;
@ -1737,7 +1737,7 @@ static int hermon_complete ( struct ib_device *ibdev,
len = MLX_GET ( &cqe->normal, byte_cnt );
assert ( len <= iob_tailroom ( iobuf ) );
iob_put ( iobuf, len );
memset ( &recv_av, 0, sizeof ( recv_av ) );
memset ( &recv_source, 0, sizeof ( recv_source ) );
switch ( qp->type ) {
case IB_QPT_SMI:
case IB_QPT_GSI:
@ -1746,28 +1746,29 @@ static int hermon_complete ( struct ib_device *ibdev,
grh = iobuf->data;
iob_pull ( iobuf, sizeof ( *grh ) );
/* Construct address vector */
av = &recv_av;
av->qpn = MLX_GET ( &cqe->normal, srq_rqpn );
av->lid = MLX_GET ( &cqe->normal, slid_smac47_32 );
av->sl = MLX_GET ( &cqe->normal, sl );
av->gid_present = MLX_GET ( &cqe->normal, g );
memcpy ( &av->gid, &grh->sgid, sizeof ( av->gid ) );
source = &recv_source;
source->qpn = MLX_GET ( &cqe->normal, srq_rqpn );
source->lid = MLX_GET ( &cqe->normal, slid_smac47_32 );
source->sl = MLX_GET ( &cqe->normal, sl );
source->gid_present = MLX_GET ( &cqe->normal, g );
memcpy ( &source->gid, &grh->sgid,
sizeof ( source->gid ) );
break;
case IB_QPT_RC:
av = &qp->av;
source = &qp->av;
break;
case IB_QPT_ETH:
/* Construct address vector */
av = &recv_av;
av->vlan_present = MLX_GET ( &cqe->normal, vlan );
av->vlan = MLX_GET ( &cqe->normal, vid );
source = &recv_source;
source->vlan_present = MLX_GET ( &cqe->normal, vlan );
source->vlan = MLX_GET ( &cqe->normal, vid );
break;
default:
assert ( 0 );
return -EINVAL;
}
/* Hand off to completion handler */
ib_complete_recv ( ibdev, qp, av, iobuf, rc );
ib_complete_recv ( ibdev, qp, source, iobuf, rc );
}
return rc;
@ -3154,20 +3155,20 @@ static void hermon_eth_complete_send ( struct ib_device *ibdev __unused,
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v av Address vector, or NULL
* @v source Source address vector, or NULL
* @v iobuf I/O buffer
* @v rc Completion status code
*/
static void hermon_eth_complete_recv ( struct ib_device *ibdev __unused,
struct ib_queue_pair *qp,
struct ib_address_vector *av,
struct ib_address_vector *source,
struct io_buffer *iobuf, int rc ) {
struct net_device *netdev = ib_qp_get_ownerdata ( qp );
struct net_device *vlan;
/* Find VLAN device, if applicable */
if ( av->vlan_present ) {
if ( ( vlan = vlan_find ( netdev, av->vlan ) ) != NULL ) {
if ( source->vlan_present ) {
if ( ( vlan = vlan_find ( netdev, source->vlan ) ) != NULL ) {
netdev = vlan;
} else if ( rc == 0 ) {
rc = -ENODEV;

View File

@ -936,13 +936,13 @@ static void linda_destroy_qp ( struct ib_device *ibdev,
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v av Address vector
* @v dest Destination address vector
* @v iobuf I/O buffer
* @ret rc Return status code
*/
static int linda_post_send ( struct ib_device *ibdev,
struct ib_queue_pair *qp,
struct ib_address_vector *av,
struct ib_address_vector *dest,
struct io_buffer *iobuf ) {
struct linda *linda = ib_get_drvdata ( ibdev );
struct ib_work_queue *wq = &qp->send;
@ -969,7 +969,7 @@ static int linda_post_send ( struct ib_device *ibdev,
/* Construct headers */
iob_populate ( &headers, header_buf, 0, sizeof ( header_buf ) );
iob_reserve ( &headers, sizeof ( header_buf ) );
ib_push ( ibdev, &headers, qp, iob_len ( iobuf ), av );
ib_push ( ibdev, &headers, qp, iob_len ( iobuf ), dest );
/* Calculate packet length */
len = ( ( sizeof ( sendpbc ) + iob_len ( &headers ) +
@ -1170,7 +1170,7 @@ static void linda_complete_recv ( struct ib_device *ibdev,
struct io_buffer headers;
struct io_buffer *iobuf;
struct ib_queue_pair *intended_qp;
struct ib_address_vector av;
struct ib_address_vector source;
unsigned int rcvtype;
unsigned int pktlen;
unsigned int egrindex;
@ -1238,7 +1238,7 @@ static void linda_complete_recv ( struct ib_device *ibdev,
qp0 = ( qp->qpn == 0 );
intended_qp = NULL;
if ( ( rc = ib_pull ( ibdev, &headers, ( qp0 ? &intended_qp : NULL ),
&payload_len, &av ) ) != 0 ) {
&payload_len, &source ) ) != 0 ) {
DBGC ( linda, "Linda %p could not parse headers: %s\n",
linda, strerror ( rc ) );
err = 1;
@ -1295,10 +1295,12 @@ static void linda_complete_recv ( struct ib_device *ibdev,
qp->recv.fill--;
intended_qp->recv.fill++;
}
ib_complete_recv ( ibdev, intended_qp, &av, iobuf, rc);
ib_complete_recv ( ibdev, intended_qp, &source,
iobuf, rc);
} else {
/* Completing on a skipped-over eager buffer */
ib_complete_recv ( ibdev, qp, &av, iobuf, -ECANCELED );
ib_complete_recv ( ibdev, qp, &source, iobuf,
-ECANCELED );
}
/* Clear eager buffer */

View File

@ -1173,13 +1173,13 @@ static void qib7322_destroy_qp ( struct ib_device *ibdev,
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v av Address vector
* @v dest Destination address vector
* @v iobuf I/O buffer
* @ret rc Return status code
*/
static int qib7322_post_send ( struct ib_device *ibdev,
struct ib_queue_pair *qp,
struct ib_address_vector *av,
struct ib_address_vector *dest,
struct io_buffer *iobuf ) {
struct qib7322 *qib7322 = ib_get_drvdata ( ibdev );
struct ib_work_queue *wq = &qp->send;
@ -1211,7 +1211,7 @@ static int qib7322_post_send ( struct ib_device *ibdev,
/* Construct headers */
iob_populate ( &headers, header_buf, 0, sizeof ( header_buf ) );
iob_reserve ( &headers, sizeof ( header_buf ) );
ib_push ( ibdev, &headers, qp, iob_len ( iobuf ), av );
ib_push ( ibdev, &headers, qp, iob_len ( iobuf ), dest );
/* Calculate packet length */
len = ( ( sizeof ( sendpbc ) + iob_len ( &headers ) +
@ -1413,7 +1413,7 @@ static void qib7322_complete_recv ( struct ib_device *ibdev,
struct io_buffer headers;
struct io_buffer *iobuf;
struct ib_queue_pair *intended_qp;
struct ib_address_vector av;
struct ib_address_vector source;
unsigned int rcvtype;
unsigned int pktlen;
unsigned int egrindex;
@ -1474,7 +1474,7 @@ static void qib7322_complete_recv ( struct ib_device *ibdev,
qp0 = ( qp->qpn == 0 );
intended_qp = NULL;
if ( ( rc = ib_pull ( ibdev, &headers, ( qp0 ? &intended_qp : NULL ),
&payload_len, &av ) ) != 0 ) {
&payload_len, &source ) ) != 0 ) {
DBGC ( qib7322, "QIB7322 %p could not parse headers: %s\n",
qib7322, strerror ( rc ) );
err = 1;
@ -1531,10 +1531,12 @@ static void qib7322_complete_recv ( struct ib_device *ibdev,
qp->recv.fill--;
intended_qp->recv.fill++;
}
ib_complete_recv ( ibdev, intended_qp, &av, iobuf, rc);
ib_complete_recv ( ibdev, intended_qp, &source,
iobuf, rc);
} else {
/* Completing on a skipped-over eager buffer */
ib_complete_recv ( ibdev, qp, &av, iobuf, -ECANCELED );
ib_complete_recv ( ibdev, qp, &source, iobuf,
-ECANCELED );
}
/* Clear eager buffer */

View File

@ -423,8 +423,8 @@ static int ipoib_transmit ( struct net_device *netdev,
struct ipoib_device *ipoib = netdev->priv;
struct ib_device *ibdev = ipoib->ibdev;
struct ipoib_hdr *ipoib_hdr;
struct ipoib_peer *dest;
struct ib_address_vector av;
struct ipoib_peer *peer;
struct ib_address_vector dest;
int rc;
/* Sanity check */
@ -441,22 +441,22 @@ static int ipoib_transmit ( struct net_device *netdev,
return -ENETUNREACH;
/* Identify destination address */
dest = ipoib_lookup_peer_by_key ( ipoib_hdr->u.peer.dest );
if ( ! dest )
peer = ipoib_lookup_peer_by_key ( ipoib_hdr->u.peer.dest );
if ( ! peer )
return -ENXIO;
ipoib_hdr->u.reserved = 0;
/* Construct address vector */
memset ( &av, 0, sizeof ( av ) );
av.qpn = ( ntohl ( dest->mac.flags__qpn ) & IB_QPN_MASK );
av.gid_present = 1;
memcpy ( &av.gid, &dest->mac.gid, sizeof ( av.gid ) );
if ( ( rc = ib_resolve_path ( ibdev, &av ) ) != 0 ) {
memset ( &dest, 0, sizeof ( dest ) );
dest.qpn = ( ntohl ( peer->mac.flags__qpn ) & IB_QPN_MASK );
dest.gid_present = 1;
memcpy ( &dest.gid, &peer->mac.gid, sizeof ( dest.gid ) );
if ( ( rc = ib_resolve_path ( ibdev, &dest ) ) != 0 ) {
/* Path not resolved yet */
return rc;
}
return ib_post_send ( ibdev, ipoib->qp, &av, iobuf );
return ib_post_send ( ibdev, ipoib->qp, &dest, iobuf );
}
/**
@ -480,13 +480,13 @@ static void ipoib_complete_send ( struct ib_device *ibdev __unused,
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v av Address vector, or NULL
* @v source Source address vector, or NULL
* @v iobuf I/O buffer
* @v rc Completion status code
*/
static void ipoib_complete_recv ( struct ib_device *ibdev __unused,
struct ib_queue_pair *qp,
struct ib_address_vector *av,
struct ib_address_vector *source,
struct io_buffer *iobuf, int rc ) {
struct ipoib_device *ipoib = ib_qp_get_ownerdata ( qp );
struct net_device *netdev = ipoib->netdev;
@ -509,7 +509,7 @@ static void ipoib_complete_recv ( struct ib_device *ibdev __unused,
return;
}
ipoib_hdr = iobuf->data;
if ( ! av ) {
if ( ! source ) {
DBGC ( ipoib, "IPoIB %p received packet without address "
"vector\n", ipoib );
netdev_rx_err ( netdev, iobuf, -ENOTTY );
@ -517,9 +517,9 @@ static void ipoib_complete_recv ( struct ib_device *ibdev __unused,
}
/* Parse source address */
if ( av->gid_present ) {
ll_src.flags__qpn = htonl ( av->qpn );
memcpy ( &ll_src.gid, &av->gid, sizeof ( ll_src.gid ) );
if ( source->gid_present ) {
ll_src.flags__qpn = htonl ( source->qpn );
memcpy ( &ll_src.gid, &source->gid, sizeof ( ll_src.gid ) );
src = ipoib_cache_peer ( &ll_src );
ipoib_hdr->u.peer.src = src->key;
}

View File

@ -152,9 +152,9 @@ union ib_headers {
extern int ib_push ( struct ib_device *ibdev, struct io_buffer *iobuf,
struct ib_queue_pair *qp, size_t payload_len,
const struct ib_address_vector *av );
const struct ib_address_vector *dest );
extern int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
struct ib_queue_pair **qp, size_t *payload_len,
struct ib_address_vector *av );
struct ib_address_vector *source );
#endif /* _IPXE_IB_PACKET_H */

View File

@ -205,13 +205,13 @@ struct ib_completion_queue_operations {
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v av Address vector, or NULL
* @v source Source address vector, or NULL
* @v iobuf I/O buffer
* @v rc Completion status code
*/
void ( * complete_recv ) ( struct ib_device *ibdev,
struct ib_queue_pair *qp,
struct ib_address_vector *av,
struct ib_address_vector *source,
struct io_buffer *iobuf, int rc );
};
@ -289,7 +289,7 @@ struct ib_device_operations {
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v av Address vector
* @v dest Destination address vector
* @v iobuf I/O buffer
* @ret rc Return status code
*
@ -300,7 +300,7 @@ struct ib_device_operations {
*/
int ( * post_send ) ( struct ib_device *ibdev,
struct ib_queue_pair *qp,
struct ib_address_vector *av,
struct ib_address_vector *dest,
struct io_buffer *iobuf );
/** Post receive work queue entry
*
@ -502,7 +502,7 @@ extern struct ib_queue_pair * ib_find_qp_mgid ( struct ib_device *ibdev,
extern struct ib_work_queue * ib_find_wq ( struct ib_completion_queue *cq,
unsigned long qpn, int is_send );
extern int ib_post_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
struct ib_address_vector *av,
struct ib_address_vector *dest,
struct io_buffer *iobuf );
extern int ib_post_recv ( struct ib_device *ibdev, struct ib_queue_pair *qp,
struct io_buffer *iobuf );
@ -511,7 +511,7 @@ extern void ib_complete_send ( struct ib_device *ibdev,
struct io_buffer *iobuf, int rc );
extern void ib_complete_recv ( struct ib_device *ibdev,
struct ib_queue_pair *qp,
struct ib_address_vector *av,
struct ib_address_vector *source,
struct io_buffer *iobuf, int rc );
extern void ib_refill_recv ( struct ib_device *ibdev,
struct ib_queue_pair *qp );

View File

@ -263,7 +263,6 @@ struct ib_queue_pair * ib_create_qp ( struct ib_device *ibdev,
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v av New address vector, if applicable
* @ret rc Return status code
*/
int ib_modify_qp ( struct ib_device *ibdev, struct ib_queue_pair *qp ) {
@ -384,14 +383,14 @@ struct ib_work_queue * ib_find_wq ( struct ib_completion_queue *cq,
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v av Address vector
* @v dest Destination address vector
* @v iobuf I/O buffer
* @ret rc Return status code
*/
int ib_post_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
struct ib_address_vector *av,
struct ib_address_vector *dest,
struct io_buffer *iobuf ) {
struct ib_address_vector av_copy;
struct ib_address_vector dest_copy;
int rc;
/* Check queue fill level */
@ -402,21 +401,21 @@ int ib_post_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
}
/* Use default address vector if none specified */
if ( ! av )
av = &qp->av;
if ( ! dest )
dest = &qp->av;
/* Make modifiable copy of address vector */
memcpy ( &av_copy, av, sizeof ( av_copy ) );
av = &av_copy;
memcpy ( &dest_copy, dest, sizeof ( dest_copy ) );
dest = &dest_copy;
/* Fill in optional parameters in address vector */
if ( ! av->qkey )
av->qkey = qp->qkey;
if ( ! av->rate )
av->rate = IB_RATE_2_5;
if ( ! dest->qkey )
dest->qkey = qp->qkey;
if ( ! dest->rate )
dest->rate = IB_RATE_2_5;
/* Post to hardware */
if ( ( rc = ibdev->op->post_send ( ibdev, qp, av, iobuf ) ) != 0 ) {
if ( ( rc = ibdev->op->post_send ( ibdev, qp, dest, iobuf ) ) != 0 ) {
DBGC ( ibdev, "IBDEV %p QPN %#lx could not post send WQE: "
"%s\n", ibdev, qp->qpn, strerror ( rc ) );
return rc;
@ -487,16 +486,16 @@ void ib_complete_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v av Address vector, or NULL
* @v source Source address vector, or NULL
* @v iobuf I/O buffer
* @v rc Completion status code
*/
void ib_complete_recv ( struct ib_device *ibdev, struct ib_queue_pair *qp,
struct ib_address_vector *av,
struct ib_address_vector *source,
struct io_buffer *iobuf, int rc ) {
if ( qp->recv.cq->op->complete_recv ) {
qp->recv.cq->op->complete_recv ( ibdev, qp, av, iobuf, rc );
qp->recv.cq->op->complete_recv ( ibdev, qp, source, iobuf, rc );
} else {
free_iob ( iobuf );
}

View File

@ -220,13 +220,13 @@ static void ib_cmrc_complete_send ( struct ib_device *ibdev __unused,
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v av Address vector, or NULL
* @v source Source address vector, or NULL
* @v iobuf I/O buffer
* @v rc Completion status code
*/
static void ib_cmrc_complete_recv ( struct ib_device *ibdev __unused,
struct ib_queue_pair *qp,
struct ib_address_vector *av __unused,
struct ib_address_vector *source __unused,
struct io_buffer *iobuf, int rc ) {
struct ib_cmrc_connection *cmrc = ib_qp_get_ownerdata ( qp );

View File

@ -112,13 +112,13 @@ static int ib_mi_handle ( struct ib_device *ibdev,
*
* @v ibdev Infiniband device
* @v qp Queue pair
* @v av Address vector
* @v source Address vector
* @v iobuf I/O buffer
* @v rc Completion status code
*/
static void ib_mi_complete_recv ( struct ib_device *ibdev,
struct ib_queue_pair *qp,
struct ib_address_vector *av,
struct ib_address_vector *source,
struct io_buffer *iobuf, int rc ) {
struct ib_mad_interface *mi = ib_qp_get_ownerdata ( qp );
union ib_mad *mad;
@ -152,7 +152,7 @@ static void ib_mi_complete_recv ( struct ib_device *ibdev,
DBGC2_HDA ( mi, 0, mad, sizeof ( *mad ) );
/* Handle MAD */
if ( ( rc = ib_mi_handle ( ibdev, mi, mad, av ) ) != 0 )
if ( ( rc = ib_mi_handle ( ibdev, mi, mad, source ) ) != 0 )
goto out;
out:

View File

@ -42,11 +42,12 @@ FILE_LICENCE ( GPL2_OR_LATER );
* @v iobuf I/O buffer to contain headers
* @v qp Queue pair
* @v payload_len Payload length
* @v av Address vector
* @v dest Destination address vector
* @ret rc Return status code
*/
int ib_push ( struct ib_device *ibdev, struct io_buffer *iobuf,
struct ib_queue_pair *qp, size_t payload_len,
const struct ib_address_vector *av ) {
const struct ib_address_vector *dest ) {
struct ib_local_route_header *lrh;
struct ib_global_route_header *grh;
struct ib_base_transport_header *bth;
@ -59,7 +60,8 @@ int ib_push ( struct ib_device *ibdev, struct io_buffer *iobuf,
unsigned int lnh;
DBGC2 ( ibdev, "IBDEV %p TX %04x:%08lx => %04x:%08lx (key %08lx)\n",
ibdev, ibdev->lid, qp->ext_qpn, av->lid, av->qpn, av->qkey );
ibdev, ibdev->lid, qp->ext_qpn, dest->lid, dest->qpn,
dest->qkey );
/* Calculate packet length */
pad_len = ( (-payload_len) & 0x3 );
@ -71,7 +73,7 @@ int ib_push ( struct ib_device *ibdev, struct io_buffer *iobuf,
deth = iob_push ( iobuf, sizeof ( *deth ) );
bth = iob_push ( iobuf, sizeof ( *bth ) );
grh_len = ( payload_len + iob_len ( iobuf ) - orig_iob_len );
grh = ( av->gid_present ?
grh = ( dest->gid_present ?
iob_push ( iobuf, sizeof ( *grh ) ) : NULL );
lrh = iob_push ( iobuf, sizeof ( *lrh ) );
lrh_len = ( payload_len + iob_len ( iobuf ) - orig_iob_len );
@ -80,8 +82,8 @@ int ib_push ( struct ib_device *ibdev, struct io_buffer *iobuf,
vl = ( ( qp->ext_qpn == IB_QPN_SMI ) ? IB_VL_SMP : IB_VL_DEFAULT );
lrh->vl__lver = ( vl << 4 );
lnh = ( grh ? IB_LNH_GRH : IB_LNH_BTH );
lrh->sl__lnh = ( ( av->sl << 4 ) | lnh );
lrh->dlid = htons ( av->lid );
lrh->sl__lnh = ( ( dest->sl << 4 ) | lnh );
lrh->dlid = htons ( dest->lid );
lrh->length = htons ( lrh_len >> 2 );
lrh->slid = htons ( ibdev->lid );
@ -93,18 +95,18 @@ int ib_push ( struct ib_device *ibdev, struct io_buffer *iobuf,
grh->nxthdr = IB_GRH_NXTHDR_IBA;
grh->hoplmt = 0;
memcpy ( &grh->sgid, &ibdev->gid, sizeof ( grh->sgid ) );
memcpy ( &grh->dgid, &av->gid, sizeof ( grh->dgid ) );
memcpy ( &grh->dgid, &dest->gid, sizeof ( grh->dgid ) );
}
/* Construct BTH */
bth->opcode = BTH_OPCODE_UD_SEND;
bth->se__m__padcnt__tver = ( pad_len << 4 );
bth->pkey = htons ( ibdev->pkey );
bth->dest_qp = htonl ( av->qpn );
bth->dest_qp = htonl ( dest->qpn );
bth->ack__psn = htonl ( ( qp->send.psn++ ) & 0xffffffUL );
/* Construct DETH */
deth->qkey = htonl ( av->qkey );
deth->qkey = htonl ( dest->qkey );
deth->src_qp = htonl ( qp->ext_qpn );
DBGCP_HDA ( ibdev, 0, iobuf->data,
@ -120,11 +122,12 @@ int ib_push ( struct ib_device *ibdev, struct io_buffer *iobuf,
* @v iobuf I/O buffer containing headers
* @v qp Queue pair to fill in, or NULL
* @v payload_len Payload length to fill in, or NULL
* @v av Address vector to fill in
* @v source Source address vector to fill in
* @ret rc Return status code
*/
int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
struct ib_queue_pair **qp, size_t *payload_len,
struct ib_address_vector *av ) {
struct ib_address_vector *source ) {
struct ib_local_route_header *lrh;
struct ib_global_route_header *grh;
struct ib_base_transport_header *bth;
@ -140,7 +143,7 @@ int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
*qp = NULL;
if ( payload_len )
*payload_len = 0;
memset ( av, 0, sizeof ( *av ) );
memset ( source, 0, sizeof ( *source ) );
/* Extract LRH */
if ( iob_len ( iobuf ) < sizeof ( *lrh ) ) {
@ -150,8 +153,8 @@ int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
}
lrh = iobuf->data;
iob_pull ( iobuf, sizeof ( *lrh ) );
av->lid = ntohs ( lrh->slid );
av->sl = ( lrh->sl__lnh >> 4 );
source->lid = ntohs ( lrh->slid );
source->sl = ( lrh->sl__lnh >> 4 );
lnh = ( lrh->sl__lnh & 0x3 );
lid = ntohs ( lrh->dlid );
@ -171,8 +174,8 @@ int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
}
grh = iobuf->data;
iob_pull ( iobuf, sizeof ( *grh ) );
av->gid_present = 1;
memcpy ( &av->gid, &grh->sgid, sizeof ( av->gid ) );
source->gid_present = 1;
memcpy ( &source->gid, &grh->sgid, sizeof ( source->gid ) );
} else {
grh = NULL;
}
@ -200,8 +203,8 @@ int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
}
deth = iobuf->data;
iob_pull ( iobuf, sizeof ( *deth ) );
av->qpn = ntohl ( deth->src_qp );
av->qkey = ntohl ( deth->qkey );
source->qpn = ntohl ( deth->src_qp );
source->qkey = ntohl ( deth->qkey );
/* Calculate payload length, if applicable */
if ( payload_len ) {
@ -233,7 +236,7 @@ int ib_pull ( struct ib_device *ibdev, struct io_buffer *iobuf,
DBGC2 ( ibdev, "IBDEV %p RX %04x:%08lx <= %04x:%08lx (key %08x)\n",
ibdev, lid, ( IB_LID_MULTICAST( lid ) ?
( qp ? (*qp)->ext_qpn : -1UL ) : qpn ),
av->lid, av->qpn, ntohl ( deth->qkey ) );
source->lid, source->qpn, ntohl ( deth->qkey ) );
DBGCP_HDA ( ibdev, 0,
( iobuf->data - ( orig_iob_len - iob_len ( iobuf ) ) ),
( orig_iob_len - iob_len ( iobuf ) ) );