Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH 2/6] wl1251: Use request_firmware_prefer_user() for loading NVS calibration data
From: Pavel Machek @ 2017-01-27 19:40 UTC (permalink / raw)
  To: Kalle Valo
  Cc: Pali Rohár, Arend Van Spriel, Ming Lei, Luis R. Rodriguez,
	Greg Kroah-Hartman, David Gnedt, Michal Kazior, Daniel Wagner,
	Tony Lindgren, Sebastian Reichel, Ivaylo Dimitrov, Aaro Koskinen,
	Grazvydas Ignotas, linux-kernel, linux-wireless, netdev
In-Reply-To: <87bmus5xyc.fsf@kamboji.qca.qualcomm.com>

[-- Attachment #1: Type: text/plain, Size: 1854 bytes --]

On Fri 2017-01-27 17:23:07, Kalle Valo wrote:
> Pali Rohár <pali.rohar@gmail.com> writes:
> 
> > On Friday 27 January 2017 14:26:22 Kalle Valo wrote:
> >> Pali Rohár <pali.rohar@gmail.com> writes:
> >> 
> >> > 2) It was already tested that example NVS data can be used for N900 e.g.
> >> > for SSH connection. If real correct data are not available it is better
> >> > to use at least those example (and probably log warning message) so user
> >> > can connect via SSH and start investigating where is problem.
> >> 
> >> I disagree. Allowing default calibration data to be used can be
> >> unnoticed by user and left her wondering why wifi works so badly.
> >
> > So there are only two options:
> >
> > 1) Disallow it and so these users will have non-working wifi.
> >
> > 2) Allow those data to be used as fallback mechanism.
> >
> > And personally I'm against 1) because it will break wifi support for
> > *all* Nokia N900 devices right now.
> 
> All two of them? :)

Umm. You clearly want a flock of angry penguins at your doorsteps :-).

> But not working is exactly my point, if correct calibration data is not
> available wifi should not work. And it's not only about functionality
> problems, there's also the regulatory aspect.

If you break existing configuration that's called "regression".

> >> > 3) If we do rename *now* we will totally break wifi support on Nokia
> >> > N900.
> >> 
> >> Then the distro should fix that when updating the linux-firmware
> >> packages. Can you provide details about the setup, what distro etc?
> >
> > Debian stable, Ubuntu LTSs 14.04, 16.04. 
> 
> You can run these out of box on N900?

Debian stable does.
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply

* Re: [PATCH RFC net-next] packet: always ensure that we pass hard_header_len bytes in skb_headlen() to the driver
From: Willem de Bruijn @ 2017-01-27 19:29 UTC (permalink / raw)
  To: Sowmini Varadhan; +Cc: David Miller, Network Development
In-Reply-To: <20170127170320.GD25829@oracle.com>

> On (01/27/17 10:28), Willem de Bruijn wrote:
>> > Would it make sense to only do the CAP_SYS_RAWIO branch if the
>> > driver declares itself to have variable length L2 headers, via, e.g.,
>> > some priv flag?
>>
>> At the time, the comments were not specific to AX25. Again, we should
>> probably put that bypass behind a flag, enabling validating in the common case.
>
> Just to make sure I'm on the same page as you (since you have more
> history with this one..) we are going to have a priv_flags like
> IFF_VAR_L2HDR which (today) would only be set for ax25, and
> we would only take the CAP_SYS_RAWIO branch for IFF_VAR_L2HDR, right?

I suggested a sysctl. But either approach may cause test applications
that depend on current behavior to start failing.

As your patch state, the contract is that any packet delivered to a
driver has the entire L2 in its linear section. Drivers are not required
to be robust against shorter packets, so there is no reason to test
those.

One option is to limit your fix to known fixed-header protocols.
In these cases hard_header_len is the minimum, so anything
smaller must be dropped.

For protocols with variable header length it is fine to send packets
shorter than hard_header_len, even with corrupted content (i.e.,
even if they would fail that protocol's validate callback), as long as
they exceed the minimum length. ax25 already has a min length
check through its protocol-specific validate callback.

^ permalink raw reply

* [PATCH] cfg80211 debugfs: Cleanup some checkpatch issues
From: Pichugin Dmitry @ 2017-01-27 19:26 UTC (permalink / raw)
  To: johannes, davem; +Cc: linux-wireless, netdev, linux-kernel

This fixes the checkpatch.pl warnings:
* Macros should not use a trailing semicolon.
* Spaces required around that '='.
* Symbolic permissions 'S_IRUGO' are not preferred.
* Macro argument reuse 'buflen' - possible side-effects

Signed-off-by: Pichugin Dmitry <smokeman85@gmail.com>
---
 net/wireless/debugfs.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/net/wireless/debugfs.c b/net/wireless/debugfs.c
index 5d45391..96e3cff 100644
--- a/net/wireless/debugfs.c
+++ b/net/wireless/debugfs.c
@@ -17,11 +17,12 @@
 static ssize_t name## _read(struct file *file, char __user *userbuf,	\
 			    size_t count, loff_t *ppos)			\
 {									\
-	struct wiphy *wiphy= file->private_data;		\
-	char buf[buflen];						\
+	struct wiphy *wiphy = file->private_data;			\
+	int __buflen = __builtin_constant_p(buflen) ? buflen : -1;	\
+	char buf[__buflen];						\
 	int res;							\
 									\
-	res = scnprintf(buf, buflen, fmt "\n", ##value);		\
+	res = scnprintf(buf, __buflen, fmt "\n", ##value);		\
 	return simple_read_from_buffer(userbuf, count, ppos, buf, res);	\
 }									\
 									\
@@ -29,14 +30,14 @@ static const struct file_operations name## _ops = {			\
 	.read = name## _read,						\
 	.open = simple_open,						\
 	.llseek = generic_file_llseek,					\
-};
+}
 
 DEBUGFS_READONLY_FILE(rts_threshold, 20, "%d",
-		      wiphy->rts_threshold)
+		      wiphy->rts_threshold);
 DEBUGFS_READONLY_FILE(fragmentation_threshold, 20, "%d",
 		      wiphy->frag_threshold);
 DEBUGFS_READONLY_FILE(short_retry_limit, 20, "%d",
-		      wiphy->retry_short)
+		      wiphy->retry_short);
 DEBUGFS_READONLY_FILE(long_retry_limit, 20, "%d",
 		      wiphy->retry_long);
 
@@ -103,7 +104,7 @@ static const struct file_operations ht40allow_map_ops = {
 };
 
 #define DEBUGFS_ADD(name)						\
-	debugfs_create_file(#name, S_IRUGO, phyd, &rdev->wiphy, &name## _ops);
+	debugfs_create_file(#name, 0444, phyd, &rdev->wiphy, &name## _ops)
 
 void cfg80211_debugfs_rdev_add(struct cfg80211_registered_device *rdev)
 {
-- 
2.7.4

^ permalink raw reply related

* Re: [PATCH v2 net-next 1/2] ravb: Add tx and rx clock internal delays mode of APSR
From: Sergei Shtylyov @ 2017-01-27 19:05 UTC (permalink / raw)
  To: Simon Horman, David Miller; +Cc: Magnus Damm, netdev, linux-renesas-soc
In-Reply-To: <1485542120-10205-2-git-send-email-horms+renesas@verge.net.au>

On 01/27/2017 09:35 PM, Simon Horman wrote:

> From: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
>
> This patch enables tx and rx clock internal delay modes (TDM and RDM).
>
> This is to address a failure in the case of 1Gbps communication using the
> by salvator-x board with the KSZ9031RNX phy. This has been reported to
> occur with both the r8a7795 (H3) and r8a7796 (M3-W) SoCs.
>
> With this change APSR internal delay modes are enabled for
> "rgmii-id", "rgmii-rxid" and "rgmii-txid" phy modes as follows:
>
> phy mode   | ASPR delay mode
> -----------+----------------
> rgmii-id   | TDM and RDM
> rgmii-rxid | RDM
> rgmii-txid | TDM
>
> Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>

Acked-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

> ---
> v2 [Simon Horman]
> * As suggested by Sergei Shtylyov
>   - Add a comment to indicate that APSR_DM appears to be undocumented.
>   - Move chip_id check outside of ravb_set_delay_mode for consistency
>   - Call ravb_modify() once in ravb_set_delay_mode()
> * Enhance comment before calls to ravb_set_delay_mode()

    Well, I meant to say that the comment should precede the body of the 
function, not be repeated at every call...

> * Remove unnecessary break from end of switch statement.

   Come on, you did remove all the *switch*. :-)

>
> v1 [Simon Horman]
> - Combined patches
> - Reworded changelog
>
> v0 [Kazuya Mizuguchi]
> ---
>  drivers/net/ethernet/renesas/ravb.h      | 10 ++++++++++
>  drivers/net/ethernet/renesas/ravb_main.c | 24 ++++++++++++++++++++++++
>  2 files changed, 34 insertions(+)
>
> diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
> index f1109661a533..0525bd696d5d 100644
> --- a/drivers/net/ethernet/renesas/ravb.h
> +++ b/drivers/net/ethernet/renesas/ravb.h
[...]
> @@ -248,6 +249,15 @@ enum ESR_BIT {
>  	ESR_EIL		= 0x00001000,
>  };
>
> +/* APSR */
> +enum APSR_BIT {
> +	APSR_MEMS		= 0x00000002,
> +	APSR_CMSW		= 0x00000010,
> +	APSR_DM			= 0x00006000,	/* Undocumented? */
> +	APSR_DM_RDM		= 0x00002000,
> +	APSR_DM_TDM		= 0x00004000,

    The field values are also undocumented if the field is...

[...]

MBR, Sergei

^ permalink raw reply

* Re: [PATCH v2] net: phy: micrel: add support for KSZ8795
From: Florian Fainelli @ 2017-01-27 18:55 UTC (permalink / raw)
  To: Sean Nyekjaer, netdev; +Cc: andrew
In-Reply-To: <20170127074623.9200-1-sean.nyekjaer@prevas.dk>

On 01/26/2017 11:46 PM, Sean Nyekjaer wrote:
> This is adds support for the PHYs in the KSZ8795 5port managed switch.
> 
> It will allow to detect the link between the switch and the soc
> and uses the same read_status functions as the KSZ8873MLL switch.
> 
> Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
> ---
> Changes in v2:
>  - Removed "switch" name
> 
>  drivers/net/phy/micrel.c   | 14 ++++++++++++++
>  include/linux/micrel_phy.h |  2 ++
>  2 files changed, 16 insertions(+)
> 
> diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
> index ea92d524d5a8..fab56c9350cf 100644
> --- a/drivers/net/phy/micrel.c
> +++ b/drivers/net/phy/micrel.c
> @@ -1014,6 +1014,20 @@ static struct phy_driver ksphy_driver[] = {
>  	.get_stats	= kszphy_get_stats,
>  	.suspend	= genphy_suspend,
>  	.resume		= genphy_resume,
> +}, {
> +	.phy_id		= PHY_ID_KSZ8795,
> +	.phy_id_mask	= MICREL_PHY_ID_MASK,
> +	.name		= "Micrel KSZ8795",
> +	.features	= (SUPPORTED_Pause | SUPPORTED_Asym_Pause),

This is wrong, it should be PHY_GBIT_FEATURES or PHY_BASIC_FEATURES.
Including the Pause/AsymPause feature bits is not longer necessary, the
PHY library takes care of adding these automatically to let your MAC do
flow control auto-negotiation later on.

Please submit an incremental fix to that.

> +	.flags		= PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
> +	.config_init	= kszphy_config_init,
> +	.config_aneg	= ksz8873mll_config_aneg,
> +	.read_status	= ksz8873mll_read_status,
> +	.get_sset_count = kszphy_get_sset_count,
> +	.get_strings	= kszphy_get_strings,
> +	.get_stats	= kszphy_get_stats,
> +	.suspend	= genphy_suspend,
> +	.resume		= genphy_resume,
>  } };
>  
>  module_phy_driver(ksphy_driver);
> diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h
> index 257173e0095e..f541da68d1e7 100644
> --- a/include/linux/micrel_phy.h
> +++ b/include/linux/micrel_phy.h
> @@ -35,6 +35,8 @@
>  #define PHY_ID_KSZ886X		0x00221430
>  #define PHY_ID_KSZ8863		0x00221435
>  
> +#define PHY_ID_KSZ8795		0x00221550
> +
>  /* struct phy_device dev_flags definitions */
>  #define MICREL_PHY_50MHZ_CLK	0x00000001
>  #define MICREL_PHY_FXEN		0x00000002
> 


-- 
Florian

^ permalink raw reply

* Re: [PATCH net-next 1/4] mlx5: Make building eswitch configurable
From: Tom Herbert @ 2017-01-27 18:42 UTC (permalink / raw)
  To: Saeed Mahameed
  Cc: Or Gerlitz, Saeed Mahameed, David Miller, Linux Netdev List,
	Kernel Team
In-Reply-To: <CALzJLG_WCiTei7CDoUCzM241gt0bSKqjGJ61ke2XbbQTOjZBkQ@mail.gmail.com>

On Fri, Jan 27, 2017 at 10:28 AM, Saeed Mahameed
<saeedm@dev.mellanox.co.il> wrote:
> On Fri, Jan 27, 2017 at 8:16 PM, Tom Herbert <tom@herbertland.com> wrote:
>> On Fri, Jan 27, 2017 at 10:05 AM, Saeed Mahameed
>> <saeedm@dev.mellanox.co.il> wrote:
>>> On Fri, Jan 27, 2017 at 7:50 PM, Tom Herbert <tom@herbertland.com> wrote:
>>>> On Fri, Jan 27, 2017 at 9:38 AM, Saeed Mahameed
>>>> <saeedm@dev.mellanox.co.il> wrote:
>>>>> On Fri, Jan 27, 2017 at 7:34 AM, Or Gerlitz <gerlitz.or@gmail.com> wrote:
>>>>>> On Fri, Jan 27, 2017 at 1:32 AM, Tom Herbert <tom@herbertland.com> wrote:
>>>>>>> Add a configuration option (CONFIG_MLX5_CORE_ESWITCH) for controlling
>>>>>>> whether the eswitch code is built. Change Kconfig and Makefile
>>>>>>> accordingly.
>>>>>>
>>>>>> Tom, FWIW, please note that the basic e-switch functionality is needed
>>>>>> also when SRIOV isn't of use, this is for a multi host configuration.
>>>>>>
>>>>>
>>>>> Right, set_l2_table_entry@eswitch.c need to be called by PF for any UC
>>>>> MAC address wanted by VF or PF.
>>>>> To keep one flow in the code, the implementation is done as part of eswitch.
>>>>>
>>>>> so in multi-host configuration (where there are 4 PFs) each PF should
>>>>> invoke set_l2_table_entry_cmd  for each one of its own UC MACs.
>>>>>
>>>>> populating the l2 table is done using the whole eswitch event driven
>>>>> mechanisms, it is not easy and IMH not right to separate eswitch
>>>>> tables from l2 table (same management logic, different tables).
>>>>>
>>>>> Anyways as Or stated this is just an FYI, eswitch needs to be enabled
>>>>> on Multi-host configuration.
>>>>>
>>>> What indicate a multi-host configuration?
>>>
>>> nothing in the driver, it is transparent.
>>>
>> So then we always need the eswitch code to be built even if someone
>> never uses any of it?
>>
>
> yes.
> but for your convenience all you need is to compile eswitch.c.
> esiwtch_offoalds.c and en_rep.c can be compiled out for basic ethernet.
>
Well eswitch.c is 2200 LOC. en_rep.c and eswitch_offloads.c are 1600
LOC. If we _must_ have eswitch.c then there's probably not much point
then. But I am still finding it hard to fathom that eswitch has now
become a mandatory component of Ethernet drivers/devices.

Tom

>>>>
>>>>>> Or.
>>>>>>
>>>>>> My WW (and same for the rest of the IL team..) has ended so I will be
>>>>>> able to further look on this series and comment on Sunday.

^ permalink raw reply

* Re: [PATCH net-next 1/4] mlx5: Make building eswitch configurable
From: Tom Herbert @ 2017-01-27 18:33 UTC (permalink / raw)
  To: Saeed Mahameed
  Cc: Saeed Mahameed, David S. Miller, Linux Netdev List, Kernel Team
In-Reply-To: <CALzJLG-=Mzm+ko-=Ycu2vE6kdvX9zGF5XAP+z4hRv6sgX3G__w@mail.gmail.com>

On Fri, Jan 27, 2017 at 10:19 AM, Saeed Mahameed
<saeedm@dev.mellanox.co.il> wrote:
> On Fri, Jan 27, 2017 at 1:32 AM, Tom Herbert <tom@herbertland.com> wrote:
>> Add a configuration option (CONFIG_MLX5_CORE_ESWITCH) for controlling
>> whether the eswitch code is built. Change Kconfig and Makefile
>> accordingly.
>>
>> Signed-off-by: Tom Herbert <tom@herbertland.com>
>> ---
>>  drivers/net/ethernet/mellanox/mlx5/core/Kconfig   | 11 +++
>>  drivers/net/ethernet/mellanox/mlx5/core/Makefile  |  6 +-
>>  drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 92 +++++++++++++++++------
>>  drivers/net/ethernet/mellanox/mlx5/core/en_tc.c   | 39 +++++++---
>>  drivers/net/ethernet/mellanox/mlx5/core/eq.c      |  4 +-
>>  drivers/net/ethernet/mellanox/mlx5/core/main.c    | 16 ++--
>>  drivers/net/ethernet/mellanox/mlx5/core/sriov.c   |  6 +-
>>  7 files changed, 125 insertions(+), 49 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
>> index ddb4ca4..27aae58 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
>> @@ -30,3 +30,14 @@ config MLX5_CORE_EN_DCB
>>           This flag is depended on the kernel's DCB support.
>>
>>           If unsure, set to Y
>> +
>> +config MLX5_CORE_EN_ESWITCH
>> +       bool "Ethernet switch"
>> +       default y
>> +       depends on MLX5_CORE_EN
>> +       ---help---
>> +         Say Y here if you want to use Ethernet switch (E-switch). E-Switch
>> +         is the software entity that represents and manages ConnectX4
>> +         inter-HCA ethernet l2 switching.
>> +
>> +         If unsure, set to Y
>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/Makefile b/drivers/net/ethernet/mellanox/mlx5/core/Makefile
>> index 9f43beb..17025d8 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/core/Makefile
>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/Makefile
>> @@ -5,9 +5,11 @@ mlx5_core-y := main.o cmd.o debugfs.o fw.o eq.o uar.o pagealloc.o \
>>                 mad.o transobj.o vport.o sriov.o fs_cmd.o fs_core.o \
>>                 fs_counters.o rl.o lag.o dev.o
>>
>> -mlx5_core-$(CONFIG_MLX5_CORE_EN) += wq.o eswitch.o eswitch_offloads.o \
>> +mlx5_core-$(CONFIG_MLX5_CORE_EN) += wq.o \
>>                 en_main.o en_common.o en_fs.o en_ethtool.o en_tx.o \
>>                 en_rx.o en_rx_am.o en_txrx.o en_clock.o vxlan.o \
>> -               en_tc.o en_arfs.o en_rep.o en_fs_ethtool.o en_selftest.o
>> +               en_tc.o en_arfs.o en_fs_ethtool.o en_selftest.o
>>
>>  mlx5_core-$(CONFIG_MLX5_CORE_EN_DCB) +=  en_dcbnl.o
>> +
>> +mlx5_core-$(CONFIG_MLX5_CORE_EN_ESWITCH) += eswitch.o eswitch_offloads.o en_rep.o
>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
>> index e829143..1db4d98 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
>> @@ -38,7 +38,9 @@
>>  #include <linux/bpf.h>
>>  #include "en.h"
>>  #include "en_tc.h"
>> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>>  #include "eswitch.h"
>> +#endif
>
> Wouldn't it be cleaner if we left the main code (en_main.c) untouched
> and kept this
> #include "eswitch.h" and instead of filling the main flow code with
> #ifdefs, in eswitch.h
> we can create eswitch mock API functions when
> CONFIG_MLX5_CORE_EN_ESWITCH is not enabled ? the main flow will be
> clean from ifdefs and will complie with mock functions.
>
> we did this with accelerated RFS feature. look for "#ifndef
> CONFIG_RFS_ACCEL" in en.h
>
There are still occurrences of CONFIG_RFS_ACCEL in en_main.c and
main.c. For eswitch its a header problem, not everything related to
eswitch was extracted out of main though backend functions. There is a
lot of code that related to eswitch that is intertwined with the core
code.

>>  #include "vxlan.h"
>>
>>  struct mlx5e_rq_param {
>> @@ -585,10 +587,12 @@ static int mlx5e_create_rq(struct mlx5e_channel *c,
>>
>>         switch (priv->params.rq_wq_type) {
>>         case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ:
>> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>>                 if (mlx5e_is_vf_vport_rep(priv)) {
>>                         err = -EINVAL;
>>                         goto err_rq_wq_destroy;
>>                 }
>> +#endif
>>
>>                 rq->handle_rx_cqe = mlx5e_handle_rx_cqe_mpwrq;
>>                 rq->alloc_wqe = mlx5e_alloc_rx_mpwqe;
>> @@ -617,10 +621,14 @@ static int mlx5e_create_rq(struct mlx5e_channel *c,
>>                         goto err_rq_wq_destroy;
>>                 }
>>
>> -               if (mlx5e_is_vf_vport_rep(priv))
>> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>> +               if (mlx5e_is_vf_vport_rep(priv)) {
>>                         rq->handle_rx_cqe = mlx5e_handle_rx_cqe_rep;
>> -               else
>> +               } else
>> +#endif
>> +               {
>>                         rq->handle_rx_cqe = mlx5e_handle_rx_cqe;
>> +               }
>>
>>                 rq->alloc_wqe = mlx5e_alloc_rx_wqe;
>>                 rq->dealloc_wqe = mlx5e_dealloc_rx_wqe;
>> @@ -2198,7 +2206,6 @@ static void mlx5e_netdev_set_tcs(struct net_device *netdev)
>>  int mlx5e_open_locked(struct net_device *netdev)
>>  {
>>         struct mlx5e_priv *priv = netdev_priv(netdev);
>> -       struct mlx5_core_dev *mdev = priv->mdev;
>>         int num_txqs;
>>         int err;
>>
>> @@ -2233,11 +2240,13 @@ int mlx5e_open_locked(struct net_device *netdev)
>>         if (priv->profile->update_stats)
>>                 queue_delayed_work(priv->wq, &priv->update_stats_work, 0);
>>
>> -       if (MLX5_CAP_GEN(mdev, vport_group_manager)) {
>> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>> +       if (MLX5_CAP_GEN(priv->mdev, vport_group_manager)) {
>>                 err = mlx5e_add_sqs_fwd_rules(priv);
>>                 if (err)
>>                         goto err_close_channels;
>>         }
>> +#endif
>>         return 0;
>>
>>  err_close_channels:
>> @@ -2262,7 +2271,6 @@ int mlx5e_open(struct net_device *netdev)
>>  int mlx5e_close_locked(struct net_device *netdev)
>>  {
>>         struct mlx5e_priv *priv = netdev_priv(netdev);
>> -       struct mlx5_core_dev *mdev = priv->mdev;
>>
>>         /* May already be CLOSED in case a previous configuration operation
>>          * (e.g RX/TX queue size change) that involves close&open failed.
>> @@ -2272,8 +2280,10 @@ int mlx5e_close_locked(struct net_device *netdev)
>>
>>         clear_bit(MLX5E_STATE_OPENED, &priv->state);
>>
>> -       if (MLX5_CAP_GEN(mdev, vport_group_manager))
>> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>> +       if (MLX5_CAP_GEN(priv->mdev, vport_group_manager))
>>                 mlx5e_remove_sqs_fwd_rules(priv);
>> +#endif
>>
>>         mlx5e_timestamp_cleanup(priv);
>>         netif_carrier_off(priv->netdev);
>> @@ -2742,12 +2752,15 @@ mlx5e_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
>>         struct mlx5e_vport_stats *vstats = &priv->stats.vport;
>>         struct mlx5e_pport_stats *pstats = &priv->stats.pport;
>>
>> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>>         if (mlx5e_is_uplink_rep(priv)) {
>>                 stats->rx_packets = PPORT_802_3_GET(pstats, a_frames_received_ok);
>>                 stats->rx_bytes   = PPORT_802_3_GET(pstats, a_octets_received_ok);
>>                 stats->tx_packets = PPORT_802_3_GET(pstats, a_frames_transmitted_ok);
>>                 stats->tx_bytes   = PPORT_802_3_GET(pstats, a_octets_transmitted_ok);
>> -       } else {
>> +       } else
>> +#endif
>> +       {
>>                 stats->rx_packets = sstats->rx_packets;
>>                 stats->rx_bytes   = sstats->rx_bytes;
>>                 stats->tx_packets = sstats->tx_packets;
>> @@ -2991,6 +3004,7 @@ static int mlx5e_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
>>         }
>>  }
>>
>> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>>  static int mlx5e_set_vf_mac(struct net_device *dev, int vf, u8 *mac)
>>  {
>>         struct mlx5e_priv *priv = netdev_priv(dev);
>> @@ -3093,6 +3107,7 @@ static int mlx5e_get_vf_stats(struct net_device *dev,
>>         return mlx5_eswitch_get_vport_stats(mdev->priv.eswitch, vf + 1,
>>                                             vf_stats);
>>  }
>> +#endif /* CONFIG_MLX5_CORE_EN_ESWITCH */
>>
>>  void mlx5e_add_vxlan_port(struct net_device *netdev,
>>                           struct udp_tunnel_info *ti)
>> @@ -3329,6 +3344,7 @@ static const struct net_device_ops mlx5e_netdev_ops_basic = {
>>  #endif
>>  };
>>
>> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>>  static const struct net_device_ops mlx5e_netdev_ops_sriov = {
>>         .ndo_open                = mlx5e_open,
>>         .ndo_stop                = mlx5e_close,
>> @@ -3358,14 +3374,15 @@ static const struct net_device_ops mlx5e_netdev_ops_sriov = {
>>         .ndo_get_vf_config       = mlx5e_get_vf_config,
>>         .ndo_set_vf_link_state   = mlx5e_set_vf_link_state,
>>         .ndo_get_vf_stats        = mlx5e_get_vf_stats,
>> +       .ndo_has_offload_stats   = mlx5e_has_offload_stats,
>> +       .ndo_get_offload_stats   = mlx5e_get_offload_stats,
>>         .ndo_tx_timeout          = mlx5e_tx_timeout,
>>         .ndo_xdp                 = mlx5e_xdp,
>>  #ifdef CONFIG_NET_POLL_CONTROLLER
>>         .ndo_poll_controller     = mlx5e_netpoll,
>>  #endif
>> -       .ndo_has_offload_stats   = mlx5e_has_offload_stats,
>> -       .ndo_get_offload_stats   = mlx5e_get_offload_stats,
>>  };
>> +#endif /* CONFIG_MLX5_CORE_EN_ESWITCH */
>>
>>  static int mlx5e_check_required_hca_cap(struct mlx5_core_dev *mdev)
>>  {
>> @@ -3586,13 +3603,16 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
>>
>>         SET_NETDEV_DEV(netdev, &mdev->pdev->dev);
>>
>> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>>         if (MLX5_CAP_GEN(mdev, vport_group_manager)) {
>>                 netdev->netdev_ops = &mlx5e_netdev_ops_sriov;
>>  #ifdef CONFIG_MLX5_CORE_EN_DCB
>>                 if (MLX5_CAP_GEN(mdev, qos))
>>                         netdev->dcbnl_ops = &mlx5e_dcbnl_ops;
>>  #endif
>> -       } else {
>> +       } else
>> +#endif
>> +       {
>>                 netdev->netdev_ops = &mlx5e_netdev_ops_basic;
>>         }
>>
>> @@ -3795,14 +3815,16 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
>>  {
>>         struct net_device *netdev = priv->netdev;
>>         struct mlx5_core_dev *mdev = priv->mdev;
>> -       struct mlx5_eswitch *esw = mdev->priv.eswitch;
>> -       struct mlx5_eswitch_rep rep;
>>
>>         mlx5_lag_add(mdev, netdev);
>>
>>         mlx5e_enable_async_events(priv);
>>
>> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>>         if (MLX5_CAP_GEN(mdev, vport_group_manager)) {
>> +               struct mlx5_eswitch *esw = mdev->priv.eswitch;
>> +               struct mlx5_eswitch_rep rep;
>> +
>>                 mlx5_query_nic_vport_mac_address(mdev, 0, rep.hw_id);
>>                 rep.load = mlx5e_nic_rep_load;
>>                 rep.unload = mlx5e_nic_rep_unload;
>> @@ -3810,6 +3832,7 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
>>                 rep.netdev = netdev;
>>                 mlx5_eswitch_register_vport_rep(esw, 0, &rep);
>>         }
>> +#endif
>>
>>         if (netdev->reg_state != NETREG_REGISTERED)
>>                 return;
>> @@ -3827,11 +3850,14 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
>>  static void mlx5e_nic_disable(struct mlx5e_priv *priv)
>>  {
>>         struct mlx5_core_dev *mdev = priv->mdev;
>> -       struct mlx5_eswitch *esw = mdev->priv.eswitch;
>>
>>         queue_work(priv->wq, &priv->set_rx_mode_work);
>> -       if (MLX5_CAP_GEN(mdev, vport_group_manager))
>> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>> +       if (MLX5_CAP_GEN(priv->mdev, vport_group_manager)) {
>> +               struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
>>                 mlx5_eswitch_unregister_vport_rep(esw, 0);
>> +       }
>> +#endif
>>         mlx5e_disable_async_events(priv);
>>         mlx5_lag_remove(mdev);
>>  }
>> @@ -3942,6 +3968,7 @@ int mlx5e_attach_netdev(struct mlx5_core_dev *mdev, struct net_device *netdev)
>>         return err;
>>  }
>>
>> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>>  static void mlx5e_register_vport_rep(struct mlx5_core_dev *mdev)
>>  {
>>         struct mlx5_eswitch *esw = mdev->priv.eswitch;
>> @@ -3964,6 +3991,7 @@ static void mlx5e_register_vport_rep(struct mlx5_core_dev *mdev)
>>                 mlx5_eswitch_register_vport_rep(esw, vport, &rep);
>>         }
>>  }
>> +#endif
>>
>>  void mlx5e_detach_netdev(struct mlx5_core_dev *mdev, struct net_device *netdev)
>>  {
>> @@ -4028,11 +4056,8 @@ static void mlx5e_detach(struct mlx5_core_dev *mdev, void *vpriv)
>>
>>  static void *mlx5e_add(struct mlx5_core_dev *mdev)
>>  {
>> -       struct mlx5_eswitch *esw = mdev->priv.eswitch;
>> -       int total_vfs = MLX5_TOTAL_VPORTS(mdev);
>>         void *ppriv = NULL;
>>         void *priv;
>> -       int vport;
>>         int err;
>>         struct net_device *netdev;
>>
>> @@ -4040,10 +4065,14 @@ static void *mlx5e_add(struct mlx5_core_dev *mdev)
>>         if (err)
>>                 return NULL;
>>
>> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>>         mlx5e_register_vport_rep(mdev);
>>
>> -       if (MLX5_CAP_GEN(mdev, vport_group_manager))
>> +       if (MLX5_CAP_GEN(mdev, vport_group_manager)) {
>> +               struct mlx5_eswitch *esw = mdev->priv.eswitch;
>>                 ppriv = &esw->offloads.vport_reps[0];
>> +       }
>> +#endif
>>
>>         netdev = mlx5e_create_netdev(mdev, &mlx5e_nic_profile, ppriv);
>>         if (!netdev) {
>> @@ -4074,8 +4103,16 @@ static void *mlx5e_add(struct mlx5_core_dev *mdev)
>>         mlx5e_destroy_netdev(mdev, priv);
>>
>>  err_unregister_reps:
>> -       for (vport = 1; vport < total_vfs; vport++)
>> -               mlx5_eswitch_unregister_vport_rep(esw, vport);
>> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>> +       {
>> +               int total_vfs = MLX5_TOTAL_VPORTS(mdev);
>> +               struct mlx5_eswitch *esw = mdev->priv.eswitch;
>> +               int vport;
>> +
>> +               for (vport = 1; vport < total_vfs; vport++)
>> +                       mlx5_eswitch_unregister_vport_rep(esw, vport);
>> +       }
>> +#endif
>>
>>         return NULL;
>>  }
>> @@ -4093,13 +4130,18 @@ void mlx5e_destroy_netdev(struct mlx5_core_dev *mdev, struct mlx5e_priv *priv)
>>
>>  static void mlx5e_remove(struct mlx5_core_dev *mdev, void *vpriv)
>>  {
>> -       struct mlx5_eswitch *esw = mdev->priv.eswitch;
>> -       int total_vfs = MLX5_TOTAL_VPORTS(mdev);
>>         struct mlx5e_priv *priv = vpriv;
>> -       int vport;
>>
>> -       for (vport = 1; vport < total_vfs; vport++)
>> -               mlx5_eswitch_unregister_vport_rep(esw, vport);
>> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>> +       {
>> +               struct mlx5_eswitch *esw = mdev->priv.eswitch;
>> +               int total_vfs = MLX5_TOTAL_VPORTS(mdev);
>> +               int vport;
>> +
>> +               for (vport = 1; vport < total_vfs; vport++)
>> +                       mlx5_eswitch_unregister_vport_rep(esw, vport);
>> +       }
>> +#endif
>>
>>         unregister_netdev(priv->netdev);
>>         mlx5e_detach(mdev, vpriv);
>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
>> index 640f10f..8e5f565 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
>> @@ -128,6 +128,7 @@ mlx5e_tc_add_nic_flow(struct mlx5e_priv *priv,
>>         return rule;
>>  }
>>
>> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>>  static struct mlx5_flow_handle *
>>  mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,
>>                       struct mlx5_flow_spec *spec,
>> @@ -160,6 +161,7 @@ static void mlx5e_detach_encap(struct mlx5e_priv *priv,
>>                 kfree(e);
>>         }
>>  }
>> +#endif /* CONFIG_MLX5_CORE_EN_ESWITCH */
>>
>>  /* we get here also when setting rule to the FW failed, etc. It means that the
>>   * flow rule itself might not exist, but some offloading related to the actions
>> @@ -168,7 +170,6 @@ static void mlx5e_detach_encap(struct mlx5e_priv *priv,
>>  static void mlx5e_tc_del_flow(struct mlx5e_priv *priv,
>>                               struct mlx5e_tc_flow *flow)
>>  {
>> -       struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
>>         struct mlx5_fc *counter = NULL;
>>
>>         if (!IS_ERR(flow->rule)) {
>> @@ -177,11 +178,17 @@ static void mlx5e_tc_del_flow(struct mlx5e_priv *priv,
>>                 mlx5_fc_destroy(priv->mdev, counter);
>>         }
>>
>> -       if (esw && esw->mode == SRIOV_OFFLOADS) {
>> -               mlx5_eswitch_del_vlan_action(esw, flow->attr);
>> -               if (flow->attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP)
>> -                       mlx5e_detach_encap(priv, flow);
>> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>> +       {
>> +               struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
>> +
>> +               if (esw && esw->mode == SRIOV_OFFLOADS) {
>> +                       mlx5_eswitch_del_vlan_action(esw, flow->attr);
>> +                       if (flow->attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP)
>> +                               mlx5e_detach_encap(priv, flow);
>> +               }
>>         }
>> +#endif
>>
>>         if (!mlx5e_tc_num_filters(priv) && (priv->fs.tc.t)) {
>>                 mlx5_destroy_flow_table(priv->fs.tc.t);
>> @@ -679,6 +686,7 @@ static inline int hash_encap_info(struct ip_tunnel_key *key)
>>         return jhash(key, sizeof(*key), 0);
>>  }
>>
>> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>>  static int mlx5e_route_lookup_ipv4(struct mlx5e_priv *priv,
>>                                    struct net_device *mirred_dev,
>>                                    struct net_device **out_dev,
>> @@ -1129,20 +1137,27 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
>>         }
>>         return 0;
>>  }
>> +#endif /* CONFIG_MLX5_CORE_EN_ESWITCH */
>>
>>  int mlx5e_configure_flower(struct mlx5e_priv *priv, __be16 protocol,
>>                            struct tc_cls_flower_offload *f)
>>  {
>>         struct mlx5e_tc_table *tc = &priv->fs.tc;
>>         int err = 0;
>> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>>         bool fdb_flow = false;
>> +#endif
>>         u32 flow_tag, action;
>>         struct mlx5e_tc_flow *flow;
>>         struct mlx5_flow_spec *spec;
>> -       struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
>>
>> -       if (esw && esw->mode == SRIOV_OFFLOADS)
>> -               fdb_flow = true;
>> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>> +       {
>> +               struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
>> +
>> +               if (esw && esw->mode == SRIOV_OFFLOADS)
>> +                       fdb_flow = true;
>> +       }
>>
>>         if (fdb_flow)
>>                 flow = kzalloc(sizeof(*flow) +
>> @@ -1150,6 +1165,9 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv, __be16 protocol,
>>                                GFP_KERNEL);
>>         else
>>                 flow = kzalloc(sizeof(*flow), GFP_KERNEL);
>> +#else
>> +       flow = kzalloc(sizeof(*flow), GFP_KERNEL);
>> +#endif
>>
>>         spec = mlx5_vzalloc(sizeof(*spec));
>>         if (!spec || !flow) {
>> @@ -1163,13 +1181,16 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv, __be16 protocol,
>>         if (err < 0)
>>                 goto err_free;
>>
>> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>>         if (fdb_flow) {
>>                 flow->attr  = (struct mlx5_esw_flow_attr *)(flow + 1);
>>                 err = parse_tc_fdb_actions(priv, f->exts, flow);
>>                 if (err < 0)
>>                         goto err_free;
>>                 flow->rule = mlx5e_tc_add_fdb_flow(priv, spec, flow->attr);
>> -       } else {
>> +       } else
>> +#endif
>> +       {
>>                 err = parse_tc_nic_actions(priv, f->exts, &action, &flow_tag);
>>                 if (err < 0)
>>                         goto err_free;
>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
>> index ea5d8d3..2c67c25 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c
>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
>> @@ -35,7 +35,7 @@
>>  #include <linux/mlx5/driver.h>
>>  #include <linux/mlx5/cmd.h>
>>  #include "mlx5_core.h"
>> -#ifdef CONFIG_MLX5_CORE_EN
>> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>>  #include "eswitch.h"
>>  #endif
>>
>> @@ -462,7 +462,7 @@ static irqreturn_t mlx5_eq_int(int irq, void *eq_ptr)
>>                         }
>>                         break;
>>
>> -#ifdef CONFIG_MLX5_CORE_EN
>> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>>                 case MLX5_EVENT_TYPE_NIC_VPORT_CHANGE:
>>                         mlx5_eswitch_vport_event(dev->priv.eswitch, eqe);
>>                         break;
>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
>> index 84f7970..224f499 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
>> @@ -53,7 +53,7 @@
>>  #include <net/devlink.h>
>>  #include "mlx5_core.h"
>>  #include "fs_core.h"
>> -#ifdef CONFIG_MLX5_CORE_EN
>> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>>  #include "eswitch.h"
>>  #endif
>>
>> @@ -941,7 +941,7 @@ static int mlx5_init_once(struct mlx5_core_dev *dev, struct mlx5_priv *priv)
>>                 goto err_tables_cleanup;
>>         }
>>
>> -#ifdef CONFIG_MLX5_CORE_EN
>> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>>         err = mlx5_eswitch_init(dev);
>>         if (err) {
>>                 dev_err(&pdev->dev, "Failed to init eswitch %d\n", err);
>> @@ -958,7 +958,7 @@ static int mlx5_init_once(struct mlx5_core_dev *dev, struct mlx5_priv *priv)
>>         return 0;
>>
>>  err_eswitch_cleanup:
>> -#ifdef CONFIG_MLX5_CORE_EN
>> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>>         mlx5_eswitch_cleanup(dev->priv.eswitch);
>>
>>  err_rl_cleanup:
>> @@ -981,7 +981,7 @@ static int mlx5_init_once(struct mlx5_core_dev *dev, struct mlx5_priv *priv)
>>  static void mlx5_cleanup_once(struct mlx5_core_dev *dev)
>>  {
>>         mlx5_sriov_cleanup(dev);
>> -#ifdef CONFIG_MLX5_CORE_EN
>> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>>         mlx5_eswitch_cleanup(dev->priv.eswitch);
>>  #endif
>>         mlx5_cleanup_rl_table(dev);
>> @@ -1131,7 +1131,7 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv,
>>                 goto err_fs;
>>         }
>>
>> -#ifdef CONFIG_MLX5_CORE_EN
>> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>>         mlx5_eswitch_attach(dev->priv.eswitch);
>>  #endif
>>
>> @@ -1162,7 +1162,7 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv,
>>         mlx5_sriov_detach(dev);
>>
>>  err_sriov:
>> -#ifdef CONFIG_MLX5_CORE_EN
>> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>>         mlx5_eswitch_detach(dev->priv.eswitch);
>>  #endif
>>         mlx5_cleanup_fs(dev);
>> @@ -1233,7 +1233,7 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv,
>>                 mlx5_detach_device(dev);
>>
>>         mlx5_sriov_detach(dev);
>> -#ifdef CONFIG_MLX5_CORE_EN
>> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>>         mlx5_eswitch_detach(dev->priv.eswitch);
>>  #endif
>>         mlx5_cleanup_fs(dev);
>> @@ -1269,7 +1269,7 @@ struct mlx5_core_event_handler {
>>  };
>>
>>  static const struct devlink_ops mlx5_devlink_ops = {
>> -#ifdef CONFIG_MLX5_CORE_EN
>> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>>         .eswitch_mode_set = mlx5_devlink_eswitch_mode_set,
>>         .eswitch_mode_get = mlx5_devlink_eswitch_mode_get,
>>         .eswitch_inline_mode_set = mlx5_devlink_eswitch_inline_mode_set,
>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/sriov.c b/drivers/net/ethernet/mellanox/mlx5/core/sriov.c
>> index e086277..0664cc4 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/core/sriov.c
>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/sriov.c
>> @@ -33,7 +33,7 @@
>>  #include <linux/pci.h>
>>  #include <linux/mlx5/driver.h>
>>  #include "mlx5_core.h"
>> -#ifdef CONFIG_MLX5_CORE_EN
>> +#ifdef CONFIG_MLX5_CORE_ESWITCH
>>  #include "eswitch.h"
>>  #endif
>>
>> @@ -57,7 +57,7 @@ static int mlx5_device_enable_sriov(struct mlx5_core_dev *dev, int num_vfs)
>>                 return -EBUSY;
>>         }
>>
>> -#ifdef CONFIG_MLX5_CORE_EN
>> +#ifdef CONFIG_MLX5_CORE_ESWITCH
>>         err = mlx5_eswitch_enable_sriov(dev->priv.eswitch, num_vfs, SRIOV_LEGACY);
>>         if (err) {
>>                 mlx5_core_warn(dev,
>> @@ -102,7 +102,7 @@ static void mlx5_device_disable_sriov(struct mlx5_core_dev *dev)
>>                 sriov->enabled_vfs--;
>>         }
>>
>> -#ifdef CONFIG_MLX5_CORE_EN
>> +#ifdef CONFIG_MLX5_CORE_ESWITCH
>>         mlx5_eswitch_disable_sriov(dev->priv.eswitch);
>>  #endif
>>
>> --
>> 2.9.3
>>

^ permalink raw reply

* Re: [PATCH v2 net] net: free ip_vs_dest structs when refcnt=0
From: Simon Horman @ 2017-01-27 18:37 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: Julian Anastasov, David Windsor, netdev, kernel-hardening,
	netfilter-devel, lvs-devel, wensong, keescook, elena.reshetova,
	ishkamiel
In-Reply-To: <20170127122111.GA2495@salvia>

On Fri, Jan 27, 2017 at 01:21:11PM +0100, Pablo Neira Ayuso wrote:
> On Fri, Jan 27, 2017 at 09:07:38AM +0100, Simon Horman wrote:
> > On Thu, Jan 26, 2017 at 10:49:10PM +0200, Julian Anastasov wrote:
> > > 
> > > 	Hello,
> > > 
> > > On Mon, 23 Jan 2017, David Windsor wrote:
> > > 
> > > > Currently, the ip_vs_dest cache frees ip_vs_dest objects when their
> > > > reference count becomes < 0.  Aside from not being semantically sound,
> > > > this is problematic for the new type refcount_t, which will be introduced
> > > > shortly in a separate patch. refcount_t is the new kernel type for
> > > > holding reference counts, and provides overflow protection and a
> > > > constrained interface relative to atomic_t (the type currently being
> > > > used for kernel reference counts).
> > > > 
> > > > Per Julian Anastasov: "The problem is that dest_trash currently holds
> > > > deleted dests (unlinked from RCU lists) with refcnt=0."  Changing
> > > > dest_trash to hold dest with refcnt=1 will allow us to free ip_vs_dest
> > > > structs when their refcnt=0, in ip_vs_dest_put_and_free().
> > > > 
> > > > Signed-off-by: David Windsor <dwindsor@gmail.com>
> > > 
> > > 	Thanks! I tested the first version and this one
> > > just adds the needed changes in comments, so
> > > 
> > > Signed-off-by: Julian Anastasov <ja@ssi.bg>
> > > 
> > > 	Simon and Pablo, this is more appropriate for
> > > ipvs-next/nf-next. Please apply!
> > 
> > Pablo, would you mind taking this one directly into nf-next?
> > 
> > Signed-off-by: Simon Horman <horms@verge.net.au>
> 
> Sure, no problem. I'll take it. Thanks!

Thanks!

^ permalink raw reply

* [PATCH v2 net-next 1/2] ravb: Add tx and rx clock internal delays mode of APSR
From: Simon Horman @ 2017-01-27 18:35 UTC (permalink / raw)
  To: David Miller, Sergei Shtylyov; +Cc: Magnus Damm, netdev, linux-renesas-soc
In-Reply-To: <1485542120-10205-1-git-send-email-horms+renesas@verge.net.au>

From: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>

This patch enables tx and rx clock internal delay modes (TDM and RDM).

This is to address a failure in the case of 1Gbps communication using the
by salvator-x board with the KSZ9031RNX phy. This has been reported to
occur with both the r8a7795 (H3) and r8a7796 (M3-W) SoCs.

With this change APSR internal delay modes are enabled for
"rgmii-id", "rgmii-rxid" and "rgmii-txid" phy modes as follows:

phy mode   | ASPR delay mode
-----------+----------------
rgmii-id   | TDM and RDM
rgmii-rxid | RDM
rgmii-txid | TDM

Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>

---
v2 [Simon Horman]
* As suggested by Sergei Shtylyov
  - Add a comment to indicate that APSR_DM appears to be undocumented.
  - Move chip_id check outside of ravb_set_delay_mode for consistency
  - Call ravb_modify() once in ravb_set_delay_mode()
* Enhance comment before calls to ravb_set_delay_mode()
* Remove unnecessary break from end of switch statement.

v1 [Simon Horman]
- Combined patches
- Reworded changelog

v0 [Kazuya Mizuguchi]
---
 drivers/net/ethernet/renesas/ravb.h      | 10 ++++++++++
 drivers/net/ethernet/renesas/ravb_main.c | 24 ++++++++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index f1109661a533..0525bd696d5d 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -76,6 +76,7 @@ enum ravb_reg {
 	CDAR20	= 0x0060,
 	CDAR21	= 0x0064,
 	ESR	= 0x0088,
+	APSR	= 0x008C,	/* R-Car Gen3 only */
 	RCR	= 0x0090,
 	RQC0	= 0x0094,
 	RQC1	= 0x0098,
@@ -248,6 +249,15 @@ enum ESR_BIT {
 	ESR_EIL		= 0x00001000,
 };
 
+/* APSR */
+enum APSR_BIT {
+	APSR_MEMS		= 0x00000002,
+	APSR_CMSW		= 0x00000010,
+	APSR_DM			= 0x00006000,	/* Undocumented? */
+	APSR_DM_RDM		= 0x00002000,
+	APSR_DM_TDM		= 0x00004000,
+};
+
 /* RCR */
 enum RCR_BIT {
 	RCR_EFFS	= 0x00000001,
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 89ac1e3f6175..f655c1c23765 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1904,6 +1904,22 @@ static void ravb_set_config_mode(struct net_device *ndev)
 	}
 }
 
+static void ravb_set_delay_mode(struct net_device *ndev)
+{
+	struct ravb_private *priv = netdev_priv(ndev);
+	int set = 0;
+
+	if (priv->phy_interface == PHY_INTERFACE_MODE_RGMII_ID ||
+	    priv->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID)
+		set |= APSR_DM_RDM;
+
+	if (priv->phy_interface == PHY_INTERFACE_MODE_RGMII_ID ||
+	    priv->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID)
+		set |= APSR_DM_TDM;
+
+	ravb_modify(ndev, APSR, APSR_DM, set);
+}
+
 static int ravb_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
@@ -2016,6 +2032,10 @@ static int ravb_probe(struct platform_device *pdev)
 	/* Request GTI loading */
 	ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI);
 
+	if (priv->chip_id != RCAR_GEN2)
+		/* Set tx and rx clock internal delay modes */
+		ravb_set_delay_mode(ndev);
+
 	/* Allocate descriptor base address table */
 	priv->desc_bat_size = sizeof(struct ravb_desc) * DBAT_ENTRY_NUM;
 	priv->desc_bat = dma_alloc_coherent(ndev->dev.parent, priv->desc_bat_size,
@@ -2152,6 +2172,10 @@ static int __maybe_unused ravb_resume(struct device *dev)
 	/* Request GTI loading */
 	ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI);
 
+	if (priv->chip_id != RCAR_GEN2)
+		/* Set tx and rx clock internal delay modes */
+		ravb_set_delay_mode(ndev);
+
 	/* Restore descriptor base address table */
 	ravb_write(ndev, priv->desc_bat_dma, DBAT);
 
-- 
2.7.0.rc3.207.g0ac5344

^ permalink raw reply related

* [PATCH v2 net-next 2/2] ravb: Support 1Gbps on R-Car H3 ES1.1+ and R-Car M3-W
From: Simon Horman @ 2017-01-27 18:35 UTC (permalink / raw)
  To: David Miller, Sergei Shtylyov; +Cc: Magnus Damm, netdev, linux-renesas-soc
In-Reply-To: <1485542120-10205-1-git-send-email-horms+renesas@verge.net.au>

From: Geert Uytterhoeven <geert+renesas@glider.be>

The limitation to 10/100Mbit speeds on R-Car Gen3 is valid for R-Car H3
ES1.0 only. Check for the exact SoC model to allow 1Gbps on newer
revisions of R-Car H3, and on R-Car M3-W.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Acked-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
---
 drivers/net/ethernet/renesas/ravb_main.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index f655c1c23765..6626bc5a6d7a 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -31,6 +31,7 @@
 #include <linux/pm_runtime.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
+#include <linux/sys_soc.h>
 
 #include <asm/div64.h>
 
@@ -973,6 +974,11 @@ static void ravb_adjust_link(struct net_device *ndev)
 		phy_print_status(phydev);
 }
 
+static const struct soc_device_attribute r8a7795es10[] = {
+	{ .soc_id = "r8a7795", .revision = "ES1.0", },
+	{ /* sentinel */ }
+};
+
 /* PHY init function */
 static int ravb_phy_init(struct net_device *ndev)
 {
@@ -1008,10 +1014,10 @@ static int ravb_phy_init(struct net_device *ndev)
 		goto err_deregister_fixed_link;
 	}
 
-	/* This driver only support 10/100Mbit speeds on Gen3
+	/* This driver only support 10/100Mbit speeds on R-Car H3 ES1.0
 	 * at this time.
 	 */
-	if (priv->chip_id == RCAR_GEN3) {
+	if (soc_device_match(r8a7795es10)) {
 		err = phy_set_max_speed(phydev, SPEED_100);
 		if (err) {
 			netdev_err(ndev, "failed to limit PHY to 100Mbit/s\n");
-- 
2.7.0.rc3.207.g0ac5344

^ permalink raw reply related

* [PATCH v2 net-next 0/2] ravb: Support 1Gbps on R-Car H3 ES1.1+ and R-Car M3-W
From: Simon Horman @ 2017-01-27 18:35 UTC (permalink / raw)
  To: David Miller, Sergei Shtylyov; +Cc: Magnus Damm, netdev, linux-renesas-soc

Hi,

this series adds support for gigabit communication to the Renesas EthernetAVB
controller when used in conjunction with  R-Car Gen3 H3 ES1.1+ and M3-W SoCs.
Gigabit is already supported with R-Car Gen 2 SoCs.

The patch from Geert was previously posted for inclusion in v4.10 and
acked by Dave for that purpose. It was, however, not accepted by the
ARM SoC maintainers.

The path from Mizuguchi-san is to address timing problems observed with
gigabit transfers. I would like it considered although my own testing on
M3-W did not show any timing problems.

Changes since v1:
* Address various feedback for "APSR" patch as noted in its changelog

Geert Uytterhoeven (1):
  ravb: Support 1Gbps on R-Car H3 ES1.1+ and R-Car M3-W

Kazuya Mizuguchi (1):
  ravb: Add tx and rx clock internal delays mode of APSR

 drivers/net/ethernet/renesas/ravb.h      | 10 ++++++++++
 drivers/net/ethernet/renesas/ravb_main.c | 34 ++++++++++++++++++++++++++++++--
 2 files changed, 42 insertions(+), 2 deletions(-)

-- 
2.7.0.rc3.207.g0ac5344

^ permalink raw reply

* Re: netvsc NAPI patch process
From: Stephen Hemminger @ 2017-01-27 17:39 UTC (permalink / raw)
  To: Greg KH; +Cc: David Miller, kys, netdev
In-Reply-To: <20170127075406.GC31443@kroah.com>

On Fri, 27 Jan 2017 08:54:06 +0100
Greg KH <greg@kroah.com> wrote:

> On Thu, Jan 26, 2017 at 01:06:46PM -0500, David Miller wrote:
> > From: Stephen Hemminger <stephen@networkplumber.org>
> > Date: Thu, 26 Jan 2017 10:04:05 -0800
> >   
> > > I have a working set of patches to enable NAPI in the netvsc driver.
> > > The problem is that it requires a set of patches to vmbus layer as well.
> > > Since vmbus patches have been going through char-misc-next tree rather
> > > than net-next, it is difficult to stage these.
> > > 
> > > How about if I send the vmbus patches through normal driver-devel upstream
> > > and during the 4.10 merge window send the last 3 patches for NAPI for linux-net
> > > tree to get into 4.10?  
> > 
> > Another option is that the char-misc-next folks create a branch with just
> > the commits you need for NAPI, I pull that into net-next, and then you
> > can submit the NAPI changes to me.  
> 
> I can easily do that, or I have no problem with the vmbus changes going
> through the net-next tree, if they are sane (i.e. let me review them
> please...)  Which ever is easier for the networking developers, their
> tree is much crazier than the tiny char-misc tree is :)
> 
> thanks,
> 
> greg k-h

I just want the least pain and the least overhead process. Waiting two releases
and trying to deal with merge conflicts is a pain. Also it makes life harder
with distro backports etc.

^ permalink raw reply

* Re: [PATCH net-next 1/4] mlx5: Make building eswitch configurable
From: Saeed Mahameed @ 2017-01-27 18:05 UTC (permalink / raw)
  To: Tom Herbert
  Cc: Or Gerlitz, Saeed Mahameed, David Miller, Linux Netdev List,
	Kernel Team
In-Reply-To: <CALx6S34K-N7TWtEG0cCgq-zAXqqfNp9zp1JtR8bLvD=F90A2pg@mail.gmail.com>

On Fri, Jan 27, 2017 at 7:50 PM, Tom Herbert <tom@herbertland.com> wrote:
> On Fri, Jan 27, 2017 at 9:38 AM, Saeed Mahameed
> <saeedm@dev.mellanox.co.il> wrote:
>> On Fri, Jan 27, 2017 at 7:34 AM, Or Gerlitz <gerlitz.or@gmail.com> wrote:
>>> On Fri, Jan 27, 2017 at 1:32 AM, Tom Herbert <tom@herbertland.com> wrote:
>>>> Add a configuration option (CONFIG_MLX5_CORE_ESWITCH) for controlling
>>>> whether the eswitch code is built. Change Kconfig and Makefile
>>>> accordingly.
>>>
>>> Tom, FWIW, please note that the basic e-switch functionality is needed
>>> also when SRIOV isn't of use, this is for a multi host configuration.
>>>
>>
>> Right, set_l2_table_entry@eswitch.c need to be called by PF for any UC
>> MAC address wanted by VF or PF.
>> To keep one flow in the code, the implementation is done as part of eswitch.
>>
>> so in multi-host configuration (where there are 4 PFs) each PF should
>> invoke set_l2_table_entry_cmd  for each one of its own UC MACs.
>>
>> populating the l2 table is done using the whole eswitch event driven
>> mechanisms, it is not easy and IMH not right to separate eswitch
>> tables from l2 table (same management logic, different tables).
>>
>> Anyways as Or stated this is just an FYI, eswitch needs to be enabled
>> on Multi-host configuration.
>>
> What indicate a multi-host configuration?

nothing in the driver, it is transparent.

>
>>> Or.
>>>
>>> My WW (and same for the rest of the IL team..) has ended so I will be
>>> able to further look on this series and comment on Sunday.

^ permalink raw reply

* Re: [PATCH net-next 1/4] mlx5: Make building eswitch configurable
From: Saeed Mahameed @ 2017-01-27 18:19 UTC (permalink / raw)
  To: Tom Herbert
  Cc: Saeed Mahameed, David S. Miller, Linux Netdev List, Kernel Team
In-Reply-To: <20170126233241.2268449-2-tom@herbertland.com>

On Fri, Jan 27, 2017 at 1:32 AM, Tom Herbert <tom@herbertland.com> wrote:
> Add a configuration option (CONFIG_MLX5_CORE_ESWITCH) for controlling
> whether the eswitch code is built. Change Kconfig and Makefile
> accordingly.
>
> Signed-off-by: Tom Herbert <tom@herbertland.com>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/Kconfig   | 11 +++
>  drivers/net/ethernet/mellanox/mlx5/core/Makefile  |  6 +-
>  drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 92 +++++++++++++++++------
>  drivers/net/ethernet/mellanox/mlx5/core/en_tc.c   | 39 +++++++---
>  drivers/net/ethernet/mellanox/mlx5/core/eq.c      |  4 +-
>  drivers/net/ethernet/mellanox/mlx5/core/main.c    | 16 ++--
>  drivers/net/ethernet/mellanox/mlx5/core/sriov.c   |  6 +-
>  7 files changed, 125 insertions(+), 49 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
> index ddb4ca4..27aae58 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
> @@ -30,3 +30,14 @@ config MLX5_CORE_EN_DCB
>           This flag is depended on the kernel's DCB support.
>
>           If unsure, set to Y
> +
> +config MLX5_CORE_EN_ESWITCH
> +       bool "Ethernet switch"
> +       default y
> +       depends on MLX5_CORE_EN
> +       ---help---
> +         Say Y here if you want to use Ethernet switch (E-switch). E-Switch
> +         is the software entity that represents and manages ConnectX4
> +         inter-HCA ethernet l2 switching.
> +
> +         If unsure, set to Y
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/Makefile b/drivers/net/ethernet/mellanox/mlx5/core/Makefile
> index 9f43beb..17025d8 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/Makefile
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/Makefile
> @@ -5,9 +5,11 @@ mlx5_core-y := main.o cmd.o debugfs.o fw.o eq.o uar.o pagealloc.o \
>                 mad.o transobj.o vport.o sriov.o fs_cmd.o fs_core.o \
>                 fs_counters.o rl.o lag.o dev.o
>
> -mlx5_core-$(CONFIG_MLX5_CORE_EN) += wq.o eswitch.o eswitch_offloads.o \
> +mlx5_core-$(CONFIG_MLX5_CORE_EN) += wq.o \
>                 en_main.o en_common.o en_fs.o en_ethtool.o en_tx.o \
>                 en_rx.o en_rx_am.o en_txrx.o en_clock.o vxlan.o \
> -               en_tc.o en_arfs.o en_rep.o en_fs_ethtool.o en_selftest.o
> +               en_tc.o en_arfs.o en_fs_ethtool.o en_selftest.o
>
>  mlx5_core-$(CONFIG_MLX5_CORE_EN_DCB) +=  en_dcbnl.o
> +
> +mlx5_core-$(CONFIG_MLX5_CORE_EN_ESWITCH) += eswitch.o eswitch_offloads.o en_rep.o
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> index e829143..1db4d98 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> @@ -38,7 +38,9 @@
>  #include <linux/bpf.h>
>  #include "en.h"
>  #include "en_tc.h"
> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>  #include "eswitch.h"
> +#endif

Wouldn't it be cleaner if we left the main code (en_main.c) untouched
and kept this
#include "eswitch.h" and instead of filling the main flow code with
#ifdefs, in eswitch.h
we can create eswitch mock API functions when
CONFIG_MLX5_CORE_EN_ESWITCH is not enabled ? the main flow will be
clean from ifdefs and will complie with mock functions.

we did this with accelerated RFS feature. look for "#ifndef
CONFIG_RFS_ACCEL" in en.h

>  #include "vxlan.h"
>
>  struct mlx5e_rq_param {
> @@ -585,10 +587,12 @@ static int mlx5e_create_rq(struct mlx5e_channel *c,
>
>         switch (priv->params.rq_wq_type) {
>         case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ:
> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>                 if (mlx5e_is_vf_vport_rep(priv)) {
>                         err = -EINVAL;
>                         goto err_rq_wq_destroy;
>                 }
> +#endif
>
>                 rq->handle_rx_cqe = mlx5e_handle_rx_cqe_mpwrq;
>                 rq->alloc_wqe = mlx5e_alloc_rx_mpwqe;
> @@ -617,10 +621,14 @@ static int mlx5e_create_rq(struct mlx5e_channel *c,
>                         goto err_rq_wq_destroy;
>                 }
>
> -               if (mlx5e_is_vf_vport_rep(priv))
> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
> +               if (mlx5e_is_vf_vport_rep(priv)) {
>                         rq->handle_rx_cqe = mlx5e_handle_rx_cqe_rep;
> -               else
> +               } else
> +#endif
> +               {
>                         rq->handle_rx_cqe = mlx5e_handle_rx_cqe;
> +               }
>
>                 rq->alloc_wqe = mlx5e_alloc_rx_wqe;
>                 rq->dealloc_wqe = mlx5e_dealloc_rx_wqe;
> @@ -2198,7 +2206,6 @@ static void mlx5e_netdev_set_tcs(struct net_device *netdev)
>  int mlx5e_open_locked(struct net_device *netdev)
>  {
>         struct mlx5e_priv *priv = netdev_priv(netdev);
> -       struct mlx5_core_dev *mdev = priv->mdev;
>         int num_txqs;
>         int err;
>
> @@ -2233,11 +2240,13 @@ int mlx5e_open_locked(struct net_device *netdev)
>         if (priv->profile->update_stats)
>                 queue_delayed_work(priv->wq, &priv->update_stats_work, 0);
>
> -       if (MLX5_CAP_GEN(mdev, vport_group_manager)) {
> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
> +       if (MLX5_CAP_GEN(priv->mdev, vport_group_manager)) {
>                 err = mlx5e_add_sqs_fwd_rules(priv);
>                 if (err)
>                         goto err_close_channels;
>         }
> +#endif
>         return 0;
>
>  err_close_channels:
> @@ -2262,7 +2271,6 @@ int mlx5e_open(struct net_device *netdev)
>  int mlx5e_close_locked(struct net_device *netdev)
>  {
>         struct mlx5e_priv *priv = netdev_priv(netdev);
> -       struct mlx5_core_dev *mdev = priv->mdev;
>
>         /* May already be CLOSED in case a previous configuration operation
>          * (e.g RX/TX queue size change) that involves close&open failed.
> @@ -2272,8 +2280,10 @@ int mlx5e_close_locked(struct net_device *netdev)
>
>         clear_bit(MLX5E_STATE_OPENED, &priv->state);
>
> -       if (MLX5_CAP_GEN(mdev, vport_group_manager))
> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
> +       if (MLX5_CAP_GEN(priv->mdev, vport_group_manager))
>                 mlx5e_remove_sqs_fwd_rules(priv);
> +#endif
>
>         mlx5e_timestamp_cleanup(priv);
>         netif_carrier_off(priv->netdev);
> @@ -2742,12 +2752,15 @@ mlx5e_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
>         struct mlx5e_vport_stats *vstats = &priv->stats.vport;
>         struct mlx5e_pport_stats *pstats = &priv->stats.pport;
>
> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>         if (mlx5e_is_uplink_rep(priv)) {
>                 stats->rx_packets = PPORT_802_3_GET(pstats, a_frames_received_ok);
>                 stats->rx_bytes   = PPORT_802_3_GET(pstats, a_octets_received_ok);
>                 stats->tx_packets = PPORT_802_3_GET(pstats, a_frames_transmitted_ok);
>                 stats->tx_bytes   = PPORT_802_3_GET(pstats, a_octets_transmitted_ok);
> -       } else {
> +       } else
> +#endif
> +       {
>                 stats->rx_packets = sstats->rx_packets;
>                 stats->rx_bytes   = sstats->rx_bytes;
>                 stats->tx_packets = sstats->tx_packets;
> @@ -2991,6 +3004,7 @@ static int mlx5e_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
>         }
>  }
>
> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>  static int mlx5e_set_vf_mac(struct net_device *dev, int vf, u8 *mac)
>  {
>         struct mlx5e_priv *priv = netdev_priv(dev);
> @@ -3093,6 +3107,7 @@ static int mlx5e_get_vf_stats(struct net_device *dev,
>         return mlx5_eswitch_get_vport_stats(mdev->priv.eswitch, vf + 1,
>                                             vf_stats);
>  }
> +#endif /* CONFIG_MLX5_CORE_EN_ESWITCH */
>
>  void mlx5e_add_vxlan_port(struct net_device *netdev,
>                           struct udp_tunnel_info *ti)
> @@ -3329,6 +3344,7 @@ static const struct net_device_ops mlx5e_netdev_ops_basic = {
>  #endif
>  };
>
> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>  static const struct net_device_ops mlx5e_netdev_ops_sriov = {
>         .ndo_open                = mlx5e_open,
>         .ndo_stop                = mlx5e_close,
> @@ -3358,14 +3374,15 @@ static const struct net_device_ops mlx5e_netdev_ops_sriov = {
>         .ndo_get_vf_config       = mlx5e_get_vf_config,
>         .ndo_set_vf_link_state   = mlx5e_set_vf_link_state,
>         .ndo_get_vf_stats        = mlx5e_get_vf_stats,
> +       .ndo_has_offload_stats   = mlx5e_has_offload_stats,
> +       .ndo_get_offload_stats   = mlx5e_get_offload_stats,
>         .ndo_tx_timeout          = mlx5e_tx_timeout,
>         .ndo_xdp                 = mlx5e_xdp,
>  #ifdef CONFIG_NET_POLL_CONTROLLER
>         .ndo_poll_controller     = mlx5e_netpoll,
>  #endif
> -       .ndo_has_offload_stats   = mlx5e_has_offload_stats,
> -       .ndo_get_offload_stats   = mlx5e_get_offload_stats,
>  };
> +#endif /* CONFIG_MLX5_CORE_EN_ESWITCH */
>
>  static int mlx5e_check_required_hca_cap(struct mlx5_core_dev *mdev)
>  {
> @@ -3586,13 +3603,16 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
>
>         SET_NETDEV_DEV(netdev, &mdev->pdev->dev);
>
> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>         if (MLX5_CAP_GEN(mdev, vport_group_manager)) {
>                 netdev->netdev_ops = &mlx5e_netdev_ops_sriov;
>  #ifdef CONFIG_MLX5_CORE_EN_DCB
>                 if (MLX5_CAP_GEN(mdev, qos))
>                         netdev->dcbnl_ops = &mlx5e_dcbnl_ops;
>  #endif
> -       } else {
> +       } else
> +#endif
> +       {
>                 netdev->netdev_ops = &mlx5e_netdev_ops_basic;
>         }
>
> @@ -3795,14 +3815,16 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
>  {
>         struct net_device *netdev = priv->netdev;
>         struct mlx5_core_dev *mdev = priv->mdev;
> -       struct mlx5_eswitch *esw = mdev->priv.eswitch;
> -       struct mlx5_eswitch_rep rep;
>
>         mlx5_lag_add(mdev, netdev);
>
>         mlx5e_enable_async_events(priv);
>
> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>         if (MLX5_CAP_GEN(mdev, vport_group_manager)) {
> +               struct mlx5_eswitch *esw = mdev->priv.eswitch;
> +               struct mlx5_eswitch_rep rep;
> +
>                 mlx5_query_nic_vport_mac_address(mdev, 0, rep.hw_id);
>                 rep.load = mlx5e_nic_rep_load;
>                 rep.unload = mlx5e_nic_rep_unload;
> @@ -3810,6 +3832,7 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
>                 rep.netdev = netdev;
>                 mlx5_eswitch_register_vport_rep(esw, 0, &rep);
>         }
> +#endif
>
>         if (netdev->reg_state != NETREG_REGISTERED)
>                 return;
> @@ -3827,11 +3850,14 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
>  static void mlx5e_nic_disable(struct mlx5e_priv *priv)
>  {
>         struct mlx5_core_dev *mdev = priv->mdev;
> -       struct mlx5_eswitch *esw = mdev->priv.eswitch;
>
>         queue_work(priv->wq, &priv->set_rx_mode_work);
> -       if (MLX5_CAP_GEN(mdev, vport_group_manager))
> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
> +       if (MLX5_CAP_GEN(priv->mdev, vport_group_manager)) {
> +               struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
>                 mlx5_eswitch_unregister_vport_rep(esw, 0);
> +       }
> +#endif
>         mlx5e_disable_async_events(priv);
>         mlx5_lag_remove(mdev);
>  }
> @@ -3942,6 +3968,7 @@ int mlx5e_attach_netdev(struct mlx5_core_dev *mdev, struct net_device *netdev)
>         return err;
>  }
>
> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>  static void mlx5e_register_vport_rep(struct mlx5_core_dev *mdev)
>  {
>         struct mlx5_eswitch *esw = mdev->priv.eswitch;
> @@ -3964,6 +3991,7 @@ static void mlx5e_register_vport_rep(struct mlx5_core_dev *mdev)
>                 mlx5_eswitch_register_vport_rep(esw, vport, &rep);
>         }
>  }
> +#endif
>
>  void mlx5e_detach_netdev(struct mlx5_core_dev *mdev, struct net_device *netdev)
>  {
> @@ -4028,11 +4056,8 @@ static void mlx5e_detach(struct mlx5_core_dev *mdev, void *vpriv)
>
>  static void *mlx5e_add(struct mlx5_core_dev *mdev)
>  {
> -       struct mlx5_eswitch *esw = mdev->priv.eswitch;
> -       int total_vfs = MLX5_TOTAL_VPORTS(mdev);
>         void *ppriv = NULL;
>         void *priv;
> -       int vport;
>         int err;
>         struct net_device *netdev;
>
> @@ -4040,10 +4065,14 @@ static void *mlx5e_add(struct mlx5_core_dev *mdev)
>         if (err)
>                 return NULL;
>
> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>         mlx5e_register_vport_rep(mdev);
>
> -       if (MLX5_CAP_GEN(mdev, vport_group_manager))
> +       if (MLX5_CAP_GEN(mdev, vport_group_manager)) {
> +               struct mlx5_eswitch *esw = mdev->priv.eswitch;
>                 ppriv = &esw->offloads.vport_reps[0];
> +       }
> +#endif
>
>         netdev = mlx5e_create_netdev(mdev, &mlx5e_nic_profile, ppriv);
>         if (!netdev) {
> @@ -4074,8 +4103,16 @@ static void *mlx5e_add(struct mlx5_core_dev *mdev)
>         mlx5e_destroy_netdev(mdev, priv);
>
>  err_unregister_reps:
> -       for (vport = 1; vport < total_vfs; vport++)
> -               mlx5_eswitch_unregister_vport_rep(esw, vport);
> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
> +       {
> +               int total_vfs = MLX5_TOTAL_VPORTS(mdev);
> +               struct mlx5_eswitch *esw = mdev->priv.eswitch;
> +               int vport;
> +
> +               for (vport = 1; vport < total_vfs; vport++)
> +                       mlx5_eswitch_unregister_vport_rep(esw, vport);
> +       }
> +#endif
>
>         return NULL;
>  }
> @@ -4093,13 +4130,18 @@ void mlx5e_destroy_netdev(struct mlx5_core_dev *mdev, struct mlx5e_priv *priv)
>
>  static void mlx5e_remove(struct mlx5_core_dev *mdev, void *vpriv)
>  {
> -       struct mlx5_eswitch *esw = mdev->priv.eswitch;
> -       int total_vfs = MLX5_TOTAL_VPORTS(mdev);
>         struct mlx5e_priv *priv = vpriv;
> -       int vport;
>
> -       for (vport = 1; vport < total_vfs; vport++)
> -               mlx5_eswitch_unregister_vport_rep(esw, vport);
> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
> +       {
> +               struct mlx5_eswitch *esw = mdev->priv.eswitch;
> +               int total_vfs = MLX5_TOTAL_VPORTS(mdev);
> +               int vport;
> +
> +               for (vport = 1; vport < total_vfs; vport++)
> +                       mlx5_eswitch_unregister_vport_rep(esw, vport);
> +       }
> +#endif
>
>         unregister_netdev(priv->netdev);
>         mlx5e_detach(mdev, vpriv);
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> index 640f10f..8e5f565 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> @@ -128,6 +128,7 @@ mlx5e_tc_add_nic_flow(struct mlx5e_priv *priv,
>         return rule;
>  }
>
> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>  static struct mlx5_flow_handle *
>  mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,
>                       struct mlx5_flow_spec *spec,
> @@ -160,6 +161,7 @@ static void mlx5e_detach_encap(struct mlx5e_priv *priv,
>                 kfree(e);
>         }
>  }
> +#endif /* CONFIG_MLX5_CORE_EN_ESWITCH */
>
>  /* we get here also when setting rule to the FW failed, etc. It means that the
>   * flow rule itself might not exist, but some offloading related to the actions
> @@ -168,7 +170,6 @@ static void mlx5e_detach_encap(struct mlx5e_priv *priv,
>  static void mlx5e_tc_del_flow(struct mlx5e_priv *priv,
>                               struct mlx5e_tc_flow *flow)
>  {
> -       struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
>         struct mlx5_fc *counter = NULL;
>
>         if (!IS_ERR(flow->rule)) {
> @@ -177,11 +178,17 @@ static void mlx5e_tc_del_flow(struct mlx5e_priv *priv,
>                 mlx5_fc_destroy(priv->mdev, counter);
>         }
>
> -       if (esw && esw->mode == SRIOV_OFFLOADS) {
> -               mlx5_eswitch_del_vlan_action(esw, flow->attr);
> -               if (flow->attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP)
> -                       mlx5e_detach_encap(priv, flow);
> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
> +       {
> +               struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
> +
> +               if (esw && esw->mode == SRIOV_OFFLOADS) {
> +                       mlx5_eswitch_del_vlan_action(esw, flow->attr);
> +                       if (flow->attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP)
> +                               mlx5e_detach_encap(priv, flow);
> +               }
>         }
> +#endif
>
>         if (!mlx5e_tc_num_filters(priv) && (priv->fs.tc.t)) {
>                 mlx5_destroy_flow_table(priv->fs.tc.t);
> @@ -679,6 +686,7 @@ static inline int hash_encap_info(struct ip_tunnel_key *key)
>         return jhash(key, sizeof(*key), 0);
>  }
>
> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>  static int mlx5e_route_lookup_ipv4(struct mlx5e_priv *priv,
>                                    struct net_device *mirred_dev,
>                                    struct net_device **out_dev,
> @@ -1129,20 +1137,27 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
>         }
>         return 0;
>  }
> +#endif /* CONFIG_MLX5_CORE_EN_ESWITCH */
>
>  int mlx5e_configure_flower(struct mlx5e_priv *priv, __be16 protocol,
>                            struct tc_cls_flower_offload *f)
>  {
>         struct mlx5e_tc_table *tc = &priv->fs.tc;
>         int err = 0;
> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>         bool fdb_flow = false;
> +#endif
>         u32 flow_tag, action;
>         struct mlx5e_tc_flow *flow;
>         struct mlx5_flow_spec *spec;
> -       struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
>
> -       if (esw && esw->mode == SRIOV_OFFLOADS)
> -               fdb_flow = true;
> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
> +       {
> +               struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
> +
> +               if (esw && esw->mode == SRIOV_OFFLOADS)
> +                       fdb_flow = true;
> +       }
>
>         if (fdb_flow)
>                 flow = kzalloc(sizeof(*flow) +
> @@ -1150,6 +1165,9 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv, __be16 protocol,
>                                GFP_KERNEL);
>         else
>                 flow = kzalloc(sizeof(*flow), GFP_KERNEL);
> +#else
> +       flow = kzalloc(sizeof(*flow), GFP_KERNEL);
> +#endif
>
>         spec = mlx5_vzalloc(sizeof(*spec));
>         if (!spec || !flow) {
> @@ -1163,13 +1181,16 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv, __be16 protocol,
>         if (err < 0)
>                 goto err_free;
>
> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>         if (fdb_flow) {
>                 flow->attr  = (struct mlx5_esw_flow_attr *)(flow + 1);
>                 err = parse_tc_fdb_actions(priv, f->exts, flow);
>                 if (err < 0)
>                         goto err_free;
>                 flow->rule = mlx5e_tc_add_fdb_flow(priv, spec, flow->attr);
> -       } else {
> +       } else
> +#endif
> +       {
>                 err = parse_tc_nic_actions(priv, f->exts, &action, &flow_tag);
>                 if (err < 0)
>                         goto err_free;
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
> index ea5d8d3..2c67c25 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
> @@ -35,7 +35,7 @@
>  #include <linux/mlx5/driver.h>
>  #include <linux/mlx5/cmd.h>
>  #include "mlx5_core.h"
> -#ifdef CONFIG_MLX5_CORE_EN
> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>  #include "eswitch.h"
>  #endif
>
> @@ -462,7 +462,7 @@ static irqreturn_t mlx5_eq_int(int irq, void *eq_ptr)
>                         }
>                         break;
>
> -#ifdef CONFIG_MLX5_CORE_EN
> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>                 case MLX5_EVENT_TYPE_NIC_VPORT_CHANGE:
>                         mlx5_eswitch_vport_event(dev->priv.eswitch, eqe);
>                         break;
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
> index 84f7970..224f499 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
> @@ -53,7 +53,7 @@
>  #include <net/devlink.h>
>  #include "mlx5_core.h"
>  #include "fs_core.h"
> -#ifdef CONFIG_MLX5_CORE_EN
> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>  #include "eswitch.h"
>  #endif
>
> @@ -941,7 +941,7 @@ static int mlx5_init_once(struct mlx5_core_dev *dev, struct mlx5_priv *priv)
>                 goto err_tables_cleanup;
>         }
>
> -#ifdef CONFIG_MLX5_CORE_EN
> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>         err = mlx5_eswitch_init(dev);
>         if (err) {
>                 dev_err(&pdev->dev, "Failed to init eswitch %d\n", err);
> @@ -958,7 +958,7 @@ static int mlx5_init_once(struct mlx5_core_dev *dev, struct mlx5_priv *priv)
>         return 0;
>
>  err_eswitch_cleanup:
> -#ifdef CONFIG_MLX5_CORE_EN
> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>         mlx5_eswitch_cleanup(dev->priv.eswitch);
>
>  err_rl_cleanup:
> @@ -981,7 +981,7 @@ static int mlx5_init_once(struct mlx5_core_dev *dev, struct mlx5_priv *priv)
>  static void mlx5_cleanup_once(struct mlx5_core_dev *dev)
>  {
>         mlx5_sriov_cleanup(dev);
> -#ifdef CONFIG_MLX5_CORE_EN
> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>         mlx5_eswitch_cleanup(dev->priv.eswitch);
>  #endif
>         mlx5_cleanup_rl_table(dev);
> @@ -1131,7 +1131,7 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv,
>                 goto err_fs;
>         }
>
> -#ifdef CONFIG_MLX5_CORE_EN
> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>         mlx5_eswitch_attach(dev->priv.eswitch);
>  #endif
>
> @@ -1162,7 +1162,7 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv,
>         mlx5_sriov_detach(dev);
>
>  err_sriov:
> -#ifdef CONFIG_MLX5_CORE_EN
> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>         mlx5_eswitch_detach(dev->priv.eswitch);
>  #endif
>         mlx5_cleanup_fs(dev);
> @@ -1233,7 +1233,7 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv,
>                 mlx5_detach_device(dev);
>
>         mlx5_sriov_detach(dev);
> -#ifdef CONFIG_MLX5_CORE_EN
> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>         mlx5_eswitch_detach(dev->priv.eswitch);
>  #endif
>         mlx5_cleanup_fs(dev);
> @@ -1269,7 +1269,7 @@ struct mlx5_core_event_handler {
>  };
>
>  static const struct devlink_ops mlx5_devlink_ops = {
> -#ifdef CONFIG_MLX5_CORE_EN
> +#ifdef CONFIG_MLX5_CORE_EN_ESWITCH
>         .eswitch_mode_set = mlx5_devlink_eswitch_mode_set,
>         .eswitch_mode_get = mlx5_devlink_eswitch_mode_get,
>         .eswitch_inline_mode_set = mlx5_devlink_eswitch_inline_mode_set,
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/sriov.c b/drivers/net/ethernet/mellanox/mlx5/core/sriov.c
> index e086277..0664cc4 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/sriov.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/sriov.c
> @@ -33,7 +33,7 @@
>  #include <linux/pci.h>
>  #include <linux/mlx5/driver.h>
>  #include "mlx5_core.h"
> -#ifdef CONFIG_MLX5_CORE_EN
> +#ifdef CONFIG_MLX5_CORE_ESWITCH
>  #include "eswitch.h"
>  #endif
>
> @@ -57,7 +57,7 @@ static int mlx5_device_enable_sriov(struct mlx5_core_dev *dev, int num_vfs)
>                 return -EBUSY;
>         }
>
> -#ifdef CONFIG_MLX5_CORE_EN
> +#ifdef CONFIG_MLX5_CORE_ESWITCH
>         err = mlx5_eswitch_enable_sriov(dev->priv.eswitch, num_vfs, SRIOV_LEGACY);
>         if (err) {
>                 mlx5_core_warn(dev,
> @@ -102,7 +102,7 @@ static void mlx5_device_disable_sriov(struct mlx5_core_dev *dev)
>                 sriov->enabled_vfs--;
>         }
>
> -#ifdef CONFIG_MLX5_CORE_EN
> +#ifdef CONFIG_MLX5_CORE_ESWITCH
>         mlx5_eswitch_disable_sriov(dev->priv.eswitch);
>  #endif
>
> --
> 2.9.3
>

^ permalink raw reply

* Re: [PATCH net-next 1/4] mlx5: Make building eswitch configurable
From: Saeed Mahameed @ 2017-01-27 18:28 UTC (permalink / raw)
  To: Tom Herbert
  Cc: Or Gerlitz, Saeed Mahameed, David Miller, Linux Netdev List,
	Kernel Team
In-Reply-To: <CALx6S375OVvSi5QLLCpsGc84iE3cJ3VH5Rm6sg8OJgDR=nqXfA@mail.gmail.com>

On Fri, Jan 27, 2017 at 8:16 PM, Tom Herbert <tom@herbertland.com> wrote:
> On Fri, Jan 27, 2017 at 10:05 AM, Saeed Mahameed
> <saeedm@dev.mellanox.co.il> wrote:
>> On Fri, Jan 27, 2017 at 7:50 PM, Tom Herbert <tom@herbertland.com> wrote:
>>> On Fri, Jan 27, 2017 at 9:38 AM, Saeed Mahameed
>>> <saeedm@dev.mellanox.co.il> wrote:
>>>> On Fri, Jan 27, 2017 at 7:34 AM, Or Gerlitz <gerlitz.or@gmail.com> wrote:
>>>>> On Fri, Jan 27, 2017 at 1:32 AM, Tom Herbert <tom@herbertland.com> wrote:
>>>>>> Add a configuration option (CONFIG_MLX5_CORE_ESWITCH) for controlling
>>>>>> whether the eswitch code is built. Change Kconfig and Makefile
>>>>>> accordingly.
>>>>>
>>>>> Tom, FWIW, please note that the basic e-switch functionality is needed
>>>>> also when SRIOV isn't of use, this is for a multi host configuration.
>>>>>
>>>>
>>>> Right, set_l2_table_entry@eswitch.c need to be called by PF for any UC
>>>> MAC address wanted by VF or PF.
>>>> To keep one flow in the code, the implementation is done as part of eswitch.
>>>>
>>>> so in multi-host configuration (where there are 4 PFs) each PF should
>>>> invoke set_l2_table_entry_cmd  for each one of its own UC MACs.
>>>>
>>>> populating the l2 table is done using the whole eswitch event driven
>>>> mechanisms, it is not easy and IMH not right to separate eswitch
>>>> tables from l2 table (same management logic, different tables).
>>>>
>>>> Anyways as Or stated this is just an FYI, eswitch needs to be enabled
>>>> on Multi-host configuration.
>>>>
>>> What indicate a multi-host configuration?
>>
>> nothing in the driver, it is transparent.
>>
> So then we always need the eswitch code to be built even if someone
> never uses any of it?
>

yes.
but for your convenience all you need is to compile eswitch.c.
esiwtch_offoalds.c and en_rep.c can be compiled out for basic ethernet.

>>>
>>>>> Or.
>>>>>
>>>>> My WW (and same for the rest of the IL team..) has ended so I will be
>>>>> able to further look on this series and comment on Sunday.

^ permalink raw reply

* Re: [PATCH net-next 1/2] ravb: Add tx and rx clock internal delays mode of APSR
From: Simon Horman @ 2017-01-27 18:21 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: David Miller, Magnus Damm, netdev, linux-renesas-soc,
	Kazuya Mizuguchi
In-Reply-To: <77bad70c-49f5-e70c-1fd6-929a394f9cbe@cogentembedded.com>

On Fri, Jan 27, 2017 at 09:11:35PM +0300, Sergei Shtylyov wrote:
> On 01/27/2017 09:07 PM, Simon Horman wrote:
> 
> >>>>>From: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
> >>>>>
> >>>>>This patch enables tx and rx clock internal delay modes (TDM and RDM).
> >>>>>
> >>>>>This is to address a failure in the case of 1Gbps communication using the
> >>>>>by salvator-x board with the KSZ9031RNX phy. This has been reported to
> >>>>>occur with both the r8a7795 (H3) and r8a7796 (M3-W) SoCs.
> >>>>>
> >>>>>With this change APSR internal delay modes are enabled for
> >>>>>"rgmii-id", "rgmii-rxid" and "rgmii-txid" phy modes as follows:
> >>>>>
> >>>>>phy mode   | ASPR delay mode
> >>>>>-----------+----------------
> >>>>>rgmii-id   | TDM and RDM
> >>>>>rgmii-rxid | RDM
> >>>>>rgmii-txid | TDM
> >>>>>
> >>>>>Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
> >>>>>Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> >>>>>
> >>>>>---
> >>>>>v1 [Simon Horman]
> >>>>>- Combined patches
> >>>>>- Reworded changelog
> >>>>>
> >>>>>v0 [Kazuya Mizuguchi]
> >>>>>---
> >>>>>drivers/net/ethernet/renesas/ravb.h      | 10 ++++++++++
> >>>>>drivers/net/ethernet/renesas/ravb_main.c | 29 +++++++++++++++++++++++++++++
> >>>>>2 files changed, 39 insertions(+)
> >>>>>
> >>>>>diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
> >>>>>index f1109661a533..d7c91d48cc48 100644
> >>>>>--- a/drivers/net/ethernet/renesas/ravb.h
> >>>>>+++ b/drivers/net/ethernet/renesas/ravb.h
> >>>>[...]
> >>>>>@@ -248,6 +249,15 @@ enum ESR_BIT {
> >>>>>	ESR_EIL		= 0x00001000,
> >>>>>};
> >>>>>
> >>>>>+/* APSR */
> >>>>>+enum APSR_BIT {
> >>>>>+	APSR_MEMS		= 0x00000002,
> >>>>
> >>>>  Not documented in the revision 0.5 of the gen3 manual...
> >>>
> >>>It is in version 0.53 of the documentation but I think it can be dropped
> >>>from this patch as its unused.
> >>
> >>   No need to drop, let it be. :-)
> >>
> >>>>>+	APSR_CMSW		= 0x00000010,
> >>>
> >>>I think the above can also be dropped as it is unused.
> >>
> >>   No need.
> >
> >Ok, lets leave it and MEMS.
> >
> >>>>>+	APSR_DM			= 0x00006000,
> >>>>
> >>>>  ... and neither this field. Are these documented in the latter revs?
> >>>
> >>>This one is not. I can ask Mizuguchi-san to confirm it exists (with himself).
> >>
> >>   The whole patch depends on it! If it's not documented, I'd like a comment
> >>added, like I did for the other undocumented things in this driver...
> >
> >Sure.
> >
> >>[...]
> >>>>>diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> >>>>>index 89ac1e3f6175..9fb4c04c5885 100644
> >>>>>--- a/drivers/net/ethernet/renesas/ravb_main.c
> >>>>>+++ b/drivers/net/ethernet/renesas/ravb_main.c
> >>>>>@@ -1904,6 +1904,29 @@ static void ravb_set_config_mode(struct net_device *ndev)
> >>>>>	}
> >>>>>}
> >>>>>
> >>>>>+static void ravb_set_delay_mode(struct net_device *ndev)
> >>>>>+{
> >>>>>+	struct ravb_private *priv = netdev_priv(ndev);
> >>>>>+
> >>>>>+	if (priv->chip_id != RCAR_GEN2) {
> >>>>>+		switch (priv->phy_interface) {
> >>>>>+		case PHY_INTERFACE_MODE_RGMII_ID:
> >>>>>+			ravb_modify(ndev, APSR, APSR_DM, APSR_DM_RDM |
> >>>>>+				   APSR_DM_TDM);
> >>>>>+			break;
> >>>>>+		case PHY_INTERFACE_MODE_RGMII_RXID:
> >>>>>+			ravb_modify(ndev, APSR, APSR_DM, APSR_DM_RDM);
> >>>>>+			break;
> >>>>>+		case PHY_INTERFACE_MODE_RGMII_TXID:
> >>>>>+			ravb_modify(ndev, APSR, APSR_DM, APSR_DM_TDM);
> >>>>>+			break;
> >>>>>+		default:
> >>>>>+			ravb_modify(ndev, APSR, APSR_DM, 0);
> >>>>>+			break;
> >>>>>+		}
> >>>>
> >>>>  How about doing ravb_modify() only once?
> >>>
> >>>Something like this?
> >>>
> >>>		int set = 0;
> >>>
> >>>		if (priv->phy_interface == PHY_INTERFACE_MODE_RGMII_ID ||
> >>>		    priv->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID)
> >>>		    set |= APSR_DM_RDM;
> >>>
> >>>		if (priv->phy_interface == PHY_INTERFACE_MODE_RGMII_ID ||
> >>>		    priv->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID)
> >>>		    set |= APSR_DM_TDM;
> >>>
> >>>		ravb_modify(ndev, APSR, APSR_DM, set);
> >>>
> >>>I don't really see any advantage to it but I can change things around
> >>>however you like.
> >>
> >>   I didn't mean to replace *switch*, actually -- just to move ravb_modify()
> >>out of it.
> >
> >Ok, I will make it so.
> 
>    Your variant is probably even better! :-)
>    I'm not sure how good gcc is at merging the similar code paths,
> simplifying its work seems worth it to me. The less repetitive code, the
> better.

Ok, thanks. I'll go with my version.

^ permalink raw reply

* Re: [PATCH net-next] net: adjust skb->truesize in pskb_expand_head()
From: Eric Dumazet @ 2017-01-27 18:16 UTC (permalink / raw)
  To: David Laight; +Cc: David Miller, netdev, Slava Shwartsman
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6DB0270F3E@AcuExch.aculab.com>

On Fri, 2017-01-27 at 17:24 +0000, David Laight wrote:
> From: Eric Dumazet
> > Sent: 27 January 2017 14:44
> ...
> > > I'm also guessing that extra headroom can be generated by stealing unused tailroom.
> > 
> > This is already done.
> > 
> > Quoting
> > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=87fb4b7b533073eeeaed0b6bf7c
> > 2328995f6c075
> > 
> >     At skb alloc phase, we put skb_shared_info struct at the exact end of
> >     skb head, to allow a better use of memory (lowering number of
> >     reallocations), since kmalloc() gives us power-of-two memory blocks.
> 
> Does that actually have the expected effect?
> 
> Allocate an skb for 512 bytes, copy in some data with 64 bytes of headroom.
> This is (probably) a 1k memory block with skb_shared_info at the end.
> 
> Some code needs to add a header that doesn't fit, calls pskb_expand_head()
> to get another 4 bytes.
> Since the existing amount of 'tailroom' must be kept kmalloc(1024+4) is called.
> This allocates a 2k memory block, again skb_shared_info is put at the end.
> So the headroom has been increased by 4 bytes and the tailroom by 1020.
> 
> Another layer needs to add another header.
> The memory block becomes 4k large.
> 
> What have I missed?

We try hard to pre-allocate enough headroom.

Because copies are expensive.

Look for MAX_HEADER, MAX_TCP_HEADER, and things like that.

For the tail, we add 128 bytes of extra tail when __pskb_pull_tail()
wants to expand skb->head.

If you believe you found a use case where we do stupid reallocations,
please fix the caller.

pskb_expand_head() should never be called, really.

Only for some pathological/malicious traffic we have to, eventually.

^ permalink raw reply

* Re: netvsc NAPI patch process
From: Greg KH @ 2017-01-27 18:04 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Miller, kys, netdev
In-Reply-To: <20170127093953.5305de3c@xeon-e3>

On Fri, Jan 27, 2017 at 09:39:53AM -0800, Stephen Hemminger wrote:
> On Fri, 27 Jan 2017 08:54:06 +0100
> Greg KH <greg@kroah.com> wrote:
> 
> > On Thu, Jan 26, 2017 at 01:06:46PM -0500, David Miller wrote:
> > > From: Stephen Hemminger <stephen@networkplumber.org>
> > > Date: Thu, 26 Jan 2017 10:04:05 -0800
> > >   
> > > > I have a working set of patches to enable NAPI in the netvsc driver.
> > > > The problem is that it requires a set of patches to vmbus layer as well.
> > > > Since vmbus patches have been going through char-misc-next tree rather
> > > > than net-next, it is difficult to stage these.
> > > > 
> > > > How about if I send the vmbus patches through normal driver-devel upstream
> > > > and during the 4.10 merge window send the last 3 patches for NAPI for linux-net
> > > > tree to get into 4.10?  
> > > 
> > > Another option is that the char-misc-next folks create a branch with just
> > > the commits you need for NAPI, I pull that into net-next, and then you
> > > can submit the NAPI changes to me.  
> > 
> > I can easily do that, or I have no problem with the vmbus changes going
> > through the net-next tree, if they are sane (i.e. let me review them
> > please...)  Which ever is easier for the networking developers, their
> > tree is much crazier than the tiny char-misc tree is :)
> > 
> > thanks,
> > 
> > greg k-h
> 
> I just want the least pain and the least overhead process. Waiting two releases
> and trying to deal with merge conflicts is a pain. Also it makes life harder
> with distro backports etc.

I totally agree.  Post the patches and let's see what they look like and
then we can argue who's tree they should go through :)

^ permalink raw reply

* Re: [PATCH net-next 1/4] mlx5: Make building eswitch configurable
From: Tom Herbert @ 2017-01-27 18:16 UTC (permalink / raw)
  To: Saeed Mahameed
  Cc: Or Gerlitz, Saeed Mahameed, David Miller, Linux Netdev List,
	Kernel Team
In-Reply-To: <CALzJLG9YXBzXAOrtth7SX8n3S5cN3ZSmKax4FOGiTr7SY8gobg@mail.gmail.com>

On Fri, Jan 27, 2017 at 10:05 AM, Saeed Mahameed
<saeedm@dev.mellanox.co.il> wrote:
> On Fri, Jan 27, 2017 at 7:50 PM, Tom Herbert <tom@herbertland.com> wrote:
>> On Fri, Jan 27, 2017 at 9:38 AM, Saeed Mahameed
>> <saeedm@dev.mellanox.co.il> wrote:
>>> On Fri, Jan 27, 2017 at 7:34 AM, Or Gerlitz <gerlitz.or@gmail.com> wrote:
>>>> On Fri, Jan 27, 2017 at 1:32 AM, Tom Herbert <tom@herbertland.com> wrote:
>>>>> Add a configuration option (CONFIG_MLX5_CORE_ESWITCH) for controlling
>>>>> whether the eswitch code is built. Change Kconfig and Makefile
>>>>> accordingly.
>>>>
>>>> Tom, FWIW, please note that the basic e-switch functionality is needed
>>>> also when SRIOV isn't of use, this is for a multi host configuration.
>>>>
>>>
>>> Right, set_l2_table_entry@eswitch.c need to be called by PF for any UC
>>> MAC address wanted by VF or PF.
>>> To keep one flow in the code, the implementation is done as part of eswitch.
>>>
>>> so in multi-host configuration (where there are 4 PFs) each PF should
>>> invoke set_l2_table_entry_cmd  for each one of its own UC MACs.
>>>
>>> populating the l2 table is done using the whole eswitch event driven
>>> mechanisms, it is not easy and IMH not right to separate eswitch
>>> tables from l2 table (same management logic, different tables).
>>>
>>> Anyways as Or stated this is just an FYI, eswitch needs to be enabled
>>> on Multi-host configuration.
>>>
>> What indicate a multi-host configuration?
>
> nothing in the driver, it is transparent.
>
So then we always need the eswitch code to be built even if someone
never uses any of it?

>>
>>>> Or.
>>>>
>>>> My WW (and same for the rest of the IL team..) has ended so I will be
>>>> able to further look on this series and comment on Sunday.

^ permalink raw reply

* Re: [PATCH net-next 0/4] mlx5: Create build configuration options
From: Tom Herbert @ 2017-01-27 18:13 UTC (permalink / raw)
  To: Saeed Mahameed
  Cc: Saeed Mahameed, David S. Miller, Linux Netdev List, Kernel Team
In-Reply-To: <CALzJLG9QpKfA3eDgQkz5MF0FFgkL91BditedDRZkOxx-ayGQSQ@mail.gmail.com>

On Fri, Jan 27, 2017 at 9:58 AM, Saeed Mahameed
<saeedm@dev.mellanox.co.il> wrote:
> On Fri, Jan 27, 2017 at 1:32 AM, Tom Herbert <tom@herbertland.com> wrote:
>> This patchset creates configuration options for sriov, vxlan, eswitch,
>> and tc features in the mlx5 driver. The purpose of this is to allow not
>> building these features. These features are optional advanced features
>> that are not required for a core Ethernet driver. A user can disable
>> these features which resuces the amount of code in the driver. Disabling
>> these features (and DCB) reduces the size of mlx5_core.o by about 16%.
>> This is also can reduce the complexity of backport and rebases since
>> user would no longer need to worry about dependencies with the rest of
>> the kernel that features which might not be of any interest to a user
>> may bring in.
>>
>> Tested: Build and ran the driver with all features enabled (the default)
>> and with none enabled (including DCB). Did not see any issues. I did
>> not explicity test operation of ayy of features in the list.
>>
>
> Basically I am not against this kind of change, infact i am with it,
> although I would have done some restructuring in the driver before i
> did such change ;), filling the code with ifdefs is not a neat thing.
>
If you wish, please take this as an RFC and feel free to structure the
code the right way. I think the intent is clear enough and looks like
davem isn't going to allow the directory restructuring so something
like this seems to be the best course of action now.

> I agree this will simplify backporting and provide some kind of
> feature separation inside the driver.
> But this will also increase the testing matrix we need to cover and
> increase the likelihood of kbuild breaks by an order of magnitude.
>
The testing matrix already exploded with the proliferation of
supported features. If anything this reduces the test matrix problem.
For instance, if we make a change to the core driver and functionality
properly isolated there is a much better chance that this won't affect
peripheral functionality and vice versa. It is just not feasible for
us to test every combination of NIC features for every change being
made.

> One more thing, do we really need a device specific flag per feature
> per vendor per device?  can't we just use the same kconfig flag for
> all drivers and if there is a more generic system wide flag that
> covers the same feature
> can't we just use it, for instance instead of
> CONFIG_<DRIVER_NAME>_SRIOV why not use already existing CONFIG_PCI_IOV
> for all drivers ?
>
That sounds good to me. We already have CONFIG_RFS_ACCEL and others
that do that.

Tom

> Saeed.
>
>>
>>
>> Tom Herbert (4):
>>   mlx5: Make building eswitch configurable
>>   mlx5: Make building SR-IOV configurable
>>   mlx5: Make building tc hardware offload configurable
>>   mlx5: Make building vxlan hardware offload configurable
>>
>>  drivers/net/ethernet/mellanox/mlx5/core/Kconfig   |  35 ++++++
>>  drivers/net/ethernet/mellanox/mlx5/core/Makefile  |  16 ++-
>>  drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 129 ++++++++++++++++------
>>  drivers/net/ethernet/mellanox/mlx5/core/en_tc.c   |  39 +++++--
>>  drivers/net/ethernet/mellanox/mlx5/core/eq.c      |   4 +-
>>  drivers/net/ethernet/mellanox/mlx5/core/lag.c     |   2 +
>>  drivers/net/ethernet/mellanox/mlx5/core/main.c    |  32 ++++--
>>  drivers/net/ethernet/mellanox/mlx5/core/sriov.c   |   6 +-
>>  8 files changed, 205 insertions(+), 58 deletions(-)
>>
>> --
>> 2.9.3
>>

^ permalink raw reply

* Re: [PATCH v2 net-next 0/4] sfc: encapsulated filters
From: Tom Herbert @ 2017-01-27 18:03 UTC (permalink / raw)
  To: Edward Cree
  Cc: linux-net-drivers, David S. Miller,
	Linux Kernel Network Developers
In-Reply-To: <9baa375c-b3b1-f640-04fb-e234c85a4e93@solarflare.com>

On Fri, Jan 27, 2017 at 7:00 AM, Edward Cree <ecree@solarflare.com> wrote:
> This series adds support for setting up filters for encapsulated traffic on
> SFC 8000-series adapters, which recognise VXLAN, GENEVE and NVGRE packets by
> parsing packet headers.  (VXLAN and GENEVE will only be recognised if the
> driver on the primary PF has notified the firmware of relevant UDP ports,
> which this driver does not yet do.)
> While the driver currently has no way of using these filters for flow
> steering, it is nonetheless necessary to insert catch-all (aka 'default')
> filters to direct this traffic, similar to the existing unencapsulated uni-
> and multi-cast catch-all filters, as otherwise the traffic will be dropped
> by the NIC - implementation details of the hardware filtering mean that the
> traffic will not get matched on outer MAC address to unencapsulated catch-
> all filters.  (Yes, this is a mess.)

I don't understand this. You seem to be saying that unless there is
filtering for VXLAN and GENEVE these packets will dropped. These are
_just_ UDP packets. Anything that the NIC does special for them is at
most an optimization, it can *NEVER* be a requirement for NICs to be
able to parse these protocols. Please elaborate...

Tom


> Although this is, therefore, fixing a bug in the existing driver, it's a bug
> which has existed since 8000 series support was added, and the fix involves
> quite a big patch with an 'adding features' flavour to it, hence why this is
> for net-next rather than net and stable.
>
> v2: move netif_cond_dbg into netdevice.h and its own patch
>
> ---
> Edward Cree (2):
>   net: implement netif_cond_dbg macro
>   sfc: insert catch-all filters for encapsulated traffic
>
> Jon Cooper (2):
>   sfc: fixes to filter restore handling
>   sfc: refactor debug-or-warnings printks
>
>  drivers/net/ethernet/sfc/ef10.c   | 582 ++++++++++++++++++++++++++++----------
>  drivers/net/ethernet/sfc/filter.h |  41 ++-
>  drivers/net/ethernet/sfc/mcdi.c   |  19 +-
>  include/linux/netdevice.h         |   9 +
>  4 files changed, 497 insertions(+), 154 deletions(-)
>

^ permalink raw reply

* Re: [PATCH net-next 1/2] ravb: Add tx and rx clock internal delays mode of APSR
From: Sergei Shtylyov @ 2017-01-27 18:11 UTC (permalink / raw)
  To: Simon Horman
  Cc: David Miller, Magnus Damm, netdev, linux-renesas-soc,
	Kazuya Mizuguchi
In-Reply-To: <20170127180701.GA13402@verge.net.au>

On 01/27/2017 09:07 PM, Simon Horman wrote:

>>>>> From: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
>>>>>
>>>>> This patch enables tx and rx clock internal delay modes (TDM and RDM).
>>>>>
>>>>> This is to address a failure in the case of 1Gbps communication using the
>>>>> by salvator-x board with the KSZ9031RNX phy. This has been reported to
>>>>> occur with both the r8a7795 (H3) and r8a7796 (M3-W) SoCs.
>>>>>
>>>>> With this change APSR internal delay modes are enabled for
>>>>> "rgmii-id", "rgmii-rxid" and "rgmii-txid" phy modes as follows:
>>>>>
>>>>> phy mode   | ASPR delay mode
>>>>> -----------+----------------
>>>>> rgmii-id   | TDM and RDM
>>>>> rgmii-rxid | RDM
>>>>> rgmii-txid | TDM
>>>>>
>>>>> Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
>>>>> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
>>>>>
>>>>> ---
>>>>> v1 [Simon Horman]
>>>>> - Combined patches
>>>>> - Reworded changelog
>>>>>
>>>>> v0 [Kazuya Mizuguchi]
>>>>> ---
>>>>> drivers/net/ethernet/renesas/ravb.h      | 10 ++++++++++
>>>>> drivers/net/ethernet/renesas/ravb_main.c | 29 +++++++++++++++++++++++++++++
>>>>> 2 files changed, 39 insertions(+)
>>>>>
>>>>> diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
>>>>> index f1109661a533..d7c91d48cc48 100644
>>>>> --- a/drivers/net/ethernet/renesas/ravb.h
>>>>> +++ b/drivers/net/ethernet/renesas/ravb.h
>>>> [...]
>>>>> @@ -248,6 +249,15 @@ enum ESR_BIT {
>>>>> 	ESR_EIL		= 0x00001000,
>>>>> };
>>>>>
>>>>> +/* APSR */
>>>>> +enum APSR_BIT {
>>>>> +	APSR_MEMS		= 0x00000002,
>>>>
>>>>   Not documented in the revision 0.5 of the gen3 manual...
>>>
>>> It is in version 0.53 of the documentation but I think it can be dropped
>> >from this patch as its unused.
>>
>>    No need to drop, let it be. :-)
>>
>>>>> +	APSR_CMSW		= 0x00000010,
>>>
>>> I think the above can also be dropped as it is unused.
>>
>>    No need.
>
> Ok, lets leave it and MEMS.
>
>>>>> +	APSR_DM			= 0x00006000,
>>>>
>>>>   ... and neither this field. Are these documented in the latter revs?
>>>
>>> This one is not. I can ask Mizuguchi-san to confirm it exists (with himself).
>>
>>    The whole patch depends on it! If it's not documented, I'd like a comment
>> added, like I did for the other undocumented things in this driver...
>
> Sure.
>
>> [...]
>>>>> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
>>>>> index 89ac1e3f6175..9fb4c04c5885 100644
>>>>> --- a/drivers/net/ethernet/renesas/ravb_main.c
>>>>> +++ b/drivers/net/ethernet/renesas/ravb_main.c
>>>>> @@ -1904,6 +1904,29 @@ static void ravb_set_config_mode(struct net_device *ndev)
>>>>> 	}
>>>>> }
>>>>>
>>>>> +static void ravb_set_delay_mode(struct net_device *ndev)
>>>>> +{
>>>>> +	struct ravb_private *priv = netdev_priv(ndev);
>>>>> +
>>>>> +	if (priv->chip_id != RCAR_GEN2) {
>>>>> +		switch (priv->phy_interface) {
>>>>> +		case PHY_INTERFACE_MODE_RGMII_ID:
>>>>> +			ravb_modify(ndev, APSR, APSR_DM, APSR_DM_RDM |
>>>>> +				   APSR_DM_TDM);
>>>>> +			break;
>>>>> +		case PHY_INTERFACE_MODE_RGMII_RXID:
>>>>> +			ravb_modify(ndev, APSR, APSR_DM, APSR_DM_RDM);
>>>>> +			break;
>>>>> +		case PHY_INTERFACE_MODE_RGMII_TXID:
>>>>> +			ravb_modify(ndev, APSR, APSR_DM, APSR_DM_TDM);
>>>>> +			break;
>>>>> +		default:
>>>>> +			ravb_modify(ndev, APSR, APSR_DM, 0);
>>>>> +			break;
>>>>> +		}
>>>>
>>>>   How about doing ravb_modify() only once?
>>>
>>> Something like this?
>>>
>>> 		int set = 0;
>>>
>>> 		if (priv->phy_interface == PHY_INTERFACE_MODE_RGMII_ID ||
>>> 		    priv->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID)
>>> 		    set |= APSR_DM_RDM;
>>>
>>> 		if (priv->phy_interface == PHY_INTERFACE_MODE_RGMII_ID ||
>>> 		    priv->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID)
>>> 		    set |= APSR_DM_TDM;
>>>
>>> 		ravb_modify(ndev, APSR, APSR_DM, set);
>>>
>>> I don't really see any advantage to it but I can change things around
>>> however you like.
>>
>>    I didn't mean to replace *switch*, actually -- just to move ravb_modify()
>> out of it.
>
> Ok, I will make it so.

    Your variant is probably even better! :-)
    I'm not sure how good gcc is at merging the similar code paths, 
simplifying its work seems worth it to me. The less repetitive code, the better.

MBR, Sergei

^ permalink raw reply

* Re: [PATCH net-next 1/2] ravb: Add tx and rx clock internal delays mode of APSR
From: Simon Horman @ 2017-01-27 18:07 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: David Miller, Magnus Damm, netdev, linux-renesas-soc,
	Kazuya Mizuguchi
In-Reply-To: <d1e19006-b57f-9429-1e6e-ff906ced47a0@cogentembedded.com>

On Fri, Jan 27, 2017 at 07:55:25PM +0300, Sergei Shtylyov wrote:
> On 01/27/2017 07:49 PM, Simon Horman wrote:
> 
> >>>From: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
> >>>
> >>>This patch enables tx and rx clock internal delay modes (TDM and RDM).
> >>>
> >>>This is to address a failure in the case of 1Gbps communication using the
> >>>by salvator-x board with the KSZ9031RNX phy. This has been reported to
> >>>occur with both the r8a7795 (H3) and r8a7796 (M3-W) SoCs.
> >>>
> >>>With this change APSR internal delay modes are enabled for
> >>>"rgmii-id", "rgmii-rxid" and "rgmii-txid" phy modes as follows:
> >>>
> >>>phy mode   | ASPR delay mode
> >>>-----------+----------------
> >>>rgmii-id   | TDM and RDM
> >>>rgmii-rxid | RDM
> >>>rgmii-txid | TDM
> >>>
> >>>Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
> >>>Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> >>>
> >>>---
> >>>v1 [Simon Horman]
> >>>- Combined patches
> >>>- Reworded changelog
> >>>
> >>>v0 [Kazuya Mizuguchi]
> >>>---
> >>>drivers/net/ethernet/renesas/ravb.h      | 10 ++++++++++
> >>>drivers/net/ethernet/renesas/ravb_main.c | 29 +++++++++++++++++++++++++++++
> >>>2 files changed, 39 insertions(+)
> >>>
> >>>diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
> >>>index f1109661a533..d7c91d48cc48 100644
> >>>--- a/drivers/net/ethernet/renesas/ravb.h
> >>>+++ b/drivers/net/ethernet/renesas/ravb.h
> >>[...]
> >>>@@ -248,6 +249,15 @@ enum ESR_BIT {
> >>>	ESR_EIL		= 0x00001000,
> >>>};
> >>>
> >>>+/* APSR */
> >>>+enum APSR_BIT {
> >>>+	APSR_MEMS		= 0x00000002,
> >>
> >>   Not documented in the revision 0.5 of the gen3 manual...
> >
> >It is in version 0.53 of the documentation but I think it can be dropped
> >from this patch as its unused.
> 
>    No need to drop, let it be. :-)
> 
> >>>+	APSR_CMSW		= 0x00000010,
> >
> >I think the above can also be dropped as it is unused.
> 
>    No need.

Ok, lets leave it and MEMS.

> >>>+	APSR_DM			= 0x00006000,
> >>
> >>   ... and neither this field. Are these documented in the latter revs?
> >
> >This one is not. I can ask Mizuguchi-san to confirm it exists (with himself).
> 
>    The whole patch depends on it! If it's not documented, I'd like a comment
> added, like I did for the other undocumented things in this driver...

Sure.

> [...]
> >>>diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> >>>index 89ac1e3f6175..9fb4c04c5885 100644
> >>>--- a/drivers/net/ethernet/renesas/ravb_main.c
> >>>+++ b/drivers/net/ethernet/renesas/ravb_main.c
> >>>@@ -1904,6 +1904,29 @@ static void ravb_set_config_mode(struct net_device *ndev)
> >>>	}
> >>>}
> >>>
> >>>+static void ravb_set_delay_mode(struct net_device *ndev)
> >>>+{
> >>>+	struct ravb_private *priv = netdev_priv(ndev);
> >>>+
> >>>+	if (priv->chip_id != RCAR_GEN2) {
> >>>+		switch (priv->phy_interface) {
> >>>+		case PHY_INTERFACE_MODE_RGMII_ID:
> >>>+			ravb_modify(ndev, APSR, APSR_DM, APSR_DM_RDM |
> >>>+				   APSR_DM_TDM);
> >>>+			break;
> >>>+		case PHY_INTERFACE_MODE_RGMII_RXID:
> >>>+			ravb_modify(ndev, APSR, APSR_DM, APSR_DM_RDM);
> >>>+			break;
> >>>+		case PHY_INTERFACE_MODE_RGMII_TXID:
> >>>+			ravb_modify(ndev, APSR, APSR_DM, APSR_DM_TDM);
> >>>+			break;
> >>>+		default:
> >>>+			ravb_modify(ndev, APSR, APSR_DM, 0);
> >>>+			break;
> >>>+		}
> >>
> >>   How about doing ravb_modify() only once?
> >
> >Something like this?
> >
> >		int set = 0;
> >
> >		if (priv->phy_interface == PHY_INTERFACE_MODE_RGMII_ID ||
> >		    priv->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID)
> >		    set |= APSR_DM_RDM;
> >
> >		if (priv->phy_interface == PHY_INTERFACE_MODE_RGMII_ID ||
> >		    priv->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID)
> >		    set |= APSR_DM_TDM;
> >
> >		ravb_modify(ndev, APSR, APSR_DM, set);
> >
> >I don't really see any advantage to it but I can change things around
> >however you like.
> 
>    I didn't mean to replace *switch*, actually -- just to move ravb_modify()
> out of it.

Ok, I will make it so.

^ permalink raw reply

* Re: [PATCH net-next 0/4] mlx5: Create build configuration options
From: Saeed Mahameed @ 2017-01-27 17:58 UTC (permalink / raw)
  To: Tom Herbert
  Cc: Saeed Mahameed, David S. Miller, Linux Netdev List, Kernel Team
In-Reply-To: <20170126233241.2268449-1-tom@herbertland.com>

On Fri, Jan 27, 2017 at 1:32 AM, Tom Herbert <tom@herbertland.com> wrote:
> This patchset creates configuration options for sriov, vxlan, eswitch,
> and tc features in the mlx5 driver. The purpose of this is to allow not
> building these features. These features are optional advanced features
> that are not required for a core Ethernet driver. A user can disable
> these features which resuces the amount of code in the driver. Disabling
> these features (and DCB) reduces the size of mlx5_core.o by about 16%.
> This is also can reduce the complexity of backport and rebases since
> user would no longer need to worry about dependencies with the rest of
> the kernel that features which might not be of any interest to a user
> may bring in.
>
> Tested: Build and ran the driver with all features enabled (the default)
> and with none enabled (including DCB). Did not see any issues. I did
> not explicity test operation of ayy of features in the list.
>

Basically I am not against this kind of change, infact i am with it,
although I would have done some restructuring in the driver before i
did such change ;), filling the code with ifdefs is not a neat thing.

I agree this will simplify backporting and provide some kind of
feature separation inside the driver.
But this will also increase the testing matrix we need to cover and
increase the likelihood of kbuild breaks by an order of magnitude.

One more thing, do we really need a device specific flag per feature
per vendor per device?  can't we just use the same kconfig flag for
all drivers and if there is a more generic system wide flag that
covers the same feature
can't we just use it, for instance instead of
CONFIG_<DRIVER_NAME>_SRIOV why not use already existing CONFIG_PCI_IOV
for all drivers ?

Saeed.

>
>
> Tom Herbert (4):
>   mlx5: Make building eswitch configurable
>   mlx5: Make building SR-IOV configurable
>   mlx5: Make building tc hardware offload configurable
>   mlx5: Make building vxlan hardware offload configurable
>
>  drivers/net/ethernet/mellanox/mlx5/core/Kconfig   |  35 ++++++
>  drivers/net/ethernet/mellanox/mlx5/core/Makefile  |  16 ++-
>  drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 129 ++++++++++++++++------
>  drivers/net/ethernet/mellanox/mlx5/core/en_tc.c   |  39 +++++--
>  drivers/net/ethernet/mellanox/mlx5/core/eq.c      |   4 +-
>  drivers/net/ethernet/mellanox/mlx5/core/lag.c     |   2 +
>  drivers/net/ethernet/mellanox/mlx5/core/main.c    |  32 ++++--
>  drivers/net/ethernet/mellanox/mlx5/core/sriov.c   |   6 +-
>  8 files changed, 205 insertions(+), 58 deletions(-)
>
> --
> 2.9.3
>

^ permalink raw reply

* Re: [1/3] ath10k: remove multiple defines of DIAG_TRANSFER_LIMIT
From: Kalle Valo @ 2017-01-27 18:04 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: linux-wireless, netdev, Srinivas Kandagatla, linux-kernel, ath10k
In-Reply-To: <1485183876-27080-1-git-send-email-srinivas.kandagatla@linaro.org>

Srinivas Kandagatla <srinivas.kandagatla@linaro.org> wrote:
> DIAG_TRANSFER_LIMIT is redefined with same value and comments
> just below this entry, remove this duplicate entry.
> 
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

3 patches applied to ath-next branch of ath.git, thanks.

dd51fa3d8a1d ath10k: remove multiple defines of DIAG_TRANSFER_LIMIT
0de4df5ba2ad ath10k: use dma_zalloc_coherent()
1ad38fd719da ath10k: fix typo in addr calculation

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

Documentation about submitting wireless patches and checking status
from patchwork:

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

^ 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