From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f49.google.com (mail-wm0-f49.google.com [74.125.82.49]) by dpdk.org (Postfix) with ESMTP id 59EB2AA38 for ; Wed, 8 Jun 2016 11:48:28 +0200 (CEST) Received: by mail-wm0-f49.google.com with SMTP id n184so173193662wmn.1 for ; Wed, 08 Jun 2016 02:48:28 -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=dKdxcE57riyKpT58uDoxBg9+ltnIvO2w46hI+icvXUI=; b=Uc3NlgXFmSbhsENiVMeAIBGiJY/fQcM0L9hDfScWv1OE5BmJOv2e/2SKc+xr4eh4QO xHPMKS6JdJSL+xHkXDCn6TWifKJSUIsHeUOC6ejas46q+PQNqhatDaMay86EwxsfMEel 64X34fJ5xUNYhFUeiM5ASSszQLRVMhu7oz5kQxfTX+PLP+r6A/1hUjDuGEpEfTzHBzoO cG2t8wFJ6QCp4NIqTOu7qFtVgcwrWIQbYnq3p8K3ck9mKLbOopCg/7YLtI5iYZqUK5GP 6mIDs9wOvkRdXtmoEDSrp3hcd+FOCAbD8BeXyUMd5QQIKzccwQsecoTmfmncmw8hqQKH sOlg== 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=dKdxcE57riyKpT58uDoxBg9+ltnIvO2w46hI+icvXUI=; b=SoJzjL983VjcOWXz50y5MM6AiovEZ/kxrNETFq0VAgsYmHIOgI7BNDY6VlKnvIJs/A JqT66xE96PPDLVDVB7wT/XsiVhBbY2exyKtSBbFoHYEw83aqexlQsYSCQKTQZnmCplRr zd7mQovC+DHJHtJmWrBKJpdWV6+3OeMwux3d1PLH0/nWyUqx6TRj81HqTKUanCFBZFGT acZlKKF3yhqILsjsadrn+f7jaquXsq2oamKkAU5h4kDQi7A0v1EL8i2WIZ1059Cp2REB 3MdU3klP08hvBi21n//It4Zl/2CdnMIKOVk0sCUFnAA1pUSq1wcIuKuF4eflhc3myldn FfGA== X-Gm-Message-State: ALyK8tKsSnlb1LQZr+iHmlyuBQAvg9XTrcbUndT3Z61DyxCNtT3jn4wpBj+zsmBfbhZ2csCD X-Received: by 10.194.83.103 with SMTP id p7mr3576127wjy.110.1465379307982; Wed, 08 Jun 2016 02:48:27 -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 c185sm23899214wme.9.2016.06.08.02.48.27 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 08 Jun 2016 02:48:27 -0700 (PDT) From: Nelio Laranjeiro To: dev@dpdk.org Cc: Adrien Mazarguil Date: Wed, 8 Jun 2016 11:47:58 +0200 Message-Id: <1465379291-25310-12-git-send-email-nelio.laranjeiro@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1465379291-25310-1-git-send-email-nelio.laranjeiro@6wind.com> References: <1465379291-25310-1-git-send-email-nelio.laranjeiro@6wind.com> Subject: [dpdk-dev] [PATCH 11/24] 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: Wed, 08 Jun 2016 09:48:28 -0000 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 4170e3b..382aac5 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -197,6 +197,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 3710bba..c612b31 100644 --- a/drivers/net/mlx5/mlx5_ethdev.c +++ b/drivers/net/mlx5/mlx5_ethdev.c @@ -1100,8 +1100,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 9f3a33b..d7cc39d 100644 --- a/drivers/net/mlx5/mlx5_txq.c +++ b/drivers/net/mlx5/mlx5_txq.c @@ -477,7 +477,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