From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9817AA0518 for ; Fri, 24 Jul 2020 14:08:16 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8AAC61C1AD; Fri, 24 Jul 2020 14:08:16 +0200 (CEST) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by dpdk.org (Postfix) with ESMTP id 89CB51C1AD for ; Fri, 24 Jul 2020 14:08:15 +0200 (CEST) Received: by mail-wm1-f67.google.com with SMTP id 3so1124128wmi.1 for ; Fri, 24 Jul 2020 05:08:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hnfrfAcckb0OYRVuX0JH3uqMGu3TX9XLPhvoiKmpF6g=; b=E3kZULpOy5yk4Woi0WbeIv/ZuTBsThSdQU9cAlyo3zxk5hSTAUh4U/8eb/MJm+mve2 hXq/82ekjLVvd+wKxRCPeb/Nl1RdmHHa+tXjkMLzROd7j+ZYlCXe/zsfeAObnR/4JPiq XjHBw0mX04AZGnEr20MUF1HAvZDTRzy6+zeLsDvt9Azi+0J58KgJfNEQCzJb75dTehB/ 3XWBRXpS9FDj5akAo4u7Shkcv6toybrC3bnnS8ae5AC5ND89xPEZsPnlB98UGO8v6dSv g/A7OlexRT0iATYfdLZnF9fUoEd2zYXR8vOS6a7lwo7LF0YcpfgkcvXnqDssKTSwUhs6 kjOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hnfrfAcckb0OYRVuX0JH3uqMGu3TX9XLPhvoiKmpF6g=; b=U3VZoreyJX08mOojC5Y1Sps8c+dqw8oK7W+K/xF/b073Yx46mb2SEiMQWPsTp/GyV/ 1TsRQLebfJwrkGYb4pBfBdDMzoTyLtlWL8Rrb3ZAa3MYsh/fX2n5keueXrqMqrAXy2mS vVhTMfRA2RVBc3NQ6n9/f+KCYMVWQlvWnWlDUqF4GTf+tvNYW7pow3IKez+S7LPIqa7y hJ+8s7swv+3ufxDoBXZ+KB5FqSC3OxUoO8oVnVG/BBjlPWnuZU08Lr7Y4wmpUzy2SJpa b6KcF3pM0QtgRZ13mMXylhd5yDhYbmjbhGcGscXpIP+UkX9poQ/3Mes4ZdSEnpUn7nZC p8PQ== X-Gm-Message-State: AOAM532ic5DRJuhBKp1ISa4UV2UkNyj4+S3NqJEPN9X6qUTRJpbUGlAP pjQxr/1PH0TFWVFH5METITM= X-Google-Smtp-Source: ABdhPJyBCmMNSXenZ/9+/PuchNBd7cqwEdwlJRDgPankDZd8yJdFKWSsgMXE/UzC3OQYDbhvEQHfeA== X-Received: by 2002:a7b:cd18:: with SMTP id f24mr8960734wmj.40.1595592495226; Fri, 24 Jul 2020 05:08:15 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id t3sm1278713wre.41.2020.07.24.05.08.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jul 2020 05:08:14 -0700 (PDT) From: luca.boccassi@gmail.com To: Xiaoyun Wang Cc: dpdk stable Date: Fri, 24 Jul 2020 12:59:13 +0100 Message-Id: <20200724120030.1863487-115-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200724120030.1863487-1-luca.boccassi@gmail.com> References: <20200724120030.1863487-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/hinic: fix setting promiscuous mode' has been queued to stable release 19.11.4 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 07/26/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Luca Boccassi --- >From d4b56ad36f7a3a5d4d74e9ac1dcc9714feb2ec4b Mon Sep 17 00:00:00 2001 From: Xiaoyun Wang Date: Sat, 27 Jun 2020 11:55:46 +0800 Subject: [PATCH] net/hinic: fix setting promiscuous mode [ upstream commit 224cff4bbaa307c6b8e38478d9492af8463720dd ] When setting promiscuous or allmulticast mode, increase multi-thread resource protection, because the patch "net/bonding: prefer allmulti to promiscuous for LACP" adds trying to use allmulti when adding a slave, and EVS bond driver also sets promisc with another thread, which may lead to thread reentry and cause failure to set promiscuous mode. Fixes: cb7b6606ebff ("net/hinic: add RSS stats and promiscuous ops") Signed-off-by: Xiaoyun Wang --- drivers/net/hinic/hinic_pmd_ethdev.c | 34 ++++++++++++++++++++++++---- drivers/net/hinic/hinic_pmd_ethdev.h | 1 + 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c index b81ecd0b8..9aa3cf7aa 100644 --- a/drivers/net/hinic/hinic_pmd_ethdev.c +++ b/drivers/net/hinic/hinic_pmd_ethdev.c @@ -1269,14 +1269,25 @@ static void hinic_disable_interrupt(struct rte_eth_dev *dev) static int hinic_set_dev_promiscuous(struct hinic_nic_dev *nic_dev, bool enable) { - u32 rx_mode_ctrl = nic_dev->rx_mode_status; + u32 rx_mode_ctrl; + int err; + + err = hinic_mutex_lock(&nic_dev->rx_mode_mutex); + if (err) + return err; + + rx_mode_ctrl = nic_dev->rx_mode_status; if (enable) rx_mode_ctrl |= HINIC_RX_MODE_PROMISC; else rx_mode_ctrl &= (~HINIC_RX_MODE_PROMISC); - return hinic_config_rx_mode(nic_dev, rx_mode_ctrl); + err = hinic_config_rx_mode(nic_dev, rx_mode_ctrl); + + (void)hinic_mutex_unlock(&nic_dev->rx_mode_mutex); + + return err; } /** @@ -1720,14 +1731,25 @@ static void hinic_remove_all_vlanid(struct rte_eth_dev *eth_dev) static int hinic_set_dev_allmulticast(struct hinic_nic_dev *nic_dev, bool enable) { - u32 rx_mode_ctrl = nic_dev->rx_mode_status; + u32 rx_mode_ctrl; + int err; + + err = hinic_mutex_lock(&nic_dev->rx_mode_mutex); + if (err) + return err; + + rx_mode_ctrl = nic_dev->rx_mode_status; if (enable) rx_mode_ctrl |= HINIC_RX_MODE_MC_ALL; else rx_mode_ctrl &= (~HINIC_RX_MODE_MC_ALL); - return hinic_config_rx_mode(nic_dev, rx_mode_ctrl); + err = hinic_config_rx_mode(nic_dev, rx_mode_ctrl); + + (void)hinic_mutex_unlock(&nic_dev->rx_mode_mutex); + + return err; } /** @@ -3034,6 +3056,8 @@ static int hinic_func_init(struct rte_eth_dev *eth_dev) } hinic_set_bit(HINIC_DEV_INTR_EN, &nic_dev->dev_status); + hinic_mutex_init(&nic_dev->rx_mode_mutex, NULL); + /* initialize filter info */ filter_info = &nic_dev->filter; memset(filter_info, 0, sizeof(struct hinic_filter_info)); @@ -3105,6 +3129,8 @@ static int hinic_dev_uninit(struct rte_eth_dev *dev) if (rte_eal_process_type() != RTE_PROC_PRIMARY) return 0; + hinic_mutex_destroy(&nic_dev->rx_mode_mutex); + hinic_dev_close(dev); dev->dev_ops = NULL; diff --git a/drivers/net/hinic/hinic_pmd_ethdev.h b/drivers/net/hinic/hinic_pmd_ethdev.h index 3e3f3b360..b7dc9640f 100644 --- a/drivers/net/hinic/hinic_pmd_ethdev.h +++ b/drivers/net/hinic/hinic_pmd_ethdev.h @@ -171,6 +171,7 @@ struct hinic_nic_dev { unsigned int flags; struct nic_service_cap nic_cap; u32 rx_mode_status; /* promisc or allmulticast */ + pthread_mutex_t rx_mode_mutex; unsigned long dev_status; char proc_dev_name[HINIC_DEV_NAME_LEN]; -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-07-24 12:53:52.975119716 +0100 +++ 0115-net-hinic-fix-setting-promiscuous-mode.patch 2020-07-24 12:53:48.383008248 +0100 @@ -1,8 +1,10 @@ -From 224cff4bbaa307c6b8e38478d9492af8463720dd Mon Sep 17 00:00:00 2001 +From d4b56ad36f7a3a5d4d74e9ac1dcc9714feb2ec4b Mon Sep 17 00:00:00 2001 From: Xiaoyun Wang Date: Sat, 27 Jun 2020 11:55:46 +0800 Subject: [PATCH] net/hinic: fix setting promiscuous mode +[ upstream commit 224cff4bbaa307c6b8e38478d9492af8463720dd ] + When setting promiscuous or allmulticast mode, increase multi-thread resource protection, because the patch "net/bonding: prefer allmulti to promiscuous for LACP" @@ -12,7 +14,6 @@ set promiscuous mode. Fixes: cb7b6606ebff ("net/hinic: add RSS stats and promiscuous ops") -Cc: stable@dpdk.org Signed-off-by: Xiaoyun Wang --- @@ -21,10 +22,10 @@ 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c -index 8f81e2230..0d3d62bd0 100644 +index b81ecd0b8..9aa3cf7aa 100644 --- a/drivers/net/hinic/hinic_pmd_ethdev.c +++ b/drivers/net/hinic/hinic_pmd_ethdev.c -@@ -1268,14 +1268,25 @@ static void hinic_disable_interrupt(struct rte_eth_dev *dev) +@@ -1269,14 +1269,25 @@ static void hinic_disable_interrupt(struct rte_eth_dev *dev) static int hinic_set_dev_promiscuous(struct hinic_nic_dev *nic_dev, bool enable) { @@ -52,7 +53,7 @@ } /** -@@ -1728,14 +1739,25 @@ static void hinic_remove_all_vlanid(struct rte_eth_dev *eth_dev) +@@ -1720,14 +1731,25 @@ static void hinic_remove_all_vlanid(struct rte_eth_dev *eth_dev) static int hinic_set_dev_allmulticast(struct hinic_nic_dev *nic_dev, bool enable) { @@ -80,16 +81,16 @@ } /** -@@ -3127,6 +3149,8 @@ static int hinic_func_init(struct rte_eth_dev *eth_dev) +@@ -3034,6 +3056,8 @@ static int hinic_func_init(struct rte_eth_dev *eth_dev) } - rte_bit_relaxed_set32(HINIC_DEV_INTR_EN, &nic_dev->dev_status); + hinic_set_bit(HINIC_DEV_INTR_EN, &nic_dev->dev_status); + hinic_mutex_init(&nic_dev->rx_mode_mutex, NULL); + /* initialize filter info */ filter_info = &nic_dev->filter; - tcam_info = &nic_dev->tcam; -@@ -3201,6 +3225,8 @@ static int hinic_dev_uninit(struct rte_eth_dev *dev) + memset(filter_info, 0, sizeof(struct hinic_filter_info)); +@@ -3105,6 +3129,8 @@ static int hinic_dev_uninit(struct rte_eth_dev *dev) if (rte_eal_process_type() != RTE_PROC_PRIMARY) return 0; @@ -99,15 +100,15 @@ dev->dev_ops = NULL; diff --git a/drivers/net/hinic/hinic_pmd_ethdev.h b/drivers/net/hinic/hinic_pmd_ethdev.h -index 77b4b9109..3f2d51d75 100644 +index 3e3f3b360..b7dc9640f 100644 --- a/drivers/net/hinic/hinic_pmd_ethdev.h +++ b/drivers/net/hinic/hinic_pmd_ethdev.h -@@ -329,6 +329,7 @@ struct hinic_nic_dev { +@@ -171,6 +171,7 @@ struct hinic_nic_dev { unsigned int flags; struct nic_service_cap nic_cap; u32 rx_mode_status; /* promisc or allmulticast */ + pthread_mutex_t rx_mode_mutex; - u32 dev_status; + unsigned long dev_status; char proc_dev_name[HINIC_DEV_NAME_LEN]; --