Commit 8cdffdcc authored by Yi Zou's avatar Yi Zou Committed by James Bottomley

[SCSI] libfcoe: add checking disable flag in FIP_FKA_ADV

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: default avatarYi Zou <yi.zou@intel.com>
Signed-off-by: default avatarRobert Love <robert.w.love@intel.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent 6580bbd0
...@@ -665,6 +665,8 @@ static int fcoe_ctlr_parse_adv(struct fcoe_ctlr *fip, ...@@ -665,6 +665,8 @@ static int fcoe_ctlr_parse_adv(struct fcoe_ctlr *fip,
if (dlen != sizeof(struct fip_fka_desc)) if (dlen != sizeof(struct fip_fka_desc))
goto len_err; goto len_err;
fka = (struct fip_fka_desc *)desc; fka = (struct fip_fka_desc *)desc;
if (fka->fd_flags & FIP_FKA_ADV_D)
fcf->fd_flags = 1;
t = ntohl(fka->fd_fka_period); t = ntohl(fka->fd_fka_period);
if (t >= FCOE_CTLR_MIN_FKA) if (t >= FCOE_CTLR_MIN_FKA)
fcf->fka_period = msecs_to_jiffies(t); fcf->fka_period = msecs_to_jiffies(t);
...@@ -1160,7 +1162,7 @@ static void fcoe_ctlr_timeout(unsigned long arg) ...@@ -1160,7 +1162,7 @@ static void fcoe_ctlr_timeout(unsigned long arg)
} }
} }
if (sel) { if (sel && !sel->fd_flags) {
if (time_after_eq(jiffies, fip->ctlr_ka_time)) { if (time_after_eq(jiffies, fip->ctlr_ka_time)) {
fip->ctlr_ka_time = jiffies + sel->fka_period; fip->ctlr_ka_time = jiffies + sel->fka_period;
fip->send_ctlr_ka = 1; fip->send_ctlr_ka = 1;
......
...@@ -214,10 +214,20 @@ struct fip_vn_desc { ...@@ -214,10 +214,20 @@ struct fip_vn_desc {
*/ */
struct fip_fka_desc { struct fip_fka_desc {
struct fip_desc fd_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 */ __be32 fd_fka_period; /* adv./keep-alive period in mS */
} __attribute__((packed)); } __attribute__((packed));
/*
* flags for fip_fka_desc.fd_flags
*/
enum fip_fka_flags {
FIP_FKA_ADV_D = 0x01, /* no need for FKA from ENode */
};
/* FIP_DT_FKA flags */
/* /*
* FIP_DT_VENDOR descriptor. * FIP_DT_VENDOR descriptor.
*/ */
......
...@@ -155,6 +155,7 @@ struct fcoe_fcf { ...@@ -155,6 +155,7 @@ struct fcoe_fcf {
u8 pri; u8 pri;
u16 flags; u16 flags;
u32 fka_period; u32 fka_period;
u8 fd_flags:1;
}; };
/* FIP API functions */ /* FIP API functions */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment