net/failsafe: fix Tx sub device deactivating
[dpdk.git] / drivers / net / failsafe / failsafe_private.h
index 80bbc61..ef646db 100644 (file)
@@ -108,6 +108,8 @@ struct sub_device {
        struct rte_eth_dev *fs_dev;
        /* flag calling for recollection */
        volatile unsigned int remove:1;
+       /* flow isolation state */
+       int flow_isolated:1;
 };
 
 struct fs_priv {
@@ -139,6 +141,8 @@ struct fs_priv {
         */
        enum dev_state state;
        unsigned int pending_alarm:1; /* An alarm is pending */
+       /* flow isolation state */
+       int flow_isolated:1;
 };
 
 /* MISC */
@@ -179,6 +183,9 @@ void failsafe_dev_remove(struct rte_eth_dev *dev);
 int failsafe_eth_rmv_event_callback(uint8_t port_id,
                                    enum rte_eth_event_type type,
                                    void *arg, void *out);
+int failsafe_eth_lsc_event_callback(uint8_t port_id,
+                                   enum rte_eth_event_type event,
+                                   void *cb_arg, void *out);
 
 /* GLOBALS */
 
@@ -327,7 +334,7 @@ fs_switch_dev(struct rte_eth_dev *dev,
        } else if ((txd && txd->state < req_state) ||
                   txd == NULL ||
                   txd == banned) {
-               struct sub_device *sdev;
+               struct sub_device *sdev = NULL;
                uint8_t i;
 
                /* Using acceptable device */
@@ -339,9 +346,10 @@ fs_switch_dev(struct rte_eth_dev *dev,
                        PRIV(dev)->subs_tx = i;
                        break;
                }
-       } else if (txd && txd->state < req_state) {
-               DEBUG("No device ready, deactivating tx_dev");
-               PRIV(dev)->subs_tx = PRIV(dev)->subs_tail;
+               if (i >= PRIV(dev)->subs_tail || sdev == NULL) {
+                       DEBUG("No device ready, deactivating tx_dev");
+                       PRIV(dev)->subs_tx = PRIV(dev)->subs_tail;
+               }
        } else {
                return;
        }