From: Vasu Dev <[email protected]>

Currently fcoemon does disable the interface on dcb becoming un-operational
but netlink event handling overrides and enables the interface before
dcb becomes operational again, so to fix that this patches tracks
enable/disable through existing unused per interface flag ff_enabled
such that enable has to be followed by disable once DCB is operational
again on link up and that prevents enabling interface on netlink event.

Signed-off-by: Vasu Dev <[email protected]>
---
 fcoemon.c |   17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/fcoemon.c b/fcoemon.c
index 6ed93ab..0d9e541 100644
--- a/fcoemon.c
+++ b/fcoemon.c
@@ -536,7 +536,7 @@ static void fcm_fc_event_handler(struct fc_nl_event 
*fc_event)
 
                /* find real interface port and re-activate again */
                p = fcm_find_fcoe_port(p->real_ifname, FCP_CFG_IFNAME);
-               if (p)
+               if (p && p->last_action != FCP_DISABLE_IF)
                        fcp_set_next_action(p, FCP_ACTIVATE_IF);
                break;
        default:
@@ -931,6 +931,7 @@ static void fcp_set_next_action(struct fcoe_port *p, enum 
fcp_action action)
                switch (action) {
                case FCP_CREATE_IF:
                case FCP_ACTIVATE_IF:
+               case FCP_ENABLE_IF:
                        if (p->auto_vlan)
                                p->action = FCP_VLAN_DISC;
                        else
@@ -1622,6 +1623,7 @@ static struct fcm_netif *fcm_netif_alloc(char *ifname)
        if (ff) {
                snprintf(ff->ifname, sizeof(ff->ifname), "%s", ifname);
                ff->ff_operstate = IF_OPER_UNKNOWN;
+               ff->ff_enabled = 1;
                TAILQ_INSERT_TAIL(&fcm_netif_head, ff, ff_list);
        } else {
                FCM_LOG_ERR(errno, "failed to allocate fcm_netif");
@@ -2117,7 +2119,13 @@ static enum fcp_action validate_dcbd_info(struct 
fcm_netif *ff)
                else
                        FCM_LOG_DEV_DBG(ff, "DCB is configured correctly\n");
 
-               return FCP_ACTIVATE_IF;
+
+               if (ff->ff_enabled)
+                       return FCP_ACTIVATE_IF;
+               else {
+                       ff->ff_enabled = 1;
+                       return FCP_ENABLE_IF;
+               }
        }
 
        /* check if dcb state qualifies to destroy the fcoe interface */
@@ -2140,6 +2148,7 @@ static enum fcp_action validate_dcbd_info(struct 
fcm_netif *ff)
                                    ff->ff_app_info.u.appcfg,
                                    ff->ff_pfc_info.u.pfcup);
 
+               ff->ff_enabled = 0;
                return FCP_DISABLE_IF;
        }
 
@@ -2737,6 +2746,10 @@ static void fcm_netif_advance(struct fcm_netif *ff)
                        fcp_action_set(ff->ifname, FCP_DESTROY_IF);
                        fcm_dcbd_state_set(ff, FCD_INIT);
                        break;
+               case FCP_ENABLE_IF:
+                       fcp_action_set(ff->ifname, FCP_ENABLE_IF);
+                       fcm_dcbd_state_set(ff, FCD_INIT);
+                       break;
                case FCP_DISABLE_IF:
                        fcp_action_set(ff->ifname, FCP_DISABLE_IF);
                        fcm_dcbd_state_set(ff, FCD_INIT);

_______________________________________________
devel mailing list
[email protected]
https://lists.open-fcoe.org/mailman/listinfo/devel

Reply via email to