Currently fcoemon cancels the timer as soon as a response is received whether all the critical descriptors are present or not. This patch verifies the critical descriptors are present in the vlan response before cancelling the timer.
Signed-off-by: Nithin Nayak Sujir <[email protected]> --- fcoemon.c | 20 ++++++++++++++++---- 1 files changed, 16 insertions(+), 4 deletions(-) diff --git a/fcoemon.c b/fcoemon.c index b12c8da..fa43a39 100644 --- a/fcoemon.c +++ b/fcoemon.c @@ -541,6 +541,12 @@ int fcm_vlan_disc_handler(struct fiphdr *fh, struct sockaddr_ll *sa, void *arg) struct fip_tlv_hdr *tlv = (struct fip_tlv_hdr *)(fh + 1); struct fcoe_port *p = arg; struct fcoe_port *vp; + int desc_mask = 0; + + enum { + VALID_MAC = 1, + VALID_VLAN = 2, + }; if (ntohs(fh->fip_proto) != FIP_PROTO_VLAN) return -1; @@ -548,14 +554,12 @@ int fcm_vlan_disc_handler(struct fiphdr *fh, struct sockaddr_ll *sa, void *arg) if (fh->fip_subcode != FIP_VLAN_NOTE) return -1; - /* cancel the retry timer, response received */ - sa_timer_cancel(&p->vlan_disc_timer); - while (len > 0) { switch (tlv->tlv_type) { case FIP_TLV_MAC_ADDR: memcpy(mac, ((struct fip_tlv_mac_addr *)tlv)->mac_addr, ETHER_ADDR_LEN); + desc_mask |= VALID_MAC; break; /* * this expects to see the MAC_ADDR TLV first, @@ -569,6 +573,7 @@ int fcm_vlan_disc_handler(struct fiphdr *fh, struct sockaddr_ll *sa, void *arg) vid = ntohs(((struct fip_tlv_vlan *)tlv)->vlan); vp = fcm_new_vlan(sa->sll_ifindex, vid); vp->dcb_required = p->dcb_required; + desc_mask |= VALID_VLAN; break; default: /* unexpected or unrecognized descriptor */ @@ -578,7 +583,14 @@ int fcm_vlan_disc_handler(struct fiphdr *fh, struct sockaddr_ll *sa, void *arg) len -= tlv->tlv_len; tlv = ((void *) tlv) + (tlv->tlv_len << 2); }; - return 0; + + if (desc_mask == (VALID_MAC | VALID_VLAN)) { + /* cancel the retry timer, valid response received */ + sa_timer_cancel(&p->vlan_disc_timer); + return 0; + } else { + return -1; + } } static void fcm_fip_recv(void *arg) -- 1.7.1 _______________________________________________ devel mailing list [email protected] https://lists.open-fcoe.org/mailman/listinfo/devel
