aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bfa
diff options
context:
space:
mode:
authorKrishna Gudipati <kgudipat@brocade.com>2012-09-21 20:26:31 -0400
committerJames Bottomley <JBottomley@Parallels.com>2012-10-07 06:20:08 -0400
commit6894f013a71b1bcd09f46b8071f0c6b55fc58139 (patch)
tree76f2ff25deb3519174c33d38e9bef2b98311fc0d /drivers/scsi/bfa
parent04ea65756251577991189ef659dd9694b97a5f81 (diff)
[SCSI] bfa: Add support for user to configure bandwidth on QoS priorities
Made changes to provide an option for user to configure the bandwidth percentage for High/Medium/Low QoS priorities. Signed-off-by: Sudarsana Reddy Kalluru <skalluru@brocade.com> Signed-off-by: Krishna Gudipati <kgudipat@brocade.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/bfa')
-rw-r--r--drivers/scsi/bfa/bfa_defs.h2
-rw-r--r--drivers/scsi/bfa/bfa_defs_svc.h15
-rw-r--r--drivers/scsi/bfa/bfa_svc.c46
-rw-r--r--drivers/scsi/bfa/bfa_svc.h3
-rw-r--r--drivers/scsi/bfa/bfad_bsg.c26
-rw-r--r--drivers/scsi/bfa/bfad_bsg.h8
6 files changed, 94 insertions, 6 deletions
diff --git a/drivers/scsi/bfa/bfa_defs.h b/drivers/scsi/bfa/bfa_defs.h
index b4d5d87f54ff..f8df2c949786 100644
--- a/drivers/scsi/bfa/bfa_defs.h
+++ b/drivers/scsi/bfa/bfa_defs.h
@@ -190,6 +190,8 @@ enum bfa_status {
190 BFA_STATUS_TOPOLOGY_LOOP = 230, /* Topology is set to Loop */ 190 BFA_STATUS_TOPOLOGY_LOOP = 230, /* Topology is set to Loop */
191 BFA_STATUS_LOOP_UNSUPP_MEZZ = 231, /* Loop topology is not supported 191 BFA_STATUS_LOOP_UNSUPP_MEZZ = 231, /* Loop topology is not supported
192 * on mezz cards */ 192 * on mezz cards */
193 BFA_STATUS_QOS_BW_INVALID = 234, /* Invalid QOS bandwidth
194 * configuration */
193 BFA_STATUS_DPORT_ENABLED = 235, /* D-port mode is already enabled */ 195 BFA_STATUS_DPORT_ENABLED = 235, /* D-port mode is already enabled */
194 BFA_STATUS_DPORT_DISABLED = 236, /* D-port mode is already disabled */ 196 BFA_STATUS_DPORT_DISABLED = 236, /* D-port mode is already disabled */
195 BFA_STATUS_CMD_NOTSUPP_MEZZ = 239, /* Cmd not supported for MEZZ card */ 197 BFA_STATUS_CMD_NOTSUPP_MEZZ = 239, /* Cmd not supported for MEZZ card */
diff --git a/drivers/scsi/bfa/bfa_defs_svc.h b/drivers/scsi/bfa/bfa_defs_svc.h
index 76ea10d37ad7..18e4f6ba70d2 100644
--- a/drivers/scsi/bfa/bfa_defs_svc.h
+++ b/drivers/scsi/bfa/bfa_defs_svc.h
@@ -522,6 +522,14 @@ enum bfa_qos_bw_alloc {
522 BFA_QOS_BW_LOW = 10, /* bandwidth allocation for Low */ 522 BFA_QOS_BW_LOW = 10, /* bandwidth allocation for Low */
523}; 523};
524#pragma pack(1) 524#pragma pack(1)
525
526struct bfa_qos_bw_s {
527 u8 qos_bw_set;
528 u8 high;
529 u8 med;
530 u8 low;
531};
532
525/* 533/*
526 * QoS attribute returned in QoS Query 534 * QoS attribute returned in QoS Query
527 */ 535 */
@@ -529,7 +537,8 @@ struct bfa_qos_attr_s {
529 u8 state; /* QoS current state */ 537 u8 state; /* QoS current state */
530 u8 rsvd1[3]; 538 u8 rsvd1[3];
531 u32 total_bb_cr; /* Total BB Credits */ 539 u32 total_bb_cr; /* Total BB Credits */
532 u32 rsvd2[2]; 540 struct bfa_qos_bw_s qos_bw; /* QOS bw cfg */
541 struct bfa_qos_bw_s qos_bw_op; /* QOS bw operational */
533}; 542};
534 543
535/* 544/*
@@ -887,7 +896,7 @@ struct bfa_port_cfg_s {
887 u8 rsvd1; 896 u8 rsvd1;
888 u16 path_tov; /* device path timeout */ 897 u16 path_tov; /* device path timeout */
889 u16 q_depth; /* SCSI Queue depth */ 898 u16 q_depth; /* SCSI Queue depth */
890 u32 rsvd2; 899 struct bfa_qos_bw_s qos_bw; /* QOS bandwidth */
891}; 900};
892#pragma pack() 901#pragma pack()
893 902
@@ -935,7 +944,7 @@ struct bfa_port_attr_s {
935 944
936 /* FCoE specific */ 945 /* FCoE specific */
937 u16 fcoe_vlan; 946 u16 fcoe_vlan;
938 u8 rsvd1[2]; 947 u8 rsvd1[6];
939}; 948};
940 949
941/* 950/*
diff --git a/drivers/scsi/bfa/bfa_svc.c b/drivers/scsi/bfa/bfa_svc.c
index 309ab2ad3ce9..299c1c889b33 100644
--- a/drivers/scsi/bfa/bfa_svc.c
+++ b/drivers/scsi/bfa/bfa_svc.c
@@ -3067,6 +3067,7 @@ bfa_fcport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
3067 */ 3067 */
3068 do_gettimeofday(&tv); 3068 do_gettimeofday(&tv);
3069 fcport->stats_reset_time = tv.tv_sec; 3069 fcport->stats_reset_time = tv.tv_sec;
3070 fcport->stats_dma_ready = BFA_FALSE;
3070 3071
3071 /* 3072 /*
3072 * initialize and set default configuration 3073 * initialize and set default configuration
@@ -3077,6 +3078,9 @@ bfa_fcport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
3077 port_cfg->maxfrsize = 0; 3078 port_cfg->maxfrsize = 0;
3078 3079
3079 port_cfg->trl_def_speed = BFA_PORT_SPEED_1GBPS; 3080 port_cfg->trl_def_speed = BFA_PORT_SPEED_1GBPS;
3081 port_cfg->qos_bw.high = BFA_QOS_BW_HIGH;
3082 port_cfg->qos_bw.med = BFA_QOS_BW_MED;
3083 port_cfg->qos_bw.low = BFA_QOS_BW_LOW;
3080 3084
3081 INIT_LIST_HEAD(&fcport->stats_pending_q); 3085 INIT_LIST_HEAD(&fcport->stats_pending_q);
3082 INIT_LIST_HEAD(&fcport->statsclr_pending_q); 3086 INIT_LIST_HEAD(&fcport->statsclr_pending_q);
@@ -3596,6 +3600,7 @@ bfa_fcport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg)
3596 case BFI_FCPORT_I2H_ENABLE_RSP: 3600 case BFI_FCPORT_I2H_ENABLE_RSP:
3597 if (fcport->msgtag == i2hmsg.penable_rsp->msgtag) { 3601 if (fcport->msgtag == i2hmsg.penable_rsp->msgtag) {
3598 3602
3603 fcport->stats_dma_ready = BFA_TRUE;
3599 if (fcport->use_flash_cfg) { 3604 if (fcport->use_flash_cfg) {
3600 fcport->cfg = i2hmsg.penable_rsp->port_cfg; 3605 fcport->cfg = i2hmsg.penable_rsp->port_cfg;
3601 fcport->cfg.maxfrsize = 3606 fcport->cfg.maxfrsize =
@@ -3611,6 +3616,8 @@ bfa_fcport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg)
3611 else 3616 else
3612 fcport->trunk.attr.state = 3617 fcport->trunk.attr.state =
3613 BFA_TRUNK_DISABLED; 3618 BFA_TRUNK_DISABLED;
3619 fcport->qos_attr.qos_bw =
3620 i2hmsg.penable_rsp->port_cfg.qos_bw;
3614 fcport->use_flash_cfg = BFA_FALSE; 3621 fcport->use_flash_cfg = BFA_FALSE;
3615 } 3622 }
3616 3623
@@ -3619,6 +3626,9 @@ bfa_fcport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg)
3619 else 3626 else
3620 fcport->qos_attr.state = BFA_QOS_DISABLED; 3627 fcport->qos_attr.state = BFA_QOS_DISABLED;
3621 3628
3629 fcport->qos_attr.qos_bw_op =
3630 i2hmsg.penable_rsp->port_cfg.qos_bw;
3631
3622 bfa_sm_send_event(fcport, BFA_FCPORT_SM_FWRSP); 3632 bfa_sm_send_event(fcport, BFA_FCPORT_SM_FWRSP);
3623 } 3633 }
3624 break; 3634 break;
@@ -3640,6 +3650,8 @@ bfa_fcport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg)
3640 bfa_sm_send_event(fcport, 3650 bfa_sm_send_event(fcport,
3641 BFA_FCPORT_SM_LINKDOWN); 3651 BFA_FCPORT_SM_LINKDOWN);
3642 } 3652 }
3653 fcport->qos_attr.qos_bw_op =
3654 i2hmsg.event->link_state.qos_attr.qos_bw_op;
3643 break; 3655 break;
3644 3656
3645 case BFI_FCPORT_I2H_TRUNK_SCN: 3657 case BFI_FCPORT_I2H_TRUNK_SCN:
@@ -4035,8 +4047,9 @@ bfa_fcport_get_stats(struct bfa_s *bfa, struct bfa_cb_pending_q_s *cb)
4035{ 4047{
4036 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); 4048 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4037 4049
4038 if (bfa_ioc_is_disabled(&bfa->ioc)) 4050 if (!bfa_iocfc_is_operational(bfa) ||
4039 return BFA_STATUS_IOC_DISABLED; 4051 !fcport->stats_dma_ready)
4052 return BFA_STATUS_IOC_NON_OP;
4040 4053
4041 if (!list_empty(&fcport->statsclr_pending_q)) 4054 if (!list_empty(&fcport->statsclr_pending_q))
4042 return BFA_STATUS_DEVBUSY; 4055 return BFA_STATUS_DEVBUSY;
@@ -4061,6 +4074,10 @@ bfa_fcport_clear_stats(struct bfa_s *bfa, struct bfa_cb_pending_q_s *cb)
4061{ 4074{
4062 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); 4075 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4063 4076
4077 if (!bfa_iocfc_is_operational(bfa) ||
4078 !fcport->stats_dma_ready)
4079 return BFA_STATUS_IOC_NON_OP;
4080
4064 if (!list_empty(&fcport->stats_pending_q)) 4081 if (!list_empty(&fcport->stats_pending_q))
4065 return BFA_STATUS_DEVBUSY; 4082 return BFA_STATUS_DEVBUSY;
4066 4083
@@ -4098,6 +4115,31 @@ bfa_fcport_is_dport(struct bfa_s *bfa)
4098 BFA_PORT_ST_DPORT); 4115 BFA_PORT_ST_DPORT);
4099} 4116}
4100 4117
4118bfa_status_t
4119bfa_fcport_set_qos_bw(struct bfa_s *bfa, struct bfa_qos_bw_s *qos_bw)
4120{
4121 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4122 enum bfa_ioc_type_e ioc_type = bfa_get_type(bfa);
4123
4124 bfa_trc(bfa, ioc_type);
4125
4126 if ((qos_bw->high == 0) || (qos_bw->med == 0) || (qos_bw->low == 0))
4127 return BFA_STATUS_QOS_BW_INVALID;
4128
4129 if ((qos_bw->high + qos_bw->med + qos_bw->low) != 100)
4130 return BFA_STATUS_QOS_BW_INVALID;
4131
4132 if ((qos_bw->med > qos_bw->high) || (qos_bw->low > qos_bw->med) ||
4133 (qos_bw->low > qos_bw->high))
4134 return BFA_STATUS_QOS_BW_INVALID;
4135
4136 if ((ioc_type == BFA_IOC_TYPE_FC) &&
4137 (fcport->cfg.topology != BFA_PORT_TOPOLOGY_LOOP))
4138 fcport->cfg.qos_bw = *qos_bw;
4139
4140 return BFA_STATUS_OK;
4141}
4142
4101bfa_boolean_t 4143bfa_boolean_t
4102bfa_fcport_is_ratelim(struct bfa_s *bfa) 4144bfa_fcport_is_ratelim(struct bfa_s *bfa)
4103{ 4145{
diff --git a/drivers/scsi/bfa/bfa_svc.h b/drivers/scsi/bfa/bfa_svc.h
index 1854ca3bc1a5..8d7fbecfcb22 100644
--- a/drivers/scsi/bfa/bfa_svc.h
+++ b/drivers/scsi/bfa/bfa_svc.h
@@ -514,6 +514,7 @@ struct bfa_fcport_s {
514 struct bfa_fcport_trunk_s trunk; 514 struct bfa_fcport_trunk_s trunk;
515 u16 fcoe_vlan; 515 u16 fcoe_vlan;
516 struct bfa_mem_dma_s fcport_dma; 516 struct bfa_mem_dma_s fcport_dma;
517 bfa_boolean_t stats_dma_ready;
517}; 518};
518 519
519#define BFA_FCPORT_MOD(__bfa) (&(__bfa)->modules.fcport) 520#define BFA_FCPORT_MOD(__bfa) (&(__bfa)->modules.fcport)
@@ -551,6 +552,8 @@ void bfa_fcport_event_register(struct bfa_s *bfa,
551 enum bfa_port_linkstate event), void *event_cbarg); 552 enum bfa_port_linkstate event), void *event_cbarg);
552bfa_boolean_t bfa_fcport_is_disabled(struct bfa_s *bfa); 553bfa_boolean_t bfa_fcport_is_disabled(struct bfa_s *bfa);
553bfa_boolean_t bfa_fcport_is_dport(struct bfa_s *bfa); 554bfa_boolean_t bfa_fcport_is_dport(struct bfa_s *bfa);
555bfa_status_t bfa_fcport_set_qos_bw(struct bfa_s *bfa,
556 struct bfa_qos_bw_s *qos_bw);
554enum bfa_port_speed bfa_fcport_get_ratelim_speed(struct bfa_s *bfa); 557enum bfa_port_speed bfa_fcport_get_ratelim_speed(struct bfa_s *bfa);
555 558
556void bfa_fcport_set_tx_bbcredit(struct bfa_s *bfa, u16 tx_bbcredit, u8 bb_scn); 559void bfa_fcport_set_tx_bbcredit(struct bfa_s *bfa, u16 tx_bbcredit, u8 bb_scn);
diff --git a/drivers/scsi/bfa/bfad_bsg.c b/drivers/scsi/bfa/bfad_bsg.c
index 69b1ba9e58f6..90c40e4e2d4b 100644
--- a/drivers/scsi/bfa/bfad_bsg.c
+++ b/drivers/scsi/bfa/bfad_bsg.c
@@ -880,6 +880,19 @@ out:
880} 880}
881 881
882int 882int
883bfad_iocmd_qos_set_bw(struct bfad_s *bfad, void *pcmd)
884{
885 struct bfa_bsg_qos_bw_s *iocmd = (struct bfa_bsg_qos_bw_s *)pcmd;
886 unsigned long flags;
887
888 spin_lock_irqsave(&bfad->bfad_lock, flags);
889 iocmd->status = bfa_fcport_set_qos_bw(&bfad->bfa, &iocmd->qos_bw);
890 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
891
892 return 0;
893}
894
895int
883bfad_iocmd_ratelim(struct bfad_s *bfad, unsigned int cmd, void *pcmd) 896bfad_iocmd_ratelim(struct bfad_s *bfad, unsigned int cmd, void *pcmd)
884{ 897{
885 struct bfa_bsg_gen_s *iocmd = (struct bfa_bsg_gen_s *)pcmd; 898 struct bfa_bsg_gen_s *iocmd = (struct bfa_bsg_gen_s *)pcmd;
@@ -2284,8 +2297,12 @@ bfad_iocmd_qos(struct bfad_s *bfad, void *cmd, unsigned int v_cmd)
2284 else { 2297 else {
2285 if (v_cmd == IOCMD_QOS_ENABLE) 2298 if (v_cmd == IOCMD_QOS_ENABLE)
2286 fcport->cfg.qos_enabled = BFA_TRUE; 2299 fcport->cfg.qos_enabled = BFA_TRUE;
2287 else if (v_cmd == IOCMD_QOS_DISABLE) 2300 else if (v_cmd == IOCMD_QOS_DISABLE) {
2288 fcport->cfg.qos_enabled = BFA_FALSE; 2301 fcport->cfg.qos_enabled = BFA_FALSE;
2302 fcport->cfg.qos_bw.high = BFA_QOS_BW_HIGH;
2303 fcport->cfg.qos_bw.med = BFA_QOS_BW_MED;
2304 fcport->cfg.qos_bw.low = BFA_QOS_BW_LOW;
2305 }
2289 } 2306 }
2290 } 2307 }
2291 spin_unlock_irqrestore(&bfad->bfad_lock, flags); 2308 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
@@ -2308,6 +2325,10 @@ bfad_iocmd_qos_get_attr(struct bfad_s *bfad, void *cmd)
2308 iocmd->attr.state = fcport->qos_attr.state; 2325 iocmd->attr.state = fcport->qos_attr.state;
2309 iocmd->attr.total_bb_cr = 2326 iocmd->attr.total_bb_cr =
2310 be32_to_cpu(fcport->qos_attr.total_bb_cr); 2327 be32_to_cpu(fcport->qos_attr.total_bb_cr);
2328 iocmd->attr.qos_bw.high = fcport->cfg.qos_bw.high;
2329 iocmd->attr.qos_bw.med = fcport->cfg.qos_bw.med;
2330 iocmd->attr.qos_bw.low = fcport->cfg.qos_bw.low;
2331 iocmd->attr.qos_bw_op = fcport->qos_attr.qos_bw_op;
2311 iocmd->status = BFA_STATUS_OK; 2332 iocmd->status = BFA_STATUS_OK;
2312 } 2333 }
2313 spin_unlock_irqrestore(&bfad->bfad_lock, flags); 2334 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
@@ -2839,6 +2860,9 @@ bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd,
2839 case IOCMD_QOS_RESET_STATS: 2860 case IOCMD_QOS_RESET_STATS:
2840 rc = bfad_iocmd_qos_reset_stats(bfad, iocmd); 2861 rc = bfad_iocmd_qos_reset_stats(bfad, iocmd);
2841 break; 2862 break;
2863 case IOCMD_QOS_SET_BW:
2864 rc = bfad_iocmd_qos_set_bw(bfad, iocmd);
2865 break;
2842 case IOCMD_VF_GET_STATS: 2866 case IOCMD_VF_GET_STATS:
2843 rc = bfad_iocmd_vf_get_stats(bfad, iocmd); 2867 rc = bfad_iocmd_vf_get_stats(bfad, iocmd);
2844 break; 2868 break;
diff --git a/drivers/scsi/bfa/bfad_bsg.h b/drivers/scsi/bfa/bfad_bsg.h
index 62f1b8809d19..b67a2292cff3 100644
--- a/drivers/scsi/bfa/bfad_bsg.h
+++ b/drivers/scsi/bfa/bfad_bsg.h
@@ -144,6 +144,7 @@ enum {
144 IOCMD_DIAG_DPORT_ENABLE, 144 IOCMD_DIAG_DPORT_ENABLE,
145 IOCMD_DIAG_DPORT_DISABLE, 145 IOCMD_DIAG_DPORT_DISABLE,
146 IOCMD_DIAG_DPORT_GET_STATE, 146 IOCMD_DIAG_DPORT_GET_STATE,
147 IOCMD_QOS_SET_BW,
147}; 148};
148 149
149struct bfa_bsg_gen_s { 150struct bfa_bsg_gen_s {
@@ -704,6 +705,13 @@ struct bfa_bsg_qos_vc_attr_s {
704 struct bfa_qos_vc_attr_s attr; 705 struct bfa_qos_vc_attr_s attr;
705}; 706};
706 707
708struct bfa_bsg_qos_bw_s {
709 bfa_status_t status;
710 u16 bfad_num;
711 u16 rsvd;
712 struct bfa_qos_bw_s qos_bw;
713};
714
707struct bfa_bsg_vf_stats_s { 715struct bfa_bsg_vf_stats_s {
708 bfa_status_t status; 716 bfa_status_t status;
709 u16 bfad_num; 717 u16 bfad_num;