From: John Daley Subject: [PATCH v2] net/enic: pick the right Rx handler after changing MTU Date: Tue, 17 Jul 2018 19:02:16 -0700 Message-ID: <20180718020216.10821-1-johndale@cisco.com> References: <20180714005452.28195-1-johndale@cisco.com> Cc: dev@dpdk.org, Hyong Youb Kim To: ferruh.yigit@intel.com Return-path: Received: from alln-iport-6.cisco.com (alln-iport-6.cisco.com [173.37.142.93]) by dpdk.org (Postfix) with ESMTP id D41502BC9 for ; Wed, 18 Jul 2018 04:02:23 +0200 (CEST) In-Reply-To: <20180714005452.28195-1-johndale@cisco.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Hyong Youb Kim enic_set_mtu always reverts to the default Rx handler after changing MTU. Try to use the simpler, non-scatter handler in this case as well. Fixes: 35e2cb6a1795 ("net/enic: add simple Rx handler") Signed-off-by: Hyong Youb Kim Reviewed-by: John Daley --- v2: remember to actually assign default handler drivers/net/enic/enic_main.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index c8456c4b7..f04dc0878 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c @@ -514,6 +514,21 @@ static void enic_prep_wq_for_simple_tx(struct enic *enic, uint16_t queue_idx) } } +static void pick_rx_handler(struct enic *enic) +{ + struct rte_eth_dev *eth_dev; + + /* Use the non-scatter, simplified RX handler if possible. */ + eth_dev = enic->rte_dev; + if (enic->rq_count > 0 && enic->rq[0].data_queue_enable == 0) { + PMD_INIT_LOG(DEBUG, " use the non-scatter Rx handler"); + eth_dev->rx_pkt_burst = &enic_noscatter_recv_pkts; + } else { + PMD_INIT_LOG(DEBUG, " use the normal Rx handler"); + eth_dev->rx_pkt_burst = &enic_recv_pkts; + } +} + int enic_enable(struct enic *enic) { unsigned int index; @@ -571,13 +586,7 @@ int enic_enable(struct enic *enic) eth_dev->tx_pkt_burst = &enic_xmit_pkts; } - /* Use the non-scatter, simplified RX handler if possible. */ - if (enic->rq_count > 0 && enic->rq[0].data_queue_enable == 0) { - PMD_INIT_LOG(DEBUG, " use the non-scatter Rx handler"); - eth_dev->rx_pkt_burst = &enic_noscatter_recv_pkts; - } else { - PMD_INIT_LOG(DEBUG, " use the normal Rx handler"); - } + pick_rx_handler(enic); for (index = 0; index < enic->wq_count; index++) enic_start_wq(enic, index); @@ -1550,7 +1559,7 @@ int enic_set_mtu(struct enic *enic, uint16_t new_mtu) /* put back the real receive function */ rte_mb(); - eth_dev->rx_pkt_burst = enic_recv_pkts; + pick_rx_handler(enic); rte_mb(); /* restart Rx traffic */ -- 2.16.2