From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io0-f195.google.com (mail-io0-f195.google.com [209.85.223.195]) by dpdk.org (Postfix) with ESMTP id 07B98324B for ; Thu, 22 Feb 2018 04:02:18 +0100 (CET) Received: by mail-io0-f195.google.com with SMTP id b34so4411205ioj.6 for ; Wed, 21 Feb 2018 19:02:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=KuvAkfnYyUp+qqc6ZFiYBXMsp3UcyD7jt/wRRxLlJVY=; b=gYXxAeqffakFgxTUS4xOKmrrwl8MV2ohMNHPLNP4e3pnntRFyRoV7+tdrwHbSNGcmr 9ScMWxlWMhL/FtwpQoKBJjnkzeVuPRO3FeZ/G+QXd6YUX3OgfdjpPKY5fPu/GV9LTfOp PUsXjgkqPrJ+d3OHhfTnY2FRqlfK6LRCqkPNA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=KuvAkfnYyUp+qqc6ZFiYBXMsp3UcyD7jt/wRRxLlJVY=; b=RQXwzsvuesgvKtfIVnWG8CJ7gHd0aXn/9MhKZ/8jlQ+WbOwPYUyN0tA3hkD78S4BZd aashJajkXAT9INJRGqHZ21rUnfZRioih8evlFt6gBDHc+Hb8AHsk5pKV9NPWi/uuoC1C OXm8J/1ieXaN5frMiLR7zrdTnvzcGWeAoAXdIhRIMDF7Cn+IDwYayqhcbCokPmFORBNz apT6tZhVnE3KhNFB4B9AeAdfbEePv/Is1v3NbrO53zr9VAJ/FnRCto2e0qTWCHCH4QZy YhmOSW1TPRWEopkBgofuLmp0q4NZuhlvaFHeX0Ynh1NvOtlH4mYqmrwgmbk5xeAD+eM6 ZV3w== X-Gm-Message-State: APf1xPAiY+kJQXPLHUx58LJbNKpw/rOTaA6FwxxrHfqa6zYgRGaZiR3N vKPYgvaMneVReegieG+JTwg2Mi5Sq/qpYBwfbKbrlg== X-Google-Smtp-Source: AG47ELuVX44TdzJ52mXdRHty7r/31iRXFCPuq/Hz2b7mYNqpWI5/YAZ+Iid+gnsoy4LMAy8YcirTm+jYE+yUO+lCiwQ= X-Received: by 10.107.189.196 with SMTP id n187mr6775216iof.47.1519268536918; Wed, 21 Feb 2018 19:02:16 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.168.203 with HTTP; Wed, 21 Feb 2018 19:01:56 -0800 (PST) In-Reply-To: <20180221103924.10022-1-somnath.kotur@broadcom.com> References: <20180221103924.10022-1-somnath.kotur@broadcom.com> From: Somnath Kotur Date: Thu, 22 Feb 2018 08:31:56 +0530 Message-ID: To: dev@dpdk.org Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH] bnxt: Fix bug with duplicate pattern for 5tuple filter X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 03:02:18 -0000 Ferruh, Sorry, please ignore this patch, think i re-sent an old one by mistake, sent out the new one now Thanks Som On Wed, Feb 21, 2018 at 4:09 PM, Somnath Kotur wrote: > When user re-issues same 5 tuple filter pattern cmd with different > destination queue, it would flag it as an existing match. > However, when deletion on this filter was attempted, it would crash as the > 'vnic' from which the filter was being removed from would be different. > Fix by updating the filter in the scenario where there is a pattern match > and only the destination queue varies. > > Signed-off-by: Somnath Kotur > --- > drivers/net/bnxt/bnxt_ethdev.c | 32 +++++++++++++++++++++++--------- > 1 file changed, 23 insertions(+), 9 deletions(-) > > diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c > index 6f8a633..6af1267 100644 > --- a/drivers/net/bnxt/bnxt_ethdev.c > +++ b/drivers/net/bnxt/bnxt_ethdev.c > @@ -1953,7 +1953,8 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu) > > static struct bnxt_filter_info* > bnxt_match_ntuple_filter(struct bnxt *bp, > - struct bnxt_filter_info *bfilter) > + struct bnxt_filter_info *bfilter, > + struct bnxt_vnic_info **mvnic) > { > struct bnxt_filter_info *mfilter = NULL; > int i; > @@ -1972,8 +1973,11 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu) > bfilter->dst_port == mfilter->dst_port && > bfilter->dst_port_mask == mfilter->dst_port_mask && > bfilter->flags == mfilter->flags && > - bfilter->enables == mfilter->enables) > + bfilter->enables == mfilter->enables) { > + if (mvnic) > + *mvnic = vnic; > return mfilter; > + } > } > } > return NULL; > @@ -1985,7 +1989,7 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu) > enum rte_filter_op filter_op) > { > struct bnxt_filter_info *bfilter, *mfilter, *filter1; > - struct bnxt_vnic_info *vnic, *vnic0; > + struct bnxt_vnic_info *vnic, *vnic0, *mvnic; > int ret; > > if (nfilter->flags != RTE_5TUPLE_FLAGS) { > @@ -2023,12 +2027,22 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu) > bfilter->ethertype = 0x800; > bfilter->enables |= NTUPLE_FLTR_ALLOC_INPUT_EN_ETHERTYPE; > > - mfilter = bnxt_match_ntuple_filter(bp, bfilter); > + mfilter = bnxt_match_ntuple_filter(bp, bfilter, &mvnic); > > - if (mfilter != NULL && filter_op == RTE_ETH_FILTER_ADD) { > - RTE_LOG(ERR, PMD, "filter exists."); > + if (mfilter != NULL && filter_op == RTE_ETH_FILTER_ADD && > + bfilter->dst_id == mfilter->dst_id) { > + RTE_LOG(ERR, PMD, "filter exists.\n"); > ret = -EEXIST; > goto free_filter; > + } else if (mfilter != NULL && filter_op == RTE_ETH_FILTER_ADD && > + bfilter->dst_id != mfilter->dst_id) { > + mfilter->dst_id = vnic->fw_vnic_id; > + ret = bnxt_hwrm_set_ntuple_filter(bp, mfilter->dst_id, mfilter); > + STAILQ_REMOVE(&mvnic->filter, mfilter, bnxt_filter_info, next); > + STAILQ_INSERT_TAIL(&vnic->filter, mfilter, next); > + RTE_LOG(ERR, PMD, "filter with matching pattern exists.\n"); > + RTE_LOG(ERR, PMD, " Updated it to the new destination queue\n"); > + goto free_filter; > } > if (mfilter == NULL && filter_op == RTE_ETH_FILTER_DELETE) { > RTE_LOG(ERR, PMD, "filter doesn't exist."); > @@ -2050,11 +2064,11 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu) > } > ret = bnxt_hwrm_clear_ntuple_filter(bp, mfilter); > > - STAILQ_REMOVE(&vnic->filter, mfilter, bnxt_filter_info, > - next); > + STAILQ_REMOVE(&vnic->filter, mfilter, bnxt_filter_info, next); > bnxt_free_filter(bp, mfilter); > - bfilter->fw_l2_filter_id = -1; > + mfilter->fw_l2_filter_id = -1; > bnxt_free_filter(bp, bfilter); > + bfilter->fw_l2_filter_id = -1; > } > > return 0; > -- > 1.9.1 >