Message ID | a28e9283e37e0911f9454edfc8f49b4d312e912d.1467981553.git.nelio.laranjeiro@6wind.com (mailing list archive) |
---|---|
State | Accepted, archived |
Delegated to: | Bruce Richardson |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id D189F6966; Fri, 8 Jul 2016 14:44:08 +0200 (CEST) Received: from mail-wm0-f50.google.com (mail-wm0-f50.google.com [74.125.82.50]) by dpdk.org (Postfix) with ESMTP id 603FD68F8 for <dev@dpdk.org>; Fri, 8 Jul 2016 14:44:07 +0200 (CEST) Received: by mail-wm0-f50.google.com with SMTP id k123so12228654wme.0 for <dev@dpdk.org>; Fri, 08 Jul 2016 05:44:07 -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; bh=+jzjBFkz3KAjXQIjkkBQSsi4rR0iPQgPnHWEHwknnTY=; b=t/nSiLw/YocTUZpO/3EWuz0XDVH2UelvgQb8QJEZIoVwR4lZ+ENE+pnq5tUOmZ7xpE h3/a/f2e6csCmoxEwecKhJBTIKiJbuUS6BD78rzUoyBo5NCZJbNRFF7iqFBwD8NNr+5l qIfZEAVkJmO7gIEmVP016IiB+ICBOSF2cCtZ36zrH2pFJyKPjO086G0+7r27+zEqBNl1 oEZkpOghTBmO13li4TVuj1gICasiDZyT6w0kGdxUbk2IsgtFcwge2yFU2fQrC/GJGCMl G4/yu2xbnJ1yGSv/Uee/I1U5RzwyS5G28l25knuZ1rxdqHsjh6GBcYaLGPmlI6pzs1At HpBg== 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; bh=+jzjBFkz3KAjXQIjkkBQSsi4rR0iPQgPnHWEHwknnTY=; b=CzBrDwpoaO6BYCsZuAhTQ+c+COcZJeZL/F1heHGRsszgCeIk7+2gIuU7nuLYrzGb1R R+74Yfr4kNexW0YIX2qZeGyZBz1XjoL74mjPxOpPatq+eJeh1Bys62PvrBklm/nCaJHE 98KAvijjxTA9ALRso2omuMg2iIUL8L5KoPOxhHK8pTojubo7RF34b/RQgX2+IMCAqHfq aDwzhE2Hf+AQtAwB4F8JGfVYKEHNZjZKQibrNhcifGhvwAFOcZx5zgJLOJ2GjtGnQEDR XoGCrFTZnU2ttmW79+O8SbfKRaAk9YmII3ab+VyckmYAsQyzUkT0ZCkmP0XDgZe60ggN XbgA== X-Gm-Message-State: ALyK8tJsh+1R4hlP42qBL2dtnEU+vH8JF1dgt+VFEMb1hyJFBOM9Sokpd0bZ2K1AVTJPTOtd X-Received: by 10.28.152.202 with SMTP id a193mr3357326wme.98.1467981847174; Fri, 08 Jul 2016 05:44:07 -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 d137sm2898438wmd.12.2016.07.08.05.44.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 08 Jul 2016 05:44:06 -0700 (PDT) From: Nelio Laranjeiro <nelio.laranjeiro@6wind.com> To: dev@dpdk.org Cc: Adrien Mazarguil <adrien.mazarguil@6wind.com>, Olga Shern <olgas@mellanox.com>, Yongseok Koh <yskoh@mellanox.com> Date: Fri, 8 Jul 2016 14:43:26 +0200 Message-Id: <a28e9283e37e0911f9454edfc8f49b4d312e912d.1467981553.git.nelio.laranjeiro@6wind.com> X-Mailer: git-send-email 2.1.4 Subject: [dpdk-dev] [PATCH] net/mlx5: fix a segmentation fault in Rx X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK <dev.dpdk.org> List-Unsubscribe: <http://dpdk.org/ml/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://dpdk.org/ml/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <http://dpdk.org/ml/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Commit Message
NĂ©lio Laranjeiro
July 8, 2016, 12:43 p.m. UTC
Fixed issue could occur when a Mbuf starvation happens in a middle of
reception of a segmented packet, in such situation, the PMD has to release
all segments of such packet. The end condition was wrong causing it to
free a Mbuf still handled by the NIC.
Fixes: 9964b965ad69 ("net/mlx5: re-add Rx scatter support")
Reported-by: Yongseok Koh <yskoh@mellanox.com>
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
---
drivers/net/mlx5/mlx5_rxtx.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
On Fri, Jul 08, 2016 at 02:43:26PM +0200, Nelio Laranjeiro wrote: > Fixed issue could occur when a Mbuf starvation happens in a middle of > reception of a segmented packet, in such situation, the PMD has to release > all segments of such packet. The end condition was wrong causing it to > free a Mbuf still handled by the NIC. > > Fixes: 9964b965ad69 ("net/mlx5: re-add Rx scatter support") > > Reported-by: Yongseok Koh <yskoh@mellanox.com> > Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com> > --- > drivers/net/mlx5/mlx5_rxtx.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c > index 0c352f3..3564937 100644 > --- a/drivers/net/mlx5/mlx5_rxtx.c > +++ b/drivers/net/mlx5/mlx5_rxtx.c > @@ -1572,7 +1572,8 @@ mlx5_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n) > rte_prefetch0(wqe); > rep = rte_mbuf_raw_alloc(rxq->mp); > if (unlikely(rep == NULL)) { > - while (pkt) { > + while (pkt != seg) { > + assert(pkt != (*rxq->elts)[idx]); > seg = NEXT(pkt); > rte_mbuf_refcnt_set(pkt, 0); > __rte_mbuf_raw_free(pkt); > -- > 2.1.4 > Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
On Fri, Jul 08, 2016 at 03:29:02PM +0200, Adrien Mazarguil wrote: > On Fri, Jul 08, 2016 at 02:43:26PM +0200, Nelio Laranjeiro wrote: > > Fixed issue could occur when a Mbuf starvation happens in a middle of > > reception of a segmented packet, in such situation, the PMD has to release > > all segments of such packet. The end condition was wrong causing it to > > free a Mbuf still handled by the NIC. > > > > Fixes: 9964b965ad69 ("net/mlx5: re-add Rx scatter support") > > > > Reported-by: Yongseok Koh <yskoh@mellanox.com> > > Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com> > > --- > > drivers/net/mlx5/mlx5_rxtx.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c > > index 0c352f3..3564937 100644 > > --- a/drivers/net/mlx5/mlx5_rxtx.c > > +++ b/drivers/net/mlx5/mlx5_rxtx.c > > @@ -1572,7 +1572,8 @@ mlx5_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n) > > rte_prefetch0(wqe); > > rep = rte_mbuf_raw_alloc(rxq->mp); > > if (unlikely(rep == NULL)) { > > - while (pkt) { > > + while (pkt != seg) { > > + assert(pkt != (*rxq->elts)[idx]); > > seg = NEXT(pkt); > > rte_mbuf_refcnt_set(pkt, 0); > > __rte_mbuf_raw_free(pkt); > > -- > > 2.1.4 > > > > Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com> > Applied to dpdk-next-net/rel_16_07 /Bruce
diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index 0c352f3..3564937 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -1572,7 +1572,8 @@ mlx5_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n) rte_prefetch0(wqe); rep = rte_mbuf_raw_alloc(rxq->mp); if (unlikely(rep == NULL)) { - while (pkt) { + while (pkt != seg) { + assert(pkt != (*rxq->elts)[idx]); seg = NEXT(pkt); rte_mbuf_refcnt_set(pkt, 0); __rte_mbuf_raw_free(pkt);