netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tariq Toukan <tariqt@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Eran Ben Elisha <eranbe@mellanox.com>,
	Saeed Mahameed <saeedm@mellanox.com>,
	Jakub Kicinski <jakub.kicinski@netronome.com>,
	moshe@mellanox.com, Tariq Toukan <tariqt@mellanox.com>
Subject: [PATCH net-next 07/12] net/mlx5e: Tx, Make SQ WQE fetch function type generic
Date: Fri,  5 Jul 2019 18:30:17 +0300	[thread overview]
Message-ID: <1562340622-4423-8-git-send-email-tariqt@mellanox.com> (raw)
In-Reply-To: <1562340622-4423-1-git-send-email-tariqt@mellanox.com>

Change mlx5e_sq_fetch_wqe to be agnostic to the Work Queue
Element (WQE) type.
Before this patch, it was specific for struct mlx5e_tx_wqe.

In order to allow the change, the function now returns the
generic void pointer, and gets the WQE size to do the zero
memset.

Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h           | 12 +++++++-----
 drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_rxtx.c |  2 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_tx.c             |  4 ++--
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h b/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h
index bd41f89afef1..1280f4163b53 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h
@@ -14,15 +14,17 @@
 	return (mlx5_wq_cyc_ctr2ix(wq, cc - pc) >= n) || (cc == pc);
 }
 
-static inline void mlx5e_sq_fetch_wqe(struct mlx5e_txqsq *sq,
-				      struct mlx5e_tx_wqe **wqe,
-				      u16 *pi)
+static inline void *
+mlx5e_sq_fetch_wqe(struct mlx5e_txqsq *sq, size_t size, u16 *pi)
 {
 	struct mlx5_wq_cyc *wq = &sq->wq;
+	void *wqe;
 
 	*pi  = mlx5_wq_cyc_ctr2ix(wq, sq->pc);
-	*wqe = mlx5_wq_cyc_get_wqe(wq, *pi);
-	memset(*wqe, 0, sizeof(**wqe));
+	wqe = mlx5_wq_cyc_get_wqe(wq, *pi);
+	memset(wqe, 0, size);
+
+	return wqe;
 }
 
 static inline struct mlx5e_tx_wqe *
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_rxtx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_rxtx.c
index 439bf5953885..7d191d98ac94 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_rxtx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_rxtx.c
@@ -248,7 +248,7 @@ static void mlx5e_tls_complete_sync_skb(struct sk_buff *skb,
 	mlx5e_tls_complete_sync_skb(skb, nskb, tcp_seq, headln,
 				    cpu_to_be64(info.rcd_sn));
 	mlx5e_sq_xmit(sq, nskb, *wqe, *pi, true);
-	mlx5e_sq_fetch_wqe(sq, wqe, pi);
+	*wqe = mlx5e_sq_fetch_wqe(sq, sizeof(**wqe), pi);
 	return skb;
 
 err_out:
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
index b1a163e66053..983ea6206a94 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
@@ -335,7 +335,7 @@ netdev_tx_t mlx5e_sq_xmit(struct mlx5e_txqsq *sq, struct sk_buff *skb,
 		struct mlx5_wqe_eth_seg cur_eth = wqe->eth;
 #endif
 		mlx5e_fill_sq_frag_edge(sq, wq, pi, contig_wqebbs_room);
-		mlx5e_sq_fetch_wqe(sq, &wqe, &pi);
+		wqe = mlx5e_sq_fetch_wqe(sq, sizeof(*wqe), &pi);
 #ifdef CONFIG_MLX5_EN_IPSEC
 		wqe->eth = cur_eth;
 #endif
@@ -397,7 +397,7 @@ netdev_tx_t mlx5e_xmit(struct sk_buff *skb, struct net_device *dev)
 	u16 pi;
 
 	sq = priv->txq2sq[skb_get_queue_mapping(skb)];
-	mlx5e_sq_fetch_wqe(sq, &wqe, &pi);
+	wqe = mlx5e_sq_fetch_wqe(sq, sizeof(*wqe), &pi);
 
 	/* might send skbs and update wqe and pi */
 	skb = mlx5e_accel_handle_tx(skb, sq, dev, &wqe, &pi);
-- 
1.8.3.1


  parent reply	other threads:[~2019-07-05 15:30 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-05 15:30 [PATCH net-next 00/12] mlx5 TLS TX HW offload support Tariq Toukan
2019-07-05 15:30 ` [PATCH net-next 01/12] net/mlx5: Accel, Expose accel wrapper for IPsec FPGA function Tariq Toukan
2019-07-05 15:30 ` [PATCH net-next 02/12] net/mlx5: Kconfig, Better organize compilation flags Tariq Toukan
2019-07-05 15:30 ` [PATCH net-next 03/12] net/mlx5: Add crypto library to support create/destroy encryption key Tariq Toukan
2019-07-05 15:30 ` [PATCH net-next 04/12] net/mlx5: Accel, Add core TLS support for the Connect-X family Tariq Toukan
2019-07-05 15:30 ` [PATCH net-next 05/12] net/mlx5e: Move helper functions to a new txrx datapath header Tariq Toukan
2019-07-05 15:30 ` [PATCH net-next 06/12] net/mlx5e: Tx, Enforce L4 inline copy when needed Tariq Toukan
2019-07-05 15:30 ` Tariq Toukan [this message]
2019-07-05 15:30 ` [PATCH net-next 08/12] net/mlx5e: Tx, Don't implicitly assume SKB-less wqe has one WQEBB Tariq Toukan
2019-07-05 15:30 ` [PATCH net-next 09/12] net/mlx5e: Tx, Unconstify SQ stop room Tariq Toukan
2019-07-05 15:30 ` [PATCH net-next 10/12] net/mlx5e: Re-work TIS creation functions Tariq Toukan
2019-07-05 15:30 ` [PATCH net-next 11/12] net/mlx5e: Introduce a fenced NOP WQE posting function Tariq Toukan
2019-07-05 15:30 ` [PATCH net-next 12/12] net/mlx5e: Add kTLS TX HW offload support Tariq Toukan
2019-07-05 20:17   ` Jakub Kicinski
2019-07-05 20:19 ` [PATCH net-next 00/12] mlx5 TLS " Jakub Kicinski
2019-07-05 23:29 ` David Miller
2019-07-07  6:44   ` Tariq Toukan
2019-07-17 17:41     ` Jakub Kicinski
2019-07-18  7:40       ` Tariq Toukan
2019-07-18 17:08         ` Jakub Kicinski
2019-07-18 19:09           ` David Miller
2019-07-21 15:19             ` Tariq Toukan

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=1562340622-4423-8-git-send-email-tariqt@mellanox.com \
    --to=tariqt@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=eranbe@mellanox.com \
    --cc=jakub.kicinski@netronome.com \
    --cc=moshe@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@mellanox.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).