Skip to content

Commit

Permalink
RDMA/qedr: Parse VLAN ID correctly and ignore the value of zero
Browse files Browse the repository at this point in the history
Rename vlan_id field name to vlan as it contains more than the vlan_id.
Mask out non vlan id fields from vlan tag of the QED LL2 RX GSI
vlan output. As it is expected to be vlan id only.
Ignore vlan_id with value of zero.

Fixes: abd4967 ("qed: Add RoCE ll2 & GSI support")
Signed-off-by: Ram Amrani <Ram.Amrani@cavium.com>
Signed-off-by: Michal Kalderon <Michal.Kalderon@cavium.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
  • Loading branch information
Amrani, Ram authored and dledford committed Oct 4, 2017
1 parent e19cd28 commit efe63c2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion drivers/infiniband/hw/qedr/qedr.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ struct qedr_qp {
u8 wqe_size;

u8 smac[ETH_ALEN];
u16 vlan_id;
u16 vlan;
int rc;
} *rqe_wr_id;

Expand Down
10 changes: 7 additions & 3 deletions drivers/infiniband/hw/qedr/qedr_cm.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void qedr_ll2_complete_rx_packet(void *cxt,

qp->rqe_wr_id[qp->rq.gsi_cons].rc = data->u.data_length_error ?
-EINVAL : 0;
qp->rqe_wr_id[qp->rq.gsi_cons].vlan_id = data->vlan;
qp->rqe_wr_id[qp->rq.gsi_cons].vlan = data->vlan;
/* note: length stands for data length i.e. GRH is excluded */
qp->rqe_wr_id[qp->rq.gsi_cons].sg_list[0].length =
data->length.data_length;
Expand Down Expand Up @@ -694,6 +694,7 @@ int qedr_gsi_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc)
struct qedr_cq *cq = get_qedr_cq(ibcq);
struct qedr_qp *qp = dev->gsi_qp;
unsigned long flags;
u16 vlan_id;
int i = 0;

spin_lock_irqsave(&cq->cq_lock, flags);
Expand All @@ -712,9 +713,12 @@ int qedr_gsi_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc)
wc[i].wc_flags |= IB_WC_GRH | IB_WC_IP_CSUM_OK;
ether_addr_copy(wc[i].smac, qp->rqe_wr_id[qp->rq.cons].smac);
wc[i].wc_flags |= IB_WC_WITH_SMAC;
if (qp->rqe_wr_id[qp->rq.cons].vlan_id) {

vlan_id = qp->rqe_wr_id[qp->rq.cons].vlan &
VLAN_VID_MASK;
if (vlan_id) {
wc[i].wc_flags |= IB_WC_WITH_VLAN;
wc[i].vlan_id = qp->rqe_wr_id[qp->rq.cons].vlan_id;
wc[i].vlan_id = vlan_id;
}

qedr_inc_sw_cons(&qp->rq);
Expand Down

0 comments on commit efe63c2

Please sign in to comment.