* Re: [pull request][net-next 00/10] Mellanox, mlx5 and devlink updates 2018-07-31
From: Jakub Kicinski @ 2018-08-07 0:49 UTC (permalink / raw)
To: Eran Ben Elisha
Cc: David Miller, saeedm, netdev, jiri, alexander.duyck, helgaas
In-Reply-To: <952362c1-6886-5293-bee4-267d87a79cba@mellanox.com>
On Mon, 6 Aug 2018 16:01:25 +0300, Eran Ben Elisha wrote:
> >> Hi Dave,
> >> I would like to re-state that this feature was not meant to be a generic
> >> one. This feature was added in order to resolve a HW bug which exist in
> >> a small portion of our devices.
> >
> > Would you mind describing the HW bug in more detail? To a outside
> > reviewer it really looks like you're adding a feature. What are you
> > working around? Is the lack of full AQM on the PCIe side of the chip
> > considered a bug?
>
> In multiple function environment, there is an issue with buffer
> allocation per function which may lead to starvation.
Multi-function? I thought you have a PF per uplink on all mlx5
silicon. Does the problem occur in single host scenarios as well?
What if with single function the host is too slow with taking packets
off the RX ring? Can the problem occur? Would this feature help in
such scenario as well?
> There is an HW WA for mitigate this starvation by identifying this
> state and apply early drop/mark.
If I understand you correctly you presently have one shared buffer with
no way to place limits (quotas) on how much of it can be consumed by a
traffic for a single PF. It remains unclear why this have not been a
problem for you until now.
To avoid the starvation you are adding AQM which is a *feature* that
may help you avoid queue build up in the NIC. But even if you could
place quotas, why would you not expose the AQM scheme? It looks very
useful.
> >> Those params will be used only on those current HWs and won't be in
> >> use for our future devices.
> >
> > I'm glad that is your plan today, however, customers may get used to
> > the simple interface you're adding now. This means the API you are
> > adding is effectively becoming an API other drivers may need to
> > implement to keep compatibility with someone's proprietary
> > orchestration.
>
> This issue was refactored, thus no need to have this WA at all in
> future NICs. So I don't believe we will end up in the situation you are
> describing. It is less likely that other vendors will be facing the
> same issue and will have to support such param. it was burn out of a
> bug and not as a feature which other may follow.
Sure other vendors may have buffers quotas configurable by e.g.
devlink-sb. But the AQM you are adding is a feature which is
potentially already supported by others.
> >> During the discussions, several alternatives where offered to be
> >> used by various members of the community. These alternatives
> >> includes TC and enhancements to PCI configuration tools.
> >>
> >> Regarding the TC, from my perspective, this is not an option as:
> >> 1) The HW mechanism handles multiple functions and therefore
> >> cannot be configured on as a regular TC
> >
> > Could you elaborate? What are the multiple functions? You seem to
> > be adding a knob to enable ECN marking and a knob for choosing
> > between some predefined slopes.
>
> PSB, The sloped are dynamic and enabled in a dynamic way.
> Indeed, we are adding a very specific knob for very non standard
> specific issue which can be used in addition to standard ECN marking.
>
> > In what way would your solution not behave like a RED offload?
>
> Existing Algo (RED, PIE, etc) are static, configurable. Our HW WA is
> dynamic (dynamic slope), adjusted and auto enabled.
You mean like Adaptive RED? The lack of documentation is making this
conversation harder to have. What's dynamic and aggressive? These
are not antonyms. Are the parameters to the algorithm configurable?
Will you not want to expose the actual threshold and adjustment values
so the customers can tweak them on their own depending on the workload?
> > With TC offload you'd also get a well-defined set of statistics, I
> > presume right now you're planning on adding a set of ethtool -S
> > counters?
> >
> >> 2) No PF + representors modeling can be applied here, this is a
> >> MultiHost environment where one host is not aware to the other
> >> hosts, and each is running on its own pci/driver. It is a device
> >> working mode configuration.
> >
> > Yes, the multihost part makes it less pleasant. But this is a
> > problem we have to tackle separately, at some point. It's not a
> > center of attention here.
>
> Agree, however the multihost part makes it non-transparent if we
> chose a solution which is not based on direct vendor configuration.
> This will lead to a bad user experience.
In my experience multi-host is not a major issue in practice. And
switchdev mode gives some visibility into statistics of others hosts
etc., which people appreciate.
^ permalink raw reply
* linux-next: manual merge of the net-next tree with the netfilter tree
From: Stephen Rothwell @ 2018-08-07 2:49 UTC (permalink / raw)
To: David Miller, Networking, Pablo Neira Ayuso, NetFilter
Cc: Linux-Next Mailing List, Linux Kernel Mailing List, Matteo Croce,
Julian Anastasov
[-- Attachment #1: Type: text/plain, Size: 2676 bytes --]
Hi all,
Today's linux-next merge of the net-next tree got a conflict in:
net/netfilter/ipvs/ip_vs_conn.c
between commit:
16e98cec49a4 ("ipvs: don't show negative times in ip_vs_conn")
from the netfilter tree and commit:
ec1b28ca9674 ("ipvs: provide just conn to ip_vs_state_name")
from the net-next tree.
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.
--
Cheers,
Stephen Rothwell
diff --cc net/netfilter/ipvs/ip_vs_conn.c
index 615286dcf4c0,0edc62910ebf..000000000000
--- a/net/netfilter/ipvs/ip_vs_conn.c
+++ b/net/netfilter/ipvs/ip_vs_conn.c
@@@ -1107,10 -1122,8 +1122,10 @@@ static int ip_vs_conn_seq_show(struct s
&cp->caddr.in6, ntohs(cp->cport),
&cp->vaddr.in6, ntohs(cp->vport),
dbuf, ntohs(cp->dport),
- ip_vs_state_name(cp->protocol, cp->state),
+ ip_vs_state_name(cp),
- (cp->timer.expires-jiffies)/HZ, pe_data);
+ jiffies_delta_to_msecs(cp->timer.expires -
+ jiffies) / 1000,
+ pe_data);
else
#endif
seq_printf(seq,
@@@ -1120,10 -1133,8 +1135,10 @@@
ntohl(cp->caddr.ip), ntohs(cp->cport),
ntohl(cp->vaddr.ip), ntohs(cp->vport),
dbuf, ntohs(cp->dport),
- ip_vs_state_name(cp->protocol, cp->state),
+ ip_vs_state_name(cp),
- (cp->timer.expires-jiffies)/HZ, pe_data);
+ jiffies_delta_to_msecs(cp->timer.expires -
+ jiffies) / 1000,
+ pe_data);
}
return 0;
}
@@@ -1173,10 -1184,9 +1188,10 @@@ static int ip_vs_conn_sync_seq_show(str
&cp->caddr.in6, ntohs(cp->cport),
&cp->vaddr.in6, ntohs(cp->vport),
dbuf, ntohs(cp->dport),
- ip_vs_state_name(cp->protocol, cp->state),
+ ip_vs_state_name(cp),
ip_vs_origin_name(cp->flags),
- (cp->timer.expires-jiffies)/HZ);
+ jiffies_delta_to_msecs(cp->timer.expires -
+ jiffies) / 1000);
else
#endif
seq_printf(seq,
@@@ -1186,10 -1196,9 +1201,10 @@@
ntohl(cp->caddr.ip), ntohs(cp->cport),
ntohl(cp->vaddr.ip), ntohs(cp->vport),
dbuf, ntohs(cp->dport),
- ip_vs_state_name(cp->protocol, cp->state),
+ ip_vs_state_name(cp),
ip_vs_origin_name(cp->flags),
- (cp->timer.expires-jiffies)/HZ);
+ jiffies_delta_to_msecs(cp->timer.expires -
+ jiffies) / 1000);
}
return 0;
}
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply
* we do the editing
From: Jason James @ 2018-08-06 14:07 UTC (permalink / raw)
To: netdev
Want to follow up the email sent last week.
Do you have needs for photo editing?
We can edit 400 images within 24 hours.
We are working on all kinds of ecommerce photos, jewelry photos, and the
portrait images.
We do cutting out and clipping path and others, and also we provide
retouching for your photos,
You can throw us a photo and we will do testing for you to check our
quality.
Thanks,
Jason
^ permalink raw reply
* Re: [PATCH v4] selftests: add headers_install to lib.mk
From: Masahiro Yamada @ 2018-08-07 2:32 UTC (permalink / raw)
To: Shuah Khan
Cc: Anders Roxell, Michal Marek, Bamvor Zhang, brgl, Paolo Bonzini,
Andrew Morton, Mike Rapoport, Andrea Arcangeli,
Linux Kbuild mailing list, Linux Kernel Mailing List,
open list:KERNEL SELFTEST FRAMEWORK, Networking
In-Reply-To: <3f332e65-0b33-9952-6aba-f9c8953a1f26@kernel.org>
2018-08-07 2:03 GMT+09:00 Shuah Khan <shuah@kernel.org>:
> Hi Anders,
>
> On 07/25/2018 10:08 AM, Anders Roxell wrote:
>> On Tue, 24 Jul 2018 at 19:11, Shuah Khan <shuah@kernel.org> wrote:
>>>
>>> On 07/23/2018 02:49 PM, Anders Roxell wrote:
>>>> On Thu, 7 Jun 2018 at 13:09, Anders Roxell <anders.roxell@linaro.org> wrote:
>>>>>
>>>>> If the kernel headers aren't installed we can't build all the tests.
>>>>> Add a new make target rule 'khdr' in the file lib.mk to generate the
>>>>> kernel headers and that gets include for every test-dir Makefile that
>>>>> includes lib.mk If the testdir in turn have its own sub-dirs the
>>>>> top_srcdir needs to be set to the linux-rootdir to be able to generate
>>>>> the kernel headers.
>>>>>
>>>>> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
>>>>> Reviewed-by: Fathi Boudra <fathi.boudra@linaro.org>
>>>>> ---
>>>>> Makefile | 14 +-------------
>>>>> scripts/subarch.include | 13 +++++++++++++
>>>>> tools/testing/selftests/android/Makefile | 2 +-
>>>>> tools/testing/selftests/android/ion/Makefile | 2 ++
>>>>> tools/testing/selftests/futex/functional/Makefile | 1 +
>>>>> tools/testing/selftests/gpio/Makefile | 7 ++-----
>>>>> tools/testing/selftests/kvm/Makefile | 7 ++-----
>>>>> tools/testing/selftests/lib.mk | 12 ++++++++++++
>>>>> tools/testing/selftests/net/Makefile | 1 +
>>>>> .../selftests/networking/timestamping/Makefile | 1 +
>>>>> tools/testing/selftests/vm/Makefile | 4 ----
>>>>> 11 files changed, 36 insertions(+), 28 deletions(-)
>>>>> create mode 100644 scripts/subarch.include
>>>>>
>>>>> diff --git a/Makefile b/Makefile
>>>>> index 6b9aea95ae3a..8050072300fa 100644
>>>>> --- a/Makefile
>>>>> +++ b/Makefile
>>>>> @@ -286,19 +286,7 @@ KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
>>>>> KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
>>>>> export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
>>>>>
>>>>> -# SUBARCH tells the usermode build what the underlying arch is. That is set
>>>>> -# first, and if a usermode build is happening, the "ARCH=um" on the command
>>>>> -# line overrides the setting of ARCH below. If a native build is happening,
>>>>> -# then ARCH is assigned, getting whatever value it gets normally, and
>>>>> -# SUBARCH is subsequently ignored.
>>>>> -
>>>>> -SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
>>>>> - -e s/sun4u/sparc64/ \
>>>>> - -e s/arm.*/arm/ -e s/sa110/arm/ \
>>>>> - -e s/s390x/s390/ -e s/parisc64/parisc/ \
>>>>> - -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
>>>>> - -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \
>>>>> - -e s/riscv.*/riscv/)
>>>>> +include scripts/subarch.include
>>>
>>> What is the reason for this SUBARCH block move to to scripts/subarch.include?
>>> Is this necessary for adding headers install dependency to lib.mk?
>>
>> This is needed to create headers for cross build.
>>
>
> I am sorry for the delay on this patch. I am going to get this into 4.19.
> If anybody has objections, please let me.
>
> Anders! Will be able to rebase the patch and send me the latest. I think
> I have Acks from kvm, android, and vm so far.
>
I may be missing something about the tools/ directory,
but why isn't it like this?
kselftest: headers_install
$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests
--
Best Regards
Masahiro Yamada
^ permalink raw reply
* Re: [PATCH net-next] tcp: fix the calculation of sysctl_max_tw_buckets in tcp_sk_init()
From: Yafang Shao @ 2018-08-07 1:40 UTC (permalink / raw)
To: David Miller; +Cc: Eric Dumazet, yanhaishuang, netdev, LKML
In-Reply-To: <20180806.134116.1016660959593702560.davem@davemloft.net>
On Tue, Aug 7, 2018 at 4:41 AM, David Miller <davem@davemloft.net> wrote:
> From: Yafang Shao <laoar.shao@gmail.com>
> Date: Mon, 6 Aug 2018 19:47:00 +0800
>
>> tcp_hashinfo.ehash_mask is always an odd number, which is set in function
>> alloc_large_system_hash(). See bellow,
>> if (_hash_mask)
>> *_hash_mask = (1 << log2qty) - 1; <<< always odd number
>>
>> Hence the local variable 'cnt' is a even number, as a result of that it is
>> no difference to do the incrementation here.
>>
>> Maybe the compiler could also optimize it, but this code is a little ugly.
>>
>> Fix: fee83d09 ("ipv4: Namespaceify tcp_max_syn_backlog knob")
>
> The correct tag is "Fixes: "
OK
>
>> @@ -2543,7 +2543,7 @@ static int __net_init tcp_sk_init(struct net *net)
>> net->ipv4.sysctl_tcp_tw_reuse = 2;
>>
>> cnt = tcp_hashinfo.ehash_mask + 1;
>> - net->ipv4.tcp_death_row.sysctl_max_tw_buckets = (cnt + 1) / 2;
>> + net->ipv4.tcp_death_row.sysctl_max_tw_buckets = cnt / 2;
>> net->ipv4.tcp_death_row.hashinfo = &tcp_hashinfo;
>
> This is completely harmless, and does no harm.
>
It is harmless, meanwhile, it is useless and a little ugly.
By the way, why do we init sysctl_max_tw_buckets to
(tcp_hashinfo.ehash_mask + 1) / 2 or (tcp_hashinfo.ehash_mask + 2) / 2
?
Per my pespective, this default value is a little huge, sometimes we
have to set this value to a lower value with sysctl, otherwise it may
easily cause tcp port exhaustion issue.
So why not just init it to a lower value ?
> You aren't "fixing" anything.
^ permalink raw reply
* [PATCH v6 9/9] nfp: Do not call pcie_print_link_status()
From: Alexandru Gagniuc @ 2018-08-06 23:25 UTC (permalink / raw)
To: linux-pci, bhelgaas, jakub.kicinski
Cc: keith.busch, alex_gagniuc, austin_bolen, shyam_iyer,
Alexandru Gagniuc, Ariel Elior, everest-linux-l2, David S. Miller,
Michael Chan, Ganesh Goudar, Jeff Kirsher, Tariq Toukan,
Saeed Mahameed, Leon Romanovsky, Dirk van der Merwe, netdev,
linux-kernel, intel-wired-lan, linux-rdma, oss-drivers
In-Reply-To: <20180806232600.25694-1-mr.nuke.me@gmail.com>
This is now done by the PCI core to warn of sub-optimal bandwidth.
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
---
drivers/net/ethernet/netronome/nfp/nfpcore/nfp6000_pcie.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp6000_pcie.c b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp6000_pcie.c
index 749655c329b2..0324f99bd1a7 100644
--- a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp6000_pcie.c
+++ b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp6000_pcie.c
@@ -1324,7 +1324,6 @@ struct nfp_cpp *nfp_cpp_from_nfp6000_pcie(struct pci_dev *pdev)
/* Finished with card initialization. */
dev_info(&pdev->dev,
"Netronome Flow Processor NFP4000/NFP6000 PCIe Card Probe\n");
- pcie_print_link_status(pdev);
nfp = kzalloc(sizeof(*nfp), GFP_KERNEL);
if (!nfp) {
--
2.17.1
^ permalink raw reply related
* [PATCH v6 4/9] cxgb4: Do not call pcie_print_link_status()
From: Alexandru Gagniuc @ 2018-08-06 23:25 UTC (permalink / raw)
To: linux-pci, bhelgaas, jakub.kicinski
Cc: keith.busch, alex_gagniuc, austin_bolen, shyam_iyer,
Alexandru Gagniuc, Ariel Elior, everest-linux-l2, David S. Miller,
Michael Chan, Ganesh Goudar, Jeff Kirsher, Tariq Toukan,
Saeed Mahameed, Leon Romanovsky, Dirk van der Merwe, netdev,
linux-kernel, intel-wired-lan, linux-rdma, oss-drivers
In-Reply-To: <20180806232600.25694-1-mr.nuke.me@gmail.com>
This is now done by the PCI core to warn of sub-optimal bandwidth.
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
---
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index a8926e97935e..049958898c17 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -5726,9 +5726,6 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
free_msix_info(adapter);
}
- /* check for PCI Express bandwidth capabiltites */
- pcie_print_link_status(pdev);
-
err = init_rss(adapter);
if (err)
goto out_free_dev;
--
2.17.1
^ permalink raw reply related
* [net-next:master 1745/1753] drivers/net/ieee802154/mac802154_hwsim.c:39:14: sparse: incorrect type in initializer (different address spaces)
From: kbuild test robot @ 2018-08-06 23:07 UTC (permalink / raw)
To: Alexander Aring; +Cc: kbuild-all, netdev, Stefan Schmidt
tree: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git master
head: de7de576eca204de9a38e2f6dafe6b7c1ddc85c1
commit: f25da51fdc381ca2863248c7060b3662632f0872 [1745/1753] ieee802154: hwsim: add replacement for fakelb
reproduce:
# apt-get install sparse
git checkout f25da51fdc381ca2863248c7060b3662632f0872
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__
sparse warnings: (new ones prefixed by >>)
>> drivers/net/ieee802154/mac802154_hwsim.c:39:14: sparse: incorrect type in initializer (different address spaces) @@ expected struct list_head *next @@ got struct list_head struct list_head *next @@
drivers/net/ieee802154/mac802154_hwsim.c:39:14: expected struct list_head *next
drivers/net/ieee802154/mac802154_hwsim.c:39:14: got struct list_head [noderef] <asn:4>*<noident>
>> drivers/net/ieee802154/mac802154_hwsim.c:39:14: sparse: incorrect type in initializer (different address spaces) @@ expected struct list_head *prev @@ got struct list_head struct list_head *prev @@
drivers/net/ieee802154/mac802154_hwsim.c:39:14: expected struct list_head *prev
drivers/net/ieee802154/mac802154_hwsim.c:39:14: got struct list_head [noderef] <asn:4>*<noident>
>> drivers/net/ieee802154/mac802154_hwsim.c:799:18: sparse: incorrect type in assignment (different address spaces) @@ expected struct hwsim_pib [noderef] <asn:4>*pib @@ got hwsim_pib [noderef] <asn:4>*pib @@
drivers/net/ieee802154/mac802154_hwsim.c:799:18: expected struct hwsim_pib [noderef] <asn:4>*pib
drivers/net/ieee802154/mac802154_hwsim.c:799:18: got struct hwsim_pib *[assigned] pib
>> drivers/net/ieee802154/mac802154_hwsim.c:801:25: sparse: incorrect type in argument 1 (different modifiers) @@ expected struct list_head *list @@ got struct lisstruct list_head *list @@
drivers/net/ieee802154/mac802154_hwsim.c:801:25: expected struct list_head *list
drivers/net/ieee802154/mac802154_hwsim.c:801:25: got struct list_head [noderef] *<noident>
>> drivers/net/ieee802154/mac802154_hwsim.c:835:9: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct callback_head *head @@ got struct callback_hstruct callback_head *head @@
drivers/net/ieee802154/mac802154_hwsim.c:835:9: expected struct callback_head *head
drivers/net/ieee802154/mac802154_hwsim.c:835:9: got struct callback_head [noderef] <asn:4>*<noident>
>> drivers/net/ieee802154/mac802154_hwsim.c:113:17: sparse: incorrect type in assignment (different address spaces) @@ expected struct hwsim_pib *pib_old @@ got struct hwsim_pib struct hwsim_pib *pib_old @@
drivers/net/ieee802154/mac802154_hwsim.c:113:17: expected struct hwsim_pib *pib_old
drivers/net/ieee802154/mac802154_hwsim.c:113:17: got struct hwsim_pib [noderef] <asn:4>*pib
>> drivers/net/ieee802154/mac802154_hwsim.c:130:9: sparse: incompatible types in comparison expression (different modifiers)
>> drivers/net/ieee802154/mac802154_hwsim.c:144:33: sparse: incompatible types in comparison expression (different address spaces)
>> drivers/net/ieee802154/mac802154_hwsim.c:161:40: sparse: incorrect type in argument 2 (different address spaces) @@ expected struct list_head *head @@ got struct list_head struct list_head *head @@
drivers/net/ieee802154/mac802154_hwsim.c:161:40: expected struct list_head *head
drivers/net/ieee802154/mac802154_hwsim.c:161:40: got struct list_head [noderef] <asn:4>*<noident>
>> drivers/net/ieee802154/mac802154_hwsim.c:232:25: sparse: incorrect type in argument 1 (different modifiers) @@ expected struct list_head const *head @@ got strustruct list_head const *head @@
drivers/net/ieee802154/mac802154_hwsim.c:232:25: expected struct list_head const *head
drivers/net/ieee802154/mac802154_hwsim.c:232:25: got struct list_head [noderef] *<noident>
drivers/net/ieee802154/mac802154_hwsim.c:243:9: sparse: incompatible types in comparison expression (different modifiers)
drivers/net/ieee802154/mac802154_hwsim.c:260:25: sparse: incompatible types in comparison expression (different address spaces)
drivers/net/ieee802154/mac802154_hwsim.c:460:9: sparse: incompatible types in comparison expression (different modifiers)
drivers/net/ieee802154/mac802154_hwsim.c:515:9: sparse: incompatible types in comparison expression (different modifiers)
drivers/net/ieee802154/mac802154_hwsim.c:573:9: sparse: incompatible types in comparison expression (different modifiers)
drivers/net/ieee802154/mac802154_hwsim.c:695:17: sparse: incompatible types in comparison expression (different modifiers)
>> drivers/net/ieee802154/mac802154_hwsim.c:717:41: sparse: incorrect type in argument 2 (different modifiers) @@ expected struct list_head *head @@ got struct lisstruct list_head *head @@
drivers/net/ieee802154/mac802154_hwsim.c:717:41: expected struct list_head *head
drivers/net/ieee802154/mac802154_hwsim.c:717:41: got struct list_head [noderef] *<noident>
drivers/net/ieee802154/mac802154_hwsim.c:725:41: sparse: incorrect type in argument 2 (different modifiers) @@ expected struct list_head *head @@ got struct lisstruct list_head *head @@
drivers/net/ieee802154/mac802154_hwsim.c:725:41: expected struct list_head *head
drivers/net/ieee802154/mac802154_hwsim.c:725:41: got struct list_head [noderef] *<noident>
vim +39 drivers/net/ieee802154/mac802154_hwsim.c
38
> 39 static __rcu LIST_HEAD(hwsim_ifup_phys);
40
41 static struct platform_device *mac802154hwsim_dev;
42
43 /* MAC802154_HWSIM netlink family */
44 static struct genl_family hwsim_genl_family;
45
46 static int hwsim_radio_idx;
47
48 enum hwsim_multicast_groups {
49 HWSIM_MCGRP_CONFIG,
50 };
51
52 static const struct genl_multicast_group hwsim_mcgrps[] = {
53 [HWSIM_MCGRP_CONFIG] = { .name = "config", },
54 };
55
56 struct hwsim_pib {
57 u8 page;
58 u8 channel;
59
60 struct rcu_head rcu;
61 };
62
63 struct hwsim_edge_info {
64 u8 lqi;
65
66 struct rcu_head rcu;
67 };
68
69 struct hwsim_edge {
70 struct hwsim_phy *endpoint;
71 struct hwsim_edge_info *info;
72
73 struct list_head list;
74 struct rcu_head rcu;
75 };
76
77 struct hwsim_phy {
78 struct ieee802154_hw *hw;
79 u32 idx;
80
81 struct hwsim_pib __rcu *pib;
82
83 bool suspended;
84 struct list_head __rcu edges;
85
86 struct list_head list;
87 struct list_head list_ifup;
88 };
89
90 static int hwsim_add_one(struct genl_info *info, struct device *dev,
91 bool init);
92 static void hwsim_del(struct hwsim_phy *phy);
93
94 static int hwsim_hw_ed(struct ieee802154_hw *hw, u8 *level)
95 {
96 *level = 0xbe;
97
98 return 0;
99 }
100
101 static int hwsim_hw_channel(struct ieee802154_hw *hw, u8 page, u8 channel)
102 {
103 struct hwsim_phy *phy = hw->priv;
104 struct hwsim_pib *pib, *pib_old;
105
106 pib = kzalloc(sizeof(*pib), GFP_KERNEL);
107 if (!pib)
108 return -ENOMEM;
109
110 pib->page = page;
111 pib->channel = channel;
112
> 113 pib_old = phy->pib;
114 rcu_assign_pointer(phy->pib, pib);
115 kfree_rcu(pib_old, rcu);
116 return 0;
117 }
118
119 static int hwsim_hw_xmit(struct ieee802154_hw *hw, struct sk_buff *skb)
120 {
121 struct hwsim_phy *current_phy = hw->priv;
122 struct hwsim_pib *current_pib, *endpoint_pib;
123 struct hwsim_edge_info *einfo;
124 struct hwsim_edge *e;
125
126 WARN_ON(current_phy->suspended);
127
128 rcu_read_lock();
129 current_pib = rcu_dereference(current_phy->pib);
> 130 list_for_each_entry_rcu(e, ¤t_phy->edges, list) {
131 /* Can be changed later in rx_irqsafe, but this is only a
132 * performance tweak. Received radio should drop the frame
133 * in mac802154 stack anyway... so we don't need to be
134 * 100% of locking here to check on suspended
135 */
136 if (e->endpoint->suspended)
137 continue;
138
139 endpoint_pib = rcu_dereference(e->endpoint->pib);
140 if (current_pib->page == endpoint_pib->page &&
141 current_pib->channel == endpoint_pib->channel) {
142 struct sk_buff *newskb = pskb_copy(skb, GFP_ATOMIC);
143
> 144 einfo = rcu_dereference(e->info);
145 if (newskb)
146 ieee802154_rx_irqsafe(e->endpoint->hw, newskb,
147 einfo->lqi);
148 }
149 }
150 rcu_read_unlock();
151
152 ieee802154_xmit_complete(hw, skb, false);
153 return 0;
154 }
155
156 static int hwsim_hw_start(struct ieee802154_hw *hw)
157 {
158 struct hwsim_phy *phy = hw->priv;
159
160 phy->suspended = false;
> 161 list_add_rcu(&phy->list_ifup, &hwsim_ifup_phys);
162 synchronize_rcu();
163
164 return 0;
165 }
166
167 static void hwsim_hw_stop(struct ieee802154_hw *hw)
168 {
169 struct hwsim_phy *phy = hw->priv;
170
171 phy->suspended = true;
172 list_del_rcu(&phy->list_ifup);
173 synchronize_rcu();
174 }
175
176 static int
177 hwsim_set_promiscuous_mode(struct ieee802154_hw *hw, const bool on)
178 {
179 return 0;
180 }
181
182 static const struct ieee802154_ops hwsim_ops = {
183 .owner = THIS_MODULE,
184 .xmit_async = hwsim_hw_xmit,
185 .ed = hwsim_hw_ed,
186 .set_channel = hwsim_hw_channel,
187 .start = hwsim_hw_start,
188 .stop = hwsim_hw_stop,
189 .set_promiscuous_mode = hwsim_set_promiscuous_mode,
190 };
191
192 static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info)
193 {
194 return hwsim_add_one(info, &mac802154hwsim_dev->dev, false);
195 }
196
197 static int hwsim_del_radio_nl(struct sk_buff *msg, struct genl_info *info)
198 {
199 struct hwsim_phy *phy, *tmp;
200 s64 idx = -1;
201
202 if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID])
203 return -EINVAL;
204
205 idx = nla_get_u32(info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID]);
206
207 mutex_lock(&hwsim_phys_lock);
208 list_for_each_entry_safe(phy, tmp, &hwsim_phys, list) {
209 if (idx == phy->idx) {
210 hwsim_del(phy);
211 mutex_unlock(&hwsim_phys_lock);
212 return 0;
213 }
214 }
215 mutex_unlock(&hwsim_phys_lock);
216
217 return -ENODEV;
218 }
219
220 static int append_radio_msg(struct sk_buff *skb, struct hwsim_phy *phy)
221 {
222 struct nlattr *nl_edges, *nl_edge;
223 struct hwsim_edge_info *einfo;
224 struct hwsim_edge *e;
225 int ret;
226
227 ret = nla_put_u32(skb, MAC802154_HWSIM_ATTR_RADIO_ID, phy->idx);
228 if (ret < 0)
229 return ret;
230
231 rcu_read_lock();
> 232 if (list_empty(&phy->edges)) {
233 rcu_read_unlock();
234 return 0;
235 }
236
237 nl_edges = nla_nest_start(skb, MAC802154_HWSIM_ATTR_RADIO_EDGES);
238 if (!nl_edges) {
239 rcu_read_unlock();
240 return -ENOBUFS;
241 }
242
243 list_for_each_entry_rcu(e, &phy->edges, list) {
244 nl_edge = nla_nest_start(skb, MAC802154_HWSIM_ATTR_RADIO_EDGE);
245 if (!nl_edge) {
246 rcu_read_unlock();
247 nla_nest_cancel(skb, nl_edges);
248 return -ENOBUFS;
249 }
250
251 ret = nla_put_u32(skb, MAC802154_HWSIM_EDGE_ATTR_ENDPOINT_ID,
252 e->endpoint->idx);
253 if (ret < 0) {
254 rcu_read_unlock();
255 nla_nest_cancel(skb, nl_edge);
256 nla_nest_cancel(skb, nl_edges);
257 return ret;
258 }
259
260 einfo = rcu_dereference(e->info);
261 ret = nla_put_u8(skb, MAC802154_HWSIM_EDGE_ATTR_LQI,
262 einfo->lqi);
263 if (ret < 0) {
264 rcu_read_unlock();
265 nla_nest_cancel(skb, nl_edge);
266 nla_nest_cancel(skb, nl_edges);
267 return ret;
268 }
269
270 nla_nest_end(skb, nl_edge);
271 }
272 rcu_read_unlock();
273
274 nla_nest_end(skb, nl_edges);
275
276 return 0;
277 }
278
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
^ permalink raw reply
* Re: e1000e driver stuck at 10Mbps after reconnection
From: Alexander Duyck @ 2018-08-06 22:45 UTC (permalink / raw)
To: Camille Bordignon; +Cc: Jeff Kirsher, David S. Miller, intel-wired-lan, Netdev
In-Reply-To: <20180806115913.GA21556@super_plancton>
On Mon, Aug 6, 2018 at 4:59 AM, Camille Bordignon
<camille.bordignon@easymile.com> wrote:
> Hello,
>
> Recently we experienced some issues with intel NIC (I219-LM and I219-V).
> It seems that after a wire reconnection, auto-negotation "fails" and
> link speed drips to 10 Mbps.
>
> From kernel logs:
> [17616.346150] e1000e: enp0s31f6 NIC Link is Down
> [17627.003322] e1000e: enp0s31f6 NIC Link is Up 10 Mbps Full Duplex, Flow Control: None
> [17627.003325] e1000e 0000:00:1f.6 enp0s31f6: 10/100 speed: disabling TSO
>
>
> $ethtool enp0s31f6
> Settings for enp0s31f6:
> Supported ports: [ TP ]
> Supported link modes: 10baseT/Half 10baseT/Full
> 100baseT/Half 100baseT/Full
> 1000baseT/Full
> Supported pause frame use: No
> Supports auto-negotiation: Yes
> Supported FEC modes: Not reported
> Advertised link modes: 10baseT/Half 10baseT/Full
> 100baseT/Half 100baseT/Full
> 1000baseT/Full
> Advertised pause frame use: No
> Advertised auto-negotiation: Yes
> Advertised FEC modes: Not reported
> Speed: 10Mb/s
> Duplex: Full
> Port: Twisted Pair
> PHYAD: 1
> Transceiver: internal
> Auto-negotiation: on
> MDI-X: on (auto)
> Supports Wake-on: pumbg
> Wake-on: g
> Current message level: 0x00000007 (7)
> drv probe link
> Link detected: yes
>
>
> Notice that if disconnection last less than about 5 seconds,
> nothing wrong happens.
> And if after last failure, disconnection / connection occurs again and
> last less than 5 seconds, link speed is back to 1000 Mbps.
>
> [18075.350678] e1000e: enp0s31f6 NIC Link is Down
> [18078.716245] e1000e: enp0s31f6 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None
>
> The following patch seems to fix this issue.
> However I don't clearly understand why.
>
> diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
> index 3ba0c90e7055..763c013960f1 100644
> --- a/drivers/net/ethernet/intel/e1000e/netdev.c
> +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
> @@ -5069,7 +5069,7 @@ static bool e1000e_has_link(struct e1000_adapter *adapter)
> case e1000_media_type_copper:
> if (hw->mac.get_link_status) {
> ret_val = hw->mac.ops.check_for_link(hw);
> - link_active = !hw->mac.get_link_status;
> + link_active = false;
> } else {
> link_active = true;
> }
>
> Maybe this is related to watchdog task.
>
> I've found out this fix by comparing with last commit that works fine :
> commit 0b76aae741abb9d16d2c0e67f8b1e766576f897d.
> However I don't know if this information is relevant.
>
> Thank you.
> Camille Bordignon
What kernel were you testing this on? I know there have been a number
of changes over the past few months in this area and it would be
useful to know exactly what code base you started out with and what
the latest version of the kernel is you have tested.
Looking over the code change the net effect of it should be to add a 2
second delay from the time the link has changed until you actually
check the speed/duplex configuration. It is possible we could be
seeing some sort of timing issue and adding the 2 second delay after
the link event is enough time for things to stabilize and detect the
link at 1000 instead of 10/100.
- Alex
^ permalink raw reply
* Re: [PATCH net-next 2/3] net: dsa: bcm_sf2: Propagate ethtool::rxnfc to CPU port
From: Florian Fainelli @ 2018-08-06 22:37 UTC (permalink / raw)
To: Andrew Lunn; +Cc: netdev, vivien.didelot, linville, davem
In-Reply-To: <20180806223225.GE18350@lunn.ch>
On 08/06/2018 03:32 PM, Andrew Lunn wrote:
>> int bcm_sf2_get_rxnfc(struct dsa_switch *ds, int port,
>> struct ethtool_rxnfc *nfc, u32 *rule_locs)
>> {
>> + struct net_device *p = ds->ports[port].cpu_dp->master;
>> struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
>> int ret = 0;
>>
>> @@ -1214,12 +1223,20 @@ int bcm_sf2_get_rxnfc(struct dsa_switch *ds, int port,
>>
>> mutex_unlock(&priv->cfp.lock);
>
> Hi Florian
>
> I think you should be testing ret here. If you have had a real error,
> you probably should be returning it, rather than overwriting it with
> what ethtool returns below.
Hu, right, thanks for spotting it, this is done in the set_rxnfc() part,
will submit a v2 shortly.
>
>> + /* Pass up the commands to the attached master network device */
>> + if (p->ethtool_ops->get_rxnfc) {
>> + ret = p->ethtool_ops->get_rxnfc(p, nfc, rule_locs);
>> + if (ret == -EOPNOTSUPP)
>> + ret = 0;
>> + }
>> +
>> return ret;
>> }
>
> Andrew
>
--
Florian
^ permalink raw reply
* Re: [PATCH net-next 2/3] net: dsa: bcm_sf2: Propagate ethtool::rxnfc to CPU port
From: Andrew Lunn @ 2018-08-06 22:32 UTC (permalink / raw)
To: Florian Fainelli; +Cc: netdev, vivien.didelot, linville, davem
In-Reply-To: <20180806212909.21720-4-f.fainelli@gmail.com>
> int bcm_sf2_get_rxnfc(struct dsa_switch *ds, int port,
> struct ethtool_rxnfc *nfc, u32 *rule_locs)
> {
> + struct net_device *p = ds->ports[port].cpu_dp->master;
> struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
> int ret = 0;
>
> @@ -1214,12 +1223,20 @@ int bcm_sf2_get_rxnfc(struct dsa_switch *ds, int port,
>
> mutex_unlock(&priv->cfp.lock);
Hi Florian
I think you should be testing ret here. If you have had a real error,
you probably should be returning it, rather than overwriting it with
what ethtool returns below.
> + /* Pass up the commands to the attached master network device */
> + if (p->ethtool_ops->get_rxnfc) {
> + ret = p->ethtool_ops->get_rxnfc(p, nfc, rule_locs);
> + if (ret == -EOPNOTSUPP)
> + ret = 0;
> + }
> +
> return ret;
> }
Andrew
^ permalink raw reply
* [PATCH net-next 3/3] net: systemport: Add support for WAKE_FILTER
From: Florian Fainelli @ 2018-08-06 21:29 UTC (permalink / raw)
To: netdev; +Cc: Florian Fainelli, andrew, vivien.didelot, linville, davem
In-Reply-To: <20180806212909.21720-1-f.fainelli@gmail.com>
The SYSTEMPORT MAC allows up to 8 filters to be programmed to wake-up
from LAN. Verify that we have up to 8 filters and program them to the
appropriate RXCHK entries to be matched (along with their masks).
We need to update the entry and exit to Wake-on-LAN mode to keep the
RXCHK engine running to match during suspend, but this is otherwise
fairly similar to Magic Packet detection.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/ethernet/broadcom/bcmsysport.c | 193 ++++++++++++++++++++-
drivers/net/ethernet/broadcom/bcmsysport.h | 11 +-
2 files changed, 195 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 284581c9680e..ca47309d4494 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -521,7 +521,7 @@ static void bcm_sysport_get_wol(struct net_device *dev,
struct bcm_sysport_priv *priv = netdev_priv(dev);
u32 reg;
- wol->supported = WAKE_MAGIC | WAKE_MAGICSECURE;
+ wol->supported = WAKE_MAGIC | WAKE_MAGICSECURE | WAKE_FILTER;
wol->wolopts = priv->wolopts;
if (!(priv->wolopts & WAKE_MAGICSECURE))
@@ -539,7 +539,7 @@ static int bcm_sysport_set_wol(struct net_device *dev,
{
struct bcm_sysport_priv *priv = netdev_priv(dev);
struct device *kdev = &priv->pdev->dev;
- u32 supported = WAKE_MAGIC | WAKE_MAGICSECURE;
+ u32 supported = WAKE_MAGIC | WAKE_MAGICSECURE | WAKE_FILTER;
if (!device_can_wakeup(kdev))
return -ENOTSUPP;
@@ -1043,7 +1043,7 @@ static int bcm_sysport_poll(struct napi_struct *napi, int budget)
static void mpd_enable_set(struct bcm_sysport_priv *priv, bool enable)
{
- u32 reg;
+ u32 reg, bit;
reg = umac_readl(priv, UMAC_MPD_CTRL);
if (enable)
@@ -1051,12 +1051,32 @@ static void mpd_enable_set(struct bcm_sysport_priv *priv, bool enable)
else
reg &= ~MPD_EN;
umac_writel(priv, reg, UMAC_MPD_CTRL);
+
+ if (priv->is_lite)
+ bit = RBUF_ACPI_EN_LITE;
+ else
+ bit = RBUF_ACPI_EN;
+
+ reg = rbuf_readl(priv, RBUF_CONTROL);
+ if (enable)
+ reg |= bit;
+ else
+ reg &= ~bit;
+ rbuf_writel(priv, reg, RBUF_CONTROL);
}
static void bcm_sysport_resume_from_wol(struct bcm_sysport_priv *priv)
{
+ u32 reg;
+
/* Stop monitoring MPD interrupt */
- intrl2_0_mask_set(priv, INTRL2_0_MPD);
+ intrl2_0_mask_set(priv, INTRL2_0_MPD | INTRL2_0_BRCM_MATCH_TAG);
+
+ /* Disable RXCHK, active filters and Broadcom tag matching */
+ reg = rxchk_readl(priv, RXCHK_CONTROL);
+ reg &= ~(RXCHK_BRCM_TAG_MATCH_MASK <<
+ RXCHK_BRCM_TAG_MATCH_SHIFT | RXCHK_EN | RXCHK_BRCM_TAG_EN);
+ rxchk_writel(priv, reg, RXCHK_CONTROL);
/* Clear the MagicPacket detection logic */
mpd_enable_set(priv, false);
@@ -1085,6 +1105,7 @@ static irqreturn_t bcm_sysport_rx_isr(int irq, void *dev_id)
struct bcm_sysport_priv *priv = netdev_priv(dev);
struct bcm_sysport_tx_ring *txr;
unsigned int ring, ring_bit;
+ u32 reg;
priv->irq0_stat = intrl2_0_readl(priv, INTRL2_CPU_STATUS) &
~intrl2_0_readl(priv, INTRL2_CPU_MASK_STATUS);
@@ -1111,7 +1132,14 @@ static irqreturn_t bcm_sysport_rx_isr(int irq, void *dev_id)
bcm_sysport_tx_reclaim_all(priv);
if (priv->irq0_stat & INTRL2_0_MPD)
- netdev_info(priv->netdev, "Wake-on-LAN interrupt!\n");
+ netdev_info(priv->netdev, "Wake-on-LAN (MPD) interrupt!\n");
+
+ if (priv->irq0_stat & INTRL2_0_BRCM_MATCH_TAG) {
+ reg = rxchk_readl(priv, RXCHK_BRCM_TAG_MATCH_STATUS) &
+ RXCHK_BRCM_TAG_MATCH_MASK;
+ netdev_info(priv->netdev,
+ "Wake-on-LAN (filters 0x%02x) interrupt!\n", reg);
+ }
if (!priv->is_lite)
goto out;
@@ -2096,6 +2124,132 @@ static int bcm_sysport_stop(struct net_device *dev)
return 0;
}
+static int bcm_sysport_rule_find(struct bcm_sysport_priv *priv,
+ u64 location)
+{
+ unsigned int index;
+ u32 reg;
+
+ for_each_set_bit(index, priv->filters, RXCHK_BRCM_TAG_MAX) {
+ reg = rxchk_readl(priv, RXCHK_BRCM_TAG(index));
+ reg >>= RXCHK_BRCM_TAG_CID_SHIFT;
+ reg &= RXCHK_BRCM_TAG_CID_MASK;
+ if (reg == location)
+ return index;
+ }
+
+ return -EINVAL;
+}
+
+static int bcm_sysport_rule_get(struct bcm_sysport_priv *priv,
+ struct ethtool_rxnfc *nfc)
+{
+ int index;
+
+ /* This is not a rule that we know about */
+ index = bcm_sysport_rule_find(priv, nfc->fs.location);
+ if (index < 0)
+ return -EOPNOTSUPP;
+
+ nfc->fs.ring_cookie = RX_CLS_FLOW_WAKE;
+
+ return 0;
+}
+
+static int bcm_sysport_rule_set(struct bcm_sysport_priv *priv,
+ struct ethtool_rxnfc *nfc)
+{
+ unsigned int index;
+ u32 reg;
+
+ /* We cannot match locations greater than what the classification ID
+ * permits (256 entries)
+ */
+ if (nfc->fs.location > RXCHK_BRCM_TAG_CID_MASK)
+ return -E2BIG;
+
+ /* We cannot support flows that are not destined for a wake-up */
+ if (nfc->fs.ring_cookie != RX_CLS_FLOW_WAKE)
+ return -EOPNOTSUPP;
+
+ /* All filters are already in use, we cannot match more rules */
+ if (bitmap_weight(priv->filters, RXCHK_BRCM_TAG_MAX) ==
+ RXCHK_BRCM_TAG_MAX)
+ return -ENOSPC;
+
+ index = find_first_zero_bit(priv->filters, RXCHK_BRCM_TAG_MAX);
+ if (index > RXCHK_BRCM_TAG_MAX)
+ return -ENOSPC;
+
+ /* Location is the classification ID, and index is the position
+ * within one of our 8 possible filters to be programmed
+ */
+ reg = rxchk_readl(priv, RXCHK_BRCM_TAG(index));
+ reg &= ~(RXCHK_BRCM_TAG_CID_MASK << RXCHK_BRCM_TAG_CID_SHIFT);
+ reg |= nfc->fs.location << RXCHK_BRCM_TAG_CID_SHIFT;
+ rxchk_writel(priv, reg, RXCHK_BRCM_TAG(index));
+ rxchk_writel(priv, 0xff00ffff, RXCHK_BRCM_TAG_MASK(index));
+
+ set_bit(index, priv->filters);
+
+ return 0;
+}
+
+static int bcm_sysport_rule_del(struct bcm_sysport_priv *priv,
+ u64 location)
+{
+ int index;
+
+ /* This is not a rule that we know about */
+ index = bcm_sysport_rule_find(priv, location);
+ if (index < 0)
+ return -EOPNOTSUPP;
+
+ /* No need to disable this filter if it was enabled, this will
+ * be taken care of during suspend time by bcm_sysport_suspend_to_wol
+ */
+ clear_bit(index, priv->filters);
+
+ return 0;
+}
+
+static int bcm_sysport_get_rxnfc(struct net_device *dev,
+ struct ethtool_rxnfc *nfc, u32 *rule_locs)
+{
+ struct bcm_sysport_priv *priv = netdev_priv(dev);
+ int ret = -EOPNOTSUPP;
+
+ switch (nfc->cmd) {
+ case ETHTOOL_GRXCLSRULE:
+ ret = bcm_sysport_rule_get(priv, nfc);
+ break;
+ default:
+ break;
+ }
+
+ return ret;
+}
+
+static int bcm_sysport_set_rxnfc(struct net_device *dev,
+ struct ethtool_rxnfc *nfc)
+{
+ struct bcm_sysport_priv *priv = netdev_priv(dev);
+ int ret = -EOPNOTSUPP;
+
+ switch (nfc->cmd) {
+ case ETHTOOL_SRXCLSRLINS:
+ ret = bcm_sysport_rule_set(priv, nfc);
+ break;
+ case ETHTOOL_SRXCLSRLDEL:
+ ret = bcm_sysport_rule_del(priv, nfc->fs.location);
+ break;
+ default:
+ break;
+ }
+
+ return ret;
+}
+
static const struct ethtool_ops bcm_sysport_ethtool_ops = {
.get_drvinfo = bcm_sysport_get_drvinfo,
.get_msglevel = bcm_sysport_get_msglvl,
@@ -2110,6 +2264,8 @@ static const struct ethtool_ops bcm_sysport_ethtool_ops = {
.set_coalesce = bcm_sysport_set_coalesce,
.get_link_ksettings = phy_ethtool_get_link_ksettings,
.set_link_ksettings = phy_ethtool_set_link_ksettings,
+ .get_rxnfc = bcm_sysport_get_rxnfc,
+ .set_rxnfc = bcm_sysport_set_rxnfc,
};
static u16 bcm_sysport_select_queue(struct net_device *dev, struct sk_buff *skb,
@@ -2434,16 +2590,39 @@ static int bcm_sysport_suspend_to_wol(struct bcm_sysport_priv *priv)
{
struct net_device *ndev = priv->netdev;
unsigned int timeout = 1000;
+ unsigned int index, i = 0;
u32 reg;
/* Password has already been programmed */
reg = umac_readl(priv, UMAC_MPD_CTRL);
- reg |= MPD_EN;
+ if (priv->wolopts & (WAKE_MAGIC | WAKE_MAGICSECURE))
+ reg |= MPD_EN;
reg &= ~PSW_EN;
if (priv->wolopts & WAKE_MAGICSECURE)
reg |= PSW_EN;
umac_writel(priv, reg, UMAC_MPD_CTRL);
+ if (priv->wolopts & WAKE_FILTER) {
+ /* Turn on ACPI matching to steal packets from RBUF */
+ reg = rbuf_readl(priv, RBUF_CONTROL);
+ if (priv->is_lite)
+ reg |= RBUF_ACPI_EN_LITE;
+ else
+ reg |= RBUF_ACPI_EN;
+ rbuf_writel(priv, reg, RBUF_CONTROL);
+
+ /* Enable RXCHK, active filters and Broadcom tag matching */
+ reg = rxchk_readl(priv, RXCHK_CONTROL);
+ reg &= ~(RXCHK_BRCM_TAG_MATCH_MASK <<
+ RXCHK_BRCM_TAG_MATCH_SHIFT);
+ for_each_set_bit(index, priv->filters, RXCHK_BRCM_TAG_MAX) {
+ reg |= BIT(RXCHK_BRCM_TAG_MATCH_SHIFT + i);
+ i++;
+ }
+ reg |= RXCHK_EN | RXCHK_BRCM_TAG_EN;
+ rxchk_writel(priv, reg, RXCHK_CONTROL);
+ }
+
/* Make sure RBUF entered WoL mode as result */
do {
reg = rbuf_readl(priv, RBUF_STATUS);
@@ -2464,7 +2643,7 @@ static int bcm_sysport_suspend_to_wol(struct bcm_sysport_priv *priv)
umac_enable_set(priv, CMD_RX_EN, 1);
/* Enable the interrupt wake-up source */
- intrl2_0_mask_clear(priv, INTRL2_0_MPD);
+ intrl2_0_mask_clear(priv, INTRL2_0_MPD | INTRL2_0_BRCM_MATCH_TAG);
netif_dbg(priv, wol, ndev, "entered WOL mode\n");
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.h b/drivers/net/ethernet/broadcom/bcmsysport.h
index cf440b91fd04..046c6c1d97fd 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.h
+++ b/drivers/net/ethernet/broadcom/bcmsysport.h
@@ -11,6 +11,7 @@
#ifndef __BCM_SYSPORT_H
#define __BCM_SYSPORT_H
+#include <linux/bitmap.h>
#include <linux/if_vlan.h>
#include <linux/net_dim.h>
@@ -155,14 +156,18 @@ struct bcm_rsb {
#define RXCHK_PARSE_AUTH (1 << 22)
#define RXCHK_BRCM_TAG0 0x04
-#define RXCHK_BRCM_TAG(i) ((i) * RXCHK_BRCM_TAG0)
+#define RXCHK_BRCM_TAG(i) ((i) * 0x4 + RXCHK_BRCM_TAG0)
#define RXCHK_BRCM_TAG0_MASK 0x24
-#define RXCHK_BRCM_TAG_MASK(i) ((i) * RXCHK_BRCM_TAG0_MASK)
+#define RXCHK_BRCM_TAG_MASK(i) ((i) * 0x4 + RXCHK_BRCM_TAG0_MASK)
#define RXCHK_BRCM_TAG_MATCH_STATUS 0x44
#define RXCHK_ETHERTYPE 0x48
#define RXCHK_BAD_CSUM_CNTR 0x4C
#define RXCHK_OTHER_DISC_CNTR 0x50
+#define RXCHK_BRCM_TAG_MAX 8
+#define RXCHK_BRCM_TAG_CID_SHIFT 16
+#define RXCHK_BRCM_TAG_CID_MASK 0xff
+
/* TXCHCK offsets and defines */
#define SYS_PORT_TXCHK_OFFSET 0x380
#define TXCHK_PKT_RDY_THRESH 0x00
@@ -185,6 +190,7 @@ struct bcm_rsb {
#define RBUF_RSB_SWAP0 (1 << 22)
#define RBUF_RSB_SWAP1 (1 << 23)
#define RBUF_ACPI_EN (1 << 23)
+#define RBUF_ACPI_EN_LITE (1 << 24)
#define RBUF_PKT_RDY_THRESH 0x04
@@ -777,6 +783,7 @@ struct bcm_sysport_priv {
/* Ethtool */
u32 msg_enable;
+ DECLARE_BITMAP(filters, RXCHK_BRCM_TAG_MAX);
struct bcm_sysport_stats64 stats64;
--
2.17.1
^ permalink raw reply related
* [PATCH net-next 2/3] net: dsa: bcm_sf2: Propagate ethtool::rxnfc to CPU port
From: Florian Fainelli @ 2018-08-06 21:29 UTC (permalink / raw)
To: netdev; +Cc: Florian Fainelli, andrew, vivien.didelot, linville, davem
In-Reply-To: <20180806212909.21720-1-f.fainelli@gmail.com>
Allow propagating ethtool::rxnfc programming to the CPU/management port
such that it is possible for such a CPU to perform e.g: Wake-on-LAN
using filters configured by the switch. We need a tiny bit of
cooperation between the switch drivers which is able to do the full flow
matching, whereas the CPU/management port might not. The CPU/management
driver needs to return -EOPNOTSUPP to indicate an non critical error,
any other error code otherwise.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/dsa/bcm_sf2_cfp.c | 40 ++++++++++++++++++++++++++++++++---
1 file changed, 37 insertions(+), 3 deletions(-)
diff --git a/drivers/net/dsa/bcm_sf2_cfp.c b/drivers/net/dsa/bcm_sf2_cfp.c
index 1e37b65aab93..e41ea0f3d5c7 100644
--- a/drivers/net/dsa/bcm_sf2_cfp.c
+++ b/drivers/net/dsa/bcm_sf2_cfp.c
@@ -732,6 +732,8 @@ static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port,
struct ethtool_rx_flow_spec *fs)
{
struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
+ s8 cpu_port = ds->ports[port].cpu_dp->index;
+ __u64 ring_cookie = fs->ring_cookie;
unsigned int queue_num, port_num;
int ret = -EINVAL;
@@ -748,13 +750,19 @@ static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port,
fs->location > bcm_sf2_cfp_rule_size(priv))
return -EINVAL;
+ /* This rule is a Wake-on-LAN filter and we must specifically
+ * target the CPU port in order for it to be working.
+ */
+ if (ring_cookie == RX_CLS_FLOW_WAKE)
+ ring_cookie = cpu_port * SF2_NUM_EGRESS_QUEUES;
+
/* We do not support discarding packets, check that the
* destination port is enabled and that we are within the
* number of ports supported by the switch
*/
- port_num = fs->ring_cookie / SF2_NUM_EGRESS_QUEUES;
+ port_num = ring_cookie / SF2_NUM_EGRESS_QUEUES;
- if (fs->ring_cookie == RX_CLS_FLOW_DISC ||
+ if (ring_cookie == RX_CLS_FLOW_DISC ||
!(dsa_is_user_port(ds, port_num) ||
dsa_is_cpu_port(ds, port_num)) ||
port_num >= priv->hw_params.num_ports)
@@ -763,7 +771,7 @@ static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port,
* We have a small oddity where Port 6 just does not have a
* valid bit here (so we substract by one).
*/
- queue_num = fs->ring_cookie % SF2_NUM_EGRESS_QUEUES;
+ queue_num = ring_cookie % SF2_NUM_EGRESS_QUEUES;
if (port_num >= 7)
port_num -= 1;
@@ -1188,6 +1196,7 @@ static int bcm_sf2_cfp_rule_get_all(struct bcm_sf2_priv *priv,
int bcm_sf2_get_rxnfc(struct dsa_switch *ds, int port,
struct ethtool_rxnfc *nfc, u32 *rule_locs)
{
+ struct net_device *p = ds->ports[port].cpu_dp->master;
struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
int ret = 0;
@@ -1214,12 +1223,20 @@ int bcm_sf2_get_rxnfc(struct dsa_switch *ds, int port,
mutex_unlock(&priv->cfp.lock);
+ /* Pass up the commands to the attached master network device */
+ if (p->ethtool_ops->get_rxnfc) {
+ ret = p->ethtool_ops->get_rxnfc(p, nfc, rule_locs);
+ if (ret == -EOPNOTSUPP)
+ ret = 0;
+ }
+
return ret;
}
int bcm_sf2_set_rxnfc(struct dsa_switch *ds, int port,
struct ethtool_rxnfc *nfc)
{
+ struct net_device *p = ds->ports[port].cpu_dp->master;
struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
int ret = 0;
@@ -1240,6 +1257,23 @@ int bcm_sf2_set_rxnfc(struct dsa_switch *ds, int port,
mutex_unlock(&priv->cfp.lock);
+ if (ret)
+ return ret;
+
+ /* Pass up the commands to the attached master network device.
+ * This can fail, so rollback the operation if we need to.
+ */
+ if (p->ethtool_ops->set_rxnfc) {
+ ret = p->ethtool_ops->set_rxnfc(p, nfc);
+ if (ret && ret != -EOPNOTSUPP) {
+ mutex_lock(&priv->cfp.lock);
+ bcm_sf2_cfp_rule_del(priv, port, nfc->fs.location);
+ mutex_unlock(&priv->cfp.lock);
+ } else {
+ ret = 0;
+ }
+ }
+
return ret;
}
--
2.17.1
^ permalink raw reply related
* [PATCH net-next 1/3] ethtool: Add WAKE_FILTER and RX_CLS_FLOW_WAKE
From: Florian Fainelli @ 2018-08-06 21:29 UTC (permalink / raw)
To: netdev; +Cc: Florian Fainelli, andrew, vivien.didelot, linville, davem
In-Reply-To: <20180806212909.21720-1-f.fainelli@gmail.com>
Add the ability to specify through ethtool::rxnfc that a rule location is
special and will be used to participate in Wake-on-LAN, by e.g: having a
specific pattern be matched. When this is the case, fs->ring_cookie must
be set to the special value RX_CLS_FLOW_WAKE.
We also define an additional ethtool::wolinfo flag: WAKE_FILTER which
can be used to configure an Ethernet adapter to allow Wake-on-LAN using
previously programmed filters.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
include/uapi/linux/ethtool.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index 813282cc8af6..dc69391d2bba 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -870,7 +870,8 @@ struct ethtool_flow_ext {
* includes the %FLOW_EXT or %FLOW_MAC_EXT flag
* (see &struct ethtool_flow_ext description).
* @ring_cookie: RX ring/queue index to deliver to, or %RX_CLS_FLOW_DISC
- * if packets should be discarded
+ * if packets should be discarded, or %RX_CLS_FLOW_WAKE if the
+ * packets should be used for Wake-on-LAN with %WAKE_FILTER
* @location: Location of rule in the table. Locations must be
* numbered such that a flow matching multiple rules will be
* classified according to the first (lowest numbered) rule.
@@ -1634,6 +1635,7 @@ static inline int ethtool_validate_duplex(__u8 duplex)
#define WAKE_ARP (1 << 4)
#define WAKE_MAGIC (1 << 5)
#define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */
+#define WAKE_FILTER (1 << 7)
/* L2-L4 network traffic flow types */
#define TCP_V4_FLOW 0x01 /* hash or spec (tcp_ip4_spec) */
@@ -1671,6 +1673,7 @@ static inline int ethtool_validate_duplex(__u8 duplex)
#define RXH_DISCARD (1 << 31)
#define RX_CLS_FLOW_DISC 0xffffffffffffffffULL
+#define RX_CLS_FLOW_WAKE 0xfffffffffffffffeULL
/* Special RX classification rule insert location values */
#define RX_CLS_LOC_SPECIAL 0x80000000 /* flag */
--
2.17.1
^ permalink raw reply related
* [PATCH] ethtool: Add support for Wake-on-LAN using filters
From: Florian Fainelli @ 2018-08-06 21:29 UTC (permalink / raw)
To: netdev; +Cc: Florian Fainelli, andrew, vivien.didelot, linville, davem
In-Reply-To: <20180806212909.21720-1-f.fainelli@gmail.com>
Define a way to specify that a flow's action is to be used for
Wake-on-LAN purposes (using -2 as an action value) and define a new
Wake-on-LAN flag: 'f' which enables the Ethernet adapter for Wake-on-LAN
using filters.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
ethtool-copy.h | 2 ++
ethtool.8.in | 4 +++-
ethtool.c | 7 ++++++-
rxclass.c | 8 +++++---
4 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/ethtool-copy.h b/ethtool-copy.h
index 8cc61e9ab40b..943af3882aa1 100644
--- a/ethtool-copy.h
+++ b/ethtool-copy.h
@@ -1628,6 +1628,7 @@ static __inline__ int ethtool_validate_duplex(__u8 duplex)
#define WAKE_ARP (1 << 4)
#define WAKE_MAGIC (1 << 5)
#define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */
+#define WAKE_FILTER (1 << 7)
/* L2-L4 network traffic flow types */
#define TCP_V4_FLOW 0x01 /* hash or spec (tcp_ip4_spec) */
@@ -1665,6 +1666,7 @@ static __inline__ int ethtool_validate_duplex(__u8 duplex)
#define RXH_DISCARD (1 << 31)
#define RX_CLS_FLOW_DISC 0xffffffffffffffffULL
+#define RX_CLS_FLOW_WAKE 0xfffffffffffffffeULL
/* Special RX classification rule insert location values */
#define RX_CLS_LOC_SPECIAL 0x80000000 /* flag */
diff --git a/ethtool.8.in b/ethtool.8.in
index 0a366aa536ae..61923eed7c27 100644
--- a/ethtool.8.in
+++ b/ethtool.8.in
@@ -58,7 +58,7 @@
.\"
.\" \(*WO - wol flags
.\"
-.ds WO \fBp\fP|\fBu\fP|\fBm\fP|\fBb\fP|\fBa\fP|\fBg\fP|\fBs\fP|\fBd\fP...
+.ds WO \fBp\fP|\fBu\fP|\fBm\fP|\fBb\fP|\fBa\fP|\fBg\fP|\fBs\fP|\fBd|\fBf\fP...
.\"
.\" \(*FL - flow type values
.\"
@@ -679,6 +679,7 @@ b Wake on broadcast messages
a Wake on ARP
g Wake on MagicPacket\[tm]
s Enable SecureOn\[tm] password for MagicPacket\[tm]
+f Wake on filter(s)
d T{
Disable (wake on nothing). This option clears all previous options.
T}
@@ -870,6 +871,7 @@ Specifies the Rx queue to send packets to, or some other action.
nokeep;
lB l.
-1 Drop the matched flow
+-2 Use the matched flow as a Wake-on-LAN filter
0 or higher Rx queue to route the flow
.TE
.TP
diff --git a/ethtool.c b/ethtool.c
index fb93ae898312..5e91ef9cecdb 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -931,6 +931,9 @@ static int parse_wolopts(char *optstr, u32 *data)
case 's':
*data |= WAKE_MAGICSECURE;
break;
+ case 'f':
+ *data |= WAKE_FILTER;
+ break;
case 'd':
*data = 0;
break;
@@ -964,6 +967,8 @@ static char *unparse_wolopts(int wolopts)
*p++ = 'g';
if (wolopts & WAKE_MAGICSECURE)
*p++ = 's';
+ if (wolopts & WAKE_FILTER)
+ *p++ = 'f';
} else {
*p = 'd';
}
@@ -4224,7 +4229,7 @@ static int flow_spec_to_ntuple(struct ethtool_rx_flow_spec *fsp,
return -1;
/* verify ring cookie can transfer to action */
- if (fsp->ring_cookie > INT_MAX && fsp->ring_cookie < (u64)(-2))
+ if (fsp->ring_cookie > INT_MAX && fsp->ring_cookie < (u64)(-3))
return -1;
/* verify only one field is setting data field */
diff --git a/rxclass.c b/rxclass.c
index 42d122d1ed86..79972651e706 100644
--- a/rxclass.c
+++ b/rxclass.c
@@ -251,7 +251,11 @@ static void rxclass_print_nfc_rule(struct ethtool_rx_flow_spec *fsp,
if (fsp->flow_type & FLOW_RSS)
fprintf(stdout, "\tRSS Context ID: %u\n", rss_context);
- if (fsp->ring_cookie != RX_CLS_FLOW_DISC) {
+ if (fsp->ring_cookie == RX_CLS_FLOW_DISC) {
+ fprintf(stdout, "\tAction: Drop\n");
+ } else if (fsp->ring_cookie == RX_CLS_FLOW_WAKE) {
+ fprintf(stdout, "\tAction: Wake-on-LAN\n");
+ } else {
u64 vf = ethtool_get_flow_spec_ring_vf(fsp->ring_cookie);
u64 queue = ethtool_get_flow_spec_ring(fsp->ring_cookie);
@@ -266,8 +270,6 @@ static void rxclass_print_nfc_rule(struct ethtool_rx_flow_spec *fsp,
else
fprintf(stdout, "\tAction: Direct to queue %llu\n",
queue);
- } else {
- fprintf(stdout, "\tAction: Drop\n");
}
fprintf(stdout, "\n");
--
2.17.1
^ permalink raw reply related
* [PATCH net-next 0/3] net: Support Wake-on-LAN using filters
From: Florian Fainelli @ 2018-08-06 21:29 UTC (permalink / raw)
To: netdev; +Cc: Florian Fainelli, andrew, vivien.didelot, linville, davem
Hi David, John,
This is technically a v2, but this patch series builds on your feedback
and defines the following:
- a new WAKE_* bit: WAKE_FILTER which can be enabled alongside other type
of Wake-on-LAN to support waking up on a programmed filter (match + action)
- a new RX_CLS_FLOW_WAKE flow action which can be specified by an user when
inserting a flow using ethtool::rxnfc, similar to the existing RX_CLS_FLOW_DISC
The bcm_sf2 and bcmsysport drivers are updated accordingly to work in concert to
allow matching packets at the switch level, identified by their filter location
to be used as a match by the SYSTEM PORT (CPU/management controller) during
Wake-on-LAN.
Let me know if this looks better than the previous incarnation of the patch
series.
Attached is also the ethtool patch that I would be submitting once the uapi
changes are committed.
Thank you!
Florian Fainelli (3):
ethtool: Add WAKE_FILTER and RX_CLS_FLOW_WAKE
net: dsa: bcm_sf2: Propagate ethtool::rxnfc to CPU port
net: systemport: Add support for WAKE_FILTER
drivers/net/dsa/bcm_sf2_cfp.c | 40 ++++-
drivers/net/ethernet/broadcom/bcmsysport.c | 193 ++++++++++++++++++++-
drivers/net/ethernet/broadcom/bcmsysport.h | 11 +-
include/uapi/linux/ethtool.h | 5 +-
4 files changed, 236 insertions(+), 13 deletions(-)
--
2.17.1
^ permalink raw reply
* [PATCH v6 8/9] net/mlx5: Do not call pcie_print_link_status()
From: Alexandru Gagniuc @ 2018-08-06 23:25 UTC (permalink / raw)
To: linux-pci, bhelgaas, jakub.kicinski
Cc: keith.busch, alex_gagniuc, austin_bolen, shyam_iyer,
Alexandru Gagniuc, Ariel Elior, everest-linux-l2, David S. Miller,
Michael Chan, Ganesh Goudar, Jeff Kirsher, Tariq Toukan,
Saeed Mahameed, Leon Romanovsky, Dirk van der Merwe, netdev,
linux-kernel, intel-wired-lan, linux-rdma, oss-drivers
In-Reply-To: <20180806232600.25694-1-mr.nuke.me@gmail.com>
This is now done by the PCI core to warn of sub-optimal bandwidth.
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
---
drivers/net/ethernet/mellanox/mlx5/core/main.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index 615005e63819..e10f9c2bea3b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -1045,10 +1045,6 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv,
dev_info(&pdev->dev, "firmware version: %d.%d.%d\n", fw_rev_maj(dev),
fw_rev_min(dev), fw_rev_sub(dev));
- /* Only PFs hold the relevant PCIe information for this query */
- if (mlx5_core_is_pf(dev))
- pcie_print_link_status(dev->pdev);
-
/* on load removing any previous indication of internal error, device is
* up
*/
--
2.17.1
^ permalink raw reply related
* [PATCH v6 7/9] net/mlx4: Do not call pcie_print_link_status()
From: Alexandru Gagniuc @ 2018-08-06 23:25 UTC (permalink / raw)
To: linux-pci, bhelgaas, jakub.kicinski
Cc: keith.busch, alex_gagniuc, austin_bolen, shyam_iyer,
Alexandru Gagniuc, Ariel Elior, everest-linux-l2, David S. Miller,
Michael Chan, Ganesh Goudar, Jeff Kirsher, Tariq Toukan,
Saeed Mahameed, Leon Romanovsky, Dirk van der Merwe, netdev,
linux-kernel, intel-wired-lan, linux-rdma, oss-drivers
In-Reply-To: <20180806232600.25694-1-mr.nuke.me@gmail.com>
This is now done by the PCI core to warn of sub-optimal bandwidth.
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
---
drivers/net/ethernet/mellanox/mlx4/main.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 872014702fc1..da4d54195853 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -3398,13 +3398,6 @@ static int mlx4_load_one(struct pci_dev *pdev, int pci_dev_data,
}
}
- /* check if the device is functioning at its maximum possible speed.
- * No return code for this call, just warn the user in case of PCI
- * express device capabilities are under-satisfied by the bus.
- */
- if (!mlx4_is_slave(dev))
- pcie_print_link_status(dev->persist->pdev);
-
/* In master functions, the communication channel must be initialized
* after obtaining its address from fw */
if (mlx4_is_master(dev)) {
--
2.17.1
^ permalink raw reply related
* [PATCH v6 6/9] ixgbe: Do not call pcie_print_link_status()
From: Alexandru Gagniuc @ 2018-08-06 23:25 UTC (permalink / raw)
To: linux-pci, bhelgaas, jakub.kicinski
Cc: keith.busch, alex_gagniuc, austin_bolen, shyam_iyer,
Alexandru Gagniuc, Ariel Elior, everest-linux-l2, David S. Miller,
Michael Chan, Ganesh Goudar, Jeff Kirsher, Tariq Toukan,
Saeed Mahameed, Leon Romanovsky, Dirk van der Merwe, netdev,
linux-kernel, intel-wired-lan, linux-rdma, oss-drivers
In-Reply-To: <20180806232600.25694-1-mr.nuke.me@gmail.com>
This is now done by the PCI core to warn of sub-optimal bandwidth.
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 26 -------------------
1 file changed, 26 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 62e57b05a0ae..7ecdc6c03a66 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -241,28 +241,6 @@ static inline bool ixgbe_pcie_from_parent(struct ixgbe_hw *hw)
}
}
-static void ixgbe_check_minimum_link(struct ixgbe_adapter *adapter,
- int expected_gts)
-{
- struct ixgbe_hw *hw = &adapter->hw;
- struct pci_dev *pdev;
-
- /* Some devices are not connected over PCIe and thus do not negotiate
- * speed. These devices do not have valid bus info, and thus any report
- * we generate may not be correct.
- */
- if (hw->bus.type == ixgbe_bus_type_internal)
- return;
-
- /* determine whether to use the parent device */
- if (ixgbe_pcie_from_parent(&adapter->hw))
- pdev = adapter->pdev->bus->parent->self;
- else
- pdev = adapter->pdev;
-
- pcie_print_link_status(pdev);
-}
-
static void ixgbe_service_event_schedule(struct ixgbe_adapter *adapter)
{
if (!test_bit(__IXGBE_DOWN, &adapter->state) &&
@@ -10585,10 +10563,6 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
break;
}
- /* don't check link if we failed to enumerate functions */
- if (expected_gts > 0)
- ixgbe_check_minimum_link(adapter, expected_gts);
-
err = ixgbe_read_pba_string_generic(hw, part_str, sizeof(part_str));
if (err)
strlcpy(part_str, "Unknown", sizeof(part_str));
--
2.17.1
^ permalink raw reply related
* [PATCH v6 5/9] fm10k: Do not call pcie_print_link_status()
From: Alexandru Gagniuc @ 2018-08-06 23:25 UTC (permalink / raw)
To: linux-pci, bhelgaas, jakub.kicinski
Cc: keith.busch, alex_gagniuc, austin_bolen, shyam_iyer,
Alexandru Gagniuc, Ariel Elior, everest-linux-l2, David S. Miller,
Michael Chan, Ganesh Goudar, Jeff Kirsher, Tariq Toukan,
Saeed Mahameed, Leon Romanovsky, Dirk van der Merwe, netdev,
linux-kernel, intel-wired-lan, linux-rdma, oss-drivers
In-Reply-To: <20180806232600.25694-1-mr.nuke.me@gmail.com>
This is now done by the PCI core to warn of sub-optimal bandwidth.
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
---
drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
index 15071e4adb98..079fd3c884ea 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
@@ -2224,9 +2224,6 @@ static int fm10k_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
/* kick off service timer now, even when interface is down */
mod_timer(&interface->service_timer, (HZ * 2) + jiffies);
- /* print warning for non-optimal configurations */
- pcie_print_link_status(interface->pdev);
-
/* report MAC address for logging */
dev_info(&pdev->dev, "%pM\n", netdev->dev_addr);
--
2.17.1
^ permalink raw reply related
* [PATCH v6 3/9] bnxt_en: Do not call pcie_print_link_status()
From: Alexandru Gagniuc @ 2018-08-06 23:25 UTC (permalink / raw)
To: linux-pci, bhelgaas, jakub.kicinski
Cc: keith.busch, alex_gagniuc, austin_bolen, shyam_iyer,
Alexandru Gagniuc, Ariel Elior, everest-linux-l2, David S. Miller,
Michael Chan, Ganesh Goudar, Jeff Kirsher, Tariq Toukan,
Saeed Mahameed, Leon Romanovsky, Dirk van der Merwe, netdev,
linux-kernel, intel-wired-lan, linux-rdma, oss-drivers
In-Reply-To: <20180806232600.25694-1-mr.nuke.me@gmail.com>
This is now done by the PCI core to warn of sub-optimal bandwidth.
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 4394c1162be4..4b3928c89076 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -8909,7 +8909,6 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
netdev_info(dev, "%s found at mem %lx, node addr %pM\n",
board_info[ent->driver_data].name,
(long)pci_resource_start(pdev, 0), dev->dev_addr);
- pcie_print_link_status(pdev);
return 0;
--
2.17.1
^ permalink raw reply related
* [PATCH v6 2/9] bnx2x: Do not call pcie_print_link_status()
From: Alexandru Gagniuc @ 2018-08-06 23:25 UTC (permalink / raw)
To: linux-pci, bhelgaas, jakub.kicinski
Cc: keith.busch, alex_gagniuc, austin_bolen, shyam_iyer,
Alexandru Gagniuc, Ariel Elior, everest-linux-l2, David S. Miller,
Michael Chan, Ganesh Goudar, Jeff Kirsher, Tariq Toukan,
Saeed Mahameed, Leon Romanovsky, Dirk van der Merwe, netdev,
linux-kernel, intel-wired-lan, linux-rdma, oss-drivers
In-Reply-To: <20180806232600.25694-1-mr.nuke.me@gmail.com>
This is now done by the PCI core to warn of sub-optimal bandwidth.
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 57348f2b49a3..3eadd6201dff 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -14100,7 +14100,6 @@ static int bnx2x_init_one(struct pci_dev *pdev,
board_info[ent->driver_data].name,
(CHIP_REV(bp) >> 12) + 'A', (CHIP_METAL(bp) >> 4),
dev->base_addr, bp->pdev->irq, dev->dev_addr);
- pcie_print_link_status(bp->pdev);
bnx2x_register_phc(bp);
--
2.17.1
^ permalink raw reply related
* [PATCH v6 1/9] PCI: Check for PCIe downtraining conditions
From: Alexandru Gagniuc @ 2018-08-06 23:25 UTC (permalink / raw)
To: linux-pci, bhelgaas, jakub.kicinski
Cc: keith.busch, alex_gagniuc, austin_bolen, shyam_iyer,
Alexandru Gagniuc, Ariel Elior, everest-linux-l2, David S. Miller,
Michael Chan, Ganesh Goudar, Jeff Kirsher, Tariq Toukan,
Saeed Mahameed, Leon Romanovsky, Dirk van der Merwe, netdev,
linux-kernel, intel-wired-lan, linux-rdma, oss-drivers
In-Reply-To: <CAErSpo4PK+SQLNfdkLNt9eLc7bpbxbkZCsa8T-tQpid601n0SQ@mail.gmail.com>
PCIe downtraining happens when both the device and PCIe port are
capable of a larger bus width or higher speed than negotiated.
Downtraining might be indicative of other problems in the system, and
identifying this from userspace is neither intuitive, nor
straightforward.
The easiest way to detect this is with pcie_print_link_status(),
since the bottleneck is usually the link that is downtrained. It's not
a perfect solution, but it works extremely well in most cases.
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
---
drivers/pci/pci.c | 22 ++++++++++++++++++----
drivers/pci/probe.c | 21 +++++++++++++++++++++
include/linux/pci.h | 1 +
3 files changed, 40 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 316496e99da9..414ad7b3abdb 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -5302,14 +5302,15 @@ u32 pcie_bandwidth_capable(struct pci_dev *dev, enum pci_bus_speed *speed,
}
/**
- * pcie_print_link_status - Report the PCI device's link speed and width
+ * __pcie_print_link_status - Report the PCI device's link speed and width
* @dev: PCI device to query
+ * @verbose: Be verbose -- print info even when enough bandwidth is available.
*
* Report the available bandwidth at the device. If this is less than the
* device is capable of, report the device's maximum possible bandwidth and
* the upstream link that limits its performance to less than that.
*/
-void pcie_print_link_status(struct pci_dev *dev)
+void __pcie_print_link_status(struct pci_dev *dev, bool verbose)
{
enum pcie_link_width width, width_cap;
enum pci_bus_speed speed, speed_cap;
@@ -5319,11 +5320,11 @@ void pcie_print_link_status(struct pci_dev *dev)
bw_cap = pcie_bandwidth_capable(dev, &speed_cap, &width_cap);
bw_avail = pcie_bandwidth_available(dev, &limiting_dev, &speed, &width);
- if (bw_avail >= bw_cap)
+ if (bw_avail >= bw_cap && verbose)
pci_info(dev, "%u.%03u Gb/s available PCIe bandwidth (%s x%d link)\n",
bw_cap / 1000, bw_cap % 1000,
PCIE_SPEED2STR(speed_cap), width_cap);
- else
+ else if (bw_avail < bw_cap)
pci_info(dev, "%u.%03u Gb/s available PCIe bandwidth, limited by %s x%d link at %s (capable of %u.%03u Gb/s with %s x%d link)\n",
bw_avail / 1000, bw_avail % 1000,
PCIE_SPEED2STR(speed), width,
@@ -5331,6 +5332,19 @@ void pcie_print_link_status(struct pci_dev *dev)
bw_cap / 1000, bw_cap % 1000,
PCIE_SPEED2STR(speed_cap), width_cap);
}
+
+/**
+ * pcie_print_link_status - Report the PCI device's link speed and width
+ * @dev: PCI device to query
+ *
+ * Report the available bandwidth at the device. If this is less than the
+ * device is capable of, report the device's maximum possible bandwidth and
+ * the upstream link that limits its performance to less than that.
+ */
+void pcie_print_link_status(struct pci_dev *dev)
+{
+ __pcie_print_link_status(dev, true);
+}
EXPORT_SYMBOL(pcie_print_link_status);
/**
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 611adcd9c169..1c8c26dd2cb2 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2205,6 +2205,24 @@ static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn)
return dev;
}
+static void pcie_check_upstream_link(struct pci_dev *dev)
+{
+ if (!pci_is_pcie(dev))
+ return;
+
+ /* Look from the device up to avoid downstream ports with no devices. */
+ if ((pci_pcie_type(dev) != PCI_EXP_TYPE_ENDPOINT) &&
+ (pci_pcie_type(dev) != PCI_EXP_TYPE_LEG_END) &&
+ (pci_pcie_type(dev) != PCI_EXP_TYPE_UPSTREAM))
+ return;
+
+ /* Multi-function PCIe share the same link/status. */
+ if (PCI_FUNC(dev->devfn) != 0 || dev->is_virtfn)
+ return;
+
+ __pcie_print_link_status(dev, false);
+}
+
static void pci_init_capabilities(struct pci_dev *dev)
{
/* Enhanced Allocation */
@@ -2240,6 +2258,9 @@ static void pci_init_capabilities(struct pci_dev *dev)
/* Advanced Error Reporting */
pci_aer_init(dev);
+ /* Check link and detect downtrain errors */
+ pcie_check_upstream_link(dev);
+
if (pci_probe_reset_function(dev) == 0)
dev->reset_fn = 1;
}
diff --git a/include/linux/pci.h b/include/linux/pci.h
index c133ccfa002e..d212de231259 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1087,6 +1087,7 @@ int pcie_set_mps(struct pci_dev *dev, int mps);
u32 pcie_bandwidth_available(struct pci_dev *dev, struct pci_dev **limiting_dev,
enum pci_bus_speed *speed,
enum pcie_link_width *width);
+void __pcie_print_link_status(struct pci_dev *dev, bool verbose);
void pcie_print_link_status(struct pci_dev *dev);
int pcie_flr(struct pci_dev *dev);
int __pci_reset_function_locked(struct pci_dev *dev);
--
2.17.1
^ permalink raw reply related
* Re: [endianness bug?] cxgb4_next_header .match_val/.match_mask should be net-endian
From: Al Viro @ 2018-08-06 21:08 UTC (permalink / raw)
To: kbuild test robot
Cc: kbuild-all, Rahul Lakkireddy, netdev, Hariprasad Shenai,
David S. Miller
In-Reply-To: <201808070355.t1rEM1C3%fengguang.wu@intel.com>
On Tue, Aug 07, 2018 at 03:51:34AM +0800, kbuild test robot wrote:
> Hi Al,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on net-next/master]
> [also build test WARNING on v4.18-rc8 next-20180806]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url: https://github.com/0day-ci/linux/commits/Al-Viro/cxgb4_next_header-match_val-match_mask-should-be-net-endian/20180806-183127
> reproduce:
> # apt-get install sparse
> make ARCH=x86_64 allmodconfig
> make C=1 CF=-D__CHECK_ENDIAN__
Yes, there are arseloads of misannotations. And I do have followups
that *do* annotate that (which is exactly how that bug had been found
in the first place). But I'd rather separate fixes from trivial
annotations - the former might need to be backported, the latter would
only cause extra PITA for backport.
^ permalink raw reply
* Re: [PATCH net] packet: refine ring v3 block size test to hold one frame
From: David Miller @ 2018-08-06 20:49 UTC (permalink / raw)
To: willemdebruijn.kernel; +Cc: netdev, eric.dumazet, loke.chetan, willemb
In-Reply-To: <20180806143834.121959-1-willemdebruijn.kernel@gmail.com>
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Date: Mon, 6 Aug 2018 10:38:34 -0400
> From: Willem de Bruijn <willemb@google.com>
>
> TPACKET_V3 stores variable length frames in fixed length blocks.
> Blocks must be able to store a block header, optional private space
> and at least one minimum sized frame.
>
> Frames, even for a zero snaplen packet, store metadata headers and
> optional reserved space.
>
> In the block size bounds check, ensure that the frame of the
> chosen configuration fits. This includes sockaddr_ll and optional
> tp_reserve.
>
> Syzbot was able to construct a ring with insuffient room for the
> sockaddr_ll in the header of a zero-length frame, triggering an
> out-of-bounds write in dev_parse_header.
>
> Convert the comparison to less than, as zero is a valid snap len.
> This matches the test for minimum tp_frame_size immediately below.
>
> Fixes: f6fb8f100b80 ("af-packet: TPACKET_V3 flexible buffer implementation.")
> Fixes: eb73190f4fbe ("net/packet: refine check for priv area size")
> Reported-by: syzbot <syzkaller@googlegroups.com>
> Signed-off-by: Willem de Bruijn <willemb@google.com>
Good catch, applied and queued up for -stable, thanks.
^ permalink raw reply
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