X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Ffailsafe%2Ffailsafe_private.h;h=d343ebf676d705c8e7b8d4e3dffa2fcc78dbb70a;hb=6681b845034c;hp=80bbc613d6971c2e39808f4232d9c610828817dd;hpb=598fb8aec6f6c8618a2425789e12fc352f120858;p=dpdk.git diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h index 80bbc613d6..d343ebf676 100644 --- a/drivers/net/failsafe/failsafe_private.h +++ b/drivers/net/failsafe/failsafe_private.h @@ -102,12 +102,16 @@ struct sub_device { uint8_t sid; /* Device state machine */ enum dev_state state; + /* Last stats snapshot passed to user */ + struct rte_eth_stats stats_snapshot; /* Some device are defined as a command line */ char *cmdline; /* fail-safe device backreference */ 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 { @@ -138,7 +142,10 @@ struct fs_priv { * synchronized state. */ enum dev_state state; + struct rte_eth_stats stats_accumulator; unsigned int pending_alarm:1; /* An alarm is pending */ + /* flow isolation state */ + int flow_isolated:1; }; /* MISC */ @@ -176,9 +183,14 @@ int failsafe_eal_uninit(struct rte_eth_dev *dev); int failsafe_eth_dev_state_sync(struct rte_eth_dev *dev); void failsafe_dev_remove(struct rte_eth_dev *dev); -int failsafe_eth_rmv_event_callback(uint8_t port_id, +void failsafe_stats_increment(struct rte_eth_stats *to, + struct rte_eth_stats *from); +int failsafe_eth_rmv_event_callback(uint16_t port_id, enum rte_eth_event_type type, void *arg, void *out); +int failsafe_eth_lsc_event_callback(uint16_t port_id, + enum rte_eth_event_type event, + void *cb_arg, void *out); /* GLOBALS */ @@ -213,10 +225,10 @@ extern int mac_from_arg; * dev: (struct rte_eth_dev *), fail-safe ethdev * state: (enum dev_state), minimum acceptable device state */ -#define FOREACH_SUBDEV_STATE(s, i, dev, state) \ - for (i = fs_find_next((dev), 0, state); \ - i < PRIV(dev)->subs_tail && (s = &PRIV(dev)->subs[i]); \ - i = fs_find_next((dev), i + 1, state)) +#define FOREACH_SUBDEV_STATE(s, i, dev, state) \ + for (s = fs_find_next((dev), 0, state, &i); \ + s != NULL; \ + s = fs_find_next((dev), i + 1, state, &i)) /** * Iterator construct over fail-safe sub-devices: @@ -287,18 +299,26 @@ extern int mac_from_arg; /* inlined functions */ -static inline uint8_t -fs_find_next(struct rte_eth_dev *dev, uint8_t sid, - enum dev_state min_state) +static inline struct sub_device * +fs_find_next(struct rte_eth_dev *dev, + uint8_t sid, + enum dev_state min_state, + uint8_t *sid_out) { - while (sid < PRIV(dev)->subs_tail) { - if (PRIV(dev)->subs[sid].state >= min_state) + struct sub_device *subs; + uint8_t tail; + + subs = PRIV(dev)->subs; + tail = PRIV(dev)->subs_tail; + while (sid < tail) { + if (subs[sid].state >= min_state) break; sid++; } - if (sid >= PRIV(dev)->subs_tail) - return PRIV(dev)->subs_tail; - return sid; + *sid_out = sid; + if (sid >= tail) + return NULL; + return &subs[sid]; } /* @@ -327,7 +347,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 +359,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; }