Currently with fcoe-utils if the FIP VLAN request fails or is not supported by the FCF then discovery will fail since the tools will not know which VLAN to send FIP traffic. To add another level of tolerance to the openfcoe tools, add a configuration parameter where user can specify a manual VLAN for FIP traffic to be sent on if the FIP VLAN request fails or is not supported by the FCF.
Signed-off-by: Chad Dupuis <[email protected]> Signed-off-by: Sawan Chandak <[email protected]> --- fcoemon.c | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/fcoemon.c b/fcoemon.c index c0af99b..5578680 100644 --- a/fcoemon.c +++ b/fcoemon.c @@ -105,6 +105,7 @@ #define CFG_IF_VAR_AUTOVLAN "AUTO_VLAN" #define CFG_IF_VAR_MODE "MODE" #define CFG_IF_VAR_FIP_RESP "FIP_RESP" +#define CFG_IF_VAR_DEFAULTVLAN "DEFAULT_VLAN" enum fcoe_mode { FCOE_MODE_FABRIC = 0, @@ -135,6 +136,9 @@ struct fcoe_port { int auto_vlan; int auto_created; int ready; + int default_vlan; + int default_vlan_set; + int default_vid; /* following track data required to manage FCoE interface state */ enum fcp_action action; /* current state */ @@ -603,6 +607,24 @@ static int fcm_read_config_files(void) if (!strncasecmp(val, "vn2vn", 5) && rc == 1) next->mode = FCOE_MODE_VN2VN; + /* DEFAULT_VLAN ID */ + rc = fcm_read_config_variable(file, val, sizeof(val), + fp, CFG_IF_VAR_DEFAULTVLAN); + if (rc < 0) { + FCM_LOG("Invalid format for %s variable in %s", + CFG_IF_VAR_DEFAULTVLAN, file); + fclose(fp); + free(next); + continue; + } + + /* if found, set default vlan id */ + if (atoi(val) > 0 && rc == 1) { + next->default_vlan = 1; + next->default_vid = atoi(val); + FCM_LOG("Default VLAN ID = %d", next->default_vid); + } + fclose(fp); if (!fcoe_config.port) { @@ -1007,9 +1029,18 @@ fcm_vlan_disc_handler(struct fiphdr *fh, struct sockaddr_ll *sa, void *arg) case FIP_TLV_VLAN: if (tlv->tlv_len != 1) { FCM_LOG_ERR(EINVAL, "bad length on VLAN TLV"); - break; + if (p->default_vlan) { + FCM_LOG_DBG("%s: Default VLAN set\n", __func__); + p->default_vlan_set =1; + } + else + break; } - vid = ntohs(((struct fip_tlv_vlan *)tlv)->vlan); + + if (p-> default_vlan && p->default_vlan_set) + vid = p->default_vid; + else + vid = ntohs(((struct fip_tlv_vlan *)tlv)->vlan); FCM_LOG_DBG("%s: vid=%d\n", __func__, vid); if (vid) { vp = fcm_new_vlan(sa->sll_ifindex, vid, vn2vn); @@ -2907,6 +2938,14 @@ void fcm_vlan_disc_timeout(void *arg) p->vlan_disc_count++; fcm_send_fip_request(p); sa_timer_set(&p->vlan_disc_timer, FCM_VLAN_DISC_TIMEOUT); + if ( p->vlan_disc_count >= 3) { + if (p->default_vlan) { + p->default_vlan_set = 1; + FCM_LOG_DBG("%s: Default VLAN set [%d]", + p->ifname, p->default_vid); + } + } + } static int fcm_start_vlan_disc(struct fcoe_port *p) @@ -3254,6 +3293,9 @@ static void fcm_dump(void) FCM_LOG("auto_vlan: %d\n", curr->auto_vlan); FCM_LOG("auto_created: %d\n", curr->auto_created); FCM_LOG("ready: %d\n", curr->ready); + FCM_LOG("default_vlan: %d\n", curr->default_vlan); + FCM_LOG("default_vlan_set: %d\n", curr->default_vlan_set); + FCM_LOG("default_vid: %d\n", curr->default_vid); FCM_LOG("action: %d\n", curr->action); FCM_LOG("last_action: %d\n", curr->last_action); FCM_LOG("last_msg_type: %d\n", curr->last_msg_type); -- 2.0.0.rc0.26.g779792a _______________________________________________ fcoe-devel mailing list [email protected] http://lists.open-fcoe.org/mailman/listinfo/fcoe-devel
