fcoe-utils/fcoe-utils-1.0.18-fcoeutils-Cancel-vlan-discovery-timer-only-when-vali.patch
Petr Sabata 9a79b1c7b8 1.0.18+ bump
BuildRoot and ExcludeArch cleanup
2011-04-20 11:03:37 +02:00

79 lines
2.4 KiB
Diff

From c76c44392b52e58cab9212eb94c19f59835240c7 Mon Sep 17 00:00:00 2001
From: Nithin Sujir <nsujir@broadcom.com>
Date: Wed, 23 Mar 2011 01:38:25 +0000
Subject: [PATCH 04/16] fcoeutils: Cancel vlan discovery timer only when valid
response is received
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 <nsujir@broadcom.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: Petr Sabata <psabata@redhat.com>
---
fcoemon.c | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/fcoemon.c b/fcoemon.c
index cd0916b..042d1c8 100644
--- a/fcoemon.c
+++ b/fcoemon.c
@@ -517,6 +517,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;
@@ -524,14 +530,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,
@@ -545,6 +549,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 */
@@ -554,7 +559,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.4.4