From patchwork Fri Jun 10 16:59:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaqing Zhao X-Patchwork-Id: 580787 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CB04C43334 for ; Fri, 10 Jun 2022 17:04:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349562AbiFJREB (ORCPT ); Fri, 10 Jun 2022 13:04:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349740AbiFJREA (ORCPT ); Fri, 10 Jun 2022 13:04:00 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A13C36309; Fri, 10 Jun 2022 10:03:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654880639; x=1686416639; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=n2DHPKG6LELctv9GPHh5MdlgXeZF+xfpjUKtxgbPNOI=; b=LKtZEpJ64QCoZdbWCorC8DNOkxW+txUFjSqj4BtIeNw1iQK2Z0ni5iMV iJRSGHpI0qz6JdL3BiVItmBqRhFMVACUywALzvCnAPXhxOCbUHGkXpspi tKgQtC/STMryWigsvqHuYUWgZXpDsnqml4tg7TaRGsJXf/bkCO6sQAhRV uNx0cCGUC1KDn9gyARA72fvuTWOOr5xqVKrCltVcCmkE/xlpKhXd3l/+N Fi8273be3OguiE3tlaTCQBwTTLH9hXKfmmTD/qUEH87nd9IuG8+5QwtQ7 QkSHCDt+O7vFbvdmfyYXS6U0Jv1sSTEvxwA0fgetC/Ot/cxsHruosMNkW g==; X-IronPort-AV: E=McAfee;i="6400,9594,10374"; a="266452769" X-IronPort-AV: E=Sophos;i="5.91,290,1647327600"; d="scan'208";a="266452769" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jun 2022 10:03:58 -0700 X-IronPort-AV: E=Sophos;i="5.91,290,1647327600"; d="scan'208";a="638218765" Received: from unknown (HELO jiaqingz-server.sh.intel.com) ([10.239.48.171]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jun 2022 10:03:57 -0700 From: Jiaqing Zhao To: Samuel Mendoza-Jonas , "David S . Miller" , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org Cc: Jiaqing Zhao Subject: [PATCH v2 2/6] net/ncsi: Rename NCSI_CAP_VLAN_NO to NCSI_CAP_VLAN_FILTERED Date: Sat, 11 Jun 2022 00:59:36 +0800 Message-Id: <20220610165940.2326777-3-jiaqing.zhao@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220610165940.2326777-1-jiaqing.zhao@linux.intel.com> References: <20220610165940.2326777-1-jiaqing.zhao@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The NCSI_CAP_VLAN_NO actually stands for the "VLAN + non-VLAN" mode defined in NCSI spec, which accepts both VLAN-tagged packets that match the enabled VLAN filter settings and non-VLAN-tagged packets. It would be more clear to rename it to NCSI_CAP_VLAN_FILTERED. Signed-off-by: Jiaqing Zhao --- net/ncsi/internal.h | 2 +- net/ncsi/ncsi-manage.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ncsi/internal.h b/net/ncsi/internal.h index bc4a00e41695..7f384f841019 100644 --- a/net/ncsi/internal.h +++ b/net/ncsi/internal.h @@ -46,7 +46,7 @@ enum { NCSI_CAP_AEN_HDS = 0x04, /* HNC driver status */ NCSI_CAP_AEN_MASK = 0x07, NCSI_CAP_VLAN_ONLY = 0x01, /* Filter VLAN packet only */ - NCSI_CAP_VLAN_NO = 0x02, /* Filter VLAN and non-VLAN */ + NCSI_CAP_VLAN_FILTERED = 0x02, /* Filter VLAN and non-VLAN */ NCSI_CAP_VLAN_ANY = 0x03, /* Filter Any-and-non-VLAN */ NCSI_CAP_VLAN_MASK = 0x07 }; diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c index 78814417d753..a8f7a2ff52a0 100644 --- a/net/ncsi/ncsi-manage.c +++ b/net/ncsi/ncsi-manage.c @@ -1098,7 +1098,7 @@ static void ncsi_configure_channel(struct ncsi_dev_priv *ndp) nca.type = NCSI_PKT_CMD_DV; } else { nca.type = NCSI_PKT_CMD_EV; - nca.bytes[3] = NCSI_CAP_VLAN_NO; + nca.bytes[3] = NCSI_CAP_VLAN_FILTERED; } nd->state = ncsi_dev_state_config_sma; } else if (nd->state == ncsi_dev_state_config_sma) { From patchwork Fri Jun 10 16:59:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaqing Zhao X-Patchwork-Id: 580786 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A811FCCA47B for ; Fri, 10 Jun 2022 17:04:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350086AbiFJREQ (ORCPT ); Fri, 10 Jun 2022 13:04:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350055AbiFJREL (ORCPT ); Fri, 10 Jun 2022 13:04:11 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A8C236B69; Fri, 10 Jun 2022 10:04:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654880643; x=1686416643; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tfHmXri7R6Bw+I2ET1tz+X8i7YZFY1rCt76KxR+OC/A=; b=E8+XksOLWlMBV7it16pnT3lfGkhiLJzTA0sXlmoe6IbyJW18uRY3GiLQ VKfMygUSLOpuqB74uJN9Xtoo5k61T9QUJaqovReElhUYosVjeWHHxCFEu vy1guNDdtSmcqtCMKXuXj+3l51dBkdPd2dl2XSS7uB8NF4Woh9m3Ch6oU yGgK5TwKXGp6FEkfH7wJLO6J/4TyreDZnKkYfIn6kEfh8TR2o70grVHo5 0s0MV/T6MSbkZ9B7+nfTLxrg5D2az5PPDXvSZxKxRSnbEnbs05LZGO4Id Zim/e4+XUsJu9/2/uwdjp55j1iYRDR239MahDUqk5nviCNqEPdYn/XgIy w==; X-IronPort-AV: E=McAfee;i="6400,9594,10374"; a="266452796" X-IronPort-AV: E=Sophos;i="5.91,290,1647327600"; d="scan'208";a="266452796" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jun 2022 10:04:03 -0700 X-IronPort-AV: E=Sophos;i="5.91,290,1647327600"; d="scan'208";a="638218799" Received: from unknown (HELO jiaqingz-server.sh.intel.com) ([10.239.48.171]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jun 2022 10:04:01 -0700 From: Jiaqing Zhao To: Samuel Mendoza-Jonas , "David S . Miller" , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org Cc: Jiaqing Zhao Subject: [PATCH v2 4/6] ftgmac100: Remove enable NCSI VLAN filtering Date: Sat, 11 Jun 2022 00:59:38 +0800 Message-Id: <20220610165940.2326777-5-jiaqing.zhao@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220610165940.2326777-1-jiaqing.zhao@linux.intel.com> References: <20220610165940.2326777-1-jiaqing.zhao@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Setting NETIF_F_HW_VLAN_CTAG_FILTER flag to enable NCSI VLAN filtering has been moved to the NCSI driver, the logic in ftgmac100 driver is no longer needed. Signed-off-by: Jiaqing Zhao --- drivers/net/ethernet/faraday/ftgmac100.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c index 5231818943c6..18821ca38795 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1922,9 +1922,6 @@ static int ftgmac100_probe(struct platform_device *pdev) NETIF_F_GRO | NETIF_F_SG | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX; - if (priv->use_ncsi) - netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER; - /* AST2400 doesn't have working HW checksum generation */ if (np && (of_device_is_compatible(np, "aspeed,ast2400-mac"))) netdev->hw_features &= ~NETIF_F_HW_CSUM; From patchwork Fri Jun 10 16:59:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaqing Zhao X-Patchwork-Id: 580785 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD3EFCCA47B for ; Fri, 10 Jun 2022 17:04:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350069AbiFJRET (ORCPT ); Fri, 10 Jun 2022 13:04:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350072AbiFJREL (ORCPT ); Fri, 10 Jun 2022 13:04:11 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E3F737010; Fri, 10 Jun 2022 10:04:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654880647; x=1686416647; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cedDuWJ1o5WzrQ7/mFOQkYqmkZRy7tIGsqftIplAouU=; b=VpcUxeLQ5LpYj62E60WzafhOsHpdVhP1SBOU7eEAR1hhS64I+eTE8KY+ DOU/4Nbp5dn5l5t1kQ5PKlKPADs0pMmFeBVJzHivo2MakAYeAqUZ+0pTJ P3KIuuFCedeXlTNgVz418QO/qhHMzUZ3tt14Mns4BC6UuZZm65YBXrt3s 37KaN9geptjbbtRP/DCd9iQ2B36tF3TVkv2k3VI0hOvjVBJGiAfcV/ytn Cru+gDYkPqFXJPR5ApGqD0EiScb0QulEUybapVA7G+fRlA3DcBmuQ4HsF +xNaKlA5T0w1XoO47zXMzf+D7W2koQD9+BuzuPmcdrVmRzcYgLna5wpNi g==; X-IronPort-AV: E=McAfee;i="6400,9594,10374"; a="266452815" X-IronPort-AV: E=Sophos;i="5.91,290,1647327600"; d="scan'208";a="266452815" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jun 2022 10:04:07 -0700 X-IronPort-AV: E=Sophos;i="5.91,290,1647327600"; d="scan'208";a="638218818" Received: from unknown (HELO jiaqingz-server.sh.intel.com) ([10.239.48.171]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jun 2022 10:04:05 -0700 From: Jiaqing Zhao To: Samuel Mendoza-Jonas , "David S . Miller" , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org Cc: Jiaqing Zhao Subject: [PATCH v2 6/6] net/ncsi: Support VLAN mode configuration Date: Sat, 11 Jun 2022 00:59:40 +0800 Message-Id: <20220610165940.2326777-7-jiaqing.zhao@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220610165940.2326777-1-jiaqing.zhao@linux.intel.com> References: <20220610165940.2326777-1-jiaqing.zhao@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org NCSI specification defines 4 VLAN modes, currently kernel NCSI driver only supports the "VLAN + non-VLAN" mode (Mode #2), and there is no way to detect which modes are supported by the device. This patch adds support for configuring VLAN mode via the "ncsi,vlan-mode" devicetree node. Signed-off-by: Jiaqing Zhao --- net/ncsi/internal.h | 1 + net/ncsi/ncsi-manage.c | 41 ++++++++++++++++++++++++++++++++++------- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/net/ncsi/internal.h b/net/ncsi/internal.h index 7f384f841019..6a988c898a8d 100644 --- a/net/ncsi/internal.h +++ b/net/ncsi/internal.h @@ -334,6 +334,7 @@ struct ncsi_dev_priv { struct work_struct work; /* For channel management */ struct packet_type ptype; /* NCSI packet Rx handler */ struct list_head node; /* Form NCSI device list */ + u32 vlan_mode; /* VLAN mode */ #define NCSI_MAX_VLAN_VIDS 15 struct list_head vlan_vids; /* List of active VLAN IDs */ diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c index 3fb95f29e3e2..a398b0eb72b2 100644 --- a/net/ncsi/ncsi-manage.c +++ b/net/ncsi/ncsi-manage.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -1042,7 +1043,11 @@ static void ncsi_configure_channel(struct ncsi_dev_priv *ndp) nd->state = ncsi_dev_state_config_oem_gma; break; case ncsi_dev_state_config_oem_gma: - nd->state = ncsi_dev_state_config_clear_vids; + /* Only set up hardware VLAN filters in filtered mode */ + if (ndp->vlan_mode == NCSI_VLAN_MODE_FILTERED) + nd->state = ncsi_dev_state_config_clear_vids; + else + nd->state = ncsi_dev_state_config_ev; ret = -1; #if IS_ENABLED(CONFIG_NCSI_OEM_CMD_GET_MAC) @@ -1094,11 +1099,15 @@ static void ncsi_configure_channel(struct ncsi_dev_priv *ndp) nd->state = ncsi_dev_state_config_svf; /* Enable/Disable the VLAN filter */ } else if (nd->state == ncsi_dev_state_config_ev) { - if (list_empty(&ndp->vlan_vids)) { - nca.type = NCSI_PKT_CMD_DV; - } else { + if (ndp->vlan_mode == NCSI_VLAN_MODE_FILTERED && + !list_empty(&ndp->vlan_vids)) { nca.type = NCSI_PKT_CMD_EV; nca.bytes[3] = NCSI_CAP_VLAN_FILTERED; + } else if (ndp->vlan_mode == NCSI_VLAN_MODE_ANY) { + nca.type = NCSI_PKT_CMD_EV; + nca.bytes[3] = NCSI_CAP_VLAN_ANY; + } else { + nca.type = NCSI_PKT_CMD_DV; } nd->state = ncsi_dev_state_config_sma; } else if (nd->state == ncsi_dev_state_config_sma) { @@ -1800,15 +1809,33 @@ struct ncsi_dev *ncsi_register_dev(struct net_device *dev, ndp->ptype.dev = dev; dev_add_pack(&ndp->ptype); + /* Set default VLAN mode (filtered) */ + ndp->vlan_mode = NCSI_VLAN_MODE_FILTERED; + pdev = to_platform_device(dev->dev.parent); if (pdev) { np = pdev->dev.of_node; - if (np && of_get_property(np, "mlx,multi-host", NULL)) - ndp->mlx_multi_host = true; + if (np) { + u32 vlan_mode; + + if (!of_property_read_u32(np, "ncsi,vlan-mode", &vlan_mode)) { + if (vlan_mode > NCSI_VLAN_MODE_ANY || + vlan_mode == NCSI_VLAN_MODE_ONLY) + dev_warn(&pdev->dev, "NCSI: Unsupported VLAN mode %u", + vlan_mode); + else + ndp->vlan_mode = vlan_mode; + dev_info(&pdev->dev, "NCSI: Configured VLAN mode %u", + ndp->vlan_mode); + } + if (of_get_property(np, "mlx,multi-host", NULL)) + ndp->mlx_multi_host = true; + } } /* Enable hardware VLAN filtering */ - if (dev->netdev_ops->ndo_vlan_rx_add_vid == ncsi_vlan_rx_add_vid && + if (ndp->vlan_mode == NCSI_VLAN_MODE_FILTERED && + dev->netdev_ops->ndo_vlan_rx_add_vid == ncsi_vlan_rx_add_vid && dev->netdev_ops->ndo_vlan_rx_kill_vid == ncsi_vlan_rx_kill_vid) dev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER;