All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pawel Wodkowski <pawelx.wodkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Eric Kinzie <ehkinzie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"dev-VfR2kkLFssw@public.gmane.org"
	<dev-VfR2kkLFssw@public.gmane.org>
Subject: Re: [PATCH 4/5] bond mode 4: allow external state machine
Date: Tue, 07 Apr 2015 16:18:08 +0200	[thread overview]
Message-ID: <5523E720.2050207@intel.com> (raw)
In-Reply-To: <1428339685-27686-5-git-send-email-ehkinzie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On 2015-04-06 19:01, Eric Kinzie wrote:

Interesting patch. I will closer look at this tomorrow.

For now I have first comments:

> +static void bond_mode_8023ad_ext_periodic_cb(void *arg);
> +
>   #ifdef RTE_LIBRTE_BOND_DEBUG_8023AD
>   #define MODE4_DEBUG(fmt, ...) RTE_LOG(DEBUG, PMD, "%6u [Port %u: %s] " fmt, \
>   			bond_dbg_get_time_diff_ms(), slave_id, \
> @@ -1014,6 +1016,8 @@ bond_mode_8023ad_conf_get(struct rte_eth_dev *dev,
>   	conf->tx_period_ms = mode4->tx_period_timeout / ms_ticks;
>   	conf->update_timeout_ms = mode4->update_timeout_us / 1000;
>   	conf->rx_marker_period_ms = mode4->rx_marker_timeout / ms_ticks;
> +	conf->slowrx_cb = mode4->slowrx_cb;
> +	conf->external_sm = mode4->external_sm;

mode4->external_sm flag realy needed? Why do not use mode4->slowrx_cb as 
external state machine indicator?

>   }
>
>   void
> @@ -1035,6 +1039,8 @@ bond_mode_8023ad_setup(struct rte_eth_dev *dev,
>   		conf->tx_period_ms = BOND_8023AD_TX_MACHINE_PERIOD_MS;
>   		conf->rx_marker_period_ms = BOND_8023AD_RX_MARKER_PERIOD_MS;
>   		conf->update_timeout_ms = BOND_MODE_8023AX_UPDATE_TIMEOUT_MS;
> +		conf->slowrx_cb = NULL;
> +		conf->external_sm = 0;
>   	}
>
>   	mode4->fast_periodic_timeout = conf->fast_periodic_ms * ms_ticks;
> @@ -1045,6 +1051,8 @@ bond_mode_8023ad_setup(struct rte_eth_dev *dev,
>   	mode4->tx_period_timeout = conf->tx_period_ms * ms_ticks;
>   	mode4->rx_marker_timeout = conf->rx_marker_period_ms * ms_ticks;
>   	mode4->update_timeout_us = conf->update_timeout_ms * 1000;
> +	mode4->slowrx_cb = conf->slowrx_cb;
> +	mode4->external_sm = conf->external_sm;
>   }
>
>   int
> @@ -1062,6 +1070,13 @@ bond_mode_8023ad_enable(struct rte_eth_dev *bond_dev)
>   int
>   bond_mode_8023ad_start(struct rte_eth_dev *bond_dev)
>   {
> +	struct bond_dev_private *internals = bond_dev->data->dev_private;
> +	struct mode8023ad_private *mode4 = &internals->mode4;
> +
> +	if (mode4->external_sm)
> +		return rte_eal_alarm_set(BOND_MODE_8023AX_UPDATE_TIMEOUT_MS * 1000,
> +			&bond_mode_8023ad_ext_periodic_cb, bond_dev);
> +
>   	return rte_eal_alarm_set(BOND_MODE_8023AX_UPDATE_TIMEOUT_MS * 1000,
>   			&bond_mode_8023ad_periodic_cb, bond_dev);
>   }
> @@ -1069,6 +1084,13 @@ bond_mode_8023ad_start(struct rte_eth_dev *bond_dev)
>   void
>   bond_mode_8023ad_stop(struct rte_eth_dev *bond_dev)
>   {
> +	struct bond_dev_private *internals = bond_dev->data->dev_private;
> +	struct mode8023ad_private *mode4 = &internals->mode4;
> +
> +	if (mode4->external_sm) {

This is bad idea. If bond_mode_8023ad_setup will be called you might 
have two handlers running for while. You should stop mode 4 by invoking 
bond_mode_8023ad_stop() before you set mode4->external_sm and then, if 
mode 4 was running, start it again.

Also, maybe a renaming "external_sm" to "state_machine_cb", set it to 
against default one and using it without "if()" will simplify code. It 
is no crucial but will eliminate couple of if's. In 
rte_eth_bond_8023ad_ext_slowtx() you can compare it against default one.

> +		rte_eal_alarm_cancel(&bond_mode_8023ad_ext_periodic_cb, bond_dev);
> +		return;
> +	}
>   	rte_eal_alarm_cancel(&bond_mode_8023ad_periodic_cb, bond_dev);
>   }
>
> @@ -1215,3 +1237,156 @@ rte_eth_bond_8023ad_slave_info(uint8_t port_id, uint8_t slave_id,
>   	info->agg_port_id = port->aggregator_port_id;
>   	return 0;
>   }

-- 
Pawel

  parent reply	other threads:[~2015-04-07 14:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-06 17:01 [PATCH 0/5] bonding corrections and additions Eric Kinzie
     [not found] ` <1428339685-27686-1-git-send-email-ehkinzie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-04-06 17:01   ` [PATCH 1/5] bond: use existing enslaved device queues Eric Kinzie
     [not found]     ` <1428339685-27686-2-git-send-email-ehkinzie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-04-10  7:40       ` Pawel Wodkowski
     [not found]         ` <55277E59.1020200-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-04-14 14:29           ` Eric Kinzie
     [not found]             ` <20150414142920.GA24843-5G/Vjf02Nsf/9pzu0YdTqQ@public.gmane.org>
2015-04-14 14:34               ` Wodkowski, PawelX
2015-04-06 17:01   ` [PATCH 2/5] bond mode 4: copy entire config structure Eric Kinzie
     [not found]     ` <1428339685-27686-3-git-send-email-ehkinzie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-04-10  7:47       ` Pawel Wodkowski
     [not found]         ` <55278003.2090706-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-04-10  7:55           ` Thomas Monjalon
2015-04-06 17:01   ` [PATCH 3/5] bond mode 4: do not ignore multicast Eric Kinzie
     [not found]     ` <1428339685-27686-4-git-send-email-ehkinzie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-04-10  7:56       ` Pawel Wodkowski
2015-04-06 17:01   ` [PATCH 4/5] bond mode 4: allow external state machine Eric Kinzie
     [not found]     ` <1428339685-27686-5-git-send-email-ehkinzie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-04-07 14:18       ` Pawel Wodkowski [this message]
     [not found]         ` <5523E720.2050207-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-04-07 14:37           ` Pawel Wodkowski
2015-04-07 17:31           ` Eric Kinzie
2015-04-10  8:29       ` Pawel Wodkowski
2015-04-06 17:01   ` [PATCH 5/5] bond mode 4: tests for " Eric Kinzie
     [not found]     ` <1428339685-27686-6-git-send-email-ehkinzie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-04-10  8:41       ` Pawel Wodkowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5523E720.2050207@intel.com \
    --to=pawelx.wodkowski-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.org \
    --cc=ehkinzie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.