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 3CCAB91FF for ; Fri, 30 Oct 2015 19:55:44 +0100 (CET) Received: by wmll128 with SMTP id l128so19302918wml.0 for ; Fri, 30 Oct 2015 11:55:44 -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=Tj0n7NJNjA8hoe34DUE8Kedc/c5SJPTQXpEKbIPL5yI=; b=jLfBt+6d8q4BVahylQe7+XmABZ0g5hyQdkt8vvPuiotWkSBedR8+wOvR1/H4M/UTet +VRegZSDOYUNUjyI5iKaS1olQJWOlWC/MguE8wGCqM+yPYto0xZbbzxZgxxiSSdrPWm4 JSmaLm0iA/nY1I8zQNqYwfURzIRCN/CT0UKTlhlE22ZFxAEox22Tu32H921JIP5Edvd6 0ky6dcBck5ng95JRzPQEE4S8HRUnQCYq6192LeIlqjZAlTXiS+u3OkNweaAGsyXfScgh 2Y2gfuCh2ITBvTgz7EYxavJNWliCW0WrFoft31RTA8Fui3ghXLIoUU4h1KfRd2YYDHhK 1W0A== 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=Tj0n7NJNjA8hoe34DUE8Kedc/c5SJPTQXpEKbIPL5yI=; b=V2zKo7yg4jTFsZHCMU+f9XypKrNQfPNay9L5ridzMU2d4QRnojj7X2RsZaqzZS1lf5 kGYCOjG/cJgdCbdu3febY/p5Mkeh7QTzDLebBNLquUUP7fh4MRqSbubiBljHmkILVbS3 0irarHfge7T+YRtdjQPpy/fMJ5ZsUXFMbR2ft5QZIKQpl/+TZgt+kWhIXNTV2gqSK7rn 1gq7qdZBPwtwH7WtROGqpqrKizJbIOWKZwatbhuTSyhbkrYpMnely5rcbZebKMdDFurJ jwzn1lFU90y2IHnm87IkJP46+ZUTenTFF0KPcX/EMhGYtA2ITwKv1ZF1I+6TiwqssrUh DEpQ== X-Gm-Message-State: ALoCoQnGMjsdGx4XaQ4HaSsN5RDOS5drYLeLD07zPsYyfnJy/xboCpbCg1+crZ0khwvsHMQfpCiV X-Received: by 10.28.88.135 with SMTP id m129mr5525807wmb.67.1446231344085; Fri, 30 Oct 2015 11:55:44 -0700 (PDT) Received: from 6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id d10sm8401800wje.14.2015.10.30.11.55.42 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 30 Oct 2015 11:55:43 -0700 (PDT) From: Adrien Mazarguil To: dev@dpdk.org Date: Fri, 30 Oct 2015 19:55:04 +0100 Message-Id: <1446231319-8185-2-git-send-email-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1446231319-8185-1-git-send-email-adrien.mazarguil@6wind.com> References: <1444067692-29645-1-git-send-email-adrien.mazarguil@6wind.com> <1446231319-8185-1-git-send-email-adrien.mazarguil@6wind.com> Subject: [dpdk-dev] [PATCH v2 01/16] mlx5: use fast Verbs interface for scattered RX operation 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: Fri, 30 Oct 2015 18:55:44 -0000 This commit updates mlx5_rx_burst_sp() to use the fast verbs interface for posting RX buffers just like mlx5_rx_burst(). Doing so avoids a loop in libmlx5 and an indirect function call through libibverbs. Note: recv_sg_list() is not implemented in the QP burst API, this commit is only to prepare transition to the WQ-based API. Signed-off-by: Adrien Mazarguil Signed-off-by: Nelio Laranjeiro --- drivers/net/mlx5/Makefile | 4 ++++ drivers/net/mlx5/mlx5_rxtx.c | 40 +++++++++++++++++----------------------- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile index 8b1e32b..2969045 100644 --- a/drivers/net/mlx5/Makefile +++ b/drivers/net/mlx5/Makefile @@ -119,6 +119,10 @@ mlx5_autoconf.h: $(RTE_SDK)/scripts/auto-config-h.sh HAVE_EXP_QUERY_DEVICE \ infiniband/verbs.h \ type 'struct ibv_exp_device_attr' $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ + HAVE_EXP_QP_BURST_RECV_SG_LIST \ + infiniband/verbs.h \ + field 'struct ibv_exp_qp_burst_family.recv_sg_list' $(AUTOCONF_OUTPUT) mlx5.o: mlx5_autoconf.h diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index 623219d..8872f19 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -35,6 +35,7 @@ #include #include #include +#include /* Verbs header. */ /* ISO C doesn't support unnamed structs/unions, disabling -pedantic. */ @@ -60,6 +61,7 @@ #endif #include "mlx5.h" +#include "mlx5_autoconf.h" #include "mlx5_utils.h" #include "mlx5_rxtx.h" #include "mlx5_defs.h" @@ -600,9 +602,6 @@ mlx5_rx_burst_sp(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n) struct rxq_elt_sp (*elts)[rxq->elts_n] = rxq->elts.sp; const unsigned int elts_n = rxq->elts_n; unsigned int elts_head = rxq->elts_head; - struct ibv_recv_wr head; - struct ibv_recv_wr **next = &head.next; - struct ibv_recv_wr *bad_wr; unsigned int i; unsigned int pkts_ret = 0; int ret; @@ -660,9 +659,6 @@ mlx5_rx_burst_sp(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n) /* Increment dropped packets counter. */ ++rxq->stats.idropped; #endif - /* Link completed WRs together for repost. */ - *next = wr; - next = &wr->next; goto repost; } ret = wc.byte_len; @@ -671,9 +667,6 @@ mlx5_rx_burst_sp(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n) break; len = ret; pkt_buf_len = len; - /* Link completed WRs together for repost. */ - *next = wr; - next = &wr->next; /* * Replace spent segments with new ones, concatenate and * return them as pkt_buf. @@ -770,26 +763,27 @@ mlx5_rx_burst_sp(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n) rxq->stats.ibytes += pkt_buf_len; #endif repost: +#ifdef HAVE_EXP_QP_BURST_RECV_SG_LIST + ret = rxq->if_qp->recv_sg_list(rxq->qp, + elt->sges, + RTE_DIM(elt->sges)); +#else /* HAVE_EXP_QP_BURST_RECV_SG_LIST */ + errno = ENOSYS; + ret = -1; +#endif /* HAVE_EXP_QP_BURST_RECV_SG_LIST */ + if (unlikely(ret)) { + /* Inability to repost WRs is fatal. */ + DEBUG("%p: recv_sg_list(): failed (ret=%d)", + (void *)rxq->priv, + ret); + abort(); + } if (++elts_head >= elts_n) elts_head = 0; continue; } if (unlikely(i == 0)) return 0; - *next = NULL; - /* Repost WRs. */ -#ifdef DEBUG_RECV - DEBUG("%p: reposting %d WRs", (void *)rxq, i); -#endif - ret = ibv_post_recv(rxq->qp, head.next, &bad_wr); - if (unlikely(ret)) { - /* Inability to repost WRs is fatal. */ - DEBUG("%p: ibv_post_recv(): failed for WR %p: %s", - (void *)rxq->priv, - (void *)bad_wr, - strerror(ret)); - abort(); - } rxq->elts_head = elts_head; #ifdef MLX5_PMD_SOFT_COUNTERS /* Increment packets counter. */ -- 2.1.0