[dpdk-dev] [PATCH v4 09/15] net/sfc: use new rte_eth_linkstatus functions
Andrew Rybchenko
arybchenko at solarflare.com
Fri Jan 12 08:45:34 CET 2018
On 01/11/2018 08:06 PM, Ferruh Yigit wrote:
> From: Stephen Hemminger <stephen at networkplumber.org>
>
> Use the new API (_rte_eth_linkstatus_set) to handle link status update.
>
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
> ---
> drivers/net/sfc/sfc_ethdev.c | 27 +++++++--------------------
> drivers/net/sfc/sfc_ev.c | 23 ++++-------------------
> 2 files changed, 11 insertions(+), 39 deletions(-)
<...>
> diff --git a/drivers/net/sfc/sfc_ev.c b/drivers/net/sfc/sfc_ev.c
> index 7abe61ae5..242b1fae4 100644
> --- a/drivers/net/sfc/sfc_ev.c
> +++ b/drivers/net/sfc/sfc_ev.c
> @@ -382,29 +382,14 @@ sfc_ev_link_change(void *arg, efx_link_mode_t link_mode)
> {
> struct sfc_evq *evq = arg;
> struct sfc_adapter *sa = evq->sa;
> - struct rte_eth_link *dev_link = &sa->eth_dev->data->dev_link;
> struct rte_eth_link new_link;
> - uint64_t new_link_u64;
> - uint64_t old_link_u64;
> -
> - EFX_STATIC_ASSERT(sizeof(*dev_link) == sizeof(rte_atomic64_t));
>
> sfc_port_link_mode_to_info(link_mode, &new_link);
> + if (_rte_eth_linkstatus_set(sa->eth_dev, &new_link) == 0)
> + return B_FALSE;
>
> - new_link_u64 = *(uint64_t *)&new_link;
> - do {
> - old_link_u64 = rte_atomic64_read((rte_atomic64_t *)dev_link);
> - if (old_link_u64 == new_link_u64)
> - break;
> -
> - if (rte_atomic64_cmpset((volatile uint64_t *)dev_link,
> - old_link_u64, new_link_u64)) {
> - evq->sa->port.lsc_seq++;
> - break;
> - }
> - } while (B_TRUE);
> -
> - return B_FALSE;
> + evq->sa->port.lsc_seq++;
> + return B_TRUE;
> }
>
> static const efx_ev_callbacks_t sfc_ev_callbacks = {
I've provided review notes for the callback a couple of times already,
but it is ignored.
The callback returns B_FALSE before the change and it must be preserved.
The return value must not depend on link status changes.
lsc_seq should be incremented in the case of any changes in link,
not up/down changes only and it should be preserved.
More information about the dev
mailing list