netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/3][pull request] Intel Wired LAN Driver Updates 2023-01-10 (ixgbe, igc, iavf)
@ 2023-01-10 22:38 Tony Nguyen
  2023-01-10 22:38 ` [PATCH net 1/3] ixgbe: fix pci device refcount leak Tony Nguyen
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Tony Nguyen @ 2023-01-10 22:38 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet; +Cc: Tony Nguyen, netdev

This series contains updates to ixgbe, igc, and iavf drivers.

Yang Yingliang adds calls to pci_dev_put() for proper ref count tracking
on ixgbe.

Christopher adds setting of Toggle on Target Time bits for proper
pulse per second (PPS) synchronization for igc.

Daniil Tatianin fixes, likely, copy/paste issue that misreported
destination instead of source for IP mask for iavf error.

The following are changes since commit 53da7aec32982f5ee775b69dce06d63992ce4af3:
  octeontx2-pf: Fix resource leakage in VF driver unbind
and are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue 10GbE

Christopher S Hall (1):
  igc: Fix PPS delta between two synchronized end-points

Daniil Tatianin (1):
  iavf/iavf_main: actually log ->src mask when talking about it

Yang Yingliang (1):
  ixgbe: fix pci device refcount leak

 drivers/net/ethernet/intel/iavf/iavf_main.c  |  2 +-
 drivers/net/ethernet/intel/igc/igc_defines.h |  2 ++
 drivers/net/ethernet/intel/igc/igc_ptp.c     | 10 ++++++----
 drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 14 +++++++++-----
 4 files changed, 18 insertions(+), 10 deletions(-)

-- 
2.38.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net 1/3] ixgbe: fix pci device refcount leak
  2023-01-10 22:38 [PATCH net 0/3][pull request] Intel Wired LAN Driver Updates 2023-01-10 (ixgbe, igc, iavf) Tony Nguyen
@ 2023-01-10 22:38 ` Tony Nguyen
  2023-01-10 22:38 ` [PATCH net 2/3] igc: Fix PPS delta between two synchronized end-points Tony Nguyen
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Tony Nguyen @ 2023-01-10 22:38 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet
  Cc: Yang Yingliang, netdev, anthony.l.nguyen, stephend, andrew,
	f.fainelli, Gurucharan G

From: Yang Yingliang <yangyingliang@huawei.com>

As the comment of pci_get_domain_bus_and_slot() says, it
returns a PCI device with refcount incremented, when finish
using it, the caller must decrement the reference count by
calling pci_dev_put().

In ixgbe_get_first_secondary_devfn() and ixgbe_x550em_a_has_mii(),
pci_dev_put() is called to avoid leak.

Fixes: 8fa10ef01260 ("ixgbe: register a mdiobus")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
index 24aa97f993ca..123dca9ce468 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
@@ -855,9 +855,11 @@ static struct pci_dev *ixgbe_get_first_secondary_devfn(unsigned int devfn)
 	rp_pdev = pci_get_domain_bus_and_slot(0, 0, devfn);
 	if (rp_pdev && rp_pdev->subordinate) {
 		bus = rp_pdev->subordinate->number;
+		pci_dev_put(rp_pdev);
 		return pci_get_domain_bus_and_slot(0, bus, 0);
 	}
 
+	pci_dev_put(rp_pdev);
 	return NULL;
 }
 
@@ -874,6 +876,7 @@ static bool ixgbe_x550em_a_has_mii(struct ixgbe_hw *hw)
 	struct ixgbe_adapter *adapter = hw->back;
 	struct pci_dev *pdev = adapter->pdev;
 	struct pci_dev *func0_pdev;
+	bool has_mii = false;
 
 	/* For the C3000 family of SoCs (x550em_a) the internal ixgbe devices
 	 * are always downstream of root ports @ 0000:00:16.0 & 0000:00:17.0
@@ -884,15 +887,16 @@ static bool ixgbe_x550em_a_has_mii(struct ixgbe_hw *hw)
 	func0_pdev = ixgbe_get_first_secondary_devfn(PCI_DEVFN(0x16, 0));
 	if (func0_pdev) {
 		if (func0_pdev == pdev)
-			return true;
-		else
-			return false;
+			has_mii = true;
+		goto out;
 	}
 	func0_pdev = ixgbe_get_first_secondary_devfn(PCI_DEVFN(0x17, 0));
 	if (func0_pdev == pdev)
-		return true;
+		has_mii = true;
 
-	return false;
+out:
+	pci_dev_put(func0_pdev);
+	return has_mii;
 }
 
 /**
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net 2/3] igc: Fix PPS delta between two synchronized end-points
  2023-01-10 22:38 [PATCH net 0/3][pull request] Intel Wired LAN Driver Updates 2023-01-10 (ixgbe, igc, iavf) Tony Nguyen
  2023-01-10 22:38 ` [PATCH net 1/3] ixgbe: fix pci device refcount leak Tony Nguyen
@ 2023-01-10 22:38 ` Tony Nguyen
  2023-01-10 22:38 ` [PATCH net 3/3] iavf/iavf_main: actually log ->src mask when talking about it Tony Nguyen
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Tony Nguyen @ 2023-01-10 22:38 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet
  Cc: Christopher S Hall, netdev, anthony.l.nguyen, richardcochran,
	Muhammad Husaini Zulkifli, Sasha Neftin, Naama Meir

From: Christopher S Hall <christopher.s.hall@intel.com>

This patch fix the pulse per second output delta between
two synchronized end-points.

Based on Intel Discrete I225 Software User Manual Section
4.2.15 TimeSync Auxiliary Control Register, ST0[Bit 4] and
ST1[Bit 7] must be set to ensure that clock output will be
toggles based on frequency value defined. This is to ensure
that output of the PPS is aligned with the clock.

How to test:

1) Running time synchronization on both end points.
Ex: ptp4l --step_threshold=1 -m -f gPTP.cfg -i <interface name>

2) Configure PPS output using below command for both end-points
Ex: SDP0 on I225 REV4 SKU variant

./testptp -d /dev/ptp0 -L 0,2
./testptp -d /dev/ptp0 -p 1000000000

3) Measure the output using analyzer for both end-points

Fixes: 87938851b6ef ("igc: enable auxiliary PHC functions for the i225")
Signed-off-by: Christopher S Hall <christopher.s.hall@intel.com>
Signed-off-by: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
Acked-by: Sasha Neftin <sasha.neftin@intel.com>
Tested-by: Naama Meir <naamax.meir@linux.intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/igc/igc_defines.h |  2 ++
 drivers/net/ethernet/intel/igc/igc_ptp.c     | 10 ++++++----
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/intel/igc/igc_defines.h b/drivers/net/ethernet/intel/igc/igc_defines.h
index a7b22639cfcd..e9747ec5ac0b 100644
--- a/drivers/net/ethernet/intel/igc/igc_defines.h
+++ b/drivers/net/ethernet/intel/igc/igc_defines.h
@@ -475,7 +475,9 @@
 #define IGC_TSAUXC_EN_TT0	BIT(0)  /* Enable target time 0. */
 #define IGC_TSAUXC_EN_TT1	BIT(1)  /* Enable target time 1. */
 #define IGC_TSAUXC_EN_CLK0	BIT(2)  /* Enable Configurable Frequency Clock 0. */
+#define IGC_TSAUXC_ST0		BIT(4)  /* Start Clock 0 Toggle on Target Time 0. */
 #define IGC_TSAUXC_EN_CLK1	BIT(5)  /* Enable Configurable Frequency Clock 1. */
+#define IGC_TSAUXC_ST1		BIT(7)  /* Start Clock 1 Toggle on Target Time 1. */
 #define IGC_TSAUXC_EN_TS0	BIT(8)  /* Enable hardware timestamp 0. */
 #define IGC_TSAUXC_AUTT0	BIT(9)  /* Auxiliary Timestamp Taken. */
 #define IGC_TSAUXC_EN_TS1	BIT(10) /* Enable hardware timestamp 0. */
diff --git a/drivers/net/ethernet/intel/igc/igc_ptp.c b/drivers/net/ethernet/intel/igc/igc_ptp.c
index 8dbb9f903ca7..c34734d432e0 100644
--- a/drivers/net/ethernet/intel/igc/igc_ptp.c
+++ b/drivers/net/ethernet/intel/igc/igc_ptp.c
@@ -322,7 +322,7 @@ static int igc_ptp_feature_enable_i225(struct ptp_clock_info *ptp,
 		ts = ns_to_timespec64(ns);
 		if (rq->perout.index == 1) {
 			if (use_freq) {
-				tsauxc_mask = IGC_TSAUXC_EN_CLK1;
+				tsauxc_mask = IGC_TSAUXC_EN_CLK1 | IGC_TSAUXC_ST1;
 				tsim_mask = 0;
 			} else {
 				tsauxc_mask = IGC_TSAUXC_EN_TT1;
@@ -333,7 +333,7 @@ static int igc_ptp_feature_enable_i225(struct ptp_clock_info *ptp,
 			freqout = IGC_FREQOUT1;
 		} else {
 			if (use_freq) {
-				tsauxc_mask = IGC_TSAUXC_EN_CLK0;
+				tsauxc_mask = IGC_TSAUXC_EN_CLK0 | IGC_TSAUXC_ST0;
 				tsim_mask = 0;
 			} else {
 				tsauxc_mask = IGC_TSAUXC_EN_TT0;
@@ -347,10 +347,12 @@ static int igc_ptp_feature_enable_i225(struct ptp_clock_info *ptp,
 		tsauxc = rd32(IGC_TSAUXC);
 		tsim = rd32(IGC_TSIM);
 		if (rq->perout.index == 1) {
-			tsauxc &= ~(IGC_TSAUXC_EN_TT1 | IGC_TSAUXC_EN_CLK1);
+			tsauxc &= ~(IGC_TSAUXC_EN_TT1 | IGC_TSAUXC_EN_CLK1 |
+				    IGC_TSAUXC_ST1);
 			tsim &= ~IGC_TSICR_TT1;
 		} else {
-			tsauxc &= ~(IGC_TSAUXC_EN_TT0 | IGC_TSAUXC_EN_CLK0);
+			tsauxc &= ~(IGC_TSAUXC_EN_TT0 | IGC_TSAUXC_EN_CLK0 |
+				    IGC_TSAUXC_ST0);
 			tsim &= ~IGC_TSICR_TT0;
 		}
 		if (on) {
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net 3/3] iavf/iavf_main: actually log ->src mask when talking about it
  2023-01-10 22:38 [PATCH net 0/3][pull request] Intel Wired LAN Driver Updates 2023-01-10 (ixgbe, igc, iavf) Tony Nguyen
  2023-01-10 22:38 ` [PATCH net 1/3] ixgbe: fix pci device refcount leak Tony Nguyen
  2023-01-10 22:38 ` [PATCH net 2/3] igc: Fix PPS delta between two synchronized end-points Tony Nguyen
@ 2023-01-10 22:38 ` Tony Nguyen
  2023-01-11 16:41 ` [PATCH net 0/3][pull request] Intel Wired LAN Driver Updates 2023-01-10 (ixgbe, igc, iavf) Alexander H Duyck
  2023-01-12  5:00 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Tony Nguyen @ 2023-01-10 22:38 UTC (permalink / raw)
  To: davem, kuba, pabeni, edumazet
  Cc: Daniil Tatianin, netdev, anthony.l.nguyen, Michal Swiatkowski

From: Daniil Tatianin <d-tatianin@yandex-team.ru>

This fixes a copy-paste issue where dev_err would log the dst mask even
though it is clearly talking about src.

Found by Linux Verification Center (linuxtesting.org) with the SVACE
static analysis tool.

Fixes: 0075fa0fadd0 ("i40evf: Add support to apply cloud filters")
Signed-off-by: Daniil Tatianin <d-tatianin@yandex-team.ru>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/iavf/iavf_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c
index c4e451ef7942..adc02adef83a 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_main.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_main.c
@@ -3850,7 +3850,7 @@ static int iavf_parse_cls_flower(struct iavf_adapter *adapter,
 				field_flags |= IAVF_CLOUD_FIELD_IIP;
 			} else {
 				dev_err(&adapter->pdev->dev, "Bad ip src mask 0x%08x\n",
-					be32_to_cpu(match.mask->dst));
+					be32_to_cpu(match.mask->src));
 				return -EINVAL;
 			}
 		}
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net 0/3][pull request] Intel Wired LAN Driver Updates 2023-01-10 (ixgbe, igc, iavf)
  2023-01-10 22:38 [PATCH net 0/3][pull request] Intel Wired LAN Driver Updates 2023-01-10 (ixgbe, igc, iavf) Tony Nguyen
                   ` (2 preceding siblings ...)
  2023-01-10 22:38 ` [PATCH net 3/3] iavf/iavf_main: actually log ->src mask when talking about it Tony Nguyen
@ 2023-01-11 16:41 ` Alexander H Duyck
  2023-01-12  5:00 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Alexander H Duyck @ 2023-01-11 16:41 UTC (permalink / raw)
  To: Tony Nguyen, davem, kuba, pabeni, edumazet; +Cc: netdev

On Tue, 2023-01-10 at 14:38 -0800, Tony Nguyen wrote:
> This series contains updates to ixgbe, igc, and iavf drivers.
> 
> Yang Yingliang adds calls to pci_dev_put() for proper ref count tracking
> on ixgbe.
> 
> Christopher adds setting of Toggle on Target Time bits for proper
> pulse per second (PPS) synchronization for igc.
> 
> Daniil Tatianin fixes, likely, copy/paste issue that misreported
> destination instead of source for IP mask for iavf error.
> 
> The following are changes since commit 53da7aec32982f5ee775b69dce06d63992ce4af3:
>   octeontx2-pf: Fix resource leakage in VF driver unbind
> and are available in the git repository at:
>   git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue 10GbE
> 
> Christopher S Hall (1):
>   igc: Fix PPS delta between two synchronized end-points
> 
> Daniil Tatianin (1):
>   iavf/iavf_main: actually log ->src mask when talking about it
> 
> Yang Yingliang (1):
>   ixgbe: fix pci device refcount leak
> 
>  drivers/net/ethernet/intel/iavf/iavf_main.c  |  2 +-
>  drivers/net/ethernet/intel/igc/igc_defines.h |  2 ++
>  drivers/net/ethernet/intel/igc/igc_ptp.c     | 10 ++++++----
>  drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 14 +++++++++-----
>  4 files changed, 18 insertions(+), 10 deletions(-)
> 

Series looks good to me.

Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net 0/3][pull request] Intel Wired LAN Driver Updates 2023-01-10 (ixgbe, igc, iavf)
  2023-01-10 22:38 [PATCH net 0/3][pull request] Intel Wired LAN Driver Updates 2023-01-10 (ixgbe, igc, iavf) Tony Nguyen
                   ` (3 preceding siblings ...)
  2023-01-11 16:41 ` [PATCH net 0/3][pull request] Intel Wired LAN Driver Updates 2023-01-10 (ixgbe, igc, iavf) Alexander H Duyck
@ 2023-01-12  5:00 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-01-12  5:00 UTC (permalink / raw)
  To: Tony Nguyen; +Cc: davem, kuba, pabeni, edumazet, netdev

Hello:

This series was applied to netdev/net.git (master)
by Tony Nguyen <anthony.l.nguyen@intel.com>:

On Tue, 10 Jan 2023 14:38:22 -0800 you wrote:
> This series contains updates to ixgbe, igc, and iavf drivers.
> 
> Yang Yingliang adds calls to pci_dev_put() for proper ref count tracking
> on ixgbe.
> 
> Christopher adds setting of Toggle on Target Time bits for proper
> pulse per second (PPS) synchronization for igc.
> 
> [...]

Here is the summary with links:
  - [net,1/3] ixgbe: fix pci device refcount leak
    https://git.kernel.org/netdev/net/c/b93fb4405fcb
  - [net,2/3] igc: Fix PPS delta between two synchronized end-points
    https://git.kernel.org/netdev/net/c/5e91c72e560c
  - [net,3/3] iavf/iavf_main: actually log ->src mask when talking about it
    https://git.kernel.org/netdev/net/c/6650c8e906ce

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-01-12  5:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-10 22:38 [PATCH net 0/3][pull request] Intel Wired LAN Driver Updates 2023-01-10 (ixgbe, igc, iavf) Tony Nguyen
2023-01-10 22:38 ` [PATCH net 1/3] ixgbe: fix pci device refcount leak Tony Nguyen
2023-01-10 22:38 ` [PATCH net 2/3] igc: Fix PPS delta between two synchronized end-points Tony Nguyen
2023-01-10 22:38 ` [PATCH net 3/3] iavf/iavf_main: actually log ->src mask when talking about it Tony Nguyen
2023-01-11 16:41 ` [PATCH net 0/3][pull request] Intel Wired LAN Driver Updates 2023-01-10 (ixgbe, igc, iavf) Alexander H Duyck
2023-01-12  5:00 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).