Netdev List
 help / color / mirror / Atom feed
* [PATCH v3 net] net: phy: marvell: Limit errata to 88m1101
From: Andrew Lunn @ 2017-05-23 15:49 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Andrew Lunn

The 88m1101 has an errata when configuring autoneg. However, it was
being applied to many other Marvell PHYs as well. Limit its scope to
just the 88m1101.

Fixes: 76884679c644 ("phylib: Add support for Marvell 88e1111S and 88e1145")
Reported-by: Daniel Walker <danielwa@cisco.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Harini Katakam <harinik@xilinx.com>
---

v3: Rebase onto net.

drivers/net/phy/marvell.c | 66 ++++++++++++++++++++++++++---------------------
 1 file changed, 37 insertions(+), 29 deletions(-)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 272b051a0199..9097e42bec2e 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -255,34 +255,6 @@ static int marvell_config_aneg(struct phy_device *phydev)
 {
 	int err;
 
-	/* The Marvell PHY has an errata which requires
-	 * that certain registers get written in order
-	 * to restart autonegotiation */
-	err = phy_write(phydev, MII_BMCR, BMCR_RESET);
-
-	if (err < 0)
-		return err;
-
-	err = phy_write(phydev, 0x1d, 0x1f);
-	if (err < 0)
-		return err;
-
-	err = phy_write(phydev, 0x1e, 0x200c);
-	if (err < 0)
-		return err;
-
-	err = phy_write(phydev, 0x1d, 0x5);
-	if (err < 0)
-		return err;
-
-	err = phy_write(phydev, 0x1e, 0);
-	if (err < 0)
-		return err;
-
-	err = phy_write(phydev, 0x1e, 0x100);
-	if (err < 0)
-		return err;
-
 	err = marvell_set_polarity(phydev, phydev->mdix_ctrl);
 	if (err < 0)
 		return err;
@@ -316,6 +288,42 @@ static int marvell_config_aneg(struct phy_device *phydev)
 	return 0;
 }
 
+static int m88e1101_config_aneg(struct phy_device *phydev)
+{
+	int err;
+
+	/* This Marvell PHY has an errata which requires
+	 * that certain registers get written in order
+	 * to restart autonegotiation
+	 */
+	err = phy_write(phydev, MII_BMCR, BMCR_RESET);
+
+	if (err < 0)
+		return err;
+
+	err = phy_write(phydev, 0x1d, 0x1f);
+	if (err < 0)
+		return err;
+
+	err = phy_write(phydev, 0x1e, 0x200c);
+	if (err < 0)
+		return err;
+
+	err = phy_write(phydev, 0x1d, 0x5);
+	if (err < 0)
+		return err;
+
+	err = phy_write(phydev, 0x1e, 0);
+	if (err < 0)
+		return err;
+
+	err = phy_write(phydev, 0x1e, 0x100);
+	if (err < 0)
+		return err;
+
+	return marvell_config_aneg(phydev);
+}
+
 static int m88e1111_config_aneg(struct phy_device *phydev)
 {
 	int err;
@@ -1892,7 +1900,7 @@ static struct phy_driver marvell_drivers[] = {
 		.flags = PHY_HAS_INTERRUPT,
 		.probe = marvell_probe,
 		.config_init = &marvell_config_init,
-		.config_aneg = &marvell_config_aneg,
+		.config_aneg = &m88e1101_config_aneg,
 		.read_status = &genphy_read_status,
 		.ack_interrupt = &marvell_ack_interrupt,
 		.config_intr = &marvell_config_intr,
-- 
2.11.0

^ permalink raw reply related

* Re: [Intel-wired-lan] [PATCH] e1000e: use disable_hardirq() also for MSIX vectors in e1000_netpoll()
From: Neftin, Sasha @ 2017-05-23 15:43 UTC (permalink / raw)
  To: Cong Wang, Konstantin Khlebnikov
  Cc: Dave Jones, Sabrina Dubroca, Linux Kernel Network Developers,
	intel-wired-lan, Thomas Gleixner, David S. Miller
In-Reply-To: <CAM_iQpUD9qJepFn-8M32+VcureTgM77-beY9=+tm0jC7Btkg7Q@mail.gmail.com>

On 5/19/2017 21:34, Cong Wang wrote:
> On Fri, May 19, 2017 at 12:18 AM, Konstantin Khlebnikov
> <khlebnikov@yandex-team.ru> wrote:
>> Replace disable_irq() which waits for threaded irq handlers with
>> disable_hardirq() which waits only for hardirq part.
>>
>> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
>> Fixes: 311191297125 ("e1000: use disable_hardirq() for e1000_netpoll()")
> Thomas had a similar patch, I don't know why he never sends it
> out formally. Anyway,
>
> Acked-by: Cong Wang <xiyou.wangcong@gmail.com>
> _______________________________________________
> Intel-wired-lan mailing list
> Intel-wired-lan@osuosl.org
> https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

Ack. Let's pick up this patch.

^ permalink raw reply

* Re: [patch net-next 0/5] add tcp flags match support to flower and offload it
From: David Miller @ 2017-05-23 15:40 UTC (permalink / raw)
  To: jiri; +Cc: netdev, jhs, xiyou.wangcong, simon.horman, mlxsw, idosch
In-Reply-To: <20170523151120.GH1829@nanopsycho>

From: Jiri Pirko <jiri@resnulli.us>
Date: Tue, 23 May 2017 17:11:20 +0200

> Tue, May 23, 2017 at 04:31:05PM CEST, jiri@resnulli.us wrote:
>>From: Jiri Pirko <jiri@mellanox.com>
>>
>>This patch adds support to dissect tcp flags, match on them using
>>flower classifier and offload such rules to mlxsw Spectrum devices.
> 
> I shifted the git format patch one commit. Will send v2. Sorry.

Ok.

^ permalink raw reply

* Re: [patch net-next 0/9] mlxsw: Support firmware flash
From: David Miller @ 2017-05-23 15:38 UTC (permalink / raw)
  To: yotamg; +Cc: Yuval.Mintz, jiri, netdev, idosch, mlxsw, bhutchings
In-Reply-To: <fba5a440-ba1e-84bd-d2d2-d011406d3a4a@mellanox.com>

From: Yotam Gigi <yotamg@mellanox.com>
Date: Tue, 23 May 2017 18:14:15 +0300

> Sorry, I am not sure I understand. You think that drivers should not implement
> ethtool's flash_device callback anymore? do you have an alternative for firmware
> flash?

As stated, export an MTD device.

^ permalink raw reply

* Re: [PATCH v9 06/15] mlx5: Replace PCI pool old API
From: David Miller @ 2017-05-23 15:26 UTC (permalink / raw)
  To: romain.perier-ZGY8ohtN/8qB+jHODAdFcQ
  Cc: leon-DgEjT+Ai2ygdnm+yROfE0A,
	dan.j.williams-ral2JQCrhuEAvxtiuMwx3w,
	dledford-H+wXaHxf7aLQT0dZR+AlfA,
	sean.hefty-ral2JQCrhuEAvxtiuMwx3w,
	hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w,
	jeffrey.t.kirsher-ral2JQCrhuEAvxtiuMwx3w,
	stas.yakovlev-Re5JQEeQqe8AvxtiuMwx3w,
	jejb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8,
	martin.petersen-QHcLZuEGTsvQT0dZR+AlfA,
	balbi-DgEjT+Ai2ygdnm+yROfE0A,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	peter.senna-ZGY8ohtN/8pPYcu2f3hruQ
In-Reply-To: <18745ec7-020a-a3d2-3e50-6a2405baaac2-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>

From: Romain Perier <romain.perier-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
Date: Tue, 23 May 2017 10:53:36 +0200

> Hello,
> 
> 
> Le 23/05/2017 à 09:27, Leon Romanovsky a écrit :
>> On Mon, May 22, 2017 at 06:48:58PM +0200, Romain Perier wrote:
>>> The PCI pool API is deprecated. This commit replaces the PCI pool old
>>> API by the appropriate function with the DMA pool API.
>>>
>>> Signed-off-by: Romain Perier <romain.perier-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
>>> Reviewed-by: Peter Senna Tschudin <peter.senna-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
>>> Acked-by: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>>> Tested-by: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>>> ---
>>>  drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 11 ++++++-----
>>>  include/linux/mlx5/driver.h                   |  2 +-
>>>  2 files changed, 7 insertions(+), 6 deletions(-)
>>>
>> Who is supposed to merge this patch series?
>>
>> Acked-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Each maintainer of the corresponding subsystem, can take a patch, I
> guess. No ?

It might be easier to accumulate acks and you submit them as a series,
in my opinion.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [RFC V1 1/1] net: cdc_ncm: Reduce memory use when kernel memory low
From: David Miller @ 2017-05-23 15:26 UTC (permalink / raw)
  To: oneukum; +Cc: jim_baxter, bjorn, linux-usb, netdev, linux-kernel
In-Reply-To: <1495528968.2174.2.camel@suse.com>

From: Oliver Neukum <oneukum@suse.com>
Date: Tue, 23 May 2017 10:42:48 +0200

> Am Montag, den 22.05.2017, 11:54 -0400 schrieb David Miller:
>> 
>> Unfortunately without a real notifier of some sort (there isn't one, and
>> it isn't actually easy to come up with a clean way to do this which is
>> probably why it doesn't exist yet in the first place) I really cannot
>> recommend anything better.
>> 
>> That being said, probably for the time being we should just backoff each
>> and every request, always trying initially to do the higher order thing.
> 
> We could use a counter. After the first failure, do it once, after the
> second twice and so on. And reset the counter as a higher order
> allocation works. (just bound it somewhere)

So an exponential backoff, that might work.

^ permalink raw reply

* Re: [v2] ath10k: remove unnecessary code
From: Kalle Valo @ 2017-05-23 15:25 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Arend Van Spriel, netdev, linux-wireless, linux-kernel, ath10k,
	Gustavo A. R. Silva
In-Reply-To: <20170509125129.GA21962@embeddedgus>

"Gustavo A. R. Silva" <garsilva@embeddedor.com> wrote:
> The array fields in struct wmi_start_scan_arg that are checked here are
> fixed size arrays so they can never be NULL.
> 
> Addresses-Coverity-ID: 1260031
> Cc: Arend Van Spriel <arend.vanspriel@broadcom.com>
> Cc: Kalle Valo <kvalo@qca.qualcomm.com>
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>

Patch applied to ath-next branch of ath.git, thanks.

8c1f20815231 ath10k: remove unnecessary code

-- 
https://patchwork.kernel.org/patch/9717869/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply

* Re: wcn36xx: Close SMD channel on device removal
From: Kalle Valo @ 2017-05-23 15:23 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Eugene Krasnikov, Kalle Valo, Eyal Ilsar, wcn36xx, linux-wireless,
	netdev, linux-kernel, linux-arm-msm
In-Reply-To: <20170509043637.28179-1-bjorn.andersson@linaro.org>

Bjorn Andersson <bjorn.andersson@linaro.org> wrote:
> The SMD channel is not the primary WCNSS channel and must explicitly be
> closed as the device is removed, or the channel will already by open on
> a subsequent probe call in e.g. the case of reloading the kernel module.
> 
> This issue was introduced because I simplified the underlying SMD
> implementation while the SMD adaptions of the driver sat on the mailing
> list, but missed to update these patches. The patch does however only
> apply back to the transition to rpmsg, hence the limited Fixes.
> 
> Fixes: 5052de8deff5 ("soc: qcom: smd: Transition client drivers from smd to rpmsg")
> Reported-by: Eyal Ilsar <c_eilsar@qti.qualcomm.com>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Patch applied to ath-current branch of ath.git, thanks.

efad8396e906 wcn36xx: Close SMD channel on device removal

-- 
https://patchwork.kernel.org/patch/9717027/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply

* Re: [patch net-next 2/5] net: flow_dissector: add support for dissection of tcp flags
From: Jiri Pirko @ 2017-05-23 15:22 UTC (permalink / raw)
  To: Or Gerlitz
  Cc: netdev, davem, jhs, xiyou.wangcong, simon.horman, mlxsw, idosch
In-Reply-To: <29df9132-b171-58fc-e943-9d6654867c57@mellanox.com>

Tue, May 23, 2017 at 05:18:33PM CEST, ogerlitz@mellanox.com wrote:
>On 5/23/2017 5:31 PM, Jiri Pirko wrote:
>> @@ -683,6 +708,12 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
>>   	case IPPROTO_MPLS:
>>   		proto = htons(ETH_P_MPLS_UC);
>>   		goto mpls;
>> +	case IPPROTO_TCP:
>> +		__skb_flow_dissect_tcp(skb, flow_dissector, target_container,
>> +				       data, nhoff, hlen);
>> +		/* Regardless of the return value, continue to process TCP
>> +		 * ports dissection below.
>> +		 */
>
>the comment here is a bit misleading, since __skb_flow_dissect_tcp is void


Fixed for v2

>
>other-wise
>
>Acked-by: Or Gerlitz <ogerlitz@mellanox.com>

Thanks

^ permalink raw reply

* RE: [patch net-next 0/9] mlxsw: Support firmware flash
From: Mintz, Yuval @ 2017-05-23 15:19 UTC (permalink / raw)
  To: Yotam Gigi, Jiri Pirko, netdev@vger.kernel.org
  Cc: davem@davemloft.net, idosch@mellanox.com, mlxsw@mellanox.com
In-Reply-To: <fba5a440-ba1e-84bd-d2d2-d011406d3a4a@mellanox.com>

> >>>> Patches 6-8 add the "ethtool -f" and the boot-time firmware upgrade
> >>>> on
> >> the
> >>>> mlxsw spectrum driver.
> >>> When we tried using `ethtool -E' for qed we got burned for trying to
> >>> use
> >> the magic
> >>> value [1]. When we suggested extending it to allow some private data
> >> indications,
> >>> Ben claimed that this entire ethtool infrastructure is a thing of
> >>> the past, and we should try using MTD instead - a claim no one
> bothered to counter.
> >>>
> >>> Creating proprietary file-formats, filling them with metadata and
> >>> complementary driver state-machines could easily overcome the
> >>> original obstacle we faced. But it raises the question of whether
> >>> these APIs are valid or obsolete.
> >> The metadata in our format is needed to allow us to hold several
> >> firmware images for several spectrum silicon variants in one file,
> >> hence the metadata is used by the driver and does not get transferred to
> the device.
> > Understood; Otherwise it would have been 'data' and not 'metadata'.
> >
> >> Our code can only be used to transfer firmware to the device, and
> >> cannot be used to configure the device.
> > Not sure what this refers to? The differences between '-f' and '-E'?
> > Also, assuming you haven't started selling your adapters as persistent
> > memory for storage, what's the difference?
> >
> 
> Sorry, I am not sure I understand. You think that drivers should not
> implement ethtool's flash_device callback anymore? do you have an
> alternative for firmware flash?

That's exactly the question Ben asked in - 
http://marc.info/?l=linux-netdev&m=146514461214421&w=2
Suggesting to use MTD for flash access.

I'm not saying that approach was necessarily the best;
But no one shared any disagreement with it back then.

^ permalink raw reply

* [PATCH] net/phy: fix mdio-octeon dependency and build
From: Randy Dunlap @ 2017-05-23 15:19 UTC (permalink / raw)
  To: netdev@vger.kernel.org, Andrew Lunn, Florian Fainelli,
	David Miller; +Cc: LKML

From: Randy Dunlap <rdunlap@infradead.org>

Fix build errors by making this driver depend on OF_MDIO, like
several other similar drivers do.

drivers/built-in.o: In function `octeon_mdiobus_remove':
mdio-octeon.c:(.text+0x196ee0): undefined reference to `mdiobus_unregister'
mdio-octeon.c:(.text+0x196ee8): undefined reference to `mdiobus_free'
drivers/built-in.o: In function `octeon_mdiobus_probe':
mdio-octeon.c:(.text+0x196f1d): undefined reference to `devm_mdiobus_alloc_size'
mdio-octeon.c:(.text+0x196ffe): undefined reference to `of_mdiobus_register'
mdio-octeon.c:(.text+0x197010): undefined reference to `mdiobus_free'

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc:	Andrew Lunn <andrew@lunn.ch>
Cc:	Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/phy/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Found in linux-next but applies to mainline also.

--- linux-next-20170523.orig/drivers/net/phy/Kconfig
+++ linux-next-20170523/drivers/net/phy/Kconfig
@@ -108,7 +108,7 @@ config MDIO_MOXART
 config MDIO_OCTEON
 	tristate "Octeon and some ThunderX SOCs MDIO buses"
 	depends on 64BIT
-	depends on HAS_IOMEM
+	depends on HAS_IOMEM && OF_MDIO
 	select MDIO_CAVIUM
 	help
 	  This module provides a driver for the Octeon and ThunderX MDIO

^ permalink raw reply

* Re: [PATCH v2 netdev] net: phy: marvell: Limit errata to 88m1101
From: David Miller @ 2017-05-23 15:19 UTC (permalink / raw)
  To: andrew; +Cc: danielwa, harini.katakam, f.fainelli, netdev
In-Reply-To: <1495495713-28374-1-git-send-email-andrew@lunn.ch>

From: Andrew Lunn <andrew@lunn.ch>
Date: Tue, 23 May 2017 01:28:33 +0200

> The 88m1101 has an errata when configuring autoneg. However, it was
> being applied to many other Marvell PHYs as well. Limit its scope to
> just the 88m1101.
> 
> Fixes: 76884679c644 ("phylib: Add support for Marvell 88e1111S and 88e1145")
> Reported-by: Daniel Walker <danielwa@cisco.com>
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>

This patch is targetting 'net' but you generated it against 'net-next'
which had a comment formatting change made recently so this patch won't
apply to 'net'.

Please respin against 'net'.

Thanks.

^ permalink raw reply

* Re: [patch net-next 2/5] net: flow_dissector: add support for dissection of tcp flags
From: Or Gerlitz @ 2017-05-23 15:18 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: netdev, davem, jhs, xiyou.wangcong, simon.horman, mlxsw, idosch
In-Reply-To: <20170523143110.5006-3-jiri@resnulli.us>

On 5/23/2017 5:31 PM, Jiri Pirko wrote:
> @@ -683,6 +708,12 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
>   	case IPPROTO_MPLS:
>   		proto = htons(ETH_P_MPLS_UC);
>   		goto mpls;
> +	case IPPROTO_TCP:
> +		__skb_flow_dissect_tcp(skb, flow_dissector, target_container,
> +				       data, nhoff, hlen);
> +		/* Regardless of the return value, continue to process TCP
> +		 * ports dissection below.
> +		 */

the comment here is a bit misleading, since __skb_flow_dissect_tcp is void

other-wise

Acked-by: Or Gerlitz <ogerlitz@mellanox.com>

^ permalink raw reply

* Re: [patch net-next 0/9] mlxsw: Support firmware flash
From: Yotam Gigi @ 2017-05-23 15:14 UTC (permalink / raw)
  To: Mintz, Yuval, Jiri Pirko, netdev@vger.kernel.org
  Cc: davem@davemloft.net, idosch@mellanox.com, mlxsw@mellanox.com,
	Ben Hutchings
In-Reply-To: <BLUPR0701MB2004EB2F32B4C8C42C5020458DF90@BLUPR0701MB2004.namprd07.prod.outlook.com>

On 05/23/2017 06:04 PM, Mintz, Yuval wrote:
>>>> Patches 6-8 add the "ethtool -f" and the boot-time firmware upgrade on
>> the
>>>> mlxsw spectrum driver.
>>> When we tried using `ethtool -E' for qed we got burned for trying to use
>> the magic
>>> value [1]. When we suggested extending it to allow some private data
>> indications,
>>> Ben claimed that this entire ethtool infrastructure is a thing of the past,
>>> and we should try using MTD instead - a claim no one bothered to counter.
>>>
>>> Creating proprietary file-formats, filling them with metadata and
>>> complementary driver state-machines could easily overcome the original
>>> obstacle we faced. But it raises the question of whether these APIs are
>>> valid or obsolete.
>> The metadata in our format is needed to allow us to hold several firmware
>> images for several spectrum silicon variants in one file, hence the metadata
>> is used by the driver and does not get transferred to the device.
> Understood; Otherwise it would have been 'data' and not 'metadata'.
>
>> Our code can only be used to transfer firmware to the device, and cannot
>> be used to configure the device.
> Not sure what this refers to? The differences between '-f' and '-E'?
> Also, assuming you haven't started selling your adapters as persistent memory
> for storage, what's the difference?
>

Sorry, I am not sure I understand. You think that drivers should not implement
ethtool's flash_device callback anymore? do you have an alternative for firmware
flash?

^ permalink raw reply

* Re: [PATCH] net: make struct request_sock_ops::obj_size unsigned
From: David Miller @ 2017-05-23 15:13 UTC (permalink / raw)
  To: adobriyan; +Cc: netdev
In-Reply-To: <20170522212139.GB28769@avx2>

From: Alexey Dobriyan <adobriyan@gmail.com>
Date: Tue, 23 May 2017 00:21:39 +0300

> This field is sizeof of corresponding kmem_cache so it can't be negative.
> 
> Space will be saved after 32-bit kmem_cache_create() patch.
> 
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>

Applied.

^ permalink raw reply

* Re: [PATCH net-next] net: make struct inet_frags::qsize unsigned
From: David Miller @ 2017-05-23 15:13 UTC (permalink / raw)
  To: adobriyan; +Cc: netdev
In-Reply-To: <20170522212026.GA28769@avx2>

From: Alexey Dobriyan <adobriyan@gmail.com>
Date: Tue, 23 May 2017 00:20:26 +0300

> This field is sizeof of corresponding kmem_cache so it can't be negative.
> 
> Prepare for 32-bit kmem_cache_create().
> 
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>

Applied.

^ permalink raw reply

* [PATCH net-next 4/4] nfp: support port splitting via devlink
From: Jakub Kicinski @ 2017-05-23 15:12 UTC (permalink / raw)
  To: netdev; +Cc: oss-drivers, Jakub Kicinski
In-Reply-To: <20170523151247.8535-1-jakub.kicinski@netronome.com>

Add support for configuring port split with devlink.  Add devlink
callbacks to validate requested config and call NSP helpers.
Getting the right nfp_port structure can be done with simple iteration.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
---
 drivers/net/ethernet/netronome/nfp/nfp_devlink.c  | 97 +++++++++++++++++++++++
 drivers/net/ethernet/netronome/nfp/nfp_net_main.c | 23 ++++--
 drivers/net/ethernet/netronome/nfp/nfp_port.c     | 19 +++++
 drivers/net/ethernet/netronome/nfp/nfp_port.h     |  4 +
 4 files changed, 136 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/netronome/nfp/nfp_devlink.c b/drivers/net/ethernet/netronome/nfp/nfp_devlink.c
index b65c50c0d211..f001e3d60bd1 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_devlink.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_devlink.c
@@ -54,7 +54,104 @@ nfp_devlink_fill_eth_port(struct nfp_port *port,
 	return 0;
 }
 
+static int
+nfp_devlink_fill_eth_port_from_id(struct nfp_pf *pf, unsigned int port_index,
+				  struct nfp_eth_table_port *copy)
+{
+	struct nfp_port *port;
+
+	port = nfp_port_from_id(pf, NFP_PORT_PHYS_PORT, port_index);
+
+	return nfp_devlink_fill_eth_port(port, copy);
+}
+
+static int
+nfp_devlink_set_lanes(struct nfp_pf *pf, unsigned int idx, unsigned int lanes)
+{
+	struct nfp_nsp *nsp;
+	int ret;
+
+	nsp = nfp_eth_config_start(pf->cpp, idx);
+	if (IS_ERR(nsp))
+		return PTR_ERR(nsp);
+
+	ret = __nfp_eth_set_split(nsp, lanes);
+	if (ret) {
+		nfp_eth_config_cleanup_end(nsp);
+		return ret;
+	}
+
+	ret = nfp_eth_config_commit_end(nsp);
+	if (ret < 0)
+		return ret;
+	if (ret) /* no change */
+		return 0;
+
+	return nfp_net_refresh_port_table_sync(pf);
+}
+
+static int
+nfp_devlink_port_split(struct devlink *devlink, unsigned int port_index,
+		       unsigned int count)
+{
+	struct nfp_pf *pf = devlink_priv(devlink);
+	struct nfp_eth_table_port eth_port;
+	int ret;
+
+	if (count < 2)
+		return -EINVAL;
+
+	mutex_lock(&pf->lock);
+
+	rtnl_lock();
+	ret = nfp_devlink_fill_eth_port_from_id(pf, port_index, &eth_port);
+	rtnl_unlock();
+	if (ret)
+		goto out;
+
+	if (eth_port.is_split || eth_port.port_lanes % count) {
+		ret = -EINVAL;
+		goto out;
+	}
+
+	ret = nfp_devlink_set_lanes(pf, eth_port.index,
+				    eth_port.port_lanes / count);
+out:
+	mutex_unlock(&pf->lock);
+
+	return ret;
+}
+
+static int
+nfp_devlink_port_unsplit(struct devlink *devlink, unsigned int port_index)
+{
+	struct nfp_pf *pf = devlink_priv(devlink);
+	struct nfp_eth_table_port eth_port;
+	int ret;
+
+	mutex_lock(&pf->lock);
+
+	rtnl_lock();
+	ret = nfp_devlink_fill_eth_port_from_id(pf, port_index, &eth_port);
+	rtnl_unlock();
+	if (ret)
+		goto out;
+
+	if (!eth_port.is_split) {
+		ret = -EINVAL;
+		goto out;
+	}
+
+	ret = nfp_devlink_set_lanes(pf, eth_port.index, eth_port.port_lanes);
+out:
+	mutex_unlock(&pf->lock);
+
+	return ret;
+}
+
 const struct devlink_ops nfp_devlink_ops = {
+	.port_split		= nfp_devlink_port_split,
+	.port_unsplit		= nfp_devlink_port_unsplit,
 };
 
 int nfp_devlink_port_register(struct nfp_app *app, struct nfp_port *port)
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c
index bf10c0a316f3..a50acca25cfa 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c
@@ -43,6 +43,7 @@
 #include <linux/etherdevice.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/lockdep.h>
 #include <linux/pci.h>
 #include <linux/pci_regs.h>
 #include <linux/msi.h>
@@ -543,19 +544,17 @@ nfp_net_eth_port_update(struct nfp_cpp *cpp, struct nfp_port *port,
 	return 0;
 }
 
-static void nfp_net_refresh_vnics(struct work_struct *work)
+int nfp_net_refresh_port_table_sync(struct nfp_pf *pf)
 {
-	struct nfp_pf *pf = container_of(work, struct nfp_pf,
-					 port_refresh_work);
 	struct nfp_eth_table *eth_table;
 	struct nfp_net *nn, *next;
 	struct nfp_port *port;
 
-	mutex_lock(&pf->lock);
+	lockdep_assert_held(&pf->lock);
 
 	/* Check for nfp_net_pci_remove() racing against us */
 	if (list_empty(&pf->vnics))
-		goto out;
+		return 0;
 
 	/* Update state of all ports */
 	rtnl_lock();
@@ -569,7 +568,7 @@ static void nfp_net_refresh_vnics(struct work_struct *work)
 				set_bit(NFP_PORT_CHANGED, &port->flags);
 		rtnl_unlock();
 		nfp_err(pf->cpp, "Error refreshing port config!\n");
-		goto out;
+		return -EIO;
 	}
 
 	list_for_each_entry(port, &pf->ports, port_list)
@@ -594,7 +593,17 @@ static void nfp_net_refresh_vnics(struct work_struct *work)
 
 	if (list_empty(&pf->vnics))
 		nfp_net_pci_remove_finish(pf);
-out:
+
+	return 0;
+}
+
+static void nfp_net_refresh_vnics(struct work_struct *work)
+{
+	struct nfp_pf *pf = container_of(work, struct nfp_pf,
+					 port_refresh_work);
+
+	mutex_lock(&pf->lock);
+	nfp_net_refresh_port_table_sync(pf);
 	mutex_unlock(&pf->lock);
 }
 
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_port.c b/drivers/net/ethernet/netronome/nfp/nfp_port.c
index 3beed4167e2f..a17410ac01ab 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_port.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_port.c
@@ -31,6 +31,8 @@
  * SOFTWARE.
  */
 
+#include <linux/lockdep.h>
+
 #include "nfpcore/nfp_nsp.h"
 #include "nfp_app.h"
 #include "nfp_main.h"
@@ -48,6 +50,23 @@ struct nfp_port *nfp_port_from_netdev(struct net_device *netdev)
 	return nn->port;
 }
 
+struct nfp_port *
+nfp_port_from_id(struct nfp_pf *pf, enum nfp_port_type type, unsigned int id)
+{
+	struct nfp_port *port;
+
+	lockdep_assert_held(&pf->lock);
+
+	if (type != NFP_PORT_PHYS_PORT)
+		return NULL;
+
+	list_for_each_entry(port, &pf->ports, port_list)
+		if (port->eth_id == id)
+			return port;
+
+	return NULL;
+}
+
 struct nfp_eth_table_port *__nfp_port_get_eth_port(struct nfp_port *port)
 {
 	if (!port)
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_port.h b/drivers/net/ethernet/netronome/nfp/nfp_port.h
index 36a540b514be..4d1a9b3fed41 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_port.h
+++ b/drivers/net/ethernet/netronome/nfp/nfp_port.h
@@ -38,6 +38,7 @@
 
 struct net_device;
 struct nfp_app;
+struct nfp_pf;
 struct nfp_port;
 
 /**
@@ -90,6 +91,8 @@ struct nfp_port {
 };
 
 struct nfp_port *nfp_port_from_netdev(struct net_device *netdev);
+struct nfp_port *
+nfp_port_from_id(struct nfp_pf *pf, enum nfp_port_type type, unsigned int id);
 struct nfp_eth_table_port *__nfp_port_get_eth_port(struct nfp_port *port);
 struct nfp_eth_table_port *nfp_port_get_eth_port(struct nfp_port *port);
 
@@ -103,6 +106,7 @@ void nfp_port_free(struct nfp_port *port);
 
 int nfp_net_refresh_eth_port(struct nfp_port *port);
 void nfp_net_refresh_port_table(struct nfp_port *port);
+int nfp_net_refresh_port_table_sync(struct nfp_pf *pf);
 
 int nfp_devlink_port_register(struct nfp_app *app, struct nfp_port *port);
 void nfp_devlink_port_unregister(struct nfp_port *port);
-- 
2.11.0

^ permalink raw reply related

* [PATCH net-next 2/4] nfp: register ports as devlink ports
From: Jakub Kicinski @ 2017-05-23 15:12 UTC (permalink / raw)
  To: netdev; +Cc: oss-drivers, Jakub Kicinski
In-Reply-To: <20170523151247.8535-1-jakub.kicinski@netronome.com>

Extend nfp_port to contain devlink_port structures.  Register the
ports to allow users inspecting device ports.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
---
 drivers/net/ethernet/netronome/nfp/nfp_devlink.c  | 49 +++++++++++++++++++++++
 drivers/net/ethernet/netronome/nfp/nfp_main.c     |  8 ++++
 drivers/net/ethernet/netronome/nfp/nfp_main.h     |  2 +
 drivers/net/ethernet/netronome/nfp/nfp_net_main.c | 34 ++++++++++++++++
 drivers/net/ethernet/netronome/nfp/nfp_port.h     |  8 ++++
 5 files changed, 101 insertions(+)

diff --git a/drivers/net/ethernet/netronome/nfp/nfp_devlink.c b/drivers/net/ethernet/netronome/nfp/nfp_devlink.c
index a8a52b3ff42b..b65c50c0d211 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_devlink.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_devlink.c
@@ -31,9 +31,58 @@
  * SOFTWARE.
  */
 
+#include <linux/rtnetlink.h>
 #include <net/devlink.h>
 
+#include "nfpcore/nfp_nsp.h"
+#include "nfp_app.h"
 #include "nfp_main.h"
+#include "nfp_port.h"
+
+static int
+nfp_devlink_fill_eth_port(struct nfp_port *port,
+			  struct nfp_eth_table_port *copy)
+{
+	struct nfp_eth_table_port *eth_port;
+
+	eth_port = __nfp_port_get_eth_port(port);
+	if (!eth_port)
+		return -EINVAL;
+
+	memcpy(copy, eth_port, sizeof(*eth_port));
+
+	return 0;
+}
 
 const struct devlink_ops nfp_devlink_ops = {
 };
+
+int nfp_devlink_port_register(struct nfp_app *app, struct nfp_port *port)
+{
+	struct nfp_eth_table_port eth_port;
+	struct devlink *devlink;
+	int ret;
+
+	rtnl_lock();
+	ret = nfp_devlink_fill_eth_port(port, &eth_port);
+	rtnl_unlock();
+	if (ret)
+		return ret;
+
+	devlink_port_type_eth_set(&port->dl_port, port->netdev);
+	if (eth_port.is_split)
+		devlink_port_split_set(&port->dl_port, eth_port.label_port);
+
+	devlink = priv_to_devlink(app->pf);
+
+	return devlink_port_register(devlink, &port->dl_port, port->eth_id);
+}
+
+void nfp_devlink_port_unregister(struct nfp_port *port)
+{
+	/* Due to unpleasant lock ordering we may see the port go away before
+	 * we have fully probed.
+	 */
+	if (port->dl_port.registered)
+		devlink_port_unregister(&port->dl_port);
+}
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_main.c b/drivers/net/ethernet/netronome/nfp/nfp_main.c
index f22c8f083ab0..ea7c122092e7 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_main.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_main.c
@@ -377,8 +377,14 @@ static int nfp_pci_probe(struct pci_dev *pdev,
 	if (err)
 		goto err_kill_ndevs;
 
+	err = nfp_net_devlink_register(pf);
+	if (err)
+		goto err_devlink_unregiser;
+
 	return 0;
 
+err_devlink_unregiser:
+	devlink_unregister(devlink);
 err_kill_ndevs:
 	nfp_net_pci_remove(pf);
 err_fw_unload:
@@ -405,6 +411,8 @@ static void nfp_pci_remove(struct pci_dev *pdev)
 
 	devlink = priv_to_devlink(pf);
 
+	nfp_net_devlink_unregister(pf);
+
 	devlink_unregister(devlink);
 
 	nfp_net_pci_remove(pf);
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_main.h b/drivers/net/ethernet/netronome/nfp/nfp_main.h
index 526db8029dea..7fdb9036f666 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_main.h
+++ b/drivers/net/ethernet/netronome/nfp/nfp_main.h
@@ -112,5 +112,7 @@ extern const struct devlink_ops nfp_devlink_ops;
 
 int nfp_net_pci_probe(struct nfp_pf *pf);
 void nfp_net_pci_remove(struct nfp_pf *pf);
+int nfp_net_devlink_register(struct nfp_pf *pf);
+void nfp_net_devlink_unregister(struct nfp_pf *pf);
 
 #endif /* NFP_MAIN_H */
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c
index dd1118c7e1a4..bf10c0a316f3 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c
@@ -584,6 +584,8 @@ static void nfp_net_refresh_vnics(struct work_struct *work)
 		if (!nn->port || nn->port->type != NFP_PORT_INVALID)
 			continue;
 
+		nfp_devlink_port_unregister(nn->port);
+
 		nfp_net_debugfs_dir_clean(&nn->debugfs_dir);
 		nfp_net_clean(nn);
 
@@ -774,3 +776,35 @@ void nfp_net_pci_remove(struct nfp_pf *pf)
 
 	cancel_work_sync(&pf->port_refresh_work);
 }
+
+int nfp_net_devlink_register(struct nfp_pf *pf)
+{
+	struct nfp_port *port;
+	int err;
+
+	mutex_lock(&pf->lock);
+	list_for_each_entry(port, &pf->ports, port_list) {
+		err = nfp_devlink_port_register(pf->app, port);
+		if (err)
+			goto err_prev_ports_unreg;
+	}
+	mutex_unlock(&pf->lock);
+
+	return 0;
+
+err_prev_ports_unreg:
+	list_for_each_entry_continue_reverse(port, &pf->ports, port_list)
+		nfp_devlink_port_unregister(port);
+	mutex_unlock(&pf->lock);
+	return err;
+}
+
+void nfp_net_devlink_unregister(struct nfp_pf *pf)
+{
+	struct nfp_port *port;
+
+	mutex_lock(&pf->lock);
+	list_for_each_entry(port, &pf->ports, port_list)
+		nfp_devlink_port_unregister(port);
+	mutex_unlock(&pf->lock);
+}
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_port.h b/drivers/net/ethernet/netronome/nfp/nfp_port.h
index 641617de41cc..36a540b514be 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_port.h
+++ b/drivers/net/ethernet/netronome/nfp/nfp_port.h
@@ -34,6 +34,8 @@
 #ifndef _NFP_PORT_H_
 #define _NFP_PORT_H_
 
+#include <net/devlink.h>
+
 struct net_device;
 struct nfp_app;
 struct nfp_port;
@@ -66,6 +68,7 @@ enum nfp_port_flags {
  * @type:	what port type does the entity represent
  * @flags:	port flags
  * @app:	backpointer to the app structure
+ * @dl_port:	devlink port structure
  * @eth_id:	for %NFP_PORT_PHYS_PORT port ID in NFP enumeration scheme
  * @eth_port:	for %NFP_PORT_PHYS_PORT translated ETH Table port entry
  * @port_list:	entry on pf's list of ports
@@ -78,6 +81,8 @@ struct nfp_port {
 
 	struct nfp_app *app;
 
+	struct devlink_port dl_port;
+
 	unsigned int eth_id;
 	struct nfp_eth_table_port *eth_port;
 
@@ -99,4 +104,7 @@ void nfp_port_free(struct nfp_port *port);
 int nfp_net_refresh_eth_port(struct nfp_port *port);
 void nfp_net_refresh_port_table(struct nfp_port *port);
 
+int nfp_devlink_port_register(struct nfp_app *app, struct nfp_port *port);
+void nfp_devlink_port_unregister(struct nfp_port *port);
+
 #endif
-- 
2.11.0

^ permalink raw reply related

* [PATCH net-next 3/4] nfp: calculate total port lanes for split
From: Jakub Kicinski @ 2017-05-23 15:12 UTC (permalink / raw)
  To: netdev; +Cc: oss-drivers, Jakub Kicinski
In-Reply-To: <20170523151247.8535-1-jakub.kicinski@netronome.com>

For port splitting we will need to know the total number of lanes
in a port.  Calculate that based on eth_table information.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
---
 drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h     |  3 +++
 drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c | 11 ++++++-----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h
index 36b21e4dc56d..84a1d20adae1 100644
--- a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h
+++ b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h
@@ -96,6 +96,7 @@ enum nfp_eth_aneg {
  * @override_changed: is media reconfig pending?
  *
  * @port_type:	one of %PORT_* defines for ethtool
+ * @port_lanes:	total number of lanes on the port (sum of lanes of all subports)
  * @is_split:	is interface part of a split port
  */
 struct nfp_eth_table {
@@ -127,6 +128,8 @@ struct nfp_eth_table {
 		/* Computed fields */
 		u8 port_type;
 
+		unsigned int port_lanes;
+
 		bool is_split;
 	} ports[0];
 };
diff --git a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c
index 639438d8313a..b0f8785c064f 100644
--- a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c
+++ b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c
@@ -186,17 +186,19 @@ nfp_eth_port_translate(struct nfp_nsp *nsp, const union eth_table_entry *src,
 }
 
 static void
-nfp_eth_mark_split_ports(struct nfp_cpp *cpp, struct nfp_eth_table *table)
+nfp_eth_calc_port_geometry(struct nfp_cpp *cpp, struct nfp_eth_table *table)
 {
 	unsigned int i, j;
 
 	for (i = 0; i < table->count; i++)
 		for (j = 0; j < table->count; j++) {
-			if (i == j)
-				continue;
 			if (table->ports[i].label_port !=
 			    table->ports[j].label_port)
 				continue;
+			table->ports[i].port_lanes += table->ports[j].lanes;
+
+			if (i == j)
+				continue;
 			if (table->ports[i].label_subport ==
 			    table->ports[j].label_subport)
 				nfp_warn(cpp,
@@ -205,7 +207,6 @@ nfp_eth_mark_split_ports(struct nfp_cpp *cpp, struct nfp_eth_table *table)
 					 table->ports[i].label_subport);
 
 			table->ports[i].is_split = true;
-			break;
 		}
 }
 
@@ -289,7 +290,7 @@ __nfp_eth_read_ports(struct nfp_cpp *cpp, struct nfp_nsp *nsp)
 			nfp_eth_port_translate(nsp, &entries[i], i,
 					       &table->ports[j++]);
 
-	nfp_eth_mark_split_ports(cpp, table);
+	nfp_eth_calc_port_geometry(cpp, table);
 	for (i = 0; i < table->count; i++)
 		nfp_eth_calc_port_type(cpp, &table->ports[i]);
 
-- 
2.11.0

^ permalink raw reply related

* [PATCH net-next 0/4] nfp: devlink port implementation
From: Jakub Kicinski @ 2017-05-23 15:12 UTC (permalink / raw)
  To: netdev; +Cc: oss-drivers, Jakub Kicinski

Hi!

This series adds basic devlink support.  The operations we can perfrom
are port show and port split/unsplit.

Jakub Kicinski (3):
  nfp: register ports as devlink ports
  nfp: calculate total port lanes for split
  nfp: support port splitting via devlink

Simon Horman (1):
  nfp: add devlink support

 drivers/net/ethernet/netronome/nfp/Makefile        |   1 +
 drivers/net/ethernet/netronome/nfp/nfp_devlink.c   | 185 +++++++++++++++++++++
 drivers/net/ethernet/netronome/nfp/nfp_main.c      |  30 +++-
 drivers/net/ethernet/netronome/nfp/nfp_main.h      |   5 +
 drivers/net/ethernet/netronome/nfp/nfp_net_main.c  |  57 ++++++-
 drivers/net/ethernet/netronome/nfp/nfp_port.c      |  19 +++
 drivers/net/ethernet/netronome/nfp/nfp_port.h      |  12 ++
 .../net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h   |   3 +
 .../ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c   |  11 +-
 9 files changed, 307 insertions(+), 16 deletions(-)
 create mode 100644 drivers/net/ethernet/netronome/nfp/nfp_devlink.c

-- 
2.11.0

^ permalink raw reply

* [PATCH net-next 1/4] nfp: add devlink support
From: Jakub Kicinski @ 2017-05-23 15:12 UTC (permalink / raw)
  To: netdev; +Cc: oss-drivers, Simon Horman, Jakub Kicinski
In-Reply-To: <20170523151247.8535-1-jakub.kicinski@netronome.com>

From: Simon Horman <simon.horman@netronome.com>

Add initial devlink support.  This patch simply switches allocation
of per-adapter structure to devlink's priv and register devlink
with empty ops table.  See following patches for implementation
of particular ops.

Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
---
 drivers/net/ethernet/netronome/nfp/Makefile      |  1 +
 drivers/net/ethernet/netronome/nfp/nfp_devlink.c | 39 ++++++++++++++++++++++++
 drivers/net/ethernet/netronome/nfp/nfp_main.c    | 22 ++++++++++---
 drivers/net/ethernet/netronome/nfp/nfp_main.h    |  3 ++
 4 files changed, 61 insertions(+), 4 deletions(-)
 create mode 100644 drivers/net/ethernet/netronome/nfp/nfp_devlink.c

diff --git a/drivers/net/ethernet/netronome/nfp/Makefile b/drivers/net/ethernet/netronome/nfp/Makefile
index e8333283ada6..95f6b97b5d71 100644
--- a/drivers/net/ethernet/netronome/nfp/Makefile
+++ b/drivers/net/ethernet/netronome/nfp/Makefile
@@ -15,6 +15,7 @@ nfp-objs := \
 	    nfpcore/nfp_rtsym.o \
 	    nfpcore/nfp_target.o \
 	    nfp_app.o \
+	    nfp_devlink.o \
 	    nfp_main.o \
 	    nfp_net_common.o \
 	    nfp_net_ethtool.o \
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_devlink.c b/drivers/net/ethernet/netronome/nfp/nfp_devlink.c
new file mode 100644
index 000000000000..a8a52b3ff42b
--- /dev/null
+++ b/drivers/net/ethernet/netronome/nfp/nfp_devlink.c
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2017 Netronome Systems, Inc.
+ *
+ * This software is dual licensed under the GNU General License Version 2,
+ * June 1991 as shown in the file COPYING in the top-level directory of this
+ * source tree or the BSD 2-Clause License provided below.  You have the
+ * option to license this software under the complete terms of either license.
+ *
+ * The BSD 2-Clause License:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      1. Redistributions of source code must retain the above
+ *         copyright notice, this list of conditions and the following
+ *         disclaimer.
+ *
+ *      2. Redistributions in binary form must reproduce the above
+ *         copyright notice, this list of conditions and the following
+ *         disclaimer in the documentation and/or other materials
+ *         provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <net/devlink.h>
+
+#include "nfp_main.h"
+
+const struct devlink_ops nfp_devlink_ops = {
+};
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_main.c b/drivers/net/ethernet/netronome/nfp/nfp_main.c
index bb586ce1ea06..f22c8f083ab0 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_main.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_main.c
@@ -44,6 +44,7 @@
 #include <linux/pci.h>
 #include <linux/firmware.h>
 #include <linux/vermagic.h>
+#include <net/devlink.h>
 
 #include "nfpcore/nfp.h"
 #include "nfpcore/nfp_cpp.h"
@@ -315,6 +316,7 @@ static void nfp_fw_unload(struct nfp_pf *pf)
 static int nfp_pci_probe(struct pci_dev *pdev,
 			 const struct pci_device_id *pci_id)
 {
+	struct devlink *devlink;
 	struct nfp_pf *pf;
 	int err;
 
@@ -335,11 +337,12 @@ static int nfp_pci_probe(struct pci_dev *pdev,
 		goto err_pci_disable;
 	}
 
-	pf = kzalloc(sizeof(*pf), GFP_KERNEL);
-	if (!pf) {
+	devlink = devlink_alloc(&nfp_devlink_ops, sizeof(*pf));
+	if (!devlink) {
 		err = -ENOMEM;
 		goto err_rel_regions;
 	}
+	pf = devlink_priv(devlink);
 	INIT_LIST_HEAD(&pf->vnics);
 	INIT_LIST_HEAD(&pf->ports);
 	pci_set_drvdata(pdev, pf);
@@ -370,8 +373,14 @@ static int nfp_pci_probe(struct pci_dev *pdev,
 	if (err)
 		goto err_fw_unload;
 
+	err = devlink_register(devlink, &pdev->dev);
+	if (err)
+		goto err_kill_ndevs;
+
 	return 0;
 
+err_kill_ndevs:
+	nfp_net_pci_remove(pf);
 err_fw_unload:
 	if (pf->fw_loaded)
 		nfp_fw_unload(pf);
@@ -380,7 +389,7 @@ static int nfp_pci_probe(struct pci_dev *pdev,
 	nfp_cpp_free(pf->cpp);
 err_disable_msix:
 	pci_set_drvdata(pdev, NULL);
-	kfree(pf);
+	devlink_free(devlink);
 err_rel_regions:
 	pci_release_regions(pdev);
 err_pci_disable:
@@ -392,6 +401,11 @@ static int nfp_pci_probe(struct pci_dev *pdev,
 static void nfp_pci_remove(struct pci_dev *pdev)
 {
 	struct nfp_pf *pf = pci_get_drvdata(pdev);
+	struct devlink *devlink;
+
+	devlink = priv_to_devlink(pf);
+
+	devlink_unregister(devlink);
 
 	nfp_net_pci_remove(pf);
 
@@ -404,7 +418,7 @@ static void nfp_pci_remove(struct pci_dev *pdev)
 	nfp_cpp_free(pf->cpp);
 
 	kfree(pf->eth_tbl);
-	kfree(pf);
+	devlink_free(devlink);
 	pci_release_regions(pdev);
 	pci_disable_device(pdev);
 }
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_main.h b/drivers/net/ethernet/netronome/nfp/nfp_main.h
index 991c4cba0bbf..526db8029dea 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_main.h
+++ b/drivers/net/ethernet/netronome/nfp/nfp_main.h
@@ -47,6 +47,7 @@
 #include <linux/workqueue.h>
 
 struct dentry;
+struct devlink_ops;
 struct pci_dev;
 
 struct nfp_cpp;
@@ -107,6 +108,8 @@ struct nfp_pf {
 
 extern struct pci_driver nfp_netvf_pci_driver;
 
+extern const struct devlink_ops nfp_devlink_ops;
+
 int nfp_net_pci_probe(struct nfp_pf *pf);
 void nfp_net_pci_remove(struct nfp_pf *pf);
 
-- 
2.11.0

^ permalink raw reply related

* Re: [patch net-next 0/5] add tcp flags match support to flower and offload it
From: Jiri Pirko @ 2017-05-23 15:11 UTC (permalink / raw)
  To: netdev; +Cc: davem, jhs, xiyou.wangcong, simon.horman, mlxsw, idosch
In-Reply-To: <20170523143110.5006-1-jiri@resnulli.us>

Tue, May 23, 2017 at 04:31:05PM CEST, jiri@resnulli.us wrote:
>From: Jiri Pirko <jiri@mellanox.com>
>
>This patch adds support to dissect tcp flags, match on them using
>flower classifier and offload such rules to mlxsw Spectrum devices.

I shifted the git format patch one commit. Will send v2. Sorry.

^ permalink raw reply

* Re: [PATCH net-next] enic: unmask intr only when napi is complete
From: David Miller @ 2017-05-23 15:06 UTC (permalink / raw)
  To: gvaradar; +Cc: netdev, benve
In-Reply-To: <20170522191948.1397-1-gvaradar@cisco.com>

From: Govindarajulu Varadarajan <gvaradar@cisco.com>
Date: Mon, 22 May 2017 12:19:48 -0700

> In case of busy poll, napi_complete_done returns false and does not
> dequeue napi. In this case do not unmask the intr. We are guaranteed
> napi is called again. This reduces unnecessary iowrites.
> 
> Signed-off-by: Govindarajulu Varadarajan <gvaradar@cisco.com>

Looks good, applied, thank you.

^ permalink raw reply

* RE: [patch net-next 0/9] mlxsw: Support firmware flash
From: Mintz, Yuval @ 2017-05-23 15:04 UTC (permalink / raw)
  To: Yotam Gigi, Jiri Pirko, netdev@vger.kernel.org
  Cc: davem@davemloft.net, idosch@mellanox.com, mlxsw@mellanox.com,
	Ben Hutchings
In-Reply-To: <ea7cf005-1f6c-aa87-db90-03d7c77c7d56@mellanox.com>

> >> Patches 6-8 add the "ethtool -f" and the boot-time firmware upgrade on
> the
> >> mlxsw spectrum driver.
> > When we tried using `ethtool -E' for qed we got burned for trying to use
> the magic
> > value [1]. When we suggested extending it to allow some private data
> indications,
> > Ben claimed that this entire ethtool infrastructure is a thing of the past,
> > and we should try using MTD instead - a claim no one bothered to counter.
> >
> > Creating proprietary file-formats, filling them with metadata and
> > complementary driver state-machines could easily overcome the original
> > obstacle we faced. But it raises the question of whether these APIs are
> > valid or obsolete.
> 
> The metadata in our format is needed to allow us to hold several firmware
> images for several spectrum silicon variants in one file, hence the metadata
> is used by the driver and does not get transferred to the device.

Understood; Otherwise it would have been 'data' and not 'metadata'.

>Our code can only be used to transfer firmware to the device, and cannot
> be used to configure the device.

Not sure what this refers to? The differences between '-f' and '-E'?
Also, assuming you haven't started selling your adapters as persistent memory
for storage, what's the difference?

^ permalink raw reply

* Re: [net PATCH] mlx5: fix bug reading rss_hash_type from CQE
From: David Miller @ 2017-05-23 15:03 UTC (permalink / raw)
  To: brouer; +Cc: saeedm, borkmann, netdev, tariqt, alexei.starovoitov
In-Reply-To: <149547678696.10455.14428063974882319686.stgit@firesoul>

From: Jesper Dangaard Brouer <brouer@redhat.com>
Date: Mon, 22 May 2017 20:13:07 +0200

> Masks for extracting part of the Completion Queue Entry (CQE)
> field rss_hash_type was swapped, namely CQE_RSS_HTYPE_IP and
> CQE_RSS_HTYPE_L4.
> 
> The bug resulted in setting skb->l4_hash, even-though the
> rss_hash_type indicated that hash was NOT computed over the
> L4 (UDP or TCP) part of the packet.
> 
> Added comments from the datasheet, to make it more clear what
> these masks are selecting.
> 
> Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>

Applied, thanks Jesper.

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox