When the D bit is set if the FKA_ADV_Period of the FIP Discovery Advertisement, the ENode should not transmit period ENode FIP Keep Alive and VN_Port FIP Keep Alive (FC-BB-5 Rev2, 7.8.3.13).
Note that fcf->flags is taken directly from the fip_header, I am claiming one bit for the purpose of the FIP_FKA_Period D bit as FIP_FL_FK_ADV_B, and use FIP_HEADER_FLAGS as bitmask for bits used in fip_header. Signed-off-by: Yi Zou <[email protected]> --- drivers/scsi/fcoe/libfcoe.c | 6 ++++-- include/scsi/fc/fc_fip.h | 10 +++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/fcoe/libfcoe.c b/drivers/scsi/fcoe/libfcoe.c index 3c501d4..a3745a2 100644 --- a/drivers/scsi/fcoe/libfcoe.c +++ b/drivers/scsi/fcoe/libfcoe.c @@ -421,7 +421,7 @@ static int fcoe_ctlr_encaps(struct fcoe_ctlr *fip, struct fc_lport *lport, return -ENODEV; /* set flags according to both FCF and lport's capability on SPMA */ - fip_flags = fcf->flags; + fip_flags = (fcf->flags & FIP_HEADER_FLAGS); fip_flags &= fip->spma ? FIP_FL_SPMA | FIP_FL_FPMA : FIP_FL_FPMA; if (!fip_flags) return -ENODEV; @@ -665,6 +665,8 @@ static int fcoe_ctlr_parse_adv(struct fcoe_ctlr *fip, if (dlen != sizeof(struct fip_fka_desc)) goto len_err; fka = (struct fip_fka_desc *)desc; + if (fka->fd_flags & FIP_FKA_ADV_D) + fcf->flags |= FIP_FL_FKA_ADV_D; t = ntohl(fka->fd_fka_period); if (t >= FCOE_CTLR_MIN_FKA) fcf->fka_period = msecs_to_jiffies(t); @@ -1160,7 +1162,7 @@ static void fcoe_ctlr_timeout(unsigned long arg) } } - if (sel) { + if ((sel) && (!(sel->flags & FIP_FL_FKA_ADV_D))) { if (time_after_eq(jiffies, fip->ctlr_ka_time)) { fip->ctlr_ka_time = jiffies + sel->fka_period; fip->send_ctlr_ka = 1; diff --git a/include/scsi/fc/fc_fip.h b/include/scsi/fc/fc_fip.h index 3d138c1..160c0c9 100644 --- a/include/scsi/fc/fc_fip.h +++ b/include/scsi/fc/fc_fip.h @@ -105,8 +105,12 @@ enum fip_flag { FIP_FL_AVAIL = 0x0004, /* available for FLOGI/ELP */ FIP_FL_SOL = 0x0002, /* this is a solicited message */ FIP_FL_FPORT = 0x0001, /* sent from an F port */ + /* these bits are not in fip header */ + FIP_FL_FKA_ADV_D = 0x0008 /* no need FKF from ENode */ }; +#define FIP_HEADER_FLAGS (FIP_FL_FPMA | FIP_FL_SPMA | \ + FIP_FL_AVAIL | FIP_FL_SOL | FIP_FL_FPORT) /* * Common descriptor header format. */ @@ -214,10 +218,14 @@ struct fip_vn_desc { */ struct fip_fka_desc { struct fip_desc fd_desc; - __u8 fd_resvd[2]; + __u8 fd_resvd; + __u8 fd_flags; /* bit0 is fka disable flag */ __be32 fd_fka_period; /* adv./keep-alive period in mS */ } __attribute__((packed)); +/* FIP_DT_FKA flags */ +#define FIP_FKA_ADV_D (1 << 0) + /* * FIP_DT_VENDOR descriptor. */ _______________________________________________ devel mailing list [email protected] http://www.open-fcoe.org/mailman/listinfo/devel
