* Re: [PATCH v2 net-next 0/7] net: l3mdev: Support for sockets bound to enslaved device
From: David Miller @ 2017-08-07 4:39 UTC (permalink / raw)
To: dsahern; +Cc: netdev
In-Reply-To: <1501877823-31365-1-git-send-email-dsahern@gmail.com>
From: David Ahern <dsahern@gmail.com>
Date: Fri, 4 Aug 2017 13:16:56 -0700
> A missing piece to the VRF puzzle is the ability to bind sockets to
> devices enslaved to a VRF. This patch set adds the enslaved device
> index, sdif, to IPv4 and IPv6 socket lookups. The end result for users
> is the following scope options for services:
>
> 1. "global" services - sockets not bound to any device
>
> Allows 1 service to work across all network interfaces with
> connected sockets bound to the VRF the connection originates
> (Requires net.ipv4.tcp_l3mdev_accept=1 for TCP and
> net.ipv4.udp_l3mdev_accept=1 for UDP)
>
> 2. "VRF" local services - sockets bound to a VRF
>
> Sockets work across all network interfaces enslaved to a VRF but
> are limited to just the one VRF.
>
> 3. "device" services - sockets bound to a specific network interface
>
> Service works only through the one specific interface.
>
> v2
> - remove sk_lookup struct and add sdif as an argument to existing
> functions
>
> Changes since RFC:
> - no significant logic changes; mainly whitespace cleanups
Series applied, thanks David.
^ permalink raw reply
* Re: [PATCH] net: Reduce skb_warn_bad_offload() noise.
From: Willem de Bruijn @ 2017-08-07 4:42 UTC (permalink / raw)
To: Tonghao Zhang
Cc: Eric Dumazet, Linux Kernel Network Developers, Eric Dumazet,
Willem de Bruijn, Pravin B Shelar
In-Reply-To: <CAMDZJNUcqFYQ8c4urSyha+F2C0Z9WzTTw05qLBX9VYpCH4V6Wg@mail.gmail.com>
> The openvswitch kernel module calls the __skb_gso_segment()(and sets
> tx_path = false) when passing packets to userspace. The UFO will set
> the ip_summed to CHECKSUM_NONE. There are a lot of warn logs. The warn
> log is shown as below. I guess we should revert the patch.
Indeed, the software UFO code computes the checksum and
sets ip_summed to CHECKSUM_NONE, as is correct on the
egress path.
Commit 6e7bc478c9a0 ("net: skb_needs_check() accepts
CHECKSUM_NONE for tx") revised the tx_path case in
skb_needs_check to avoid the warning exactly for the UFO case.
We cannot just make an exception for CHECKSUM_NONE in the
!tx_path case, as the entire statement then becomes false:
return skb->ip_summed == CHECKSUM_NONE;
Since on egress CHECKSUM_UNNECESSARY is equivalent to
CHECKSUM_NONE, it should be fine to update the UFO code
to set that, instead:
@@ -235,7 +235,7 @@ static struct sk_buff *udp4_ufo_fragment(struct
sk_buff *skb,
if (uh->check == 0)
uh->check = CSUM_MANGLED_0;
- skb->ip_summed = CHECKSUM_NONE;
+ skb->ip_summed = CHECKSUM_UNNECESSARY;
^ permalink raw reply
* FINANCING ASSISTANCE AT 2% INTEREST RATE
From: Lucas Brown @ 2017-08-07 0:34 UTC (permalink / raw)
To: Recipients
GOOD DAY,WE ARE OFFERING FINANCING ASSISTANCE AT 2% INTEREST RATE IF YOU NEED A LOAN CONTACT US
^ permalink raw reply
* Re: linux-next: manual merge of the net-next tree with the net tree
From: Stephen Rothwell @ 2017-08-07 4:59 UTC (permalink / raw)
To: Neal Cardwell
Cc: David Miller, Networking, Linux-Next Mailing List,
Linux Kernel Mailing List, Yuchung Cheng
In-Reply-To: <CADVnQyncPCCp5T+jDU=S4KF-X+Od8sPFJGEdFhWE9k5VABJqFQ@mail.gmail.com>
Hi Neal,
On Sun, 6 Aug 2017 22:21:43 -0400 Neal Cardwell <ncardwell@google.com> wrote:
>
> > I fixed it up (see below) and can carry the fix as necessary. This
> > is now fixed as far as linux-next is concerned, but any non trivial
> > conflicts should be mentioned to your upstream maintainer when your tree
> > is submitted for merging. You may also want to consider cooperating
> > with the maintainer of the conflicting tree to minimise any particularly
> > complex conflicts.
>
> Sorry about that. Will try to follow that procedure in the future.
The above is a generic statement I add to all these emails. It is
aimed more at the maintainers if the trees involved, no the developers
of patches. I don't think you need to do anything different in these
cases with the "net" and "net-next" tree. Dave Miller will fix up any
conflicts when he next merges the net tree into the net-next tree.
--
Cheers,
Stephen Rothwell
^ permalink raw reply
* [PATCH v2] rtlwifi: constify rate_control_ops structure
From: Bhumika Goyal @ 2017-08-07 5:00 UTC (permalink / raw)
To: julia.lawall, Larry.Finger, chaoming_li, kvalo, linux-wireless,
netdev, linux-kernel
Cc: Bhumika Goyal
rate_control_ops structure is only passed as an argument to the
function ieee80211_rate_control_{register/unregister}. This argument
is of type const, so declare the structure as const.
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
Changes in v2:
* Change subject line.
drivers/net/wireless/realtek/rtlwifi/rc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/realtek/rtlwifi/rc.c b/drivers/net/wireless/realtek/rtlwifi/rc.c
index 951d257..02811ed 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rc.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rc.c
@@ -283,7 +283,7 @@ static void rtl_rate_free_sta(void *rtlpriv,
kfree(rate_priv);
}
-static struct rate_control_ops rtl_rate_ops = {
+static const struct rate_control_ops rtl_rate_ops = {
.name = "rtl_rc",
.alloc = rtl_rate_alloc,
.free = rtl_rate_free,
--
1.9.1
^ permalink raw reply related
* Re: [PATCH] tcp_input: move out condition check from tcp_data_queue()
From: Eric Dumazet @ 2017-08-07 5:04 UTC (permalink / raw)
To: Ilya Matveychikov; +Cc: netdev
In-Reply-To: <A64FCA3E-9A20-412D-823C-37EDA312A8C3@gmail.com>
On Sun, 2017-08-06 at 21:57 +0400, Ilya Matveychikov wrote:
> > On Aug 6, 2017, at 9:07 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> >
> > On Sun, 2017-08-06 at 13:51 +0400, Ilya Matveychikov wrote:
> >> As tcp_data_queue() function is used just only twice it's better
> >> to move out the first check and wrap it with inline. It saves a
> >> single call in case the condition evaluated as true.
> >>
...
> > We wont accept such a change, because this code does not need to be
> > inlined in the callers, ( and btw inline in .c files are discouraged
> > these days )
>
> Not sure that I understand you point. What’s the reason for that code
> not need to be inlined in the callers?
You sent a patch, you have to explain why it is needed.
Your changelog is absolutely not giving a compelling reason.
TCP stack is already complex, no need to add yet another obfuscation
unless there is a strong reason.
^ permalink raw reply
* Re: [patch net-next 00/15] net: sched: summer cleanup part 2, ndo_setup_tc
From: Jiri Pirko @ 2017-08-07 5:27 UTC (permalink / raw)
To: David Miller
Cc: netdev, jhs, xiyou.wangcong, daniel, mlxsw, andrew,
vivien.didelot, f.fainelli, simon.horman, pieter.jansenvanvuuren,
dirk.vandermerwe, alexander.h.duyck, amritha.nambiar, oss-drivers
In-Reply-To: <20170806.213749.505593800109957053.davem@davemloft.net>
Mon, Aug 07, 2017 at 06:37:49AM CEST, davem@davemloft.net wrote:
>From: Jiri Pirko <jiri@resnulli.us>
>Date: Sat, 5 Aug 2017 16:53:22 +0200
>
>> From: Jiri Pirko <jiri@mellanox.com>
>>
>> This patchset focuses on ndo_setup_tc and its args.
>> Currently there are couple of things that do not make much sense.
>> The type is passed in struct tc_to_netdev, but as it is always
>> required, should be arg of the ndo. Other things are passed as args
>> but they are only relevant for cls offloads and not mqprio. Therefore,
>> they should be pushed to struct. As the tc_to_netdev struct in the end
>> is just a container of single pointer, we get rid of it and pass the
>> struct according to type. So in the end, we have:
>> ndo_setup_tc(dev, type, type_data_struct)
>>
>> There are couple of cosmetics done on the way to make things smooth.
>> Also, reported error is consolidated to eopnotsupp in case the
>> asked offload is not supported.
>
>Series applied, thanks Jiri.
Pushed this already? I just got an email from kbuildbot, I missed hns3pf
driver (3 days). I can send the fix as followup as well. Up to you.
^ permalink raw reply
* Re: [patch net-next 00/15] net: sched: summer cleanup part 2, ndo_setup_tc
From: David Miller @ 2017-08-07 6:09 UTC (permalink / raw)
To: jiri
Cc: netdev, jhs, xiyou.wangcong, daniel, mlxsw, andrew,
vivien.didelot, f.fainelli, simon.horman, pieter.jansenvanvuuren,
dirk.vandermerwe, alexander.h.duyck, amritha.nambiar, oss-drivers
In-Reply-To: <20170807052734.GA2085@nanopsycho.orion>
From: Jiri Pirko <jiri@resnulli.us>
Date: Mon, 7 Aug 2017 07:27:34 +0200
> Mon, Aug 07, 2017 at 06:37:49AM CEST, davem@davemloft.net wrote:
>>From: Jiri Pirko <jiri@resnulli.us>
>>Date: Sat, 5 Aug 2017 16:53:22 +0200
>>
>>> From: Jiri Pirko <jiri@mellanox.com>
>>>
>>> This patchset focuses on ndo_setup_tc and its args.
>>> Currently there are couple of things that do not make much sense.
>>> The type is passed in struct tc_to_netdev, but as it is always
>>> required, should be arg of the ndo. Other things are passed as args
>>> but they are only relevant for cls offloads and not mqprio. Therefore,
>>> they should be pushed to struct. As the tc_to_netdev struct in the end
>>> is just a container of single pointer, we get rid of it and pass the
>>> struct according to type. So in the end, we have:
>>> ndo_setup_tc(dev, type, type_data_struct)
>>>
>>> There are couple of cosmetics done on the way to make things smooth.
>>> Also, reported error is consolidated to eopnotsupp in case the
>>> asked offload is not supported.
>>
>>Series applied, thanks Jiri.
>
> Pushed this already? I just got an email from kbuildbot, I missed hns3pf
> driver (3 days). I can send the fix as followup as well. Up to you.
Luckily I didn't push yet, please respin with hns3pf fixed, thanks!
^ permalink raw reply
* Re: [patch net-next 00/15] net: sched: summer cleanup part 2, ndo_setup_tc
From: Jiri Pirko @ 2017-08-07 6:21 UTC (permalink / raw)
To: David Miller
Cc: netdev, jhs, xiyou.wangcong, daniel, mlxsw, andrew,
vivien.didelot, f.fainelli, simon.horman, pieter.jansenvanvuuren,
dirk.vandermerwe, alexander.h.duyck, amritha.nambiar, oss-drivers
In-Reply-To: <20170806.230901.1220176297368809463.davem@davemloft.net>
Mon, Aug 07, 2017 at 08:09:01AM CEST, davem@davemloft.net wrote:
>From: Jiri Pirko <jiri@resnulli.us>
>Date: Mon, 7 Aug 2017 07:27:34 +0200
>
>> Mon, Aug 07, 2017 at 06:37:49AM CEST, davem@davemloft.net wrote:
>>>From: Jiri Pirko <jiri@resnulli.us>
>>>Date: Sat, 5 Aug 2017 16:53:22 +0200
>>>
>>>> From: Jiri Pirko <jiri@mellanox.com>
>>>>
>>>> This patchset focuses on ndo_setup_tc and its args.
>>>> Currently there are couple of things that do not make much sense.
>>>> The type is passed in struct tc_to_netdev, but as it is always
>>>> required, should be arg of the ndo. Other things are passed as args
>>>> but they are only relevant for cls offloads and not mqprio. Therefore,
>>>> they should be pushed to struct. As the tc_to_netdev struct in the end
>>>> is just a container of single pointer, we get rid of it and pass the
>>>> struct according to type. So in the end, we have:
>>>> ndo_setup_tc(dev, type, type_data_struct)
>>>>
>>>> There are couple of cosmetics done on the way to make things smooth.
>>>> Also, reported error is consolidated to eopnotsupp in case the
>>>> asked offload is not supported.
>>>
>>>Series applied, thanks Jiri.
>>
>> Pushed this already? I just got an email from kbuildbot, I missed hns3pf
>> driver (3 days). I can send the fix as followup as well. Up to you.
>
>Luckily I didn't push yet, please respin with hns3pf fixed, thanks!
Will do. Thanks.
^ permalink raw reply
* Re: [PATCH] bluetooth: document config options
From: Marcel Holtmann @ 2017-08-07 6:34 UTC (permalink / raw)
To: Pavel Machek
Cc: Gustavo F. Padovan, Johan Hedberg, linux-bluetooth, kernel list,
Netdev list
In-Reply-To: <20170721104228.GA9448@amd>
Hi Pavel,
>>> Kernel config options should include useful help text; I had to look
>>> up the terms on wikipedia.
>>>
>>> Signed-off-by: Pavel Machek <pavel@ucw.cz>
>>>
>>> diff --git a/net/bluetooth/Kconfig b/net/bluetooth/Kconfig
>>> index 68f951b..133c8a6 100644
>>> --- a/net/bluetooth/Kconfig
>>> +++ b/net/bluetooth/Kconfig
>>> @@ -45,6 +45,8 @@ config BT_BREDR
>>> bool "Bluetooth Classic (BR/EDR) features"
>>> depends on BT
>>> default y
>>> + help
>>> + Support Bluetooth version 1 and 2 connections.
>>
>> so this is actually not correct. Version 5.0 is also Bluetooth BR/EDR.
>>
>> I am fine if use the terms "Basic Rate" and "Enhanced Data Rate" in the description, but the version numbers are kinda not how this works. So some alternative wording needs to be used:
>>
>> "Bluetooth Classic includes support for Basic Rate (BR) available with Bluetooth version 1.0b or later and support for Enhanced Data Rate (EDR) available with Bluetooth version 2.0 or later."
>>
>
> Ok, works for me.
>
>>> + help
>>> + Bluetooth 3 introduces high-speed mode where bluetooth endpoints
>>> + negotiate fast connection over WIFI. This controls its support.
>>
>> Again, while Bluetooth version 3.0 introduces HS support, it is not what is selecting this.
>>
>> I think here we can write something like this:
>>
>> "Bluetooth High Speed includes support for off-loading Bluetooth connections via 802.11 physical layer available with Bluetooth version 3.0 or later."
>>
>
> Ok.
are you planning to send a patch with updated wording for this?
Regards
Marcel
^ permalink raw reply
* [PATCH] ip/link_vti6.c: Fix local/remote any handling
From: Christian Langrock @ 2017-08-07 6:41 UTC (permalink / raw)
To: netdev
[-- Attachment #1.1.1: Type: text/plain, Size: 2034 bytes --]
According to the IPv4 behavior of 'ip' it should be possible to omit the
arguments for local and remote address.
Without this patch omitting these parameters would lead to
uninitialized memory being interpreted as IPv6 addresses.
Signed-off-by: Christian Langrock <christian.langrock@secunet.com>
---
ip/link_vti6.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/ip/link_vti6.c b/ip/link_vti6.c
index be4e33c..220b7df 100644
--- a/ip/link_vti6.c
+++ b/ip/link_vti6.c
@@ -60,7 +60,9 @@ static int vti6_parse_opt(struct link_util *lu, int
argc, char **argv,
struct rtattr *linkinfo[IFLA_INFO_MAX+1];
struct rtattr *vtiinfo[IFLA_VTI_MAX + 1];
struct in6_addr saddr;
+ bool use_saddr = false;
struct in6_addr daddr;
+ bool use_daddr = false;
unsigned int ikey = 0;
unsigned int okey = 0;
unsigned int link = 0;
@@ -167,6 +169,7 @@ get_failed:
get_prefix(&addr, *argv, AF_INET6);
memcpy(&daddr, addr.data, addr.bytelen);
+ use_daddr = true;
}
} else if (!matches(*argv, "local")) {
NEXT_ARG();
@@ -178,6 +181,7 @@ get_failed:
get_prefix(&addr, *argv, AF_INET6);
memcpy(&saddr, addr.data, addr.bytelen);
+ use_saddr = true;
}
} else if (!matches(*argv, "dev")) {
NEXT_ARG();
@@ -195,8 +199,10 @@ get_failed:
addattr32(n, 1024, IFLA_VTI_IKEY, ikey);
addattr32(n, 1024, IFLA_VTI_OKEY, okey);
- addattr_l(n, 1024, IFLA_VTI_LOCAL, &saddr, sizeof(saddr));
- addattr_l(n, 1024, IFLA_VTI_REMOTE, &daddr, sizeof(daddr));
+ if (use_saddr)
+ addattr_l(n, 1024, IFLA_VTI_LOCAL, &saddr, sizeof(saddr));
+ if (use_daddr)
+ addattr_l(n, 1024, IFLA_VTI_REMOTE, &daddr, sizeof(daddr));
addattr32(n, 1024, IFLA_VTI_FWMARK, fwmark);
if (link)
addattr32(n, 1024, IFLA_VTI_LINK, link);
--
2.7.4
[-- Attachment #1.1.2: 0x82EB6B5E.asc --]
[-- Type: application/pgp-keys, Size: 1758 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply related
* Re: [PATCH v2 net-next 0/7] net: l3mdev: Support for sockets bound to enslaved device
From: David Miller @ 2017-08-07 6:51 UTC (permalink / raw)
To: dsahern; +Cc: netdev
In-Reply-To: <20170806.213938.1049251959507174455.davem@davemloft.net>
From: David Miller <davem@davemloft.net>
Date: Sun, 06 Aug 2017 21:39:38 -0700 (PDT)
> From: David Ahern <dsahern@gmail.com>
> Date: Fri, 4 Aug 2017 13:16:56 -0700
>
>> A missing piece to the VRF puzzle is the ability to bind sockets to
>> devices enslaved to a VRF. This patch set adds the enslaved device
>> index, sdif, to IPv4 and IPv6 socket lookups. The end result for users
>> is the following scope options for services:
>>
>> 1. "global" services - sockets not bound to any device
>>
>> Allows 1 service to work across all network interfaces with
>> connected sockets bound to the VRF the connection originates
>> (Requires net.ipv4.tcp_l3mdev_accept=1 for TCP and
>> net.ipv4.udp_l3mdev_accept=1 for UDP)
>>
>> 2. "VRF" local services - sockets bound to a VRF
>>
>> Sockets work across all network interfaces enslaved to a VRF but
>> are limited to just the one VRF.
>>
>> 3. "device" services - sockets bound to a specific network interface
>>
>> Service works only through the one specific interface.
>>
>> v2
>> - remove sk_lookup struct and add sdif as an argument to existing
>> functions
>>
>> Changes since RFC:
>> - no significant logic changes; mainly whitespace cleanups
>
> Series applied, thanks David.
David, I had to revert. You didn't convert dccp which breaks
the build.
net/dccp/ipv4.c: In function ‘dccp_v4_err’:
net/dccp/ipv4.c:256:7: error: too few arguments to function ‘__inet_lookup_established’
sk = __inet_lookup_established(net, &dccp_hashinfo,
^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from net/dccp/ipv4.c:22:0:
./include/net/inet_hashtables.h:289:14: note: declared here
struct sock *__inet_lookup_established(struct net *net,
^~~~~~~~~~~~~~~~~~~~~~~~~
Thanks.
^ permalink raw reply
* Re: [PATCH net-next 4/8] net: ethernet: add the Alpine Ethernet driver
From: Chocron, Jonathan @ 2017-08-07 7:39 UTC (permalink / raw)
To: Andrew Lunn, Antoine Tenart
Cc: netdev@vger.kernel.org, davem@davemloft.net,
linux-arm-kernel@lists.infradead.org,
thomas.petazzoni@free-electrons.com, arnd@arndb.de, BSHARA, Said
In-Reply-To: <20170203205823.GA22572@lunn.ch>
________________________________________
From: Andrew Lunn <andrew@lunn.ch>
Sent: Friday, February 3, 2017 22:58
To: Antoine Tenart
Cc: netdev@vger.kernel.org; davem@davemloft.net; linux-arm-kernel@lists.infradead.org; tsahee@annapurnalabs.com; rshitrit@annapurnalabs.com; saeed@annapurnalabs.com; barak@annapurnalabs.com; talz@annapurnalabs.com; thomas.petazzoni@free-electrons.com; arnd@arndb.de
Subject: Re: [PATCH net-next 4/8] net: ethernet: add the Alpine Ethernet driver
> +/* MDIO */
> +#define AL_ETH_MDIO_C45_DEV_MASK 0x1f0000
> +#define AL_ETH_MDIO_C45_DEV_SHIFT 16
> +#define AL_ETH_MDIO_C45_REG_MASK 0xffff
> +
> +static int al_mdio_read(struct mii_bus *bp, int mii_id, int reg)
> +{
> + struct al_eth_adapter *adapter = bp->priv;
> + u16 value = 0;
> + int rc;
> + int timeout = MDIO_TIMEOUT_MSEC;
> +
> + while (timeout > 0) {
> + if (reg & MII_ADDR_C45) {
> + netdev_dbg(adapter->netdev, "[c45]: dev %x reg %x val %x\n",
> + ((reg & AL_ETH_MDIO_C45_DEV_MASK) >> AL_ETH_MDIO_C45_DEV_SHIFT),
> + (reg & AL_ETH_MDIO_C45_REG_MASK), value);
> + rc = al_eth_mdio_read(&adapter->hw_adapter, adapter->phy_addr,
> + ((reg & AL_ETH_MDIO_C45_DEV_MASK) >> AL_ETH_MDIO_C45_DEV_SHIFT),
> + (reg & AL_ETH_MDIO_C45_REG_MASK), &value);
> + } else {
> + rc = al_eth_mdio_read(&adapter->hw_adapter, adapter->phy_addr,
> + MDIO_DEVAD_NONE, reg, &value);
> + }
> +
> + if (rc == 0)
> + return value;
> +
> + netdev_dbg(adapter->netdev,
> + "mdio read failed. try again in 10 msec\n");
> +
> + timeout -= 10;
> + msleep(10);
> + }
This is rather unusual, retrying MDIO operations. Are you working
around a hardware bug? I suspect this also opens up race conditions,
in particular with PHY interrupts, which can be clear on read.
The MDIO bus is shared between the ethernet units. There is a HW lock used to arbitrate between different interfaces trying to access the bus,
therefore there is a retry loop. The reg isn't accessed before obtaining the lock, so there shouldn't be any clear on read issues.
> +
> +static int al_eth_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
> +{
> + struct al_eth_adapter *adapter = netdev_priv(netdev);
> + struct mii_ioctl_data *mdio = if_mii(ifr);
> + struct phy_device *phydev;
> +
> + netdev_info(adapter->netdev, "ioctl: phy id 0x%x, reg 0x%x, val_in 0x%x\n",
> + mdio->phy_id, mdio->reg_num, mdio->val_in);
netdev_info() for an ioctl?
> +static int al_eth_flow_ctrl_config(struct al_eth_adapter *adapter);
> +static u8 al_eth_flow_ctrl_mutual_cap_get(struct al_eth_adapter *adapter);
> +static void al_eth_down(struct al_eth_adapter *adapter);
> +static int al_eth_up(struct al_eth_adapter *adapter);
Forward declarations are generally not liked. Can you move the code
around to remove them?
> +
> +static void al_eth_adjust_link(struct net_device *dev)
> +{
> + struct al_eth_adapter *adapter = netdev_priv(dev);
> + struct al_eth_link_config *link_config = &adapter->link_config;
> + struct phy_device *phydev = adapter->phydev;
> + enum al_eth_mac_mode mac_mode_needed = AL_ETH_MAC_MODE_RGMII;
> + int new_state = 0;
> + bool force_1000_base_x = false;
> +
> + if (phydev->link) {
> + if (phydev->duplex != link_config->active_duplex) {
> + new_state = 1;
> + link_config->active_duplex = phydev->duplex;
> + }
> +
> + if (phydev->speed != link_config->active_speed) {
> + new_state = 1;
> + switch (phydev->speed) {
> + case SPEED_1000:
> + case SPEED_100:
> + case SPEED_10:
> + mac_mode_needed = (adapter->mac_mode == AL_ETH_MAC_MODE_RGMII) ?
> + AL_ETH_MAC_MODE_RGMII : AL_ETH_MAC_MODE_SGMII;
> + break;
> + case SPEED_10000:
> + case SPEED_2500:
> + mac_mode_needed = AL_ETH_MAC_MODE_10GbE_Serial;
> + break;
> + default:
> + if (netif_msg_link(adapter))
> + netdev_warn(adapter->netdev,
> + "Ack! Speed (%d) is not 10/100/1000!",
Not particularly accurate, since 2.5G and 10G is supported.
> + phydev->speed);
> +static int al_eth_phy_init(struct al_eth_adapter *adapter)
> +{
> + struct phy_device *phydev = mdiobus_get_phy(adapter->mdio_bus, adapter->phy_addr);
> +
> + adapter->link_config.old_link = 0;
> + adapter->link_config.active_duplex = DUPLEX_UNKNOWN;
> + adapter->link_config.active_speed = SPEED_UNKNOWN;
> +
> + /* Attach the MAC to the PHY. */
> + phydev = phy_connect(adapter->netdev, dev_name(&phydev->mdio.dev), al_eth_adjust_link,
> + PHY_INTERFACE_MODE_RGMII);
> + if (IS_ERR(phydev)) {
> + netdev_err(adapter->netdev, "Could not attach to PHY\n");
> + return PTR_ERR(phydev);
> + }
> +
> + netdev_info(adapter->netdev, "phy[%d]: device %s, driver %s\n",
> + phydev->mdio.addr, dev_name(&phydev->mdio.dev),
> + phydev->drv ? phydev->drv->name : "unknown");
> +
phy_attached_info()?
> + /* Mask with MAC supported features. */
> + phydev->supported &= (PHY_GBIT_FEATURES |
> + SUPPORTED_Pause |
> + SUPPORTED_Asym_Pause);
> +
> + phydev->advertising = phydev->supported;
> +
> + netdev_info(adapter->netdev, "phy[%d]:supported %x adv %x\n",
> + phydev->mdio.addr, phydev->supported, phydev->advertising);
> +
More output?
> + adapter->phydev = phydev;
> + /* Bring the PHY up */
> + phy_start(adapter->phydev);
This is normally done in the open() call.
> +/* al_eth_mdiobus_setup - initialize mdiobus and register to kernel */
> +static int al_eth_mdiobus_setup(struct al_eth_adapter *adapter)
> +{
> + struct phy_device *phydev;
> + int i;
> + int ret = 0;
> +
> + adapter->mdio_bus = mdiobus_alloc();
> + if (!adapter->mdio_bus)
> + return -ENOMEM;
> +
> + adapter->mdio_bus->name = "al mdio bus";
> + snprintf(adapter->mdio_bus->id, MII_BUS_ID_SIZE, "%x",
> + (adapter->pdev->bus->number << 8) | adapter->pdev->devfn);
> + adapter->mdio_bus->priv = adapter;
> + adapter->mdio_bus->parent = &adapter->pdev->dev;
> + adapter->mdio_bus->read = &al_mdio_read;
> + adapter->mdio_bus->write = &al_mdio_write;
> + adapter->mdio_bus->phy_mask = ~BIT(adapter->phy_addr);
Why do this?
Since the MDIO bus is shared, we want each interface to probe only for the PHY associated with it.
> + for (i = 0; i < PHY_MAX_ADDR; i++)
> + adapter->mdio_bus->irq[i] = PHY_POLL;
Not needed. The core will do this.
> +
> + if (adapter->phy_if != AL_ETH_BOARD_PHY_IF_XMDIO) {
> + i = mdiobus_register(adapter->mdio_bus);
> + if (i) {
> + netdev_warn(adapter->netdev,
> + "mdiobus_reg failed (0x%x)\n", i);
> + mdiobus_free(adapter->mdio_bus);
> + return i;
> + }
> +
> + phydev = mdiobus_get_phy(adapter->mdio_bus, adapter->phy_addr);
> + } else {
> + adapter->mdio_bus->phy_mask = 0xffffffff;
> + i = mdiobus_register(adapter->mdio_bus);
> + if (i) {
> + netdev_warn(adapter->netdev,
> + "mdiobus_reg failed (0x%x)\n", i);
> + mdiobus_free(adapter->mdio_bus);
> + return i;
> + }
> +
> + phydev = get_phy_device(adapter->mdio_bus, adapter->phy_addr,
> + true);
> + if (!phydev) {
> + netdev_err(adapter->netdev, "phy device get failed\n");
> + goto error;
> + }
> +
> + ret = phy_device_register(phydev);
> + if (ret) {
> + netdev_err(adapter->netdev,
> + "phy device register failed\n");
> + goto error;
> + }
> + }
It seems like this should be split up into two. One function to
register the MDIO bus, and a second to handle the PHY on the mdio bus.
> +
> + if (!phydev || !phydev->drv)
> + goto error;
> +
> + return 0;
> +
> +error:
> + netdev_warn(adapter->netdev, "No PHY devices\n");
Yet more warnings....
> + mdiobus_unregister(adapter->mdio_bus);
> + mdiobus_free(adapter->mdio_bus);
> + return -ENODEV;
> +}
> +
> +/* al_eth_mdiobus_teardown - mdiobus unregister */
> +static void al_eth_mdiobus_teardown(struct al_eth_adapter *adapter)
> +{
> + if (!adapter->mdio_bus)
> + return;
> +
> + mdiobus_unregister(adapter->mdio_bus);
> + mdiobus_free(adapter->mdio_bus);
> + phy_device_free(adapter->phydev);
Humm, you might want to think about the ordering here.
> +}
> +
> +static void al_eth_tx_timeout(struct net_device *dev)
> +{
> + struct al_eth_adapter *adapter = netdev_priv(dev);
> +
> + if (netif_msg_tx_err(adapter))
> + netdev_err(dev, "transmit timed out!!!!\n");
> +}
> +
> +static int al_eth_change_mtu(struct net_device *dev, int new_mtu)
> +{
> + struct al_eth_adapter *adapter = netdev_priv(dev);
> + int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
> +
> + if ((new_mtu < AL_ETH_MIN_FRAME_LEN) || (new_mtu > AL_ETH_MAX_MTU) ||
> + (max_frame > AL_ETH_MAX_FRAME_LEN)) {
> + netdev_err(dev, "Invalid MTU setting\n");
> + return -EINVAL;
> + }
The core will do this check for you, if you tell it to.
> + switch (params.speed) {
> + default:
> + dev_warn(&adapter->pdev->dev,
> + "invalid speed (%d)\n", params.speed);
It is a bit unusual having the default first. And that leads me to a C
question. Can it fall through into the next case statement if there is no break?
> +static int al_eth_nway_reset(struct net_device *netdev)
> +{
> + struct al_eth_adapter *adapter = netdev_priv(netdev);
> + struct phy_device *phydev = adapter->phydev;
> +
> + if (!phydev)
> + return -ENODEV;
> +
> + return phy_start_aneg(phydev);
> +}
phy_ethtool_nway_reset() should be used.
> +static int al_eth_set_mac_addr(struct net_device *dev, void *p)
> +{
> + struct al_eth_adapter *adapter = netdev_priv(dev);
> + struct sockaddr *addr = p;
> + int err = 0;
> +
> + if (!is_valid_ether_addr(addr->sa_data))
> + return -EADDRNOTAVAIL;
Seems like the core should be doing that for you. Not checked though.
If it does not, i suggest you do add it to the core.
> +static void al_eth_mdio_1g_mac_read(struct al_hw_eth_adapter *adapter,
> + u32 phy_addr, u32 reg, u16 *val)
> +{
> + *val = readl(&adapter->mac_regs_base->mac_1g.phy_regs_base + reg);
> +}
> +
> +static void al_eth_mdio_1g_mac_write(struct al_hw_eth_adapter *adapter,
> + u32 phy_addr, u32 reg, u16 val)
> +{
> + writel(val, &adapter->mac_regs_base->mac_1g.phy_regs_base + reg);
> +}
Are there range checks made on reg before these functions are called?
Just thinking about SIOCSMIIREG ioctl.
> +
> +static int al_eth_mdio_10g_mac_wait_busy(struct al_hw_eth_adapter *adapter)
> +{
> + int count = 0;
> + u32 mdio_cfg_status;
> +
> + do {
> + mdio_cfg_status = readl(&adapter->mac_regs_base->mac_10g.mdio_cfg_status);
> + if (mdio_cfg_status & BIT(0)) {
Would be nice to have a #define for this 0 bit, and it seems bit 1 is an error?
> + if (count > 0)
> + netdev_dbg(adapter->netdev,
> + "eth [%s] mdio: still busy!\n",
> + adapter->name);
> + } else {
> + return 0;
> + }
> + udelay(AL_ETH_MDIO_DELAY_PERIOD);
> + } while (count++ < AL_ETH_MDIO_DELAY_COUNT);
> +
> + return -ETIMEDOUT;
> +}
> +
> +static int al_eth_mdio_10g_mac_type22(struct al_hw_eth_adapter *adapter,
> + int read, u32 phy_addr, u32 reg, u16 *val)
> +{
> + int rc;
> + const char *op = (read == 1) ? "read" : "write";
> + u32 mdio_cfg_status;
> + u16 mdio_cmd;
> +
> + /* wait if the HW is busy */
> + rc = al_eth_mdio_10g_mac_wait_busy(adapter);
> + if (rc) {
> + netdev_err(adapter->netdev,
> + " eth [%s] mdio %s failed. HW is busy\n",
> + adapter->name, op);
How about moving this netdev_err() inside
al_eth_mdio_10g_mac_wait_busy() so you only need it once?
> + return rc;
> + }
> +
> + mdio_cmd = (u16)(0x1F & reg);
> + mdio_cmd |= (0x1F & phy_addr) << 5;
> +
> + if (read)
> + mdio_cmd |= BIT(15); /* READ command */
Another #define please.
> + * acquire mdio interface ownership
> + * when mdio interface shared between multiple eth controllers, this function waits until the ownership granted for this controller.
> + * this function does nothing when the mdio interface is used only by this controller.
> + *
> + * @param adapter
> + * @return 0 on success, -ETIMEDOUT on timeout.
> + */
> +static int al_eth_mdio_lock(struct al_hw_eth_adapter *adapter)
> +{
> + int count = 0;
> + u32 mdio_ctrl_1;
> +
> + if (!adapter->shared_mdio_if)
> + return 0; /* nothing to do when interface is not shared */
> +
> + do {
> + mdio_ctrl_1 = readl(&adapter->mac_regs_base->gen.mdio_ctrl_1);
> + if (mdio_ctrl_1 & BIT(0)) {
> + if (count > 0)
> + netdev_dbg(adapter->netdev,
> + "eth %s mdio interface still busy!\n",
> + adapter->name);
> + } else {
> + return 0;
> + }
> + udelay(AL_ETH_MDIO_DELAY_PERIOD);
> + } while (count++ < (AL_ETH_MDIO_DELAY_COUNT * 4));
This needs explaining. How can a read alone perform a lock? How is
this race free?
This is how this HW lock works: when the bit is 0 this means the lock is free. When a read transaction arrives to the lock, it changes its value to 1 but sends 0 as the response,
basically taking ownership. When the owner is done, it writes a 0 which essentially "frees" the lock.
> + if (adapter->mdio_type == AL_ETH_MDIO_TYPE_CLAUSE_22)
> + rc = al_eth_mdio_10g_mac_type22(adapter, 1, phy_addr,
> + reg, val);
> + else
> + rc = al_eth_mdio_10g_mac_type45(adapter, 1, phy_addr,
> + device, reg, val);
This seems odd. My understanding is that the device on the MDIO bus,
the PHY, is either c22 or c45. The PHY driver will tell you this, not
the adaptor.
The current implementation sets mdio_type according to information which is originally deduced from the DeviceTree (the bootloader parses the ethernet node of the DeviceTree and saves this data to HW registers, which are then read by this driver).
How can this information be obtained by the PHY driver?
Andrew
Jonathan
^ permalink raw reply
* RE: [PATCH] qed: Fix a memory allocation failure test in 'qed_mcp_cmd_init()'
From: Tayar, Tomer @ 2017-08-07 7:40 UTC (permalink / raw)
To: Christophe JAILLET, Mintz, Yuval, Elior, Ariel,
Dept-Eng Everest Linux L2
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
In-Reply-To: <20170806220017.20465-1-christophe.jaillet@wanadoo.fr>
> We allocate 'p_info->mfw_mb_cur' and 'p_info->mfw_mb_shadow' but we
> check
> 'p_info->mfw_mb_addr' instead of 'p_info->mfw_mb_cur'.
>
> 'p_info->mfw_mb_addr' is never 0, because it is initiliazed a few lines
> above in 'qed_load_mcp_offsets()'.
>
> Update the test and check the result of the 2 'kzalloc()' instead.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Thanks
Acked-by: Tomer Tayar <Tomer.Tayar@cavium.com>
^ permalink raw reply
* [patch net-next v2 00/16] net: sched: summer cleanup part 2, ndo_setup_tc
From: Jiri Pirko @ 2017-08-07 8:15 UTC (permalink / raw)
To: netdev
Cc: davem, jhs, xiyou.wangcong, daniel, mlxsw, andrew, vivien.didelot,
f.fainelli, simon.horman, pieter.jansenvanvuuren,
dirk.vandermerwe, alexander.h.duyck, amritha.nambiar, oss-drivers,
yisen.zhuang, salil.mehta
From: Jiri Pirko <jiri@mellanox.com>
This patchset focuses on ndo_setup_tc and its args.
Currently there are couple of things that do not make much sense.
The type is passed in struct tc_to_netdev, but as it is always
required, should be arg of the ndo. Other things are passed as args
but they are only relevant for cls offloads and not mqprio. Therefore,
they should be pushed to struct. As the tc_to_netdev struct in the end
is just a container of single pointer, we get rid of it and pass the
struct according to type. So in the end, we have:
ndo_setup_tc(dev, type, type_data_struct)
There are couple of cosmetics done on the way to make things smooth.
Also, reported error is consolidated to eopnotsupp in case the
asked offload is not supported.
v1->v2:
- added forgotten hns3pf bits
Jiri Pirko (16):
net: sched: make type an argument for ndo_setup_tc
net: sched: rename TC_SETUP_MATCHALL to TC_SETUP_CLSMATCHALL
net: sched: make egress_dev flag part of flower offload struct
cxgb4: push cls_u32 setup_tc processing into a separate function
ixgbe: push cls_u32 and mqprio setup_tc processing into separate
functions
mlx5e: push cls_flower and mqprio setup_tc processing into separate
functions
mlx5e_rep: push cls_flower setup_tc processing into a separate
function
mlxsw: spectrum: push cls_flower and cls_matchall setup_tc processing
into separate functions
mlxsw: spectrum: rename cls arg in matchall processing
dsa: push cls_matchall setup_tc processing into a separate function
nfp: change flows in apps that offload ndo_setup_tc
hns3pf: don't check handle during mqprio offload
net: sched: push cls related args into cls_common structure
net: sched: move prio into cls_common
net: sched: change return value of ndo_setup_tc for driver supporting
mqprio only
net: sched: get rid of struct tc_to_netdev
drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 14 +--
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 14 +--
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | 4 +-
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 14 +--
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 43 +++++----
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c | 7 +-
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.h | 6 +-
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 13 +--
.../net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c | 13 +--
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 14 +--
drivers/net/ethernet/intel/i40e/i40e_main.c | 15 +--
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 65 +++++++------
drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 17 ++--
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 55 +++++------
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 45 +++++----
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/en_tc.h | 4 +-
drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 102 ++++++++++++---------
drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 2 +-
.../net/ethernet/mellanox/mlxsw/spectrum_flower.c | 4 +-
drivers/net/ethernet/netronome/nfp/bpf/main.c | 20 ++--
drivers/net/ethernet/netronome/nfp/flower/main.h | 4 +-
.../net/ethernet/netronome/nfp/flower/offload.c | 15 ++-
drivers/net/ethernet/netronome/nfp/nfp_app.h | 8 +-
drivers/net/ethernet/netronome/nfp/nfp_port.c | 9 +-
drivers/net/ethernet/netronome/nfp/nfp_port.h | 5 +-
drivers/net/ethernet/sfc/efx.h | 4 +-
drivers/net/ethernet/sfc/falcon/efx.h | 4 +-
drivers/net/ethernet/sfc/falcon/tx.c | 13 +--
drivers/net/ethernet/sfc/tx.c | 13 +--
drivers/net/ethernet/ti/netcp_core.c | 13 +--
include/linux/netdevice.h | 30 ++----
include/net/pkt_cls.h | 23 ++++-
net/dsa/slave.c | 39 ++++----
net/sched/cls_bpf.c | 24 ++---
net/sched/cls_flower.c | 60 +++++-------
net/sched/cls_matchall.c | 31 +++----
net/sched/cls_u32.c | 95 ++++++++-----------
net/sched/sch_mqprio.c | 16 ++--
39 files changed, 438 insertions(+), 441 deletions(-)
--
2.9.3
^ permalink raw reply
* [patch net-next v2 01/16] net: sched: make type an argument for ndo_setup_tc
From: Jiri Pirko @ 2017-08-07 8:15 UTC (permalink / raw)
To: netdev
Cc: davem, jhs, xiyou.wangcong, daniel, mlxsw, andrew, vivien.didelot,
f.fainelli, simon.horman, pieter.jansenvanvuuren,
dirk.vandermerwe, alexander.h.duyck, amritha.nambiar, oss-drivers,
yisen.zhuang, salil.mehta
In-Reply-To: <20170807081532.32760-1-jiri@resnulli.us>
From: Jiri Pirko <jiri@mellanox.com>
Since the type is always present, push it to be a separate argument to
ndo_setup_tc. On the way, name the type enum and use it for arg type.
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
---
drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 6 +++---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 7 ++++---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | 5 +++--
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 7 ++++---
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 7 ++++---
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 7 ++++---
.../net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c | 6 +++---
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 7 ++++---
drivers/net/ethernet/intel/i40e/i40e_main.c | 6 +++---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 9 +++++----
drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 6 +++---
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 8 ++++----
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 9 +++++----
drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 10 +++++-----
drivers/net/ethernet/netronome/nfp/bpf/main.c | 5 +++--
drivers/net/ethernet/netronome/nfp/flower/main.h | 3 ++-
drivers/net/ethernet/netronome/nfp/flower/offload.c | 5 +++--
drivers/net/ethernet/netronome/nfp/nfp_app.h | 6 ++++--
drivers/net/ethernet/netronome/nfp/nfp_port.c | 7 ++++---
drivers/net/ethernet/netronome/nfp/nfp_port.h | 5 +++--
drivers/net/ethernet/sfc/efx.h | 5 +++--
drivers/net/ethernet/sfc/falcon/efx.h | 5 +++--
drivers/net/ethernet/sfc/falcon/tx.c | 7 ++++---
drivers/net/ethernet/sfc/tx.c | 7 ++++---
drivers/net/ethernet/ti/netcp_core.c | 7 ++++---
include/linux/netdevice.h | 9 +++++----
net/dsa/slave.c | 6 +++---
net/sched/cls_bpf.c | 4 ++--
net/sched/cls_flower.c | 14 ++++++--------
net/sched/cls_matchall.c | 10 ++++------
net/sched/cls_u32.c | 20 ++++++++------------
net/sched/sch_mqprio.c | 13 ++++++-------
32 files changed, 125 insertions(+), 113 deletions(-)
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
index ecef3ee..6a6ea3b 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
@@ -1918,14 +1918,14 @@ static void xgbe_poll_controller(struct net_device *netdev)
}
#endif /* End CONFIG_NET_POLL_CONTROLLER */
-static int xgbe_setup_tc(struct net_device *netdev, u32 handle, u32 chain_index,
- __be16 proto,
+static int xgbe_setup_tc(struct net_device *netdev, enum tc_setup_type type,
+ u32 handle, u32 chain_index, __be16 proto,
struct tc_to_netdev *tc_to_netdev)
{
struct xgbe_prv_data *pdata = netdev_priv(netdev);
u8 tc;
- if (tc_to_netdev->type != TC_SETUP_MQPRIO)
+ if (type != TC_SETUP_MQPRIO)
return -EINVAL;
tc_to_netdev->mqprio->hw = TC_MQPRIO_HW_OFFLOAD_TCS;
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index 67fe3d8..4395d1c 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -4284,10 +4284,11 @@ int bnx2x_setup_tc(struct net_device *dev, u8 num_tc)
return 0;
}
-int __bnx2x_setup_tc(struct net_device *dev, u32 handle, u32 chain_index,
- __be16 proto, struct tc_to_netdev *tc)
+int __bnx2x_setup_tc(struct net_device *dev, enum tc_setup_type type,
+ u32 handle, u32 chain_index, __be16 proto,
+ struct tc_to_netdev *tc)
{
- if (tc->type != TC_SETUP_MQPRIO)
+ if (type != TC_SETUP_MQPRIO)
return -EINVAL;
tc->mqprio->hw = TC_MQPRIO_HW_OFFLOAD_TCS;
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
index c26688d..1ac4eb0 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
@@ -486,8 +486,9 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev);
/* setup_tc callback */
int bnx2x_setup_tc(struct net_device *dev, u8 num_tc);
-int __bnx2x_setup_tc(struct net_device *dev, u32 handle, u32 chain_index,
- __be16 proto, struct tc_to_netdev *tc);
+int __bnx2x_setup_tc(struct net_device *dev, enum tc_setup_type type,
+ u32 handle, u32 chain_index, __be16 proto,
+ struct tc_to_netdev *tc);
int bnx2x_get_vf_config(struct net_device *dev, int vf,
struct ifla_vf_info *ivi);
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 156fb37..b98d9f3 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -7237,10 +7237,11 @@ int bnxt_setup_mq_tc(struct net_device *dev, u8 tc)
return 0;
}
-static int bnxt_setup_tc(struct net_device *dev, u32 handle, u32 chain_index,
- __be16 proto, struct tc_to_netdev *ntc)
+static int bnxt_setup_tc(struct net_device *dev, enum tc_setup_type type,
+ u32 handle, u32 chain_index, __be16 proto,
+ struct tc_to_netdev *ntc)
{
- if (ntc->type != TC_SETUP_MQPRIO)
+ if (type != TC_SETUP_MQPRIO)
return -EINVAL;
ntc->mqprio->hw = TC_MQPRIO_HW_OFFLOAD_TCS;
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index fdf220a..89d2b0c 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -2889,8 +2889,9 @@ static int cxgb_set_tx_maxrate(struct net_device *dev, int index, u32 rate)
return err;
}
-static int cxgb_setup_tc(struct net_device *dev, u32 handle, u32 chain_index,
- __be16 proto, struct tc_to_netdev *tc)
+static int cxgb_setup_tc(struct net_device *dev, enum tc_setup_type type,
+ u32 handle, u32 chain_index, __be16 proto,
+ struct tc_to_netdev *tc)
{
struct port_info *pi = netdev2pinfo(dev);
struct adapter *adap = netdev2adap(dev);
@@ -2906,7 +2907,7 @@ static int cxgb_setup_tc(struct net_device *dev, u32 handle, u32 chain_index,
}
if (TC_H_MAJ(handle) == TC_H_MAJ(TC_H_INGRESS) &&
- tc->type == TC_SETUP_CLSU32) {
+ type == TC_SETUP_CLSU32) {
switch (tc->cls_u32->command) {
case TC_CLSU32_NEW_KNODE:
case TC_CLSU32_REPLACE_KNODE:
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index 550ea1e..d86d766 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -342,14 +342,15 @@ static void dpaa_get_stats64(struct net_device *net_dev,
}
}
-static int dpaa_setup_tc(struct net_device *net_dev, u32 handle,
- u32 chain_index, __be16 proto, struct tc_to_netdev *tc)
+static int dpaa_setup_tc(struct net_device *net_dev, enum tc_setup_type type,
+ u32 handle, u32 chain_index, __be16 proto,
+ struct tc_to_netdev *tc)
{
struct dpaa_priv *priv = netdev_priv(net_dev);
u8 num_tc;
int i;
- if (tc->type != TC_SETUP_MQPRIO)
+ if (type != TC_SETUP_MQPRIO)
return -EINVAL;
tc->mqprio->hw = TC_MQPRIO_HW_OFFLOAD_TCS;
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c
index ad9481c..6bb1e35 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c
@@ -1219,11 +1219,11 @@ static int hns3_setup_tc(struct net_device *netdev, u8 tc)
return 0;
}
-static int hns3_nic_setup_tc(struct net_device *dev, u32 handle,
- u32 chain_index, __be16 protocol,
+static int hns3_nic_setup_tc(struct net_device *dev, enum tc_setup_type type,
+ u32 handle, u32 chain_index, __be16 protocol,
struct tc_to_netdev *tc)
{
- if (handle != TC_H_ROOT || tc->type != TC_SETUP_MQPRIO)
+ if (handle != TC_H_ROOT || type != TC_SETUP_MQPRIO)
return -EINVAL;
return hns3_setup_tc(dev, tc->mqprio->num_tc);
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
index 5e37387..b301906 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
@@ -1265,10 +1265,11 @@ int fm10k_setup_tc(struct net_device *dev, u8 tc)
return err;
}
-static int __fm10k_setup_tc(struct net_device *dev, u32 handle, u32 chain_index,
- __be16 proto, struct tc_to_netdev *tc)
+static int __fm10k_setup_tc(struct net_device *dev, enum tc_setup_type type,
+ u32 handle, u32 chain_index, __be16 proto,
+ struct tc_to_netdev *tc)
{
- if (tc->type != TC_SETUP_MQPRIO)
+ if (type != TC_SETUP_MQPRIO)
return -EINVAL;
tc->mqprio->hw = TC_MQPRIO_HW_OFFLOAD_TCS;
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 4104944..7d47a71 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -5656,11 +5656,11 @@ static int i40e_setup_tc(struct net_device *netdev, u8 tc)
return ret;
}
-static int __i40e_setup_tc(struct net_device *netdev, u32 handle,
- u32 chain_index, __be16 proto,
+static int __i40e_setup_tc(struct net_device *netdev, enum tc_setup_type type,
+ u32 handle, u32 chain_index, __be16 proto,
struct tc_to_netdev *tc)
{
- if (tc->type != TC_SETUP_MQPRIO)
+ if (type != TC_SETUP_MQPRIO)
return -EINVAL;
tc->mqprio->hw = TC_MQPRIO_HW_OFFLOAD_TCS;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 091fcc7..d39db97 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -9226,8 +9226,9 @@ static int ixgbe_configure_clsu32(struct ixgbe_adapter *adapter,
return err;
}
-static int __ixgbe_setup_tc(struct net_device *dev, u32 handle, u32 chain_index,
- __be16 proto, struct tc_to_netdev *tc)
+static int __ixgbe_setup_tc(struct net_device *dev, enum tc_setup_type type,
+ u32 handle, u32 chain_index, __be16 proto,
+ struct tc_to_netdev *tc)
{
struct ixgbe_adapter *adapter = netdev_priv(dev);
@@ -9235,7 +9236,7 @@ static int __ixgbe_setup_tc(struct net_device *dev, u32 handle, u32 chain_index,
return -EOPNOTSUPP;
if (TC_H_MAJ(handle) == TC_H_MAJ(TC_H_INGRESS) &&
- tc->type == TC_SETUP_CLSU32) {
+ type == TC_SETUP_CLSU32) {
switch (tc->cls_u32->command) {
case TC_CLSU32_NEW_KNODE:
case TC_CLSU32_REPLACE_KNODE:
@@ -9255,7 +9256,7 @@ static int __ixgbe_setup_tc(struct net_device *dev, u32 handle, u32 chain_index,
}
}
- if (tc->type != TC_SETUP_MQPRIO)
+ if (type != TC_SETUP_MQPRIO)
return -EINVAL;
tc->mqprio->hw = TC_MQPRIO_HW_OFFLOAD_TCS;
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 3a291fc..5c33550 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -130,11 +130,11 @@ int mlx4_en_alloc_tx_queue_per_tc(struct net_device *dev, u8 tc)
return err;
}
-static int __mlx4_en_setup_tc(struct net_device *dev, u32 handle,
- u32 chain_index, __be16 proto,
+static int __mlx4_en_setup_tc(struct net_device *dev, enum tc_setup_type type,
+ u32 handle, u32 chain_index, __be16 proto,
struct tc_to_netdev *tc)
{
- if (tc->type != TC_SETUP_MQPRIO)
+ if (type != TC_SETUP_MQPRIO)
return -EINVAL;
if (tc->mqprio->num_tc && tc->mqprio->num_tc != MLX4_EN_NUM_UP_HIGH)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 57f31fa..4052e225f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -3027,8 +3027,8 @@ static int mlx5e_setup_tc(struct net_device *netdev, u8 tc)
return err;
}
-static int mlx5e_ndo_setup_tc(struct net_device *dev, u32 handle,
- u32 chain_index, __be16 proto,
+static int mlx5e_ndo_setup_tc(struct net_device *dev, enum tc_setup_type type,
+ u32 handle, u32 chain_index, __be16 proto,
struct tc_to_netdev *tc)
{
struct mlx5e_priv *priv = netdev_priv(dev);
@@ -3039,7 +3039,7 @@ static int mlx5e_ndo_setup_tc(struct net_device *dev, u32 handle,
if (chain_index)
return -EOPNOTSUPP;
- switch (tc->type) {
+ switch (type) {
case TC_SETUP_CLSFLOWER:
switch (tc->cls_flower->command) {
case TC_CLSFLOWER_REPLACE:
@@ -3054,7 +3054,7 @@ static int mlx5e_ndo_setup_tc(struct net_device *dev, u32 handle,
}
mqprio:
- if (tc->type != TC_SETUP_MQPRIO)
+ if (type != TC_SETUP_MQPRIO)
return -EINVAL;
tc->mqprio->hw = TC_MQPRIO_HW_OFFLOAD_TCS;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index 45e60be..d44049e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -651,7 +651,8 @@ static int mlx5e_rep_get_phys_port_name(struct net_device *dev,
return 0;
}
-static int mlx5e_rep_ndo_setup_tc(struct net_device *dev, u32 handle,
+static int mlx5e_rep_ndo_setup_tc(struct net_device *dev,
+ enum tc_setup_type type, u32 handle,
u32 chain_index, __be16 proto,
struct tc_to_netdev *tc)
{
@@ -664,15 +665,15 @@ static int mlx5e_rep_ndo_setup_tc(struct net_device *dev, u32 handle,
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
struct net_device *uplink_dev = mlx5_eswitch_get_uplink_netdev(esw);
- return uplink_dev->netdev_ops->ndo_setup_tc(uplink_dev, handle,
- chain_index,
+ return uplink_dev->netdev_ops->ndo_setup_tc(uplink_dev, type,
+ handle, chain_index,
proto, tc);
}
if (chain_index)
return -EOPNOTSUPP;
- switch (tc->type) {
+ switch (type) {
case TC_SETUP_CLSFLOWER:
switch (tc->cls_flower->command) {
case TC_CLSFLOWER_REPLACE:
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index 66d511d..1554242 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -1693,8 +1693,8 @@ static void mlxsw_sp_port_del_cls_matchall(struct mlxsw_sp_port *mlxsw_sp_port,
kfree(mall_tc_entry);
}
-static int mlxsw_sp_setup_tc(struct net_device *dev, u32 handle,
- u32 chain_index, __be16 proto,
+static int mlxsw_sp_setup_tc(struct net_device *dev, enum tc_setup_type type,
+ u32 handle, u32 chain_index, __be16 proto,
struct tc_to_netdev *tc)
{
struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);
@@ -1703,7 +1703,7 @@ static int mlxsw_sp_setup_tc(struct net_device *dev, u32 handle,
if (chain_index)
return -EOPNOTSUPP;
- switch (tc->type) {
+ switch (type) {
case TC_SETUP_MATCHALL:
switch (tc->cls_mall->command) {
case TC_CLSMATCHALL_REPLACE:
@@ -1733,9 +1733,9 @@ static int mlxsw_sp_setup_tc(struct net_device *dev, u32 handle,
default:
return -EOPNOTSUPP;
}
+ default:
+ return -EOPNOTSUPP;
}
-
- return -EOPNOTSUPP;
}
static const struct net_device_ops mlxsw_sp_port_netdev_ops = {
diff --git a/drivers/net/ethernet/netronome/nfp/bpf/main.c b/drivers/net/ethernet/netronome/nfp/bpf/main.c
index afbdf5f..7888808 100644
--- a/drivers/net/ethernet/netronome/nfp/bpf/main.c
+++ b/drivers/net/ethernet/netronome/nfp/bpf/main.c
@@ -121,7 +121,8 @@ static void nfp_bpf_vnic_clean(struct nfp_app *app, struct nfp_net *nn)
}
static int nfp_bpf_setup_tc(struct nfp_app *app, struct net_device *netdev,
- u32 handle, __be16 proto, struct tc_to_netdev *tc)
+ enum tc_setup_type type, u32 handle, __be16 proto,
+ struct tc_to_netdev *tc)
{
struct nfp_net *nn = netdev_priv(netdev);
@@ -130,7 +131,7 @@ static int nfp_bpf_setup_tc(struct nfp_app *app, struct net_device *netdev,
if (proto != htons(ETH_P_ALL))
return -EOPNOTSUPP;
- if (tc->type == TC_SETUP_CLSBPF && nfp_net_ebpf_capable(nn)) {
+ if (type == TC_SETUP_CLSBPF && nfp_net_ebpf_capable(nn)) {
if (!nn->dp.bpf_offload_xdp)
return nfp_net_bpf_offload(nn, tc->cls_bpf);
else
diff --git a/drivers/net/ethernet/netronome/nfp/flower/main.h b/drivers/net/ethernet/netronome/nfp/flower/main.h
index 9e64c04..314e6e8 100644
--- a/drivers/net/ethernet/netronome/nfp/flower/main.h
+++ b/drivers/net/ethernet/netronome/nfp/flower/main.h
@@ -135,7 +135,8 @@ int nfp_flower_metadata_init(struct nfp_app *app);
void nfp_flower_metadata_cleanup(struct nfp_app *app);
int nfp_flower_setup_tc(struct nfp_app *app, struct net_device *netdev,
- u32 handle, __be16 proto, struct tc_to_netdev *tc);
+ enum tc_setup_type type, u32 handle, __be16 proto,
+ struct tc_to_netdev *tc);
int nfp_flower_compile_flow_match(struct tc_cls_flower_offload *flow,
struct nfp_fl_key_ls *key_ls,
struct net_device *netdev,
diff --git a/drivers/net/ethernet/netronome/nfp/flower/offload.c b/drivers/net/ethernet/netronome/nfp/flower/offload.c
index 4ad10bd..d045cf8 100644
--- a/drivers/net/ethernet/netronome/nfp/flower/offload.c
+++ b/drivers/net/ethernet/netronome/nfp/flower/offload.c
@@ -385,7 +385,8 @@ nfp_flower_repr_offload(struct nfp_app *app, struct net_device *netdev,
}
int nfp_flower_setup_tc(struct nfp_app *app, struct net_device *netdev,
- u32 handle, __be16 proto, struct tc_to_netdev *tc)
+ enum tc_setup_type type, u32 handle, __be16 proto,
+ struct tc_to_netdev *tc)
{
if (TC_H_MAJ(handle) != TC_H_MAJ(TC_H_INGRESS))
return -EOPNOTSUPP;
@@ -393,7 +394,7 @@ int nfp_flower_setup_tc(struct nfp_app *app, struct net_device *netdev,
if (!eth_proto_is_802_3(proto))
return -EOPNOTSUPP;
- if (tc->type != TC_SETUP_CLSFLOWER)
+ if (type != TC_SETUP_CLSFLOWER)
return -EINVAL;
return nfp_flower_repr_offload(app, netdev, tc->cls_flower);
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_app.h b/drivers/net/ethernet/netronome/nfp/nfp_app.h
index 5d714e1..b3b03bb9 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_app.h
+++ b/drivers/net/ethernet/netronome/nfp/nfp_app.h
@@ -109,7 +109,8 @@ struct nfp_app_type {
void (*ctrl_msg_rx)(struct nfp_app *app, struct sk_buff *skb);
int (*setup_tc)(struct nfp_app *app, struct net_device *netdev,
- u32 handle, __be16 proto, struct tc_to_netdev *tc);
+ enum tc_setup_type type, u32 handle, __be16 proto,
+ struct tc_to_netdev *tc);
bool (*tc_busy)(struct nfp_app *app, struct nfp_net *nn);
int (*xdp_offload)(struct nfp_app *app, struct nfp_net *nn,
struct bpf_prog *prog);
@@ -238,12 +239,13 @@ static inline bool nfp_app_tc_busy(struct nfp_app *app, struct nfp_net *nn)
static inline int nfp_app_setup_tc(struct nfp_app *app,
struct net_device *netdev,
+ enum tc_setup_type type,
u32 handle, __be16 proto,
struct tc_to_netdev *tc)
{
if (!app || !app->type->setup_tc)
return -EOPNOTSUPP;
- return app->type->setup_tc(app, netdev, handle, proto, tc);
+ return app->type->setup_tc(app, netdev, type, handle, proto, tc);
}
static inline int nfp_app_xdp_offload(struct nfp_app *app, struct nfp_net *nn,
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_port.c b/drivers/net/ethernet/netronome/nfp/nfp_port.c
index d16a7b7..9d776f9 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_port.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_port.c
@@ -88,8 +88,9 @@ const struct switchdev_ops nfp_port_switchdev_ops = {
.switchdev_port_attr_get = nfp_port_attr_get,
};
-int nfp_port_setup_tc(struct net_device *netdev, u32 handle, u32 chain_index,
- __be16 proto, struct tc_to_netdev *tc)
+int nfp_port_setup_tc(struct net_device *netdev, enum tc_setup_type type,
+ u32 handle, u32 chain_index, __be16 proto,
+ struct tc_to_netdev *tc)
{
struct nfp_port *port;
@@ -100,7 +101,7 @@ int nfp_port_setup_tc(struct net_device *netdev, u32 handle, u32 chain_index,
if (!port)
return -EOPNOTSUPP;
- return nfp_app_setup_tc(port->app, netdev, handle, proto, tc);
+ return nfp_app_setup_tc(port->app, netdev, type, handle, proto, tc);
}
struct nfp_port *
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_port.h b/drivers/net/ethernet/netronome/nfp/nfp_port.h
index 56c7692..239c540 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_port.h
+++ b/drivers/net/ethernet/netronome/nfp/nfp_port.h
@@ -109,8 +109,9 @@ struct nfp_port {
extern const struct switchdev_ops nfp_port_switchdev_ops;
-int nfp_port_setup_tc(struct net_device *netdev, u32 handle, u32 chain_index,
- __be16 proto, struct tc_to_netdev *tc);
+int nfp_port_setup_tc(struct net_device *netdev, enum tc_setup_type type,
+ u32 handle, u32 chain_index, __be16 proto,
+ struct tc_to_netdev *tc);
struct nfp_port *nfp_port_from_netdev(struct net_device *netdev);
struct nfp_port *
diff --git a/drivers/net/ethernet/sfc/efx.h b/drivers/net/ethernet/sfc/efx.h
index fcea937..e41a717 100644
--- a/drivers/net/ethernet/sfc/efx.h
+++ b/drivers/net/ethernet/sfc/efx.h
@@ -32,8 +32,9 @@ netdev_tx_t efx_hard_start_xmit(struct sk_buff *skb,
struct net_device *net_dev);
netdev_tx_t efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb);
void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index);
-int efx_setup_tc(struct net_device *net_dev, u32 handle, u32 chain_index,
- __be16 proto, struct tc_to_netdev *tc);
+int efx_setup_tc(struct net_device *net_dev, enum tc_setup_type type,
+ u32 handle, u32 chain_index, __be16 proto,
+ struct tc_to_netdev *tc);
unsigned int efx_tx_max_skb_descs(struct efx_nic *efx);
extern unsigned int efx_piobuf_size;
extern bool efx_separate_tx_channels;
diff --git a/drivers/net/ethernet/sfc/falcon/efx.h b/drivers/net/ethernet/sfc/falcon/efx.h
index e5a7a40..f3bc67e 100644
--- a/drivers/net/ethernet/sfc/falcon/efx.h
+++ b/drivers/net/ethernet/sfc/falcon/efx.h
@@ -32,8 +32,9 @@ netdev_tx_t ef4_hard_start_xmit(struct sk_buff *skb,
struct net_device *net_dev);
netdev_tx_t ef4_enqueue_skb(struct ef4_tx_queue *tx_queue, struct sk_buff *skb);
void ef4_xmit_done(struct ef4_tx_queue *tx_queue, unsigned int index);
-int ef4_setup_tc(struct net_device *net_dev, u32 handle, u32 chain_index,
- __be16 proto, struct tc_to_netdev *tc);
+int ef4_setup_tc(struct net_device *net_dev, enum tc_setup_type type,
+ u32 handle, u32 chain_index, __be16 proto,
+ struct tc_to_netdev *tc);
unsigned int ef4_tx_max_skb_descs(struct ef4_nic *efx);
extern bool ef4_separate_tx_channels;
diff --git a/drivers/net/ethernet/sfc/falcon/tx.c b/drivers/net/ethernet/sfc/falcon/tx.c
index f1520a4..6c47526 100644
--- a/drivers/net/ethernet/sfc/falcon/tx.c
+++ b/drivers/net/ethernet/sfc/falcon/tx.c
@@ -425,8 +425,9 @@ void ef4_init_tx_queue_core_txq(struct ef4_tx_queue *tx_queue)
efx->n_tx_channels : 0));
}
-int ef4_setup_tc(struct net_device *net_dev, u32 handle, u32 chain_index,
- __be16 proto, struct tc_to_netdev *ntc)
+int ef4_setup_tc(struct net_device *net_dev, enum tc_setup_type type,
+ u32 handle, u32 chain_index, __be16 proto,
+ struct tc_to_netdev *ntc)
{
struct ef4_nic *efx = netdev_priv(net_dev);
struct ef4_channel *channel;
@@ -434,7 +435,7 @@ int ef4_setup_tc(struct net_device *net_dev, u32 handle, u32 chain_index,
unsigned tc, num_tc;
int rc;
- if (ntc->type != TC_SETUP_MQPRIO)
+ if (type != TC_SETUP_MQPRIO)
return -EINVAL;
num_tc = ntc->mqprio->num_tc;
diff --git a/drivers/net/ethernet/sfc/tx.c b/drivers/net/ethernet/sfc/tx.c
index 02d41eb..0c08c10 100644
--- a/drivers/net/ethernet/sfc/tx.c
+++ b/drivers/net/ethernet/sfc/tx.c
@@ -653,8 +653,9 @@ void efx_init_tx_queue_core_txq(struct efx_tx_queue *tx_queue)
efx->n_tx_channels : 0));
}
-int efx_setup_tc(struct net_device *net_dev, u32 handle, u32 chain_index,
- __be16 proto, struct tc_to_netdev *ntc)
+int efx_setup_tc(struct net_device *net_dev, enum tc_setup_type type,
+ u32 handle, u32 chain_index, __be16 proto,
+ struct tc_to_netdev *ntc)
{
struct efx_nic *efx = netdev_priv(net_dev);
struct efx_channel *channel;
@@ -662,7 +663,7 @@ int efx_setup_tc(struct net_device *net_dev, u32 handle, u32 chain_index,
unsigned tc, num_tc;
int rc;
- if (ntc->type != TC_SETUP_MQPRIO)
+ if (type != TC_SETUP_MQPRIO)
return -EINVAL;
num_tc = ntc->mqprio->num_tc;
diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c
index 9d52c3a..cb21742 100644
--- a/drivers/net/ethernet/ti/netcp_core.c
+++ b/drivers/net/ethernet/ti/netcp_core.c
@@ -1877,8 +1877,9 @@ static u16 netcp_select_queue(struct net_device *dev, struct sk_buff *skb,
return 0;
}
-static int netcp_setup_tc(struct net_device *dev, u32 handle, u32 chain_index,
- __be16 proto, struct tc_to_netdev *tc)
+static int netcp_setup_tc(struct net_device *dev, enum tc_setup_type type,
+ u32 handle, u32 chain_index, __be16 proto,
+ struct tc_to_netdev *tc)
{
u8 num_tc;
int i;
@@ -1886,7 +1887,7 @@ static int netcp_setup_tc(struct net_device *dev, u32 handle, u32 chain_index,
/* setup tc must be called under rtnl lock */
ASSERT_RTNL();
- if (tc->type != TC_SETUP_MQPRIO)
+ if (type != TC_SETUP_MQPRIO)
return -EINVAL;
tc->mqprio->hw = TC_MQPRIO_HW_OFFLOAD_TCS;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 3a3cdc1..e4238e5 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -774,7 +774,7 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
/* These structures hold the attributes of qdisc and classifiers
* that are being passed to the netdevice through the setup_tc op.
*/
-enum {
+enum tc_setup_type {
TC_SETUP_MQPRIO,
TC_SETUP_CLSU32,
TC_SETUP_CLSFLOWER,
@@ -785,7 +785,6 @@ enum {
struct tc_cls_u32_offload;
struct tc_to_netdev {
- unsigned int type;
union {
struct tc_cls_u32_offload *cls_u32;
struct tc_cls_flower_offload *cls_flower;
@@ -978,8 +977,9 @@ struct xfrmdev_ops {
* with PF and querying it may introduce a theoretical security risk.
* int (*ndo_set_vf_rss_query_en)(struct net_device *dev, int vf, bool setting);
* int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb);
- * int (*ndo_setup_tc)(struct net_device *dev, u32 handle, u32 chain_index,
- * __be16 protocol, struct tc_to_netdev *tc);
+ * int (*ndo_setup_tc)(struct net_device *dev, enum tc_setup_type type,
+ * u32 handle, u32 chain_index, __be16 protocol,
+ * struct tc_to_netdev *tc);
* Called to setup any 'tc' scheduler, classifier or action on @dev.
* This is always called from the stack with the rtnl lock held and netif
* tx queues stopped. This allows the netdevice to perform queue
@@ -1227,6 +1227,7 @@ struct net_device_ops {
struct net_device *dev,
int vf, bool setting);
int (*ndo_setup_tc)(struct net_device *dev,
+ enum tc_setup_type type,
u32 handle, u32 chain_index,
__be16 protocol,
struct tc_to_netdev *tc);
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 75c5c58..b4b63c2 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -863,8 +863,8 @@ static void dsa_slave_del_cls_matchall(struct net_device *dev,
kfree(mall_tc_entry);
}
-static int dsa_slave_setup_tc(struct net_device *dev, u32 handle,
- u32 chain_index, __be16 protocol,
+static int dsa_slave_setup_tc(struct net_device *dev, enum tc_setup_type type,
+ u32 handle, u32 chain_index, __be16 protocol,
struct tc_to_netdev *tc)
{
bool ingress = TC_H_MAJ(handle) == TC_H_MAJ(TC_H_INGRESS);
@@ -872,7 +872,7 @@ static int dsa_slave_setup_tc(struct net_device *dev, u32 handle,
if (chain_index)
return -EOPNOTSUPP;
- switch (tc->type) {
+ switch (type) {
case TC_SETUP_MATCHALL:
switch (tc->cls_mall->command) {
case TC_CLSMATCHALL_REPLACE:
diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c
index cf248c3..e2bf275 100644
--- a/net/sched/cls_bpf.c
+++ b/net/sched/cls_bpf.c
@@ -151,7 +151,6 @@ static int cls_bpf_offload_cmd(struct tcf_proto *tp, struct cls_bpf_prog *prog,
struct tc_to_netdev offload;
int err;
- offload.type = TC_SETUP_CLSBPF;
offload.cls_bpf = &bpf_offload;
bpf_offload.command = cmd;
@@ -161,7 +160,8 @@ static int cls_bpf_offload_cmd(struct tcf_proto *tp, struct cls_bpf_prog *prog,
bpf_offload.exts_integrated = prog->exts_integrated;
bpf_offload.gen_flags = prog->gen_flags;
- err = dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle,
+ err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSBPF,
+ tp->q->handle,
tp->chain->index,
tp->protocol, &offload);
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index 7ab524f..ddeed17 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -236,11 +236,10 @@ static void fl_hw_destroy_filter(struct tcf_proto *tp, struct cls_fl_filter *f)
offload.prio = tp->prio;
offload.cookie = (unsigned long)f;
- tc->type = TC_SETUP_CLSFLOWER;
tc->cls_flower = &offload;
- dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle, tp->chain->index,
- tp->protocol, tc);
+ dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSFLOWER, tp->q->handle,
+ tp->chain->index, tp->protocol, tc);
}
static int fl_hw_replace_filter(struct tcf_proto *tp,
@@ -273,11 +272,11 @@ static int fl_hw_replace_filter(struct tcf_proto *tp,
offload.key = &f->mkey;
offload.exts = &f->exts;
- tc->type = TC_SETUP_CLSFLOWER;
tc->cls_flower = &offload;
- err = dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle,
- tp->chain->index, tp->protocol, tc);
+ err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSFLOWER,
+ tp->q->handle, tp->chain->index,
+ tp->protocol, tc);
if (!err)
f->flags |= TCA_CLS_FLAGS_IN_HW;
@@ -300,10 +299,9 @@ static void fl_hw_update_stats(struct tcf_proto *tp, struct cls_fl_filter *f)
offload.cookie = (unsigned long)f;
offload.exts = &f->exts;
- tc->type = TC_SETUP_CLSFLOWER;
tc->cls_flower = &offload;
- dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle,
+ dev->netdev_ops->ndo_setup_tc(dev, TC_CLSFLOWER_STATS, tp->q->handle,
tp->chain->index, tp->protocol, tc);
}
diff --git a/net/sched/cls_matchall.c b/net/sched/cls_matchall.c
index f35177b..6ffe0b8 100644
--- a/net/sched/cls_matchall.c
+++ b/net/sched/cls_matchall.c
@@ -58,14 +58,13 @@ static int mall_replace_hw_filter(struct tcf_proto *tp,
struct tc_cls_matchall_offload mall_offload = {0};
int err;
- offload.type = TC_SETUP_MATCHALL;
offload.cls_mall = &mall_offload;
offload.cls_mall->command = TC_CLSMATCHALL_REPLACE;
offload.cls_mall->exts = &head->exts;
offload.cls_mall->cookie = cookie;
- err = dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle,
- tp->chain->index,
+ err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_MATCHALL,
+ tp->q->handle, tp->chain->index,
tp->protocol, &offload);
if (!err)
head->flags |= TCA_CLS_FLAGS_IN_HW;
@@ -81,14 +80,13 @@ static void mall_destroy_hw_filter(struct tcf_proto *tp,
struct tc_to_netdev offload;
struct tc_cls_matchall_offload mall_offload = {0};
- offload.type = TC_SETUP_MATCHALL;
offload.cls_mall = &mall_offload;
offload.cls_mall->command = TC_CLSMATCHALL_DESTROY;
offload.cls_mall->exts = NULL;
offload.cls_mall->cookie = cookie;
- dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle, tp->chain->index,
- tp->protocol, &offload);
+ dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_MATCHALL, tp->q->handle,
+ tp->chain->index, tp->protocol, &offload);
}
static void mall_destroy(struct tcf_proto *tp)
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
index 9fd2437..d1bae4c 100644
--- a/net/sched/cls_u32.c
+++ b/net/sched/cls_u32.c
@@ -434,15 +434,14 @@ static void u32_remove_hw_knode(struct tcf_proto *tp, u32 handle)
struct tc_cls_u32_offload u32_offload = {0};
struct tc_to_netdev offload;
- offload.type = TC_SETUP_CLSU32;
offload.cls_u32 = &u32_offload;
if (tc_should_offload(dev, tp, 0)) {
offload.cls_u32->command = TC_CLSU32_DELETE_KNODE;
offload.cls_u32->knode.handle = handle;
- dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle,
- tp->chain->index, tp->protocol,
- &offload);
+ dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSU32,
+ tp->q->handle, tp->chain->index,
+ tp->protocol, &offload);
}
}
@@ -457,7 +456,6 @@ static int u32_replace_hw_hnode(struct tcf_proto *tp, struct tc_u_hnode *h,
if (!tc_should_offload(dev, tp, flags))
return tc_skip_sw(flags) ? -EINVAL : 0;
- offload.type = TC_SETUP_CLSU32;
offload.cls_u32 = &u32_offload;
offload.cls_u32->command = TC_CLSU32_NEW_HNODE;
@@ -465,7 +463,7 @@ static int u32_replace_hw_hnode(struct tcf_proto *tp, struct tc_u_hnode *h,
offload.cls_u32->hnode.handle = h->handle;
offload.cls_u32->hnode.prio = h->prio;
- err = dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle,
+ err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSU32, tp->q->handle,
tp->chain->index, tp->protocol,
&offload);
if (tc_skip_sw(flags))
@@ -480,7 +478,6 @@ static void u32_clear_hw_hnode(struct tcf_proto *tp, struct tc_u_hnode *h)
struct tc_cls_u32_offload u32_offload = {0};
struct tc_to_netdev offload;
- offload.type = TC_SETUP_CLSU32;
offload.cls_u32 = &u32_offload;
if (tc_should_offload(dev, tp, 0)) {
@@ -489,9 +486,9 @@ static void u32_clear_hw_hnode(struct tcf_proto *tp, struct tc_u_hnode *h)
offload.cls_u32->hnode.handle = h->handle;
offload.cls_u32->hnode.prio = h->prio;
- dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle,
- tp->chain->index, tp->protocol,
- &offload);
+ dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSU32,
+ tp->q->handle, tp->chain->index,
+ tp->protocol, &offload);
}
}
@@ -503,7 +500,6 @@ static int u32_replace_hw_knode(struct tcf_proto *tp, struct tc_u_knode *n,
struct tc_to_netdev offload;
int err;
- offload.type = TC_SETUP_CLSU32;
offload.cls_u32 = &u32_offload;
if (!tc_should_offload(dev, tp, flags))
@@ -524,7 +520,7 @@ static int u32_replace_hw_knode(struct tcf_proto *tp, struct tc_u_knode *n,
if (n->ht_down)
offload.cls_u32->knode.link_handle = n->ht_down->handle;
- err = dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle,
+ err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSU32, tp->q->handle,
tp->chain->index, tp->protocol,
&offload);
diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c
index e0c0272..329610c 100644
--- a/net/sched/sch_mqprio.c
+++ b/net/sched/sch_mqprio.c
@@ -40,10 +40,10 @@ static void mqprio_destroy(struct Qdisc *sch)
if (priv->hw_offload && dev->netdev_ops->ndo_setup_tc) {
struct tc_mqprio_qopt offload = { 0 };
- struct tc_to_netdev tc = { .type = TC_SETUP_MQPRIO,
- { .mqprio = &offload } };
+ struct tc_to_netdev tc = { { .mqprio = &offload } };
- dev->netdev_ops->ndo_setup_tc(dev, sch->handle, 0, 0, &tc);
+ dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_MQPRIO,
+ sch->handle, 0, 0, &tc);
} else {
netdev_set_num_tc(dev, 0);
}
@@ -149,11 +149,10 @@ static int mqprio_init(struct Qdisc *sch, struct nlattr *opt)
*/
if (qopt->hw) {
struct tc_mqprio_qopt offload = *qopt;
- struct tc_to_netdev tc = { .type = TC_SETUP_MQPRIO,
- { .mqprio = &offload } };
+ struct tc_to_netdev tc = { { .mqprio = &offload } };
- err = dev->netdev_ops->ndo_setup_tc(dev, sch->handle,
- 0, 0, &tc);
+ err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_MQPRIO,
+ sch->handle, 0, 0, &tc);
if (err)
return err;
--
2.9.3
^ permalink raw reply related
* [patch net-next v2 02/16] net: sched: rename TC_SETUP_MATCHALL to TC_SETUP_CLSMATCHALL
From: Jiri Pirko @ 2017-08-07 8:15 UTC (permalink / raw)
To: netdev
Cc: davem, jhs, xiyou.wangcong, daniel, mlxsw, andrew, vivien.didelot,
f.fainelli, simon.horman, pieter.jansenvanvuuren,
dirk.vandermerwe, alexander.h.duyck, amritha.nambiar, oss-drivers,
yisen.zhuang, salil.mehta
In-Reply-To: <20170807081532.32760-1-jiri@resnulli.us>
From: Jiri Pirko <jiri@mellanox.com>
In order to be aligned with the rest of the types, rename
TC_SETUP_MATCHALL to TC_SETUP_CLSMATCHALL.
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 2 +-
include/linux/netdevice.h | 2 +-
net/dsa/slave.c | 2 +-
net/sched/cls_matchall.c | 4 ++--
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index 1554242..6438c38 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -1704,7 +1704,7 @@ static int mlxsw_sp_setup_tc(struct net_device *dev, enum tc_setup_type type,
return -EOPNOTSUPP;
switch (type) {
- case TC_SETUP_MATCHALL:
+ case TC_SETUP_CLSMATCHALL:
switch (tc->cls_mall->command) {
case TC_CLSMATCHALL_REPLACE:
return mlxsw_sp_port_add_cls_matchall(mlxsw_sp_port,
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index e4238e5..f8051a3 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -778,7 +778,7 @@ enum tc_setup_type {
TC_SETUP_MQPRIO,
TC_SETUP_CLSU32,
TC_SETUP_CLSFLOWER,
- TC_SETUP_MATCHALL,
+ TC_SETUP_CLSMATCHALL,
TC_SETUP_CLSBPF,
};
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index b4b63c2..453f6dd 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -873,7 +873,7 @@ static int dsa_slave_setup_tc(struct net_device *dev, enum tc_setup_type type,
return -EOPNOTSUPP;
switch (type) {
- case TC_SETUP_MATCHALL:
+ case TC_SETUP_CLSMATCHALL:
switch (tc->cls_mall->command) {
case TC_CLSMATCHALL_REPLACE:
return dsa_slave_add_cls_matchall(dev, protocol,
diff --git a/net/sched/cls_matchall.c b/net/sched/cls_matchall.c
index 6ffe0b8..a8853ad 100644
--- a/net/sched/cls_matchall.c
+++ b/net/sched/cls_matchall.c
@@ -63,7 +63,7 @@ static int mall_replace_hw_filter(struct tcf_proto *tp,
offload.cls_mall->exts = &head->exts;
offload.cls_mall->cookie = cookie;
- err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_MATCHALL,
+ err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSMATCHALL,
tp->q->handle, tp->chain->index,
tp->protocol, &offload);
if (!err)
@@ -85,7 +85,7 @@ static void mall_destroy_hw_filter(struct tcf_proto *tp,
offload.cls_mall->exts = NULL;
offload.cls_mall->cookie = cookie;
- dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_MATCHALL, tp->q->handle,
+ dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSMATCHALL, tp->q->handle,
tp->chain->index, tp->protocol, &offload);
}
--
2.9.3
^ permalink raw reply related
* [patch net-next v2 03/16] net: sched: make egress_dev flag part of flower offload struct
From: Jiri Pirko @ 2017-08-07 8:15 UTC (permalink / raw)
To: netdev
Cc: davem, jhs, xiyou.wangcong, daniel, mlxsw, andrew, vivien.didelot,
f.fainelli, simon.horman, pieter.jansenvanvuuren,
dirk.vandermerwe, alexander.h.duyck, amritha.nambiar, oss-drivers,
yisen.zhuang, salil.mehta
In-Reply-To: <20170807081532.32760-1-jiri@resnulli.us>
From: Jiri Pirko <jiri@mellanox.com>
Since this is specific to flower now, make it part of the flower offload
struct.
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 2 +-
include/linux/netdevice.h | 1 -
include/net/pkt_cls.h | 1 +
net/sched/cls_flower.c | 2 +-
4 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index d44049e..0e6bab1 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -661,7 +661,7 @@ static int mlx5e_rep_ndo_setup_tc(struct net_device *dev,
if (TC_H_MAJ(handle) != TC_H_MAJ(TC_H_INGRESS))
return -EOPNOTSUPP;
- if (tc->egress_dev) {
+ if (type == TC_SETUP_CLSFLOWER && tc->cls_flower->egress_dev) {
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
struct net_device *uplink_dev = mlx5_eswitch_get_uplink_netdev(esw);
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index f8051a3..bd49dba 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -792,7 +792,6 @@ struct tc_to_netdev {
struct tc_cls_bpf_offload *cls_bpf;
struct tc_mqprio_qopt *mqprio;
};
- bool egress_dev;
};
/* These structures hold the attributes of xdp state that are being passed
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index e0c54f1..8213acd 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -504,6 +504,7 @@ struct tc_cls_flower_offload {
struct fl_flow_key *mask;
struct fl_flow_key *key;
struct tcf_exts *exts;
+ bool egress_dev;
};
enum tc_matchall_command {
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index ddeed17..52deeed 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -259,7 +259,7 @@ static int fl_hw_replace_filter(struct tcf_proto *tp,
return tc_skip_sw(f->flags) ? -EINVAL : 0;
}
dev = f->hw_dev;
- tc->egress_dev = true;
+ offload.egress_dev = true;
} else {
f->hw_dev = dev;
}
--
2.9.3
^ permalink raw reply related
* [patch net-next v2 04/16] cxgb4: push cls_u32 setup_tc processing into a separate function
From: Jiri Pirko @ 2017-08-07 8:15 UTC (permalink / raw)
To: netdev
Cc: davem, jhs, xiyou.wangcong, daniel, mlxsw, andrew, vivien.didelot,
f.fainelli, simon.horman, pieter.jansenvanvuuren,
dirk.vandermerwe, alexander.h.duyck, amritha.nambiar, oss-drivers,
yisen.zhuang, salil.mehta
In-Reply-To: <20170807081532.32760-1-jiri@resnulli.us>
From: Jiri Pirko <jiri@mellanox.com>
Let cxgb_setup_tc be a splitter for specific setup_tc types and push out
cls_u32 specific code into a separate function.
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
---
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 42 +++++++++++++++----------
1 file changed, 26 insertions(+), 16 deletions(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index 89d2b0c..6512290 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -2889,6 +2889,26 @@ static int cxgb_set_tx_maxrate(struct net_device *dev, int index, u32 rate)
return err;
}
+static int cxgb_setup_tc_cls_u32(struct net_device *dev,
+ enum tc_setup_type type,
+ u32 handle, u32 chain_index, __be16 proto,
+ struct tc_cls_u32_offload *cls_u32)
+{
+ if (TC_H_MAJ(handle) != TC_H_MAJ(TC_H_INGRESS) ||
+ chain_index)
+ return -EOPNOTSUPP;
+
+ switch (cls_u32->command) {
+ case TC_CLSU32_NEW_KNODE:
+ case TC_CLSU32_REPLACE_KNODE:
+ return cxgb4_config_knode(dev, proto, cls_u32);
+ case TC_CLSU32_DELETE_KNODE:
+ return cxgb4_delete_knode(dev, proto, cls_u32);
+ default:
+ return -EOPNOTSUPP;
+ }
+}
+
static int cxgb_setup_tc(struct net_device *dev, enum tc_setup_type type,
u32 handle, u32 chain_index, __be16 proto,
struct tc_to_netdev *tc)
@@ -2896,9 +2916,6 @@ static int cxgb_setup_tc(struct net_device *dev, enum tc_setup_type type,
struct port_info *pi = netdev2pinfo(dev);
struct adapter *adap = netdev2adap(dev);
- if (chain_index)
- return -EOPNOTSUPP;
-
if (!(adap->flags & FULL_INIT_DONE)) {
dev_err(adap->pdev_dev,
"Failed to setup tc on port %d. Link Down?\n",
@@ -2906,20 +2923,13 @@ static int cxgb_setup_tc(struct net_device *dev, enum tc_setup_type type,
return -EINVAL;
}
- if (TC_H_MAJ(handle) == TC_H_MAJ(TC_H_INGRESS) &&
- type == TC_SETUP_CLSU32) {
- switch (tc->cls_u32->command) {
- case TC_CLSU32_NEW_KNODE:
- case TC_CLSU32_REPLACE_KNODE:
- return cxgb4_config_knode(dev, proto, tc->cls_u32);
- case TC_CLSU32_DELETE_KNODE:
- return cxgb4_delete_knode(dev, proto, tc->cls_u32);
- default:
- return -EOPNOTSUPP;
- }
+ switch (type) {
+ case TC_SETUP_CLSU32:
+ return cxgb_setup_tc_cls_u32(dev, type, handle, chain_index,
+ proto, tc->cls_u32);
+ default:
+ return -EOPNOTSUPP;
}
-
- return -EOPNOTSUPP;
}
static netdev_features_t cxgb_fix_features(struct net_device *dev,
--
2.9.3
^ permalink raw reply related
* [patch net-next v2 05/16] ixgbe: push cls_u32 and mqprio setup_tc processing into separate functions
From: Jiri Pirko @ 2017-08-07 8:15 UTC (permalink / raw)
To: netdev
Cc: davem, jhs, xiyou.wangcong, daniel, mlxsw, andrew, vivien.didelot,
f.fainelli, simon.horman, pieter.jansenvanvuuren,
dirk.vandermerwe, alexander.h.duyck, amritha.nambiar, oss-drivers,
yisen.zhuang, salil.mehta
In-Reply-To: <20170807081532.32760-1-jiri@resnulli.us>
From: Jiri Pirko <jiri@mellanox.com>
Let __ixgbe_setup_tc be a splitter for specific setup_tc types and push out
cls_u32 and mqprio specific codes into separate functions. Also change
the return values so they are the same as in the rest of the drivers.
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 67 ++++++++++++++++-----------
1 file changed, 39 insertions(+), 28 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index d39db97..35db198 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -9226,42 +9226,53 @@ static int ixgbe_configure_clsu32(struct ixgbe_adapter *adapter,
return err;
}
-static int __ixgbe_setup_tc(struct net_device *dev, enum tc_setup_type type,
- u32 handle, u32 chain_index, __be16 proto,
- struct tc_to_netdev *tc)
+static int ixgbe_setup_tc_cls_u32(struct net_device *dev,
+ u32 handle, u32 chain_index, __be16 proto,
+ struct tc_cls_u32_offload *cls_u32)
{
struct ixgbe_adapter *adapter = netdev_priv(dev);
- if (chain_index)
+ if (TC_H_MAJ(handle) != TC_H_MAJ(TC_H_INGRESS) ||
+ chain_index)
return -EOPNOTSUPP;
- if (TC_H_MAJ(handle) == TC_H_MAJ(TC_H_INGRESS) &&
- type == TC_SETUP_CLSU32) {
- switch (tc->cls_u32->command) {
- case TC_CLSU32_NEW_KNODE:
- case TC_CLSU32_REPLACE_KNODE:
- return ixgbe_configure_clsu32(adapter,
- proto, tc->cls_u32);
- case TC_CLSU32_DELETE_KNODE:
- return ixgbe_delete_clsu32(adapter, tc->cls_u32);
- case TC_CLSU32_NEW_HNODE:
- case TC_CLSU32_REPLACE_HNODE:
- return ixgbe_configure_clsu32_add_hnode(adapter, proto,
- tc->cls_u32);
- case TC_CLSU32_DELETE_HNODE:
- return ixgbe_configure_clsu32_del_hnode(adapter,
- tc->cls_u32);
- default:
- return -EINVAL;
- }
+ switch (cls_u32->command) {
+ case TC_CLSU32_NEW_KNODE:
+ case TC_CLSU32_REPLACE_KNODE:
+ return ixgbe_configure_clsu32(adapter, proto, cls_u32);
+ case TC_CLSU32_DELETE_KNODE:
+ return ixgbe_delete_clsu32(adapter, cls_u32);
+ case TC_CLSU32_NEW_HNODE:
+ case TC_CLSU32_REPLACE_HNODE:
+ return ixgbe_configure_clsu32_add_hnode(adapter, proto,
+ cls_u32);
+ case TC_CLSU32_DELETE_HNODE:
+ return ixgbe_configure_clsu32_del_hnode(adapter, cls_u32);
+ default:
+ return -EOPNOTSUPP;
}
+}
- if (type != TC_SETUP_MQPRIO)
- return -EINVAL;
-
- tc->mqprio->hw = TC_MQPRIO_HW_OFFLOAD_TCS;
+static int ixgbe_setup_tc_mqprio(struct net_device *dev,
+ struct tc_mqprio_qopt *mqprio)
+{
+ mqprio->hw = TC_MQPRIO_HW_OFFLOAD_TCS;
+ return ixgbe_setup_tc(dev, mqprio->num_tc);
+}
- return ixgbe_setup_tc(dev, tc->mqprio->num_tc);
+static int __ixgbe_setup_tc(struct net_device *dev, enum tc_setup_type type,
+ u32 handle, u32 chain_index, __be16 proto,
+ struct tc_to_netdev *tc)
+{
+ switch (type) {
+ case TC_SETUP_CLSU32:
+ return ixgbe_setup_tc_cls_u32(dev, handle, chain_index, proto,
+ tc->cls_u32);
+ case TC_SETUP_MQPRIO:
+ return ixgbe_setup_tc_mqprio(dev, tc->mqprio);
+ default:
+ return -EOPNOTSUPP;
+ }
}
#ifdef CONFIG_PCI_IOV
--
2.9.3
^ permalink raw reply related
* [patch net-next v2 06/16] mlx5e: push cls_flower and mqprio setup_tc processing into separate functions
From: Jiri Pirko @ 2017-08-07 8:15 UTC (permalink / raw)
To: netdev
Cc: davem, jhs, xiyou.wangcong, daniel, mlxsw, andrew, vivien.didelot,
f.fainelli, simon.horman, pieter.jansenvanvuuren,
dirk.vandermerwe, alexander.h.duyck, amritha.nambiar, oss-drivers,
yisen.zhuang, salil.mehta
In-Reply-To: <20170807081532.32760-1-jiri@resnulli.us>
From: Jiri Pirko <jiri@mellanox.com>
Let mlx5e_setup_tc (former mlx5e_ndo_setup_tc) be a splitter for specific
setup_tc types and push out cls_flower and mqprio specific codes into
separate functions. Also change the return values so they are the same
as in the rest of the drivers.
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 56 +++++++++++++----------
1 file changed, 31 insertions(+), 25 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 4052e225f..adf35da 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -2998,12 +2998,16 @@ static int mlx5e_modify_channels_vsd(struct mlx5e_channels *chs, bool vsd)
return 0;
}
-static int mlx5e_setup_tc(struct net_device *netdev, u8 tc)
+static int mlx5e_setup_tc_mqprio(struct net_device *netdev,
+ struct tc_mqprio_qopt *mqprio)
{
struct mlx5e_priv *priv = netdev_priv(netdev);
struct mlx5e_channels new_channels = {};
+ u8 tc = mqprio->num_tc;
int err = 0;
+ mqprio->hw = TC_MQPRIO_HW_OFFLOAD_TCS;
+
if (tc && tc != MLX5E_MAX_NUM_TC)
return -EINVAL;
@@ -3027,39 +3031,41 @@ static int mlx5e_setup_tc(struct net_device *netdev, u8 tc)
return err;
}
-static int mlx5e_ndo_setup_tc(struct net_device *dev, enum tc_setup_type type,
- u32 handle, u32 chain_index, __be16 proto,
- struct tc_to_netdev *tc)
+static int mlx5e_setup_tc_cls_flower(struct net_device *dev,
+ u32 handle, u32 chain_index, __be16 proto,
+ struct tc_cls_flower_offload *cls_flower)
{
struct mlx5e_priv *priv = netdev_priv(dev);
- if (TC_H_MAJ(handle) != TC_H_MAJ(TC_H_INGRESS))
- goto mqprio;
+ if (TC_H_MAJ(handle) != TC_H_MAJ(TC_H_INGRESS) ||
+ chain_index)
+ return -EOPNOTSUPP;
- if (chain_index)
+ switch (cls_flower->command) {
+ case TC_CLSFLOWER_REPLACE:
+ return mlx5e_configure_flower(priv, proto, cls_flower);
+ case TC_CLSFLOWER_DESTROY:
+ return mlx5e_delete_flower(priv, cls_flower);
+ case TC_CLSFLOWER_STATS:
+ return mlx5e_stats_flower(priv, cls_flower);
+ default:
return -EOPNOTSUPP;
+ }
+}
+static int mlx5e_setup_tc(struct net_device *dev, enum tc_setup_type type,
+ u32 handle, u32 chain_index, __be16 proto,
+ struct tc_to_netdev *tc)
+{
switch (type) {
case TC_SETUP_CLSFLOWER:
- switch (tc->cls_flower->command) {
- case TC_CLSFLOWER_REPLACE:
- return mlx5e_configure_flower(priv, proto, tc->cls_flower);
- case TC_CLSFLOWER_DESTROY:
- return mlx5e_delete_flower(priv, tc->cls_flower);
- case TC_CLSFLOWER_STATS:
- return mlx5e_stats_flower(priv, tc->cls_flower);
- }
+ return mlx5e_setup_tc_cls_flower(dev, handle, chain_index,
+ proto, tc->cls_flower);
+ case TC_SETUP_MQPRIO:
+ return mlx5e_setup_tc_mqprio(dev, tc->mqprio);
default:
return -EOPNOTSUPP;
}
-
-mqprio:
- if (type != TC_SETUP_MQPRIO)
- return -EINVAL;
-
- tc->mqprio->hw = TC_MQPRIO_HW_OFFLOAD_TCS;
-
- return mlx5e_setup_tc(dev, tc->mqprio->num_tc);
}
static void
@@ -3695,7 +3701,7 @@ static const struct net_device_ops mlx5e_netdev_ops_basic = {
.ndo_open = mlx5e_open,
.ndo_stop = mlx5e_close,
.ndo_start_xmit = mlx5e_xmit,
- .ndo_setup_tc = mlx5e_ndo_setup_tc,
+ .ndo_setup_tc = mlx5e_setup_tc,
.ndo_select_queue = mlx5e_select_queue,
.ndo_get_stats64 = mlx5e_get_stats,
.ndo_set_rx_mode = mlx5e_set_rx_mode,
@@ -3720,7 +3726,7 @@ static const struct net_device_ops mlx5e_netdev_ops_sriov = {
.ndo_open = mlx5e_open,
.ndo_stop = mlx5e_close,
.ndo_start_xmit = mlx5e_xmit,
- .ndo_setup_tc = mlx5e_ndo_setup_tc,
+ .ndo_setup_tc = mlx5e_setup_tc,
.ndo_select_queue = mlx5e_select_queue,
.ndo_get_stats64 = mlx5e_get_stats,
.ndo_set_rx_mode = mlx5e_set_rx_mode,
--
2.9.3
^ permalink raw reply related
* [patch net-next v2 07/16] mlx5e_rep: push cls_flower setup_tc processing into a separate function
From: Jiri Pirko @ 2017-08-07 8:15 UTC (permalink / raw)
To: netdev
Cc: davem, jhs, xiyou.wangcong, daniel, mlxsw, andrew, vivien.didelot,
f.fainelli, simon.horman, pieter.jansenvanvuuren,
dirk.vandermerwe, alexander.h.duyck, amritha.nambiar, oss-drivers,
yisen.zhuang, salil.mehta
In-Reply-To: <20170807081532.32760-1-jiri@resnulli.us>
From: Jiri Pirko <jiri@mellanox.com>
Let mlx5e_rep_setup_tc (former mlx5e_rep_ndo_setup_tc) be a splitter for
specific setup_tc types and push out cls_flower specific code into
a separate function.
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 49 ++++++++++++++----------
1 file changed, 29 insertions(+), 20 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index 0e6bab1..e6cc642 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -651,38 +651,47 @@ static int mlx5e_rep_get_phys_port_name(struct net_device *dev,
return 0;
}
-static int mlx5e_rep_ndo_setup_tc(struct net_device *dev,
- enum tc_setup_type type, u32 handle,
- u32 chain_index, __be16 proto,
- struct tc_to_netdev *tc)
+static int mlx5e_rep_setup_tc_cls_flower(struct net_device *dev,
+ u32 handle, u32 chain_index,
+ __be16 proto,
+ struct tc_to_netdev *tc)
{
+ struct tc_cls_flower_offload *cls_flower = tc->cls_flower;
struct mlx5e_priv *priv = netdev_priv(dev);
- if (TC_H_MAJ(handle) != TC_H_MAJ(TC_H_INGRESS))
+ if (TC_H_MAJ(handle) != TC_H_MAJ(TC_H_INGRESS) ||
+ chain_index)
return -EOPNOTSUPP;
- if (type == TC_SETUP_CLSFLOWER && tc->cls_flower->egress_dev) {
+ if (cls_flower->egress_dev) {
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
- struct net_device *uplink_dev = mlx5_eswitch_get_uplink_netdev(esw);
- return uplink_dev->netdev_ops->ndo_setup_tc(uplink_dev, type,
- handle, chain_index,
- proto, tc);
+ dev = mlx5_eswitch_get_uplink_netdev(esw);
+ return dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSFLOWER,
+ handle, chain_index,
+ proto, tc);
}
- if (chain_index)
+ switch (cls_flower->command) {
+ case TC_CLSFLOWER_REPLACE:
+ return mlx5e_configure_flower(priv, proto, cls_flower);
+ case TC_CLSFLOWER_DESTROY:
+ return mlx5e_delete_flower(priv, cls_flower);
+ case TC_CLSFLOWER_STATS:
+ return mlx5e_stats_flower(priv, cls_flower);
+ default:
return -EOPNOTSUPP;
+ }
+}
+static int mlx5e_rep_setup_tc(struct net_device *dev, enum tc_setup_type type,
+ u32 handle, u32 chain_index, __be16 proto,
+ struct tc_to_netdev *tc)
+{
switch (type) {
case TC_SETUP_CLSFLOWER:
- switch (tc->cls_flower->command) {
- case TC_CLSFLOWER_REPLACE:
- return mlx5e_configure_flower(priv, proto, tc->cls_flower);
- case TC_CLSFLOWER_DESTROY:
- return mlx5e_delete_flower(priv, tc->cls_flower);
- case TC_CLSFLOWER_STATS:
- return mlx5e_stats_flower(priv, tc->cls_flower);
- }
+ return mlx5e_rep_setup_tc_cls_flower(dev, handle, chain_index,
+ proto, tc);
default:
return -EOPNOTSUPP;
}
@@ -774,7 +783,7 @@ static const struct net_device_ops mlx5e_netdev_ops_rep = {
.ndo_stop = mlx5e_rep_close,
.ndo_start_xmit = mlx5e_xmit,
.ndo_get_phys_port_name = mlx5e_rep_get_phys_port_name,
- .ndo_setup_tc = mlx5e_rep_ndo_setup_tc,
+ .ndo_setup_tc = mlx5e_rep_setup_tc,
.ndo_get_stats64 = mlx5e_rep_get_stats,
.ndo_has_offload_stats = mlx5e_has_offload_stats,
.ndo_get_offload_stats = mlx5e_get_offload_stats,
--
2.9.3
^ permalink raw reply related
* [patch net-next v2 08/16] mlxsw: spectrum: push cls_flower and cls_matchall setup_tc processing into separate functions
From: Jiri Pirko @ 2017-08-07 8:15 UTC (permalink / raw)
To: netdev
Cc: davem, jhs, xiyou.wangcong, daniel, mlxsw, andrew, vivien.didelot,
f.fainelli, simon.horman, pieter.jansenvanvuuren,
dirk.vandermerwe, alexander.h.duyck, amritha.nambiar, oss-drivers,
yisen.zhuang, salil.mehta
In-Reply-To: <20170807081532.32760-1-jiri@resnulli.us>
From: Jiri Pirko <jiri@mellanox.com>
Let mlxsw_sp_setup_tc be a splitter for specific setup_tc types and push
out cls_flower and cls_matchall specific codes into separate functions.
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 81 ++++++++++++++++----------
1 file changed, 51 insertions(+), 30 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index 6438c38..9f8ba37 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -1693,46 +1693,67 @@ static void mlxsw_sp_port_del_cls_matchall(struct mlxsw_sp_port *mlxsw_sp_port,
kfree(mall_tc_entry);
}
-static int mlxsw_sp_setup_tc(struct net_device *dev, enum tc_setup_type type,
+static int mlxsw_sp_setup_tc_cls_matchall(struct mlxsw_sp_port *mlxsw_sp_port,
+ u32 handle, u32 chain_index,
+ __be16 proto,
+ struct tc_cls_matchall_offload *f)
+{
+ bool ingress = TC_H_MAJ(handle) == TC_H_MAJ(TC_H_INGRESS);
+
+ if (chain_index)
+ return -EOPNOTSUPP;
+
+ switch (f->command) {
+ case TC_CLSMATCHALL_REPLACE:
+ return mlxsw_sp_port_add_cls_matchall(mlxsw_sp_port, proto, f,
+ ingress);
+ case TC_CLSMATCHALL_DESTROY:
+ mlxsw_sp_port_del_cls_matchall(mlxsw_sp_port, f);
+ return 0;
+ default:
+ return -EOPNOTSUPP;
+ }
+}
+
+static int
+mlxsw_sp_setup_tc_cls_flower(struct mlxsw_sp_port *mlxsw_sp_port,
u32 handle, u32 chain_index, __be16 proto,
- struct tc_to_netdev *tc)
+ struct tc_cls_flower_offload *f)
{
- struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);
bool ingress = TC_H_MAJ(handle) == TC_H_MAJ(TC_H_INGRESS);
if (chain_index)
return -EOPNOTSUPP;
+ switch (f->command) {
+ case TC_CLSFLOWER_REPLACE:
+ return mlxsw_sp_flower_replace(mlxsw_sp_port, ingress,
+ proto, f);
+ case TC_CLSFLOWER_DESTROY:
+ mlxsw_sp_flower_destroy(mlxsw_sp_port, ingress, f);
+ return 0;
+ case TC_CLSFLOWER_STATS:
+ return mlxsw_sp_flower_stats(mlxsw_sp_port, ingress, f);
+ default:
+ return -EOPNOTSUPP;
+ }
+}
+
+static int mlxsw_sp_setup_tc(struct net_device *dev, enum tc_setup_type type,
+ u32 handle, u32 chain_index, __be16 proto,
+ struct tc_to_netdev *tc)
+{
+ struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);
+
switch (type) {
case TC_SETUP_CLSMATCHALL:
- switch (tc->cls_mall->command) {
- case TC_CLSMATCHALL_REPLACE:
- return mlxsw_sp_port_add_cls_matchall(mlxsw_sp_port,
- proto,
- tc->cls_mall,
- ingress);
- case TC_CLSMATCHALL_DESTROY:
- mlxsw_sp_port_del_cls_matchall(mlxsw_sp_port,
- tc->cls_mall);
- return 0;
- default:
- return -EOPNOTSUPP;
- }
+ return mlxsw_sp_setup_tc_cls_matchall(mlxsw_sp_port, handle,
+ chain_index, proto,
+ tc->cls_mall);
case TC_SETUP_CLSFLOWER:
- switch (tc->cls_flower->command) {
- case TC_CLSFLOWER_REPLACE:
- return mlxsw_sp_flower_replace(mlxsw_sp_port, ingress,
- proto, tc->cls_flower);
- case TC_CLSFLOWER_DESTROY:
- mlxsw_sp_flower_destroy(mlxsw_sp_port, ingress,
- tc->cls_flower);
- return 0;
- case TC_CLSFLOWER_STATS:
- return mlxsw_sp_flower_stats(mlxsw_sp_port, ingress,
- tc->cls_flower);
- default:
- return -EOPNOTSUPP;
- }
+ return mlxsw_sp_setup_tc_cls_flower(mlxsw_sp_port, handle,
+ chain_index, proto,
+ tc->cls_flower);
default:
return -EOPNOTSUPP;
}
--
2.9.3
^ permalink raw reply related
* [patch net-next v2 09/16] mlxsw: spectrum: rename cls arg in matchall processing
From: Jiri Pirko @ 2017-08-07 8:15 UTC (permalink / raw)
To: netdev
Cc: davem, jhs, xiyou.wangcong, daniel, mlxsw, andrew, vivien.didelot,
f.fainelli, simon.horman, pieter.jansenvanvuuren,
dirk.vandermerwe, alexander.h.duyck, amritha.nambiar, oss-drivers,
yisen.zhuang, salil.mehta
In-Reply-To: <20170807081532.32760-1-jiri@resnulli.us>
From: Jiri Pirko <jiri@mellanox.com>
To sync-up with the naming in the rest of the driver, rename the cls arg.
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index 9f8ba37..f333d08 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -1618,7 +1618,7 @@ mlxsw_sp_port_del_cls_matchall_sample(struct mlxsw_sp_port *mlxsw_sp_port)
static int mlxsw_sp_port_add_cls_matchall(struct mlxsw_sp_port *mlxsw_sp_port,
__be16 protocol,
- struct tc_cls_matchall_offload *cls,
+ struct tc_cls_matchall_offload *f,
bool ingress)
{
struct mlxsw_sp_port_mall_tc_entry *mall_tc_entry;
@@ -1626,7 +1626,7 @@ static int mlxsw_sp_port_add_cls_matchall(struct mlxsw_sp_port *mlxsw_sp_port,
LIST_HEAD(actions);
int err;
- if (!tcf_exts_has_one_action(cls->exts)) {
+ if (!tcf_exts_has_one_action(f->exts)) {
netdev_err(mlxsw_sp_port->dev, "only singular actions are supported\n");
return -EOPNOTSUPP;
}
@@ -1634,9 +1634,9 @@ static int mlxsw_sp_port_add_cls_matchall(struct mlxsw_sp_port *mlxsw_sp_port,
mall_tc_entry = kzalloc(sizeof(*mall_tc_entry), GFP_KERNEL);
if (!mall_tc_entry)
return -ENOMEM;
- mall_tc_entry->cookie = cls->cookie;
+ mall_tc_entry->cookie = f->cookie;
- tcf_exts_to_list(cls->exts, &actions);
+ tcf_exts_to_list(f->exts, &actions);
a = list_first_entry(&actions, struct tc_action, list);
if (is_tcf_mirred_egress_mirror(a) && protocol == htons(ETH_P_ALL)) {
@@ -1648,7 +1648,7 @@ static int mlxsw_sp_port_add_cls_matchall(struct mlxsw_sp_port *mlxsw_sp_port,
mirror, a, ingress);
} else if (is_tcf_sample(a) && protocol == htons(ETH_P_ALL)) {
mall_tc_entry->type = MLXSW_SP_PORT_MALL_SAMPLE;
- err = mlxsw_sp_port_add_cls_matchall_sample(mlxsw_sp_port, cls,
+ err = mlxsw_sp_port_add_cls_matchall_sample(mlxsw_sp_port, f,
a, ingress);
} else {
err = -EOPNOTSUPP;
@@ -1666,12 +1666,12 @@ static int mlxsw_sp_port_add_cls_matchall(struct mlxsw_sp_port *mlxsw_sp_port,
}
static void mlxsw_sp_port_del_cls_matchall(struct mlxsw_sp_port *mlxsw_sp_port,
- struct tc_cls_matchall_offload *cls)
+ struct tc_cls_matchall_offload *f)
{
struct mlxsw_sp_port_mall_tc_entry *mall_tc_entry;
mall_tc_entry = mlxsw_sp_port_mall_tc_entry_find(mlxsw_sp_port,
- cls->cookie);
+ f->cookie);
if (!mall_tc_entry) {
netdev_dbg(mlxsw_sp_port->dev, "tc entry not found on port\n");
return;
--
2.9.3
^ permalink raw reply related
* [patch net-next v2 10/16] dsa: push cls_matchall setup_tc processing into a separate function
From: Jiri Pirko @ 2017-08-07 8:15 UTC (permalink / raw)
To: netdev
Cc: davem, jhs, xiyou.wangcong, daniel, mlxsw, andrew, vivien.didelot,
f.fainelli, simon.horman, pieter.jansenvanvuuren,
dirk.vandermerwe, alexander.h.duyck, amritha.nambiar, oss-drivers,
yisen.zhuang, salil.mehta
In-Reply-To: <20170807081532.32760-1-jiri@resnulli.us>
From: Jiri Pirko <jiri@mellanox.com>
Let dsa_slave_setup_tc be a splitter for specific setup_tc types and
push out cls_matchall specific code into a separate function.
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
net/dsa/slave.c | 33 +++++++++++++++++++++------------
1 file changed, 21 insertions(+), 12 deletions(-)
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 453f6dd..e76d576 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -863,26 +863,35 @@ static void dsa_slave_del_cls_matchall(struct net_device *dev,
kfree(mall_tc_entry);
}
-static int dsa_slave_setup_tc(struct net_device *dev, enum tc_setup_type type,
- u32 handle, u32 chain_index, __be16 protocol,
- struct tc_to_netdev *tc)
+static int dsa_slave_setup_tc_cls_matchall(struct net_device *dev,
+ u32 handle, u32 chain_index,
+ __be16 protocol,
+ struct tc_cls_matchall_offload *cls)
{
bool ingress = TC_H_MAJ(handle) == TC_H_MAJ(TC_H_INGRESS);
if (chain_index)
return -EOPNOTSUPP;
+ switch (cls->command) {
+ case TC_CLSMATCHALL_REPLACE:
+ return dsa_slave_add_cls_matchall(dev, protocol, cls, ingress);
+ case TC_CLSMATCHALL_DESTROY:
+ dsa_slave_del_cls_matchall(dev, cls);
+ return 0;
+ default:
+ return -EOPNOTSUPP;
+ }
+}
+
+static int dsa_slave_setup_tc(struct net_device *dev, enum tc_setup_type type,
+ u32 handle, u32 chain_index, __be16 protocol,
+ struct tc_to_netdev *tc)
+{
switch (type) {
case TC_SETUP_CLSMATCHALL:
- switch (tc->cls_mall->command) {
- case TC_CLSMATCHALL_REPLACE:
- return dsa_slave_add_cls_matchall(dev, protocol,
- tc->cls_mall,
- ingress);
- case TC_CLSMATCHALL_DESTROY:
- dsa_slave_del_cls_matchall(dev, tc->cls_mall);
- return 0;
- }
+ return dsa_slave_setup_tc_cls_matchall(dev, handle, chain_index,
+ protocol, tc->cls_mall);
default:
return -EOPNOTSUPP;
}
--
2.9.3
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox