Skip to content

Commit 9064aeb

Browse files
jsmart-ghmartinkpetersen
authored andcommitted
scsi: lpfc: Add EDC ELS support
When congestion management is enabled, issue EDC ELS to register congestion signaling capabilities with the fabric. The response handling will process the fabric parameters and set the reporting parameters. Similarly, add support for receiving an EDC request from the fabric generating a corresponding response. Implement handlers for congestion signals from the fabric and maintain statistics for them. Link: https://lore.kernel.org/r/[email protected] Co-developed-by: Justin Tee <[email protected]> Signed-off-by: Justin Tee <[email protected]> Signed-off-by: James Smart <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 428569e commit 9064aeb

File tree

10 files changed

+988
-11
lines changed

10 files changed

+988
-11
lines changed

drivers/scsi/lpfc/lpfc.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,11 @@ struct lpfc_trunk_link {
403403
link3;
404404
};
405405

406+
struct lpfc_cgn_acqe_stat {
407+
atomic64_t alarm;
408+
atomic64_t warn;
409+
};
410+
406411
struct lpfc_vport {
407412
struct lpfc_hba *phba;
408413
struct list_head listentry;
@@ -1343,6 +1348,36 @@ struct lpfc_hba {
13431348
uint64_t ktime_seg10_min;
13441349
uint64_t ktime_seg10_max;
13451350
#endif
1351+
/* CMF objects */
1352+
u32 cmf_active_mode;
1353+
#define LPFC_CFG_OFF 0
1354+
1355+
/* Signal / FPIN handling for Congestion Mgmt */
1356+
u8 cgn_reg_fpin; /* Negotiated value from RDF */
1357+
u8 cgn_init_reg_fpin; /* Initial value from READ_CONFIG */
1358+
#define LPFC_CGN_FPIN_NONE 0x0
1359+
#define LPFC_CGN_FPIN_WARN 0x1
1360+
#define LPFC_CGN_FPIN_ALARM 0x2
1361+
#define LPFC_CGN_FPIN_BOTH (LPFC_CGN_FPIN_WARN | LPFC_CGN_FPIN_ALARM)
1362+
1363+
u8 cgn_reg_signal; /* Negotiated value from EDC */
1364+
u8 cgn_init_reg_signal; /* Initial value from READ_CONFIG */
1365+
/* cgn_reg_signal and cgn_init_reg_signal use
1366+
* enum fc_edc_cg_signal_cap_types
1367+
*/
1368+
u16 cgn_fpin_frequency;
1369+
#define LPFC_FPIN_INIT_FREQ 0xffff
1370+
u32 cgn_sig_freq;
1371+
u32 cgn_acqe_cnt;
1372+
1373+
/* Statistics counter for ACQE cgn alarms and warnings */
1374+
struct lpfc_cgn_acqe_stat cgn_acqe_stat;
1375+
1376+
/* Congestion buffer information */
1377+
atomic_t cgn_fabric_warn_cnt; /* Total warning cgn events for info */
1378+
atomic_t cgn_fabric_alarm_cnt; /* Total alarm cgn events for info */
1379+
atomic_t cgn_sync_warn_cnt; /* Total warning events for SYNC wqe */
1380+
atomic_t cgn_sync_alarm_cnt; /* Total alarm events for SYNC wqe */
13461381

13471382
struct hlist_node cpuhp; /* used for cpuhp per hba callback */
13481383
struct timer_list cpuhp_poll_timer;

drivers/scsi/lpfc/lpfc_attr.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6150,6 +6150,19 @@ LPFC_ATTR_RW(ras_fwlog_func, 0, 0, 7, "Firmware Logging Enabled on Function");
61506150
*/
61516151
LPFC_BBCR_ATTR_RW(enable_bbcr, 1, 0, 1, "Enable BBC Recovery");
61526152

6153+
/* Signaling module parameters */
6154+
int lpfc_fabric_cgn_frequency = 100; /* 100 ms default */
6155+
module_param(lpfc_fabric_cgn_frequency, int, 0444);
6156+
MODULE_PARM_DESC(lpfc_fabric_cgn_frequency, "Congestion signaling fabric freq");
6157+
6158+
int lpfc_acqe_cgn_frequency = 10; /* 10 sec default */
6159+
module_param(lpfc_acqe_cgn_frequency, int, 0444);
6160+
MODULE_PARM_DESC(lpfc_acqe_cgn_frequency, "Congestion signaling ACQE freq");
6161+
6162+
int lpfc_use_cgn_signal = 1; /* 0 - only use FPINs, 1 - Use signals if avail */
6163+
module_param(lpfc_use_cgn_signal, int, 0444);
6164+
MODULE_PARM_DESC(lpfc_use_cgn_signal, "Use Congestion signaling if available");
6165+
61536166
/*
61546167
* lpfc_enable_dpp: Enable DPP on G7
61556168
* 0 = DPP on G7 disabled
@@ -6915,6 +6928,9 @@ lpfc_get_stats(struct Scsi_Host *shost)
69156928
hs->invalid_crc_count = pmb->un.varRdLnk.crcCnt;
69166929
hs->error_frames = pmb->un.varRdLnk.crcCnt;
69176930

6931+
hs->cn_sig_warn = atomic64_read(&phba->cgn_acqe_stat.warn);
6932+
hs->cn_sig_alarm = atomic64_read(&phba->cgn_acqe_stat.alarm);
6933+
69186934
hs->link_failure_count -= lso->link_failure_count;
69196935
hs->loss_of_sync_count -= lso->loss_of_sync_count;
69206936
hs->loss_of_signal_count -= lso->loss_of_signal_count;
@@ -7026,6 +7042,12 @@ lpfc_reset_stats(struct Scsi_Host *shost)
70267042
else
70277043
lso->link_events = (phba->fc_eventTag >> 1);
70287044

7045+
atomic64_set(&phba->cgn_acqe_stat.warn, 0);
7046+
atomic64_set(&phba->cgn_acqe_stat.alarm, 0);
7047+
7048+
memset(&shost_to_fc_host(shost)->fpin_stats, 0,
7049+
sizeof(shost_to_fc_host(shost)->fpin_stats));
7050+
70297051
psli->stats_start = ktime_get_seconds();
70307052

70317053
mempool_free(pmboxq, phba->mbox_mem_pool);
@@ -7459,6 +7481,11 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
74597481
lpfc_enable_dpp_init(phba, lpfc_enable_dpp);
74607482
lpfc_enable_mi_init(phba, lpfc_enable_mi);
74617483

7484+
phba->cmf_active_mode = LPFC_CFG_OFF;
7485+
if (lpfc_fabric_cgn_frequency > EDC_CG_SIGFREQ_CNT_MAX ||
7486+
lpfc_fabric_cgn_frequency < EDC_CG_SIGFREQ_CNT_MIN)
7487+
lpfc_fabric_cgn_frequency = 100; /* 100 ms default */
7488+
74627489
if (phba->sli_rev != LPFC_SLI_REV4) {
74637490
/* NVME only supported on SLI4 */
74647491
phba->nvmet_support = 0;

drivers/scsi/lpfc/lpfc_crtn.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ int lpfc_init_iocb_list(struct lpfc_hba *phba, int cnt);
7474
void lpfc_free_iocb_list(struct lpfc_hba *phba);
7575
int lpfc_post_rq_buffer(struct lpfc_hba *phba, struct lpfc_queue *hrq,
7676
struct lpfc_queue *drq, int count, int idx);
77+
int lpfc_config_cgn_signal(struct lpfc_hba *phba);
7778

7879
void lpfc_mbx_cmpl_local_config_link(struct lpfc_hba *, LPFC_MBOXQ_t *);
7980
void lpfc_mbx_cmpl_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *);
@@ -143,6 +144,7 @@ int lpfc_issue_els_scr(struct lpfc_vport *vport, uint8_t retry);
143144
int lpfc_issue_els_rscn(struct lpfc_vport *vport, uint8_t retry);
144145
int lpfc_issue_fabric_reglogin(struct lpfc_vport *);
145146
int lpfc_issue_els_rdf(struct lpfc_vport *vport, uint8_t retry);
147+
int lpfc_issue_els_edc(struct lpfc_vport *vport, uint8_t retry);
146148
int lpfc_els_free_iocb(struct lpfc_hba *, struct lpfc_iocbq *);
147149
int lpfc_ct_free_iocb(struct lpfc_hba *, struct lpfc_iocbq *);
148150
int lpfc_els_rsp_acc(struct lpfc_vport *, uint32_t, struct lpfc_iocbq *,
@@ -607,6 +609,10 @@ extern int lpfc_enable_nvmet_cnt;
607609
extern unsigned long long lpfc_enable_nvmet[];
608610
extern int lpfc_no_hba_reset_cnt;
609611
extern unsigned long lpfc_no_hba_reset[];
612+
extern int lpfc_acqe_cgn_frequency;
613+
extern int lpfc_fabric_cgn_frequency;
614+
extern int lpfc_use_cgn_signal;
615+
610616
extern union lpfc_wqe128 lpfc_iread_cmd_template;
611617
extern union lpfc_wqe128 lpfc_iwrite_cmd_template;
612618
extern union lpfc_wqe128 lpfc_icmnd_cmd_template;

drivers/scsi/lpfc/lpfc_ct.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2288,6 +2288,8 @@ lpfc_cmpl_ct_disc_fdmi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
22882288
/* No retry on Vendor, RPA only done on physical port */
22892289
if (phba->link_flag & LS_CT_VEN_RPA) {
22902290
phba->link_flag &= ~LS_CT_VEN_RPA;
2291+
if (phba->cmf_active_mode == LPFC_CFG_OFF)
2292+
return;
22912293
lpfc_printf_log(phba, KERN_ERR,
22922294
LOG_DISCOVERY | LOG_ELS,
22932295
"6460 VEN FDMI RPA failure\n");

0 commit comments

Comments
 (0)