From patchwork Wed May 20 00:04:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Kirsher X-Patchwork-Id: 218970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9BF1C433E0 for ; Wed, 20 May 2020 00:04:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 986F420709 for ; Wed, 20 May 2020 00:04:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728039AbgETAEc (ORCPT ); Tue, 19 May 2020 20:04:32 -0400 Received: from mga01.intel.com ([192.55.52.88]:15427 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726352AbgETAE3 (ORCPT ); Tue, 19 May 2020 20:04:29 -0400 IronPort-SDR: jvutKwNnQfG+u097eYTRTchsIUBrxtcrivSzJMErgK92A1GZQPnNV5sTXgfCxUlcS0lGO9N5uF Kkq67kYEKU0A== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2020 17:04:21 -0700 IronPort-SDR: 5x4hsWqIuwtGRkrAgVqdYixmZRzRHg873Q5/z2uq8YvuEQxuJ1nxrjDS2XLHj1cI12a+thvYGr Ma6Nys/7TfUA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,411,1583222400"; d="scan'208";a="466324747" Received: from jtkirshe-desk1.jf.intel.com ([134.134.177.86]) by fmsmga006.fm.intel.com with ESMTP; 19 May 2020 17:04:20 -0700 From: Jeff Kirsher To: davem@davemloft.net Cc: Sasha Neftin , netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com, Aaron Brown , Jeff Kirsher Subject: [net-next 01/14] igc: Remove PCIe Control register Date: Tue, 19 May 2020 17:04:06 -0700 Message-Id: <20200520000419.1595788-2-jeffrey.t.kirsher@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200520000419.1595788-1-jeffrey.t.kirsher@intel.com> References: <20200520000419.1595788-1-jeffrey.t.kirsher@intel.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Sasha Neftin GCR (PCIe Control) register not in use and should be removed This patch clean up this register Signed-off-by: Sasha Neftin Tested-by: Aaron Brown Signed-off-by: Jeff Kirsher --- drivers/net/ethernet/intel/igc/igc_regs.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/net/ethernet/intel/igc/igc_regs.h b/drivers/net/ethernet/intel/igc/igc_regs.h index 5a6110e211fd..0f94285ddc11 100644 --- a/drivers/net/ethernet/intel/igc/igc_regs.h +++ b/drivers/net/ethernet/intel/igc/igc_regs.h @@ -36,9 +36,6 @@ #define IGC_FCRTH 0x02168 /* FC Receive Threshold High - RW */ #define IGC_FCRTV 0x02460 /* FC Refresh Timer Value - RW */ -/* PCIe Register Description */ -#define IGC_GCR 0x05B00 /* PCIe control- RW */ - /* Semaphore registers */ #define IGC_SW_FW_SYNC 0x05B5C /* SW-FW Synchronization - RW */ #define IGC_SWSM 0x05B50 /* SW Semaphore */ From patchwork Wed May 20 00:04:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Kirsher X-Patchwork-Id: 218964 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8F9AC433E0 for ; Wed, 20 May 2020 00:04:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 862AD20823 for ; Wed, 20 May 2020 00:04:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728337AbgETAEz (ORCPT ); Tue, 19 May 2020 20:04:55 -0400 Received: from mga01.intel.com ([192.55.52.88]:15427 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726344AbgETAEa (ORCPT ); Tue, 19 May 2020 20:04:30 -0400 IronPort-SDR: 9gvD7+InowOQ/eIlVU40deMNdqcTVMOnSWNnrC/CX22q4uQMNcRMWPe4XeT39aRa3IodRPS6zq WW9Zjh1E4WKw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2020 17:04:21 -0700 IronPort-SDR: wmERnAFtviNl0vMM2C5DGVApAZQHUwHOSLK33tgbV+jSVMRt+ctwKgxVh/KxKuXNcHgFx4dVgt WRJdJbjC56Dg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,411,1583222400"; d="scan'208";a="466324752" Received: from jtkirshe-desk1.jf.intel.com ([134.134.177.86]) by fmsmga006.fm.intel.com with ESMTP; 19 May 2020 17:04:21 -0700 From: Jeff Kirsher To: davem@davemloft.net Cc: Vitaly Lifshits , netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com, Sasha Neftin , Aaron Brown , Jeff Kirsher Subject: [net-next 02/14] igc: remove IGC_REMOVED function Date: Tue, 19 May 2020 17:04:07 -0700 Message-Id: <20200520000419.1595788-3-jeffrey.t.kirsher@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200520000419.1595788-1-jeffrey.t.kirsher@intel.com> References: <20200520000419.1595788-1-jeffrey.t.kirsher@intel.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Vitaly Lifshits igc driver has leftovers from the previous device that supported Virtualization. This can be found in the function IGC_REMOVED which became obsolete, and can be removed. Signed-off-by: Vitaly Lifshits Acked-by: Sasha Neftin Tested-by: Aaron Brown Signed-off-by: Jeff Kirsher --- drivers/net/ethernet/intel/igc/igc_mac.h | 4 ---- drivers/net/ethernet/intel/igc/igc_main.c | 3 --- drivers/net/ethernet/intel/igc/igc_regs.h | 3 +-- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/net/ethernet/intel/igc/igc_mac.h b/drivers/net/ethernet/intel/igc/igc_mac.h index 832cccec87cd..b5963f86defb 100644 --- a/drivers/net/ethernet/intel/igc/igc_mac.h +++ b/drivers/net/ethernet/intel/igc/igc_mac.h @@ -8,10 +8,6 @@ #include "igc_phy.h" #include "igc_defines.h" -#ifndef IGC_REMOVED -#define IGC_REMOVED(a) (0) -#endif /* IGC_REMOVED */ - /* forward declaration */ s32 igc_disable_pcie_master(struct igc_hw *hw); s32 igc_check_for_copper_link(struct igc_hw *hw); diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c index 0ae3590a50eb..125026d053eb 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c @@ -4659,9 +4659,6 @@ u32 igc_rd32(struct igc_hw *hw, u32 reg) u8 __iomem *hw_addr = READ_ONCE(hw->hw_addr); u32 value = 0; - if (IGC_REMOVED(hw_addr)) - return ~value; - value = readl(&hw_addr[reg]); /* reads should not return all F's */ diff --git a/drivers/net/ethernet/intel/igc/igc_regs.h b/drivers/net/ethernet/intel/igc/igc_regs.h index 0f94285ddc11..f101bfbf52e6 100644 --- a/drivers/net/ethernet/intel/igc/igc_regs.h +++ b/drivers/net/ethernet/intel/igc/igc_regs.h @@ -275,8 +275,7 @@ u32 igc_rd32(struct igc_hw *hw, u32 reg); #define wr32(reg, val) \ do { \ u8 __iomem *hw_addr = READ_ONCE((hw)->hw_addr); \ - if (!IGC_REMOVED(hw_addr)) \ - writel((val), &hw_addr[(reg)]); \ + writel((val), &hw_addr[(reg)]); \ } while (0) #define rd32(reg) (igc_rd32(hw, reg)) From patchwork Wed May 20 00:04:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Kirsher X-Patchwork-Id: 218968 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B624C433E0 for ; Wed, 20 May 2020 00:04:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EEBFF20823 for ; Wed, 20 May 2020 00:04:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728275AbgETAEi (ORCPT ); Tue, 19 May 2020 20:04:38 -0400 Received: from mga01.intel.com ([192.55.52.88]:15430 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728043AbgETAEc (ORCPT ); Tue, 19 May 2020 20:04:32 -0400 IronPort-SDR: jshl26KQfCJ1pk7NVL/4vToa39Fop4jLJOvx/hNM4o0GeVl041GDOQPCe6Ox7mvY8Dt9VzVzrs i0CrWwfxwjHg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2020 17:04:22 -0700 IronPort-SDR: pelFi1fwfMz5pez2Ec/gQqJoF3DcwAVsmyl+dbmmFtM8cpNPYmHexpZgDG8Q/aqIEDKixw4r1d CyXtdhn3OVnw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,411,1583222400"; d="scan'208";a="466324777" Received: from jtkirshe-desk1.jf.intel.com ([134.134.177.86]) by fmsmga006.fm.intel.com with ESMTP; 19 May 2020 17:04:22 -0700 From: Jeff Kirsher To: davem@davemloft.net Cc: Andre Guedes , netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com, Aaron Brown , Jeff Kirsher Subject: [net-next 06/14] igc: Return -EOPNOTSUPP when VLAN mask doesn't match Date: Tue, 19 May 2020 17:04:11 -0700 Message-Id: <20200520000419.1595788-7-jeffrey.t.kirsher@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200520000419.1595788-1-jeffrey.t.kirsher@intel.com> References: <20200520000419.1595788-1-jeffrey.t.kirsher@intel.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Andre Guedes The I225 controller supports Rx queue assignment based on VLAN priority only. Other Tag Control Information (TCI) are valid, but not supported by the driver. So this patch changes the returning code from igc_add_ ethtool_nfc_entry() to -EOPNOTSUPP in order to provide more meaningful information on why the function failed. It also adds a debug messages to give the user a hint about what went wrong with the NFC setup. Signed-off-by: Andre Guedes Tested-by: Aaron Brown Signed-off-by: Jeff Kirsher --- drivers/net/ethernet/intel/igc/igc_ethtool.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c index 19da9dc8dafb..f28f7feb39a5 100644 --- a/drivers/net/ethernet/intel/igc/igc_ethtool.c +++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c @@ -1446,7 +1446,8 @@ static int igc_add_ethtool_nfc_entry(struct igc_adapter *adapter, if ((fsp->flow_type & FLOW_EXT) && fsp->m_ext.vlan_tci) { if (fsp->m_ext.vlan_tci != htons(VLAN_PRIO_MASK)) { - err = -EINVAL; + netdev_dbg(netdev, "VLAN mask not supported\n"); + err = -EOPNOTSUPP; goto err_out; } input->filter.vlan_tci = fsp->h_ext.vlan_tci; From patchwork Wed May 20 00:04:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Kirsher X-Patchwork-Id: 218969 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4ED5AC433DF for ; Wed, 20 May 2020 00:04:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 36E6F20709 for ; Wed, 20 May 2020 00:04:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728213AbgETAEf (ORCPT ); Tue, 19 May 2020 20:04:35 -0400 Received: from mga01.intel.com ([192.55.52.88]:15429 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726959AbgETAEc (ORCPT ); Tue, 19 May 2020 20:04:32 -0400 IronPort-SDR: gtxW049GZ2KUMFuOEkbKTqLMgj8Eeg+szn4M+58lEoI15uPRhCWz85WsNd6orxGOmCVQ87VAht A1IUrQffaexQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2020 17:04:23 -0700 IronPort-SDR: Id7FORvO5+iDQmRMa7YD/7d2HdoK9vop9yEYyvKOnIvyW9D4xPeAjyTQfz23WODzF0nvzUEWMs F1CgCq5zJiYg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,411,1583222400"; d="scan'208";a="466324781" Received: from jtkirshe-desk1.jf.intel.com ([134.134.177.86]) by fmsmga006.fm.intel.com with ESMTP; 19 May 2020 17:04:22 -0700 From: Jeff Kirsher To: davem@davemloft.net Cc: Andre Guedes , netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com, Aaron Brown , Jeff Kirsher Subject: [net-next 07/14] igc: Refactor VLAN priority filtering code Date: Tue, 19 May 2020 17:04:12 -0700 Message-Id: <20200520000419.1595788-8-jeffrey.t.kirsher@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200520000419.1595788-1-jeffrey.t.kirsher@intel.com> References: <20200520000419.1595788-1-jeffrey.t.kirsher@intel.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Andre Guedes The whole VLAN priority filtering code is implemented in igc_ethtool.c and mixes logic from ethtool and core parts. This patch refactors it so core logic is moved to igc_main.c, aligning the VLAN priority filtering code organization with the MAC address filtering code. This patch also takes the opportunity to add some log messages to ease debugging. Signed-off-by: Andre Guedes Tested-by: Aaron Brown Signed-off-by: Jeff Kirsher --- drivers/net/ethernet/intel/igc/igc.h | 3 + drivers/net/ethernet/intel/igc/igc_ethtool.c | 64 ++++---------------- drivers/net/ethernet/intel/igc/igc_main.c | 52 ++++++++++++++++ 3 files changed, 68 insertions(+), 51 deletions(-) diff --git a/drivers/net/ethernet/intel/igc/igc.h b/drivers/net/ethernet/intel/igc/igc.h index 661dc8875f3f..5f1e1d31e832 100644 --- a/drivers/net/ethernet/intel/igc/igc.h +++ b/drivers/net/ethernet/intel/igc/igc.h @@ -235,6 +235,9 @@ int igc_add_mac_filter(struct igc_adapter *adapter, const u8 *addr, const s8 queue, const u8 flags); int igc_del_mac_filter(struct igc_adapter *adapter, const u8 *addr, const u8 flags); +int igc_add_vlan_prio_filter(struct igc_adapter *adapter, int prio, + int queue); +void igc_del_vlan_prio_filter(struct igc_adapter *adapter, int prio); void igc_update_stats(struct igc_adapter *adapter); /* igc_dump declarations */ diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c index f28f7feb39a5..c5be8b936963 100644 --- a/drivers/net/ethernet/intel/igc/igc_ethtool.c +++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c @@ -1223,35 +1223,6 @@ static int igc_rxnfc_write_etype_filter(struct igc_adapter *adapter, return 0; } -static int igc_rxnfc_write_vlan_prio_filter(struct igc_adapter *adapter, - struct igc_nfc_filter *input) -{ - struct igc_hw *hw = &adapter->hw; - u8 vlan_priority; - u16 queue_index; - u32 vlapqf; - - vlapqf = rd32(IGC_VLANPQF); - vlan_priority = (ntohs(input->filter.vlan_tci) & VLAN_PRIO_MASK) - >> VLAN_PRIO_SHIFT; - queue_index = (vlapqf >> (vlan_priority * 4)) & IGC_VLANPQF_QUEUE_MASK; - - /* check whether this VLAN prio is already set */ - if (vlapqf & IGC_VLANPQF_VALID(vlan_priority) && - queue_index != input->action) { - netdev_err(adapter->netdev, - "ethtool rxnfc set VLAN prio filter failed\n"); - return -EEXIST; - } - - vlapqf |= IGC_VLANPQF_VALID(vlan_priority); - vlapqf |= IGC_VLANPQF_QSEL(vlan_priority, input->action); - - wr32(IGC_VLANPQF, vlapqf); - - return 0; -} - int igc_add_filter(struct igc_adapter *adapter, struct igc_nfc_filter *input) { struct igc_hw *hw = &adapter->hw; @@ -1285,10 +1256,15 @@ int igc_add_filter(struct igc_adapter *adapter, struct igc_nfc_filter *input) return err; } - if (input->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI) - err = igc_rxnfc_write_vlan_prio_filter(adapter, input); + if (input->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI) { + int prio = (ntohs(input->filter.vlan_tci) & VLAN_PRIO_MASK) >> + VLAN_PRIO_SHIFT; + err = igc_add_vlan_prio_filter(adapter, prio, input->action); + if (err) + return err; + } - return err; + return 0; } static void igc_clear_etype_filter_regs(struct igc_adapter *adapter, @@ -1306,31 +1282,17 @@ static void igc_clear_etype_filter_regs(struct igc_adapter *adapter, adapter->etype_bitmap[reg_index] = false; } -static void igc_clear_vlan_prio_filter(struct igc_adapter *adapter, - u16 vlan_tci) -{ - struct igc_hw *hw = &adapter->hw; - u8 vlan_priority; - u32 vlapqf; - - vlan_priority = (vlan_tci & VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT; - - vlapqf = rd32(IGC_VLANPQF); - vlapqf &= ~IGC_VLANPQF_VALID(vlan_priority); - vlapqf &= ~IGC_VLANPQF_QSEL(vlan_priority, IGC_VLANPQF_QUEUE_MASK); - - wr32(IGC_VLANPQF, vlapqf); -} - int igc_erase_filter(struct igc_adapter *adapter, struct igc_nfc_filter *input) { if (input->filter.match_flags & IGC_FILTER_FLAG_ETHER_TYPE) igc_clear_etype_filter_regs(adapter, input->etype_reg_index); - if (input->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI) - igc_clear_vlan_prio_filter(adapter, - ntohs(input->filter.vlan_tci)); + if (input->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI) { + int prio = (ntohs(input->filter.vlan_tci) & VLAN_PRIO_MASK) >> + VLAN_PRIO_SHIFT; + igc_del_vlan_prio_filter(adapter, prio); + } if (input->filter.match_flags & IGC_FILTER_FLAG_SRC_MAC_ADDR) igc_del_mac_filter(adapter, input->filter.src_addr, diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c index 125026d053eb..7e59c0393dbc 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c @@ -2314,6 +2314,58 @@ int igc_del_mac_filter(struct igc_adapter *adapter, const u8 *addr, return 0; } +/** + * igc_add_vlan_prio_filter() - Add VLAN priority filter + * @adapter: Pointer to adapter where the filter should be added + * @prio: VLAN priority value + * @queue: Queue number which matching frames are assigned to + * + * Return: 0 in case of success, negative errno code otherwise. + */ +int igc_add_vlan_prio_filter(struct igc_adapter *adapter, int prio, int queue) +{ + struct net_device *dev = adapter->netdev; + struct igc_hw *hw = &adapter->hw; + u32 vlanpqf; + + vlanpqf = rd32(IGC_VLANPQF); + + if (vlanpqf & IGC_VLANPQF_VALID(prio)) { + netdev_dbg(dev, "VLAN priority filter already in use\n"); + return -EEXIST; + } + + vlanpqf |= IGC_VLANPQF_QSEL(prio, queue); + vlanpqf |= IGC_VLANPQF_VALID(prio); + + wr32(IGC_VLANPQF, vlanpqf); + + netdev_dbg(dev, "Add VLAN priority filter: prio %d queue %d\n", + prio, queue); + return 0; +} + +/** + * igc_del_vlan_prio_filter() - Delete VLAN priority filter + * @adapter: Pointer to adapter where the filter should be deleted from + * @prio: VLAN priority value + */ +void igc_del_vlan_prio_filter(struct igc_adapter *adapter, int prio) +{ + struct igc_hw *hw = &adapter->hw; + u32 vlanpqf; + + vlanpqf = rd32(IGC_VLANPQF); + + vlanpqf &= ~IGC_VLANPQF_VALID(prio); + vlanpqf &= ~IGC_VLANPQF_QSEL(prio, IGC_VLANPQF_QUEUE_MASK); + + wr32(IGC_VLANPQF, vlanpqf); + + netdev_dbg(adapter->netdev, "Delete VLAN priority filter: prio %d\n", + prio); +} + static int igc_uc_sync(struct net_device *netdev, const unsigned char *addr) { struct igc_adapter *adapter = netdev_priv(netdev); From patchwork Wed May 20 00:04:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Kirsher X-Patchwork-Id: 218965 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66C17C433DF for ; Wed, 20 May 2020 00:04:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 38DEF20709 for ; Wed, 20 May 2020 00:04:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728324AbgETAEu (ORCPT ); Tue, 19 May 2020 20:04:50 -0400 Received: from mga01.intel.com ([192.55.52.88]:15427 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728053AbgETAEc (ORCPT ); Tue, 19 May 2020 20:04:32 -0400 IronPort-SDR: DiIHW2dBj6AA6GwZZbrN0xLMZMGtl4HZx259WxSu14Ci60X0faQ+5f9Oc4qkdiNmV+vg1XqQdM fYmMMKmDUkKQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2020 17:04:24 -0700 IronPort-SDR: Eefx+OVwM6VbKSNDYKyRcf7ftLigMPBXugEnfWPFwYNwXOpco/kRRHymgT5IKEhJ91k4Gd1jDj /E37id7QPV2A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,411,1583222400"; d="scan'208";a="466324789" Received: from jtkirshe-desk1.jf.intel.com ([134.134.177.86]) by fmsmga006.fm.intel.com with ESMTP; 19 May 2020 17:04:23 -0700 From: Jeff Kirsher To: davem@davemloft.net Cc: Andre Guedes , netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com, Aaron Brown , Jeff Kirsher Subject: [net-next 09/14] igc: Remove ethertype filter in PTP code Date: Tue, 19 May 2020 17:04:14 -0700 Message-Id: <20200520000419.1595788-10-jeffrey.t.kirsher@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200520000419.1595788-1-jeffrey.t.kirsher@intel.com> References: <20200520000419.1595788-1-jeffrey.t.kirsher@intel.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Andre Guedes The driver only supports hardware timestamping for all incoming traffic (HWTSTAMP_FILTER_ALL) which is enabled via Rx Time Sync Control (TSYNCRXCTL) register already. Therefore, the ethertype filter set in in igc_ptp_set_timestamp_mode() is useless so this patch removes it. Signed-off-by: Andre Guedes Tested-by: Aaron Brown Signed-off-by: Jeff Kirsher --- drivers/net/ethernet/intel/igc/igc.h | 2 +- drivers/net/ethernet/intel/igc/igc_defines.h | 3 --- drivers/net/ethernet/intel/igc/igc_ptp.c | 12 ------------ 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/drivers/net/ethernet/intel/igc/igc.h b/drivers/net/ethernet/intel/igc/igc.h index 5f1e1d31e832..e4169fe955d8 100644 --- a/drivers/net/ethernet/intel/igc/igc.h +++ b/drivers/net/ethernet/intel/igc/igc.h @@ -26,7 +26,7 @@ void igc_set_ethtool_ops(struct net_device *); #define MAX_Q_VECTORS 8 #define MAX_STD_JUMBO_FRAME_SIZE 9216 -#define MAX_ETYPE_FILTER (4 - 1) +#define MAX_ETYPE_FILTER 4 #define IGC_RETA_SIZE 128 struct igc_tx_queue_stats { diff --git a/drivers/net/ethernet/intel/igc/igc_defines.h b/drivers/net/ethernet/intel/igc/igc_defines.h index f1bb5414f99f..6909826bc747 100644 --- a/drivers/net/ethernet/intel/igc/igc_defines.h +++ b/drivers/net/ethernet/intel/igc/igc_defines.h @@ -384,9 +384,6 @@ #define IGC_TSICR_INTERRUPTS IGC_TSICR_TXTS -/* PTP Queue Filter */ -#define IGC_ETQF_1588 BIT(30) - #define IGC_FTQF_VF_BP 0x00008000 #define IGC_FTQF_1588_TIME_STAMP 0x08000000 #define IGC_FTQF_MASK 0xF0000000 diff --git a/drivers/net/ethernet/intel/igc/igc_ptp.c b/drivers/net/ethernet/intel/igc/igc_ptp.c index 1bf016398b9d..0d746f8588c8 100644 --- a/drivers/net/ethernet/intel/igc/igc_ptp.c +++ b/drivers/net/ethernet/intel/igc/igc_ptp.c @@ -305,7 +305,6 @@ static int igc_ptp_set_timestamp_mode(struct igc_adapter *adapter, struct igc_hw *hw = &adapter->hw; u32 tsync_rx_cfg = 0; bool is_l4 = false; - bool is_l2 = false; u32 regval; /* reserved for future extensions */ @@ -346,7 +345,6 @@ static int igc_ptp_set_timestamp_mode(struct igc_adapter *adapter, case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ: tsync_rx_ctl |= IGC_TSYNCRXCTL_TYPE_EVENT_V2; config->rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT; - is_l2 = true; is_l4 = true; break; case HWTSTAMP_FILTER_PTP_V1_L4_EVENT: @@ -370,7 +368,6 @@ static int igc_ptp_set_timestamp_mode(struct igc_adapter *adapter, tsync_rx_ctl |= IGC_TSYNCRXCTL_TYPE_ALL; tsync_rx_ctl |= IGC_TSYNCRXCTL_RXSYNSIG; config->rx_filter = HWTSTAMP_FILTER_ALL; - is_l2 = true; is_l4 = true; if (hw->mac.type == igc_i225) { @@ -405,15 +402,6 @@ static int igc_ptp_set_timestamp_mode(struct igc_adapter *adapter, /* define which PTP packets are time stamped */ wr32(IGC_TSYNCRXCFG, tsync_rx_cfg); - /* define ethertype filter for timestamped packets */ - if (is_l2) - wr32(IGC_ETQF(3), - (IGC_ETQF_FILTER_ENABLE | /* enable filter */ - IGC_ETQF_1588 | /* enable timestamping */ - ETH_P_1588)); /* 1588 eth protocol type */ - else - wr32(IGC_ETQF(3), 0); - /* L4 Queue Filter[3]: filter by destination port and protocol */ if (is_l4) { u32 ftqf = (IPPROTO_UDP /* UDP */ From patchwork Wed May 20 00:04:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Kirsher X-Patchwork-Id: 218966 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71C65C433DF for ; Wed, 20 May 2020 00:04:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 594A420823 for ; Wed, 20 May 2020 00:04:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728303AbgETAEr (ORCPT ); Tue, 19 May 2020 20:04:47 -0400 Received: from mga01.intel.com ([192.55.52.88]:15429 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728056AbgETAEd (ORCPT ); Tue, 19 May 2020 20:04:33 -0400 IronPort-SDR: VGmx3va2HpuGhAqWrgVkBzCpzaSMeLsSk6562U6mWh4MyDAeAz67ZvA0jiaPkGGH8YfEBlvsvc SispnBzbb0oQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2020 17:04:24 -0700 IronPort-SDR: g89GgPz5n2rd3N1m4/lyNE44iCq4p5A22Hgjt1Z+FByVkdAoZ05F7OQxUBM7aGlNLbRIy8vxCW 0cfwttW5skoA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,411,1583222400"; d="scan'208";a="466324793" Received: from jtkirshe-desk1.jf.intel.com ([134.134.177.86]) by fmsmga006.fm.intel.com with ESMTP; 19 May 2020 17:04:23 -0700 From: Jeff Kirsher To: davem@davemloft.net Cc: Andre Guedes , netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com, Aaron Brown , Jeff Kirsher Subject: [net-next 10/14] igc: Fix MAX_ETYPE_FILTER value Date: Tue, 19 May 2020 17:04:15 -0700 Message-Id: <20200520000419.1595788-11-jeffrey.t.kirsher@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200520000419.1595788-1-jeffrey.t.kirsher@intel.com> References: <20200520000419.1595788-1-jeffrey.t.kirsher@intel.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Andre Guedes The I225 controller has 8 ethertype filters, not 4. This patch fixes the MAX_ETYPE_FILTER macro accordingly. Signed-off-by: Andre Guedes Tested-by: Aaron Brown Signed-off-by: Jeff Kirsher --- drivers/net/ethernet/intel/igc/igc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/igc/igc.h b/drivers/net/ethernet/intel/igc/igc.h index e4169fe955d8..8389569aea8a 100644 --- a/drivers/net/ethernet/intel/igc/igc.h +++ b/drivers/net/ethernet/intel/igc/igc.h @@ -26,7 +26,7 @@ void igc_set_ethtool_ops(struct net_device *); #define MAX_Q_VECTORS 8 #define MAX_STD_JUMBO_FRAME_SIZE 9216 -#define MAX_ETYPE_FILTER 4 +#define MAX_ETYPE_FILTER 8 #define IGC_RETA_SIZE 128 struct igc_tx_queue_stats { From patchwork Wed May 20 00:04:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Kirsher X-Patchwork-Id: 218967 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B88D0C433E1 for ; Wed, 20 May 2020 00:04:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9813B20709 for ; Wed, 20 May 2020 00:04:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728289AbgETAEl (ORCPT ); Tue, 19 May 2020 20:04:41 -0400 Received: from mga01.intel.com ([192.55.52.88]:15427 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728145AbgETAEd (ORCPT ); Tue, 19 May 2020 20:04:33 -0400 IronPort-SDR: b6e0VHUxXDOt6VjS51ECpOBIlZi5EuJRIrem839d15lDcBTx2iogmr6vbZK4sLlqCCKPX0RCdp c+BOYyixGE6Q== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2020 17:04:25 -0700 IronPort-SDR: EM7hchqGDJFJi1SLkSgBulLMT6vTHOnN7edgm0LsVIPiIKYlBITdeKz7pA1FL0OiHnmGlFETh4 M/FClxfEpISg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,411,1583222400"; d="scan'208";a="466324809" Received: from jtkirshe-desk1.jf.intel.com ([134.134.177.86]) by fmsmga006.fm.intel.com with ESMTP; 19 May 2020 17:04:24 -0700 From: Jeff Kirsher To: davem@davemloft.net Cc: Andre Guedes , netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com, Aaron Brown , Jeff Kirsher Subject: [net-next 12/14] igc: Dump ETQF registers Date: Tue, 19 May 2020 17:04:17 -0700 Message-Id: <20200520000419.1595788-13-jeffrey.t.kirsher@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200520000419.1595788-1-jeffrey.t.kirsher@intel.com> References: <20200520000419.1595788-1-jeffrey.t.kirsher@intel.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Andre Guedes This patch adds the EType Queue Filter (ETQF) registers to the list of registers dumped by igc_get_regs(). Signed-off-by: Andre Guedes Tested-by: Aaron Brown Signed-off-by: Jeff Kirsher --- drivers/net/ethernet/intel/igc/igc_ethtool.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c index 3cdb88a5eb01..c6586e2be3a8 100644 --- a/drivers/net/ethernet/intel/igc/igc_ethtool.c +++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c @@ -318,6 +318,9 @@ static void igc_get_regs(struct net_device *netdev, regs_buff[188 + i] = rd32(IGC_RAH(i)); regs_buff[204] = rd32(IGC_VLANPQF); + + for (i = 0; i < 8; i++) + regs_buff[205 + i] = rd32(IGC_ETQF(i)); } static void igc_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)