diff options
author | Devesh Sharma <devesh.sharma@avagotech.com> | 2015-05-19 02:02:35 -0400 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2015-05-18 10:25:24 -0400 |
commit | 6f5deab0bed6bcfad0dbafcb40a1e269a01ab01d (patch) | |
tree | 1b86c517abf3645d3289179deb0aa522b51f2a11 /drivers/infiniband | |
parent | fe48822bc6d5b455aab963038a9c776d641645cc (diff) |
RDMA/ocrdma: Use VID 0 if PFC is enabled and vlan is not configured
If the adapter ports are in PFC mode and VLAN is not configured,
use vlan tag 0 for RoCE traffic. Also, log an advisory message
in system logs.
Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@avagotech.com>
Signed-off-by: Devesh Sharma <devesh.sharma@avagotech.com>
Signed-off-by: Selvin Xavier <selvin.xavier@avagotech.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/ocrdma/ocrdma_ah.c | 8 | ||||
-rw-r--r-- | drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 12 |
2 files changed, 18 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_ah.c b/drivers/infiniband/hw/ocrdma/ocrdma_ah.c index d812904f3984..2a5993b75651 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_ah.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_ah.c | |||
@@ -56,7 +56,13 @@ static inline int set_av_attr(struct ocrdma_dev *dev, struct ocrdma_ah *ah, | |||
56 | vlan_tag = attr->vlan_id; | 56 | vlan_tag = attr->vlan_id; |
57 | if (!vlan_tag || (vlan_tag > 0xFFF)) | 57 | if (!vlan_tag || (vlan_tag > 0xFFF)) |
58 | vlan_tag = dev->pvid; | 58 | vlan_tag = dev->pvid; |
59 | if (vlan_tag && (vlan_tag < 0x1000)) { | 59 | if (vlan_tag || dev->pfc_state) { |
60 | if (!vlan_tag) { | ||
61 | pr_err("ocrdma%d:Using VLAN with PFC is recommended\n", | ||
62 | dev->id); | ||
63 | pr_err("ocrdma%d:Using VLAN 0 for this connection\n", | ||
64 | dev->id); | ||
65 | } | ||
60 | eth.eth_type = cpu_to_be16(0x8100); | 66 | eth.eth_type = cpu_to_be16(0x8100); |
61 | eth.roce_eth_type = cpu_to_be16(OCRDMA_ROCE_ETH_TYPE); | 67 | eth.roce_eth_type = cpu_to_be16(OCRDMA_ROCE_ETH_TYPE); |
62 | vlan_tag |= (dev->sl & 0x07) << OCRDMA_VID_PCP_SHIFT; | 68 | vlan_tag |= (dev->sl & 0x07) << OCRDMA_VID_PCP_SHIFT; |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c index 65759acb12dc..da688d78fc02 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c | |||
@@ -2434,7 +2434,7 @@ static int ocrdma_set_av_params(struct ocrdma_qp *qp, | |||
2434 | int status; | 2434 | int status; |
2435 | struct ib_ah_attr *ah_attr = &attrs->ah_attr; | 2435 | struct ib_ah_attr *ah_attr = &attrs->ah_attr; |
2436 | union ib_gid sgid, zgid; | 2436 | union ib_gid sgid, zgid; |
2437 | u32 vlan_id; | 2437 | u32 vlan_id = 0xFFFF; |
2438 | u8 mac_addr[6]; | 2438 | u8 mac_addr[6]; |
2439 | struct ocrdma_dev *dev = get_ocrdma_dev(qp->ibqp.device); | 2439 | struct ocrdma_dev *dev = get_ocrdma_dev(qp->ibqp.device); |
2440 | 2440 | ||
@@ -2474,12 +2474,22 @@ static int ocrdma_set_av_params(struct ocrdma_qp *qp, | |||
2474 | cmd->params.vlan_dmac_b4_to_b5 = mac_addr[4] | (mac_addr[5] << 8); | 2474 | cmd->params.vlan_dmac_b4_to_b5 = mac_addr[4] | (mac_addr[5] << 8); |
2475 | if (attr_mask & IB_QP_VID) { | 2475 | if (attr_mask & IB_QP_VID) { |
2476 | vlan_id = attrs->vlan_id; | 2476 | vlan_id = attrs->vlan_id; |
2477 | } else if (dev->pfc_state) { | ||
2478 | vlan_id = 0; | ||
2479 | pr_err("ocrdma%d:Using VLAN with PFC is recommended\n", | ||
2480 | dev->id); | ||
2481 | pr_err("ocrdma%d:Using VLAN 0 for this connection\n", | ||
2482 | dev->id); | ||
2483 | } | ||
2484 | |||
2485 | if (vlan_id < 0x1000) { | ||
2477 | cmd->params.vlan_dmac_b4_to_b5 |= | 2486 | cmd->params.vlan_dmac_b4_to_b5 |= |
2478 | vlan_id << OCRDMA_QP_PARAMS_VLAN_SHIFT; | 2487 | vlan_id << OCRDMA_QP_PARAMS_VLAN_SHIFT; |
2479 | cmd->flags |= OCRDMA_QP_PARA_VLAN_EN_VALID; | 2488 | cmd->flags |= OCRDMA_QP_PARA_VLAN_EN_VALID; |
2480 | cmd->params.rnt_rc_sl_fl |= | 2489 | cmd->params.rnt_rc_sl_fl |= |
2481 | (dev->sl & 0x07) << OCRDMA_QP_PARAMS_SL_SHIFT; | 2490 | (dev->sl & 0x07) << OCRDMA_QP_PARAMS_SL_SHIFT; |
2482 | } | 2491 | } |
2492 | |||
2483 | return 0; | 2493 | return 0; |
2484 | } | 2494 | } |
2485 | 2495 | ||