Skip to content

Commit

Permalink
[hermon] Work around hardware stripping of VLAN tags
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Dec 1, 2010
1 parent 5273c27 commit f14a504
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/drivers/infiniband/hermon.c
Expand Up @@ -39,6 +39,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/if_ether.h>
#include <ipxe/ethernet.h>
#include <ipxe/fcoe.h>
#include <ipxe/vlan.h>
#include "hermon.h"

/**
Expand Down Expand Up @@ -1648,6 +1649,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 ) );
switch ( qp->type ) {
case IB_QPT_SMI:
case IB_QPT_GSI:
Expand All @@ -1657,7 +1659,6 @@ static int hermon_complete ( struct ib_device *ibdev,
iob_pull ( iobuf, sizeof ( *grh ) );
/* Construct address vector */
av = &recv_av;
memset ( av, 0, sizeof ( *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 );
Expand All @@ -1668,7 +1669,10 @@ static int hermon_complete ( struct ib_device *ibdev,
av = &qp->av;
break;
case IB_QPT_ETH:
av = NULL;
/* Construct address vector */
av = &recv_av;
av->vlan_present = MLX_GET ( &cqe->normal, vlan );
av->vlan = MLX_GET ( &cqe->normal, vid );
break;
default:
assert ( 0 );
Expand Down Expand Up @@ -2275,9 +2279,19 @@ static void hermon_eth_complete_send ( struct ib_device *ibdev __unused,
*/
static void hermon_eth_complete_recv ( struct ib_device *ibdev __unused,
struct ib_queue_pair *qp,
struct ib_address_vector *av __unused,
struct ib_address_vector *av,
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 ) {
netdev = vlan;
} else if ( rc == 0 ) {
rc = -ENODEV;
}
}

/* Hand off to network layer */
if ( rc == 0 ) {
Expand Down
4 changes: 4 additions & 0 deletions src/include/ipxe/infiniband.h
Expand Up @@ -89,6 +89,10 @@ struct ib_address_vector {
unsigned int gid_present;
/** GID, if present */
union ib_gid gid;
/** VLAN is present */
unsigned int vlan_present;
/** VLAN, if present */
unsigned int vlan;
};

/** An Infiniband Work Queue */
Expand Down

0 comments on commit f14a504

Please sign in to comment.