From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f53.google.com (mail-wm0-f53.google.com [74.125.82.53]) by dpdk.org (Postfix) with ESMTP id 9A01BC5BE for ; Thu, 23 Jun 2016 19:05:49 +0200 (CEST) Received: by mail-wm0-f53.google.com with SMTP id r190so4916062wmr.0 for ; Thu, 23 Jun 2016 10:05:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BAdxyxgzRN87PZfgfU6YP23EP3gsDTUCq8o7m1sDzGY=; b=0wCwTDMeVUI8mLRb9ZDyHEWZm566RcWyNqySMZIoWJgfyYdjyvdGbHuNgemkZ9sNPZ M+LHjv56m/0CTObUxumr81XxYYMDgX668HA1R9kw0qnjrORsVhtRXgr4JGCNcgqPw6K8 T7iyOArsz6Bxr/ZShsH9CCDgcDuZ6vSUQMDlMAKxuZsS4F+dg6kg3LreJ96pfpwIWYuw roG2WlCgWkm89L5cktrYvrRAlpdA20pOPVPurXK1nH7j1Xa7wj7F8Q3eUQGvdehMJXyR 9lRtaFtFPovUGzpMx0x1Z7PVKwjxdRUabas7YQ5/b6VadIjDMPLtvgOEsd6z/3lVM1dt EK5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BAdxyxgzRN87PZfgfU6YP23EP3gsDTUCq8o7m1sDzGY=; b=SFNRg3WXdLUigTvlMAQFk/UGFLTDz+LjlBSYHxMKepF16+HfRIYBhupW+oyZT51ePB Rqm5BdfVluLMg5DC6LVGvK80hLim8t7Bn/D0n5kjpq+dZqwRcujE3IGu9dB4zrWDUQbf 7UbXnn/8mz5NSVv1Zb+fMYNSqnielGHqo+NaSa3IeuG2iIFlOywshuT91sMUgE2HRXLG VxvxBzZjTXYS4+O0N4i5n5Qiiq4avU1TGfYiRCxWiJgguq4QenISfi8rNJ5XyYuNGA20 D+5FIqs9SdPiO2WoEIWw8dbM5d4YLEwnppv9jNxTL7l5nybjquyk7Sz9E2/tQy+SC/bp KgIw== X-Gm-Message-State: ALyK8tIcZmsl/loMiOwMvAayH9QKy42zHKssCdcLcMPn9jyjIPbBZpCQoyHECCTe1uCxpMKI X-Received: by 10.194.104.196 with SMTP id gg4mr34565639wjb.112.1466701549381; Thu, 23 Jun 2016 10:05:49 -0700 (PDT) Received: from ping.vm.6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id q63sm4770644wma.0.2016.06.23.10.05.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 23 Jun 2016 10:05:48 -0700 (PDT) From: Nelio Laranjeiro To: dev@dpdk.org Cc: Ferruh Yigit , Adrien Mazarguil Date: Thu, 23 Jun 2016 19:05:10 +0200 Message-Id: <1466700801-10383-11-git-send-email-nelio.laranjeiro@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1466700801-10383-1-git-send-email-nelio.laranjeiro@6wind.com> References: <1466586355-30777-1-git-send-email-nelio.laranjeiro@6wind.com> <1466700801-10383-1-git-send-email-nelio.laranjeiro@6wind.com> Subject: [dpdk-dev] [PATCH v5 12/25] mlx5: add Tx/Rx burst function selection wrapper 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: Thu, 23 Jun 2016 17:05:49 -0000 Content-Type: text/plain; charset="UTF-8" Message-ID: <20160623170510.NMvFGAPDVvZgdDB1nigV9LhSKd31xB49lwrvJDGqsGM@z> These wrappers are meant to prevent code duplication later. Signed-off-by: Nelio Laranjeiro Signed-off-by: Adrien Mazarguil --- drivers/net/mlx5/mlx5.h | 2 ++ drivers/net/mlx5/mlx5_ethdev.c | 34 ++++++++++++++++++++++++++++------ drivers/net/mlx5/mlx5_txq.c | 2 +- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 935e1b0..3dca03d 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -196,6 +196,8 @@ void priv_dev_interrupt_handler_install(struct priv *, struct rte_eth_dev *); int mlx5_set_link_down(struct rte_eth_dev *dev); int mlx5_set_link_up(struct rte_eth_dev *dev); struct priv *mlx5_secondary_data_setup(struct priv *priv); +void priv_select_tx_function(struct priv *); +void priv_select_rx_function(struct priv *); /* mlx5_mac.c */ diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c index 4095a06..759434e 100644 --- a/drivers/net/mlx5/mlx5_ethdev.c +++ b/drivers/net/mlx5/mlx5_ethdev.c @@ -1099,8 +1099,8 @@ priv_set_link(struct priv *priv, int up) err = priv_set_flags(priv, ~IFF_UP, IFF_UP); if (err) return err; - dev->rx_pkt_burst = mlx5_rx_burst; - dev->tx_pkt_burst = mlx5_tx_burst; + priv_select_tx_function(priv); + priv_select_rx_function(priv); } else { err = priv_set_flags(priv, ~IFF_UP, ~IFF_UP); if (err) @@ -1290,13 +1290,11 @@ mlx5_secondary_data_setup(struct priv *priv) rte_mb(); priv->dev->data = &sd->data; rte_mb(); - priv->dev->tx_pkt_burst = mlx5_tx_burst; - priv->dev->rx_pkt_burst = removed_rx_burst; + priv_select_tx_function(priv); + priv_select_rx_function(priv); priv_unlock(priv); end: /* More sanity checks. */ - assert(priv->dev->tx_pkt_burst == mlx5_tx_burst); - assert(priv->dev->rx_pkt_burst == removed_rx_burst); assert(priv->dev->data == &sd->data); rte_spinlock_unlock(&sd->lock); return priv; @@ -1307,3 +1305,27 @@ error: rte_spinlock_unlock(&sd->lock); return NULL; } + +/** + * Configure the TX function to use. + * + * @param priv + * Pointer to private structure. + */ +void +priv_select_tx_function(struct priv *priv) +{ + priv->dev->tx_pkt_burst = mlx5_tx_burst; +} + +/** + * Configure the RX function to use. + * + * @param priv + * Pointer to private structure. + */ +void +priv_select_rx_function(struct priv *priv) +{ + priv->dev->rx_pkt_burst = mlx5_rx_burst; +} diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c index 51210f2..ec4488a 100644 --- a/drivers/net/mlx5/mlx5_txq.c +++ b/drivers/net/mlx5/mlx5_txq.c @@ -478,7 +478,7 @@ mlx5_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, (void *)dev, (void *)txq_ctrl); (*priv->txqs)[idx] = &txq_ctrl->txq; /* Update send callback. */ - dev->tx_pkt_burst = mlx5_tx_burst; + priv_select_tx_function(priv); } priv_unlock(priv); return -ret; -- 2.1.4