diff options
author | Krishna Gudipati <kgudipat@brocade.com> | 2012-09-21 20:26:50 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-10-07 06:23:20 -0400 |
commit | 1a1297c644b38d2edfef3004bcc6f9c0084b43a9 (patch) | |
tree | 7bcb7981f79800bf6d6be5b5c1aa36cdea95a41e | |
parent | 7ace27ae28a5fa67fa3d25f31d1111991c81e015 (diff) |
[SCSI] bfa: Add support to configure min/max bandwidth for a pcifn
- Added support to configure minimum bandwidth for a pcifn.
- Minimum bandwith is guaranteed at per queue level.
- Added support to update pcifn bandwidth dynamically without
a server reboot.
Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r-- | drivers/scsi/bfa/bfa_core.c | 9 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_defs.h | 4 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_ioc.c | 20 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_ioc.h | 8 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfad_bsg.c | 20 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfad_bsg.h | 3 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfi.h | 3 |
7 files changed, 41 insertions, 26 deletions
diff --git a/drivers/scsi/bfa/bfa_core.c b/drivers/scsi/bfa/bfa_core.c index eb296286c37e..89ebd4459bfc 100644 --- a/drivers/scsi/bfa/bfa_core.c +++ b/drivers/scsi/bfa/bfa_core.c | |||
@@ -838,19 +838,20 @@ void | |||
838 | bfa_isr_enable(struct bfa_s *bfa) | 838 | bfa_isr_enable(struct bfa_s *bfa) |
839 | { | 839 | { |
840 | u32 umsk; | 840 | u32 umsk; |
841 | int pci_func = bfa_ioc_pcifn(&bfa->ioc); | 841 | int port_id = bfa_ioc_portid(&bfa->ioc); |
842 | 842 | ||
843 | bfa_trc(bfa, pci_func); | 843 | bfa_trc(bfa, bfa_ioc_pcifn(&bfa->ioc)); |
844 | bfa_trc(bfa, port_id); | ||
844 | 845 | ||
845 | bfa_msix_ctrl_install(bfa); | 846 | bfa_msix_ctrl_install(bfa); |
846 | 847 | ||
847 | if (bfa_asic_id_ct2(bfa->ioc.pcidev.device_id)) { | 848 | if (bfa_asic_id_ct2(bfa->ioc.pcidev.device_id)) { |
848 | umsk = __HFN_INT_ERR_MASK_CT2; | 849 | umsk = __HFN_INT_ERR_MASK_CT2; |
849 | umsk |= pci_func == 0 ? | 850 | umsk |= port_id == 0 ? |
850 | __HFN_INT_FN0_MASK_CT2 : __HFN_INT_FN1_MASK_CT2; | 851 | __HFN_INT_FN0_MASK_CT2 : __HFN_INT_FN1_MASK_CT2; |
851 | } else { | 852 | } else { |
852 | umsk = __HFN_INT_ERR_MASK; | 853 | umsk = __HFN_INT_ERR_MASK; |
853 | umsk |= pci_func == 0 ? __HFN_INT_FN0_MASK : __HFN_INT_FN1_MASK; | 854 | umsk |= port_id == 0 ? __HFN_INT_FN0_MASK : __HFN_INT_FN1_MASK; |
854 | } | 855 | } |
855 | 856 | ||
856 | writel(umsk, bfa->iocfc.bfa_regs.intr_status); | 857 | writel(umsk, bfa->iocfc.bfa_regs.intr_status); |
diff --git a/drivers/scsi/bfa/bfa_defs.h b/drivers/scsi/bfa/bfa_defs.h index f8df2c949786..f0b251e928bf 100644 --- a/drivers/scsi/bfa/bfa_defs.h +++ b/drivers/scsi/bfa/bfa_defs.h | |||
@@ -190,6 +190,7 @@ 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_INVALID_BW = 233, /* Invalid bandwidth value */ | ||
193 | BFA_STATUS_QOS_BW_INVALID = 234, /* Invalid QOS bandwidth | 194 | BFA_STATUS_QOS_BW_INVALID = 234, /* Invalid QOS bandwidth |
194 | * configuration */ | 195 | * configuration */ |
195 | BFA_STATUS_DPORT_ENABLED = 235, /* D-port mode is already enabled */ | 196 | BFA_STATUS_DPORT_ENABLED = 235, /* D-port mode is already enabled */ |
@@ -749,7 +750,8 @@ struct bfa_ablk_cfg_pf_s { | |||
749 | u8 rsvd[1]; | 750 | u8 rsvd[1]; |
750 | u16 num_qpairs; | 751 | u16 num_qpairs; |
751 | u16 num_vectors; | 752 | u16 num_vectors; |
752 | u32 bw; | 753 | u16 bw_min; |
754 | u16 bw_max; | ||
753 | }; | 755 | }; |
754 | 756 | ||
755 | struct bfa_ablk_cfg_port_s { | 757 | struct bfa_ablk_cfg_port_s { |
diff --git a/drivers/scsi/bfa/bfa_ioc.c b/drivers/scsi/bfa/bfa_ioc.c index 4fbff0394985..c697890eeca8 100644 --- a/drivers/scsi/bfa/bfa_ioc.c +++ b/drivers/scsi/bfa/bfa_ioc.c | |||
@@ -3019,7 +3019,6 @@ bfa_ablk_config_swap(struct bfa_ablk_cfg_s *cfg) | |||
3019 | struct bfa_ablk_cfg_inst_s *cfg_inst; | 3019 | struct bfa_ablk_cfg_inst_s *cfg_inst; |
3020 | int i, j; | 3020 | int i, j; |
3021 | u16 be16; | 3021 | u16 be16; |
3022 | u32 be32; | ||
3023 | 3022 | ||
3024 | for (i = 0; i < BFA_ABLK_MAX; i++) { | 3023 | for (i = 0; i < BFA_ABLK_MAX; i++) { |
3025 | cfg_inst = &cfg->inst[i]; | 3024 | cfg_inst = &cfg->inst[i]; |
@@ -3030,8 +3029,10 @@ bfa_ablk_config_swap(struct bfa_ablk_cfg_s *cfg) | |||
3030 | cfg_inst->pf_cfg[j].num_qpairs = be16_to_cpu(be16); | 3029 | cfg_inst->pf_cfg[j].num_qpairs = be16_to_cpu(be16); |
3031 | be16 = cfg_inst->pf_cfg[j].num_vectors; | 3030 | be16 = cfg_inst->pf_cfg[j].num_vectors; |
3032 | cfg_inst->pf_cfg[j].num_vectors = be16_to_cpu(be16); | 3031 | cfg_inst->pf_cfg[j].num_vectors = be16_to_cpu(be16); |
3033 | be32 = cfg_inst->pf_cfg[j].bw; | 3032 | be16 = cfg_inst->pf_cfg[j].bw_min; |
3034 | cfg_inst->pf_cfg[j].bw = be16_to_cpu(be32); | 3033 | cfg_inst->pf_cfg[j].bw_min = be16_to_cpu(be16); |
3034 | be16 = cfg_inst->pf_cfg[j].bw_max; | ||
3035 | cfg_inst->pf_cfg[j].bw_max = be16_to_cpu(be16); | ||
3035 | } | 3036 | } |
3036 | } | 3037 | } |
3037 | } | 3038 | } |
@@ -3173,7 +3174,8 @@ bfa_ablk_query(struct bfa_ablk_s *ablk, struct bfa_ablk_cfg_s *ablk_cfg, | |||
3173 | 3174 | ||
3174 | bfa_status_t | 3175 | bfa_status_t |
3175 | bfa_ablk_pf_create(struct bfa_ablk_s *ablk, u16 *pcifn, | 3176 | bfa_ablk_pf_create(struct bfa_ablk_s *ablk, u16 *pcifn, |
3176 | u8 port, enum bfi_pcifn_class personality, int bw, | 3177 | u8 port, enum bfi_pcifn_class personality, |
3178 | u16 bw_min, u16 bw_max, | ||
3177 | bfa_ablk_cbfn_t cbfn, void *cbarg) | 3179 | bfa_ablk_cbfn_t cbfn, void *cbarg) |
3178 | { | 3180 | { |
3179 | struct bfi_ablk_h2i_pf_req_s *m; | 3181 | struct bfi_ablk_h2i_pf_req_s *m; |
@@ -3197,7 +3199,8 @@ bfa_ablk_pf_create(struct bfa_ablk_s *ablk, u16 *pcifn, | |||
3197 | bfi_h2i_set(m->mh, BFI_MC_ABLK, BFI_ABLK_H2I_PF_CREATE, | 3199 | bfi_h2i_set(m->mh, BFI_MC_ABLK, BFI_ABLK_H2I_PF_CREATE, |
3198 | bfa_ioc_portid(ablk->ioc)); | 3200 | bfa_ioc_portid(ablk->ioc)); |
3199 | m->pers = cpu_to_be16((u16)personality); | 3201 | m->pers = cpu_to_be16((u16)personality); |
3200 | m->bw = cpu_to_be32(bw); | 3202 | m->bw_min = cpu_to_be16(bw_min); |
3203 | m->bw_max = cpu_to_be16(bw_max); | ||
3201 | m->port = port; | 3204 | m->port = port; |
3202 | bfa_ioc_mbox_queue(ablk->ioc, &ablk->mb); | 3205 | bfa_ioc_mbox_queue(ablk->ioc, &ablk->mb); |
3203 | 3206 | ||
@@ -3297,8 +3300,8 @@ bfa_ablk_port_config(struct bfa_ablk_s *ablk, int port, enum bfa_mode_s mode, | |||
3297 | } | 3300 | } |
3298 | 3301 | ||
3299 | bfa_status_t | 3302 | bfa_status_t |
3300 | bfa_ablk_pf_update(struct bfa_ablk_s *ablk, int pcifn, int bw, | 3303 | bfa_ablk_pf_update(struct bfa_ablk_s *ablk, int pcifn, u16 bw_min, |
3301 | bfa_ablk_cbfn_t cbfn, void *cbarg) | 3304 | u16 bw_max, bfa_ablk_cbfn_t cbfn, void *cbarg) |
3302 | { | 3305 | { |
3303 | struct bfi_ablk_h2i_pf_req_s *m; | 3306 | struct bfi_ablk_h2i_pf_req_s *m; |
3304 | 3307 | ||
@@ -3320,7 +3323,8 @@ bfa_ablk_pf_update(struct bfa_ablk_s *ablk, int pcifn, int bw, | |||
3320 | bfi_h2i_set(m->mh, BFI_MC_ABLK, BFI_ABLK_H2I_PF_UPDATE, | 3323 | bfi_h2i_set(m->mh, BFI_MC_ABLK, BFI_ABLK_H2I_PF_UPDATE, |
3321 | bfa_ioc_portid(ablk->ioc)); | 3324 | bfa_ioc_portid(ablk->ioc)); |
3322 | m->pcifn = (u8)pcifn; | 3325 | m->pcifn = (u8)pcifn; |
3323 | m->bw = cpu_to_be32(bw); | 3326 | m->bw_min = cpu_to_be16(bw_min); |
3327 | m->bw_max = cpu_to_be16(bw_max); | ||
3324 | bfa_ioc_mbox_queue(ablk->ioc, &ablk->mb); | 3328 | bfa_ioc_mbox_queue(ablk->ioc, &ablk->mb); |
3325 | 3329 | ||
3326 | return BFA_STATUS_OK; | 3330 | return BFA_STATUS_OK; |
diff --git a/drivers/scsi/bfa/bfa_ioc.h b/drivers/scsi/bfa/bfa_ioc.h index 8e267246c1a5..0ad221abfc8f 100644 --- a/drivers/scsi/bfa/bfa_ioc.h +++ b/drivers/scsi/bfa/bfa_ioc.h | |||
@@ -889,12 +889,12 @@ bfa_status_t bfa_ablk_port_config(struct bfa_ablk_s *ablk, int port, | |||
889 | enum bfa_mode_s mode, int max_pf, int max_vf, | 889 | enum bfa_mode_s mode, int max_pf, int max_vf, |
890 | bfa_ablk_cbfn_t cbfn, void *cbarg); | 890 | bfa_ablk_cbfn_t cbfn, void *cbarg); |
891 | bfa_status_t bfa_ablk_pf_create(struct bfa_ablk_s *ablk, u16 *pcifn, | 891 | bfa_status_t bfa_ablk_pf_create(struct bfa_ablk_s *ablk, u16 *pcifn, |
892 | u8 port, enum bfi_pcifn_class personality, int bw, | 892 | u8 port, enum bfi_pcifn_class personality, |
893 | bfa_ablk_cbfn_t cbfn, void *cbarg); | 893 | u16 bw_min, u16 bw_max, bfa_ablk_cbfn_t cbfn, void *cbarg); |
894 | bfa_status_t bfa_ablk_pf_delete(struct bfa_ablk_s *ablk, int pcifn, | 894 | bfa_status_t bfa_ablk_pf_delete(struct bfa_ablk_s *ablk, int pcifn, |
895 | bfa_ablk_cbfn_t cbfn, void *cbarg); | 895 | bfa_ablk_cbfn_t cbfn, void *cbarg); |
896 | bfa_status_t bfa_ablk_pf_update(struct bfa_ablk_s *ablk, int pcifn, int bw, | 896 | bfa_status_t bfa_ablk_pf_update(struct bfa_ablk_s *ablk, int pcifn, |
897 | bfa_ablk_cbfn_t cbfn, void *cbarg); | 897 | u16 bw_min, u16 bw_max, bfa_ablk_cbfn_t cbfn, void *cbarg); |
898 | bfa_status_t bfa_ablk_optrom_en(struct bfa_ablk_s *ablk, | 898 | bfa_status_t bfa_ablk_optrom_en(struct bfa_ablk_s *ablk, |
899 | bfa_ablk_cbfn_t cbfn, void *cbarg); | 899 | bfa_ablk_cbfn_t cbfn, void *cbarg); |
900 | bfa_status_t bfa_ablk_optrom_dis(struct bfa_ablk_s *ablk, | 900 | bfa_status_t bfa_ablk_optrom_dis(struct bfa_ablk_s *ablk, |
diff --git a/drivers/scsi/bfa/bfad_bsg.c b/drivers/scsi/bfa/bfad_bsg.c index 6e1478ae6251..0ab1d400ac33 100644 --- a/drivers/scsi/bfa/bfad_bsg.c +++ b/drivers/scsi/bfa/bfad_bsg.c | |||
@@ -33,7 +33,7 @@ bfad_iocmd_ioc_enable(struct bfad_s *bfad, void *cmd) | |||
33 | /* If IOC is not in disabled state - return */ | 33 | /* If IOC is not in disabled state - return */ |
34 | if (!bfa_ioc_is_disabled(&bfad->bfa.ioc)) { | 34 | if (!bfa_ioc_is_disabled(&bfad->bfa.ioc)) { |
35 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 35 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
36 | iocmd->status = BFA_STATUS_IOC_FAILURE; | 36 | iocmd->status = BFA_STATUS_OK; |
37 | return rc; | 37 | return rc; |
38 | } | 38 | } |
39 | 39 | ||
@@ -54,6 +54,12 @@ bfad_iocmd_ioc_disable(struct bfad_s *bfad, void *cmd) | |||
54 | unsigned long flags; | 54 | unsigned long flags; |
55 | 55 | ||
56 | spin_lock_irqsave(&bfad->bfad_lock, flags); | 56 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
57 | if (bfa_ioc_is_disabled(&bfad->bfa.ioc)) { | ||
58 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | ||
59 | iocmd->status = BFA_STATUS_OK; | ||
60 | return rc; | ||
61 | } | ||
62 | |||
57 | if (bfad->disable_active) { | 63 | if (bfad->disable_active) { |
58 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 64 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
59 | return -EBUSY; | 65 | return -EBUSY; |
@@ -1191,8 +1197,8 @@ bfad_iocmd_pcifn_create(struct bfad_s *bfad, void *cmd) | |||
1191 | spin_lock_irqsave(&bfad->bfad_lock, flags); | 1197 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
1192 | iocmd->status = bfa_ablk_pf_create(&bfad->bfa.modules.ablk, | 1198 | iocmd->status = bfa_ablk_pf_create(&bfad->bfa.modules.ablk, |
1193 | &iocmd->pcifn_id, iocmd->port, | 1199 | &iocmd->pcifn_id, iocmd->port, |
1194 | iocmd->pcifn_class, iocmd->bandwidth, | 1200 | iocmd->pcifn_class, iocmd->bw_min, |
1195 | bfad_hcb_comp, &fcomp); | 1201 | iocmd->bw_max, bfad_hcb_comp, &fcomp); |
1196 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 1202 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
1197 | if (iocmd->status != BFA_STATUS_OK) | 1203 | if (iocmd->status != BFA_STATUS_OK) |
1198 | goto out; | 1204 | goto out; |
@@ -1235,8 +1241,8 @@ bfad_iocmd_pcifn_bw(struct bfad_s *bfad, void *cmd) | |||
1235 | init_completion(&fcomp.comp); | 1241 | init_completion(&fcomp.comp); |
1236 | spin_lock_irqsave(&bfad->bfad_lock, flags); | 1242 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
1237 | iocmd->status = bfa_ablk_pf_update(&bfad->bfa.modules.ablk, | 1243 | iocmd->status = bfa_ablk_pf_update(&bfad->bfa.modules.ablk, |
1238 | iocmd->pcifn_id, iocmd->bandwidth, | 1244 | iocmd->pcifn_id, iocmd->bw_min, |
1239 | bfad_hcb_comp, &fcomp); | 1245 | iocmd->bw_max, bfad_hcb_comp, &fcomp); |
1240 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 1246 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
1241 | bfa_trc(bfad, iocmd->status); | 1247 | bfa_trc(bfad, iocmd->status); |
1242 | if (iocmd->status != BFA_STATUS_OK) | 1248 | if (iocmd->status != BFA_STATUS_OK) |
@@ -2122,7 +2128,7 @@ bfad_iocmd_boot_cfg(struct bfad_s *bfad, void *cmd) | |||
2122 | init_completion(&fcomp.comp); | 2128 | init_completion(&fcomp.comp); |
2123 | spin_lock_irqsave(&bfad->bfad_lock, flags); | 2129 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
2124 | iocmd->status = bfa_flash_update_part(BFA_FLASH(&bfad->bfa), | 2130 | iocmd->status = bfa_flash_update_part(BFA_FLASH(&bfad->bfa), |
2125 | BFA_FLASH_PART_BOOT, PCI_FUNC(bfad->pcidev->devfn), | 2131 | BFA_FLASH_PART_BOOT, bfad->bfa.ioc.port_id, |
2126 | &iocmd->cfg, sizeof(struct bfa_boot_cfg_s), 0, | 2132 | &iocmd->cfg, sizeof(struct bfa_boot_cfg_s), 0, |
2127 | bfad_hcb_comp, &fcomp); | 2133 | bfad_hcb_comp, &fcomp); |
2128 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 2134 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
@@ -2144,7 +2150,7 @@ bfad_iocmd_boot_query(struct bfad_s *bfad, void *cmd) | |||
2144 | init_completion(&fcomp.comp); | 2150 | init_completion(&fcomp.comp); |
2145 | spin_lock_irqsave(&bfad->bfad_lock, flags); | 2151 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
2146 | iocmd->status = bfa_flash_read_part(BFA_FLASH(&bfad->bfa), | 2152 | iocmd->status = bfa_flash_read_part(BFA_FLASH(&bfad->bfa), |
2147 | BFA_FLASH_PART_BOOT, PCI_FUNC(bfad->pcidev->devfn), | 2153 | BFA_FLASH_PART_BOOT, bfad->bfa.ioc.port_id, |
2148 | &iocmd->cfg, sizeof(struct bfa_boot_cfg_s), 0, | 2154 | &iocmd->cfg, sizeof(struct bfa_boot_cfg_s), 0, |
2149 | bfad_hcb_comp, &fcomp); | 2155 | bfad_hcb_comp, &fcomp); |
2150 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 2156 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
diff --git a/drivers/scsi/bfa/bfad_bsg.h b/drivers/scsi/bfa/bfad_bsg.h index 37922b96079b..e48dcca0d7fa 100644 --- a/drivers/scsi/bfa/bfad_bsg.h +++ b/drivers/scsi/bfa/bfad_bsg.h | |||
@@ -469,7 +469,8 @@ struct bfa_bsg_pcifn_s { | |||
469 | bfa_status_t status; | 469 | bfa_status_t status; |
470 | u16 bfad_num; | 470 | u16 bfad_num; |
471 | u16 pcifn_id; | 471 | u16 pcifn_id; |
472 | u32 bandwidth; | 472 | u16 bw_min; |
473 | u16 bw_max; | ||
473 | u8 port; | 474 | u8 port; |
474 | enum bfi_pcifn_class pcifn_class; | 475 | enum bfi_pcifn_class pcifn_class; |
475 | u8 rsvd[1]; | 476 | u8 rsvd[1]; |
diff --git a/drivers/scsi/bfa/bfi.h b/drivers/scsi/bfa/bfi.h index 6f1dd9eac1d1..9c9861f8e6ce 100644 --- a/drivers/scsi/bfa/bfi.h +++ b/drivers/scsi/bfa/bfi.h | |||
@@ -690,7 +690,8 @@ struct bfi_ablk_h2i_pf_req_s { | |||
690 | u8 pcifn; | 690 | u8 pcifn; |
691 | u8 port; | 691 | u8 port; |
692 | u16 pers; | 692 | u16 pers; |
693 | u32 bw; | 693 | u16 bw_min; /* percent BW @ max speed */ |
694 | u16 bw_max; /* percent BW @ max speed */ | ||
694 | }; | 695 | }; |
695 | 696 | ||
696 | /* BFI_ABLK_H2I_OPTROM_ENABLE, BFI_ABLK_H2I_OPTROM_DISABLE */ | 697 | /* BFI_ABLK_H2I_OPTROM_ENABLE, BFI_ABLK_H2I_OPTROM_DISABLE */ |