From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id AE204377A for ; Tue, 7 Apr 2015 16:18:55 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 07 Apr 2015 07:18:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,538,1422950400"; d="scan'208";a="676354409" Received: from unknown (HELO [10.217.248.56]) ([10.217.248.56]) by orsmga001.jf.intel.com with ESMTP; 07 Apr 2015 07:18:51 -0700 Message-ID: <5523E720.2050207@intel.com> Date: Tue, 07 Apr 2015 16:18:08 +0200 From: Pawel Wodkowski User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Eric Kinzie , "dev@dpdk.org" References: <1428339685-27686-1-git-send-email-ehkinzie@gmail.com> <1428339685-27686-5-git-send-email-ehkinzie@gmail.com> In-Reply-To: <1428339685-27686-5-git-send-email-ehkinzie@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 4/5] bond mode 4: allow external state machine X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2015 14:18:56 -0000 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