Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Sep 2016 08:29:28 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r306245 - stable/10/sys/dev/mlx5/mlx5_en
Message-ID:  <201609230829.u8N8TSD4052310@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Fri Sep 23 08:29:27 2016
New Revision: 306245
URL: https://svnweb.freebsd.org/changeset/base/306245

Log:
  MFC r305868:
  mlx5en: Separate the sendqueue from using the mlx5e_channel structure.
  
  This change allows for reusing the transmit path for so called
  rate limited senqueues. While at it optimise some pointer lookups
  in the fast path.
  
  Sponsored by:	Mellanox Technologies

Modified:
  stable/10/sys/dev/mlx5/mlx5_en/en.h
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_txrx.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mlx5/mlx5_en/en.h
==============================================================================
--- stable/10/sys/dev/mlx5/mlx5_en/en.h	Fri Sep 23 08:28:44 2016	(r306244)
+++ stable/10/sys/dev/mlx5/mlx5_en/en.h	Fri Sep 23 08:29:27 2016	(r306245)
@@ -439,9 +439,9 @@ struct mlx5e_cq {
 
 	/* data path - accessed per HW polling */
 	struct mlx5_core_cq mcq;
-	struct mlx5e_channel *channel;
 
 	/* control */
+	struct mlx5e_priv *priv;
 	struct mlx5_wq_ctrl wq_ctrl;
 } __aligned(MLX5E_CACHELINE_SIZE);
 
@@ -525,6 +525,7 @@ struct mlx5e_sq {
 	struct	mlx5_wq_cyc wq;
 	void	__iomem *uar_map;
 	void	__iomem *uar_bf_map;
+	struct	ifnet *ifp;
 	u32	sqn;
 	u32	bf_buf_size;
 	struct  device *pdev;
@@ -533,7 +534,7 @@ struct mlx5e_sq {
 	/* control path */
 	struct	mlx5_wq_ctrl wq_ctrl;
 	struct	mlx5_uar uar;
-	struct	mlx5e_channel *channel;
+	struct	mlx5e_priv *priv;
 	int	tc;
 	unsigned int queue_state;
 } __aligned(MLX5E_CACHELINE_SIZE);

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==============================================================================
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c	Fri Sep 23 08:28:44 2016	(r306244)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c	Fri Sep 23 08:29:27 2016	(r306245)
@@ -988,7 +988,8 @@ mlx5e_create_sq(struct mlx5e_channel *c,
 
 	sq->pdev = c->pdev;
 	sq->mkey_be = c->mkey_be;
-	sq->channel = c;
+	sq->ifp = priv->ifp;
+	sq->priv = priv;
 	sq->tc = tc;
 
 	sq->br = buf_ring_alloc(MLX5E_SQ_TX_QUEUE_SIZE, M_MLX5EN,
@@ -1045,15 +1046,12 @@ done:
 static void
 mlx5e_destroy_sq(struct mlx5e_sq *sq)
 {
-	struct mlx5e_channel *c = sq->channel;
-	struct mlx5e_priv *priv = c->priv;
-
 	/* destroy all sysctl nodes */
 	sysctl_ctx_free(&sq->stats.ctx);
 
 	mlx5e_free_sq_db(sq);
 	mlx5_wq_destroy(&sq->wq_ctrl);
-	mlx5_unmap_free_uar(priv->mdev, &sq->uar);
+	mlx5_unmap_free_uar(sq->priv->mdev, &sq->uar);
 	taskqueue_drain(sq->sq_tq, &sq->sq_task);
 	taskqueue_free(sq->sq_tq);
 	buf_ring_free(sq->br, M_MLX5EN);
@@ -1062,10 +1060,6 @@ mlx5e_destroy_sq(struct mlx5e_sq *sq)
 static int
 mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param)
 {
-	struct mlx5e_channel *c = sq->channel;
-	struct mlx5e_priv *priv = c->priv;
-	struct mlx5_core_dev *mdev = priv->mdev;
-
 	void *in;
 	void *sqc;
 	void *wq;
@@ -1083,8 +1077,8 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, str
 
 	memcpy(sqc, param->sqc, sizeof(param->sqc));
 
-	MLX5_SET(sqc, sqc, tis_num_0, priv->tisn[sq->tc]);
-	MLX5_SET(sqc, sqc, cqn, c->sq[sq->tc].cq.mcq.cqn);
+	MLX5_SET(sqc, sqc, tis_num_0, sq->priv->tisn[sq->tc]);
+	MLX5_SET(sqc, sqc, cqn, sq->cq.mcq.cqn);
 	MLX5_SET(sqc, sqc, state, MLX5_SQC_STATE_RST);
 	MLX5_SET(sqc, sqc, tis_lst_sz, 1);
 	MLX5_SET(sqc, sqc, flush_in_error_en, 1);
@@ -1098,7 +1092,7 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, str
 	mlx5_fill_page_array(&sq->wq_ctrl.buf,
 	    (__be64 *) MLX5_ADDR_OF(wq, wq, pas));
 
-	err = mlx5_core_create_sq(mdev, in, inlen, &sq->sqn);
+	err = mlx5_core_create_sq(sq->priv->mdev, in, inlen, &sq->sqn);
 
 	kvfree(in);
 
@@ -1108,10 +1102,6 @@ mlx5e_enable_sq(struct mlx5e_sq *sq, str
 static int
 mlx5e_modify_sq(struct mlx5e_sq *sq, int curr_state, int next_state)
 {
-	struct mlx5e_channel *c = sq->channel;
-	struct mlx5e_priv *priv = c->priv;
-	struct mlx5_core_dev *mdev = priv->mdev;
-
 	void *in;
 	void *sqc;
 	int inlen;
@@ -1128,7 +1118,7 @@ mlx5e_modify_sq(struct mlx5e_sq *sq, int
 	MLX5_SET(modify_sq_in, in, sq_state, curr_state);
 	MLX5_SET(sqc, sqc, state, next_state);
 
-	err = mlx5_core_modify_sq(mdev, in, inlen);
+	err = mlx5_core_modify_sq(sq->priv->mdev, in, inlen);
 
 	kvfree(in);
 
@@ -1138,11 +1128,8 @@ mlx5e_modify_sq(struct mlx5e_sq *sq, int
 static void
 mlx5e_disable_sq(struct mlx5e_sq *sq)
 {
-	struct mlx5e_channel *c = sq->channel;
-	struct mlx5e_priv *priv = c->priv;
-	struct mlx5_core_dev *mdev = priv->mdev;
 
-	mlx5_core_destroy_sq(mdev, sq->sqn);
+	mlx5_core_destroy_sq(sq->priv->mdev, sq->sqn);
 }
 
 static int
@@ -1308,7 +1295,7 @@ mlx5e_create_cq(struct mlx5e_channel *c,
 		cqe->op_own = 0xf1;
 	}
 
-	cq->channel = c;
+	cq->priv = priv;
 
 	return (0);
 }
@@ -1323,9 +1310,6 @@ static int
 mlx5e_enable_cq(struct mlx5e_cq *cq, struct mlx5e_cq_param *param,
     u8 moderation_mode)
 {
-	struct mlx5e_channel *c = cq->channel;
-	struct mlx5e_priv *priv = c->priv;
-	struct mlx5_core_dev *mdev = priv->mdev;
 	struct mlx5_core_cq *mcq = &cq->mcq;
 	void *in;
 	void *cqc;
@@ -1347,7 +1331,7 @@ mlx5e_enable_cq(struct mlx5e_cq *cq, str
 	mlx5_fill_page_array(&cq->wq_ctrl.buf,
 	    (__be64 *) MLX5_ADDR_OF(create_cq_in, in, pas));
 
-	mlx5_vector2eqn(mdev, param->eq_ix, &eqn, &irqn_not_used);
+	mlx5_vector2eqn(cq->priv->mdev, param->eq_ix, &eqn, &irqn_not_used);
 
 	MLX5_SET(cqc, cqc, cq_period_mode, moderation_mode);
 	MLX5_SET(cqc, cqc, c_eqn, eqn);
@@ -1356,7 +1340,7 @@ mlx5e_enable_cq(struct mlx5e_cq *cq, str
 	    PAGE_SHIFT);
 	MLX5_SET64(cqc, cqc, dbr_addr, cq->wq_ctrl.db.dma);
 
-	err = mlx5_core_create_cq(mdev, mcq, in, inlen);
+	err = mlx5_core_create_cq(cq->priv->mdev, mcq, in, inlen);
 
 	kvfree(in);
 
@@ -1371,11 +1355,8 @@ mlx5e_enable_cq(struct mlx5e_cq *cq, str
 static void
 mlx5e_disable_cq(struct mlx5e_cq *cq)
 {
-	struct mlx5e_channel *c = cq->channel;
-	struct mlx5e_priv *priv = c->priv;
-	struct mlx5_core_dev *mdev = priv->mdev;
 
-	mlx5_core_destroy_cq(mdev, &cq->mcq);
+	mlx5_core_destroy_cq(cq->priv->mdev, &cq->mcq);
 }
 
 static int

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
==============================================================================
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c	Fri Sep 23 08:28:44 2016	(r306244)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c	Fri Sep 23 08:29:27 2016	(r306245)
@@ -233,7 +233,7 @@ mlx5e_sq_xmit(struct mlx5e_sq *sq, struc
 	/* Setup local variables */
 	pi = sq->pc & sq->wq.sz_m1;
 	wqe = mlx5_wq_cyc_get_wqe(&sq->wq, pi);
-	ifp = sq->channel->ifp;
+	ifp = sq->ifp;
 
 	memset(wqe, 0, sizeof(*wqe));
 
@@ -534,7 +534,7 @@ void
 mlx5e_tx_que(void *context, int pending)
 {
 	struct mlx5e_sq *sq = context;
-	struct ifnet *ifp = sq->channel->ifp;
+	struct ifnet *ifp = sq->ifp;
 
 	if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
 		mtx_lock(&sq->lock);

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_txrx.c
==============================================================================
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_txrx.c	Fri Sep 23 08:28:44 2016	(r306244)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_txrx.c	Fri Sep 23 08:29:27 2016	(r306245)
@@ -47,10 +47,7 @@ void
 mlx5e_cq_error_event(struct mlx5_core_cq *mcq, int event)
 {
 	struct mlx5e_cq *cq = container_of(mcq, struct mlx5e_cq, mcq);
-	struct mlx5e_channel *c = cq->channel;
-	struct mlx5e_priv *priv = c->priv;
-	struct ifnet *ifp = priv->ifp;
 
-	if_printf(ifp, "%s: cqn=0x%.6x event=0x%.2x\n",
+	if_printf(cq->priv->ifp, "%s: cqn=0x%.6x event=0x%.2x\n",
 	    __func__, mcq->cqn, event);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201609230829.u8N8TSD4052310>