* Re: [PATCH net-next v4 0/6] net: tcp: sctp: dccp: Replace jprobe usage with trace events
From: Steven Rostedt @ 2017-12-21 3:12 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: David Miller, mingo, ian.mcdonald, vyasevich, stephen, peterz,
tglx, linux-kernel, hpa, gerrit, nhorman, dccp, netdev,
linux-sctp, sfr
In-Reply-To: <20171221113657.f25b2f61eb472579ab32132d@kernel.org>
On Thu, 21 Dec 2017 11:36:57 +0900
Masami Hiramatsu <mhiramat@kernel.org> wrote:
> On Wed, 20 Dec 2017 14:24:24 -0500 (EST)
> David Miller <davem@davemloft.net> wrote:
>
> > From: David Miller <davem@davemloft.net>
> > Date: Wed, 20 Dec 2017 14:20:40 -0500 (EST)
> >
> > > From: Masami Hiramatsu <mhiramat@kernel.org>
> > > Date: Wed, 20 Dec 2017 13:14:11 +0900
> > >
> > >> This series is v4 of the replacement of jprobe usage with trace
> > >> events. This version is rebased on net-next, fixes a build warning
> > >> and moves a temporal variable definition in a block.
> > >>
> > >> Previous version is here;
> > >> https://lkml.org/lkml/2017/12/19/153
> > >>
> > >> Changes from v3:
> > >> All: Rebased on net-next
> > >> [3/6]: fixes a build warning for i386 by casting pointer unsigned
> > >> long instead of __u64, and moves a temporal variable
> > >> definition in a block.
> > >
> > > Looks good, series applied to net-next, thanks.
> >
> > Actually, this doesn't even compile, so I've reverted:
> >
> > [davem@dhcp-10-15-49-227 net-next]$ make -s -j16
> > In file included from net/dccp/trace.h:105:0,
> > from net/dccp/proto.c:42:
> > ./include/trace/define_trace.h:89:42: fatal error: ./trace.h: No such file or directory
> > #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
> > ^
> > compilation terminated.
>
> Hi David,
>
> Could you share your .config file? I would like to reproduce it.
> When I tried with attached kconfig, I could not reproduce this issue,
> and could run it.
>
Hi Masami,
Are you sure you committed everything in this change set? I don't see a
modification of the Makefile to get the trace.h file you created.
Shouldn't there be something like:
CFLAGS_proto.o := -I$(src)
in the Makefile?
-- Steve
^ permalink raw reply
* Re: [PATCH bpf-next] tools/bpf: adjust rlimit RLIMIT_MEMLOCK for test_dev_cgroup
From: Alexei Starovoitov @ 2017-12-21 3:21 UTC (permalink / raw)
To: Yonghong Song; +Cc: ast, daniel, guro, netdev, kernel-team
In-Reply-To: <20171220183708.2334406-1-yhs@fb.com>
On Wed, Dec 20, 2017 at 10:37:08AM -0800, Yonghong Song wrote:
> The default rlimit RLIMIT_MEMLOCK is 64KB. In certain cases,
> e.g. in a test machine mimicking our production system, this test may
> fail due to unable to charge the required memory for prog load:
>
> $ ./test_dev_cgroup
> libbpf: load bpf program failed: Operation not permitted
> libbpf: failed to load program 'cgroup/dev'
> libbpf: failed to load object './dev_cgroup.o'
> Failed to load DEV_CGROUP program
> ...
>
> Changing the default rlimit RLIMIT_MEMLOCK to unlimited
> makes the test pass.
>
> This patch also fixed a problem where when bpf_prog_load fails,
> cleanup_cgroup_environment() should not be called since
> setup_cgroup_environment() has not been invoked. Otherwise,
> the following confusing message will appear:
> ...
> (/home/yhs/local/linux/tools/testing/selftests/bpf/cgroup_helpers.c:95:
> errno: No such file or directory) Opening Cgroup Procs: /mnt/cgroup.procs
> ...
>
> Signed-off-by: Yonghong Song <yhs@fb.com>
Applied, Thanks Yonghong.
^ permalink raw reply
* Re: [PATCH v3 next-queue 05/10] ixgbe: add ipsec offload add and remove SA
From: Shannon Nelson @ 2017-12-21 3:30 UTC (permalink / raw)
To: Marcelo Ricardo Leitner
Cc: intel-wired-lan, jeffrey.t.kirsher, steffen.klassert,
sowmini.varadhan, netdev, saeedm, borisp, ilant
In-Reply-To: <20171221022104.GN6122@localhost.localdomain>
On 12/20/2017 6:21 PM, Marcelo Ricardo Leitner wrote:
> On Wed, Dec 20, 2017 at 05:39:13PM -0800, Shannon Nelson wrote:
>> On 12/20/2017 5:17 PM, Marcelo Ricardo Leitner wrote:
>>> Hi,
>>>
>>> On Tue, Dec 19, 2017 at 03:59:57PM -0800, Shannon Nelson wrote:
>>>> +}
>>>> +
>>>> +static const struct xfrmdev_ops ixgbe_xfrmdev_ops = {
>>>> + .xdo_dev_state_add = ixgbe_ipsec_add_sa,
>>>> + .xdo_dev_state_delete = ixgbe_ipsec_del_sa,
>>>> +};
>>>> +
>>>
>>> This struct is only declared if XFRM_OFFLOAD is selected. What is
>>> selecting it for ixgbe driver?
>>> mlx5 driver has an extra option for ipsec offload and it then does
>>> 'depends on XFRM_OFFLOAD'
>>>
>>> Marcelo
>>>
>>
>> I didn't bother putting a 'depends' item in the ixgbe's Kconfig entry, and I
>> didn't create an extra CONFIG variable to enable ixgbe's support of the
>> offload. If CONFIG_XFRM_OFFLOAD is set, then ixgbe will support it.
>
> You handled it via Makefile, okay. Missed it on patch 2, my bad.
>
> Anyhow, we probably could use some standard here across the vendors
> here. With this patchset, we have 2 drivers supporting it, and 2
> different ways to configure it.
I suspect that the mlx5 folks did an extra option as part of being the
first to support the feature, and needing an easy way to toggle support
while they were developing it without needing to rebuild the whole
kernel. Now that the feature has reached a certain level of "maturity",
I think we can treat it like other features (e.g. CONFIG_PCI_IOV,
CONFIG_FCOE, CONFIG_PM, CONFIG_DEBUG_FS) and not need driver specific
toggles.
sln
^ permalink raw reply
* Re: [PATCH V3 net-next 00/17] add some features and fix some bugs for HNS3 driver
From: David Miller @ 2017-12-21 4:04 UTC (permalink / raw)
To: lipeng321; +Cc: netdev, linux-kernel, linuxarm, salil.mehta
In-Reply-To: <4f928ad7-de45-55e2-4f3d-df43d7def801@huawei.com>
From: "lipeng (Y)" <lipeng321@huawei.com>
Date: Thu, 21 Dec 2017 09:30:01 +0800
>
>
> On 2017/12/21 3:28, David Miller wrote:
>> From: Lipeng <lipeng321@huawei.com>
>> Date: Wed, 20 Dec 2017 16:43:02 +0800
>>
>>> This patchset adds some new feature support and fixes some bugs:
>>> [Patch 1/17 - 5/17] add the support to modify/query the tqp number
>>> through ethtool -L/l command, and also fix some related bugs for
>>> change tqp number.
>>> [Patch 6/17 - 9-17] add support vlan tag offload on tx&&rx direction
>>> for pf, and fix some related bugs.
>>> [patch 10/17 - 11/17] fix bugs for auto negotiation.
>>> [patch 12/17] adds support for ethtool command set_pauseparam.
>>> [patch 13/17 - 14/17] add support to update flow control settings
>>> after
>>> autoneg.
>>> [patch 15/17 - 17/17] fix some other bugs in net-next.
>> In your From: email field, as well as you and your colleagues signoffs
>> you are not using your full, real, name:
>> ====================
>> From: Lipeng <lipeng321@huawei.com>
>
> My first name is 'Peng' and Surname is 'Li'.
> But it is usually spelled as 'Lipeng' in one go when referring.
> This is quite usual convention with full names originating from
> China. Surnames comes first, followed by the first name and they
> both are inseparable while they are written as well.
> "Lipeng" is my full real name, and my sign-off's appear like above.
The same applies to "qumingguang"? Why is it not capitalized?
It seems to just be a copy of the email address username.
^ permalink raw reply
* Re: [PATCH net-next v4 0/6] net: tcp: sctp: dccp: Replace jprobe usage with trace events
From: David Miller @ 2017-12-21 4:08 UTC (permalink / raw)
To: mhiramat
Cc: mingo, ian.mcdonald, vyasevich, stephen, rostedt, peterz, tglx,
linux-kernel, hpa, gerrit, nhorman, dccp, netdev, linux-sctp, sfr
In-Reply-To: <20171221113657.f25b2f61eb472579ab32132d@kernel.org>
From: Masami Hiramatsu <mhiramat@kernel.org>
Date: Thu, 21 Dec 2017 11:36:57 +0900
> Could you share your .config file?
You never need to ask me this question.
All of my test builds are with "allmodconfig".
^ permalink raw reply
* Re: pull-request: bpf 2017-12-21
From: David Miller @ 2017-12-21 4:12 UTC (permalink / raw)
To: daniel; +Cc: ast, netdev
In-Reply-To: <20171221025747.5071-1-daniel@iogearbox.net>
From: Daniel Borkmann <daniel@iogearbox.net>
Date: Thu, 21 Dec 2017 03:57:47 +0100
> The following pull-request contains BPF updates for your *net* tree.
...
> Please consider pulling these changes from:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git
Pulled, thanks Daniel.
^ permalink raw reply
* Re: [RFC PATCH] virtio_net: Extend virtio to use VF datapath when available
From: Jakub Kicinski @ 2017-12-21 4:52 UTC (permalink / raw)
To: Siwei Liu
Cc: mst, sridhar.samudrala, alexander.duyck, virtualization, netdev,
David Miller
In-Reply-To: <CADGSJ22mDyC0Sw2EPW96ZWvMPLnzif+Y9MMouhM-6T03ZaKA0Q@mail.gmail.com>
On Wed, 20 Dec 2017 18:16:30 -0800, Siwei Liu wrote:
> > The plan is to remove the delay and do the naming in the kernel.
> > This was suggested by Lennart since udev is only doing naming policy
> > because kernel names were not repeatable.
> >
> > This makes the VF show up as "ethN_vf" on Hyper-V which is user friendly.
> >
> > Patch is pending.
>
> While it's good to show VF with specific naming to indicate
> enslavement, I wonder wouldn't it be better to hide this netdev at all
> from the user space? IMHO this extra device is useless when being
> enslaved and we may delegate controls (e.g. ethtool) over to the
> para-virtual device instead? That way it's possible to eliminate the
> possibility of additional udev setup or modification?
>
> I'm not sure if this is consistent with Windows guest or not, but I
> don't find it _Linux_ user friendly that ethtool doesn't work on the
> composite interface any more, and I have to end up with finding out
> the correct enslaved VF I must operate on.
Hiding "low level" netdevs comes up from time to time, and is more
widely applicable than just to VF bonds. We should find a generic
solution to that problem.
^ permalink raw reply
* [PATCH net-next] net: dwc-xlgmac: Get rid of custom hex_dump_to_buffer()
From: Jie Deng @ 2017-12-21 5:32 UTC (permalink / raw)
To: netdev; +Cc: davem, Jose.Abreu, andriy.shevchenko, Jie Deng
Get rid of custom hex_dump_to_buffer().
The output is slightly changed, i.e. each byte followed by white space.
Note, we don't use print_hex_dump() here since the original code uses
nedev_dbg().
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jie Deng <jiedeng@synopsys.com>
---
drivers/net/ethernet/synopsys/dwc-xlgmac-common.c | 24 +++++++----------------
1 file changed, 7 insertions(+), 17 deletions(-)
diff --git a/drivers/net/ethernet/synopsys/dwc-xlgmac-common.c b/drivers/net/ethernet/synopsys/dwc-xlgmac-common.c
index d655a42..eb1c6b0 100644
--- a/drivers/net/ethernet/synopsys/dwc-xlgmac-common.c
+++ b/drivers/net/ethernet/synopsys/dwc-xlgmac-common.c
@@ -333,9 +333,8 @@ void xlgmac_print_pkt(struct net_device *netdev,
struct sk_buff *skb, bool tx_rx)
{
struct ethhdr *eth = (struct ethhdr *)skb->data;
- unsigned char *buf = skb->data;
unsigned char buffer[128];
- unsigned int i, j;
+ unsigned int i;
netdev_dbg(netdev, "\n************** SKB dump ****************\n");
@@ -346,22 +345,13 @@ void xlgmac_print_pkt(struct net_device *netdev,
netdev_dbg(netdev, "Src MAC addr: %pM\n", eth->h_source);
netdev_dbg(netdev, "Protocol: %#06hx\n", ntohs(eth->h_proto));
- for (i = 0, j = 0; i < skb->len;) {
- j += snprintf(buffer + j, sizeof(buffer) - j, "%02hhx",
- buf[i++]);
-
- if ((i % 32) == 0) {
- netdev_dbg(netdev, " %#06x: %s\n", i - 32, buffer);
- j = 0;
- } else if ((i % 16) == 0) {
- buffer[j++] = ' ';
- buffer[j++] = ' ';
- } else if ((i % 4) == 0) {
- buffer[j++] = ' ';
- }
+ for (i = 0; i < skb->len; i += 32) {
+ unsigned int len = min(skb->len - i, 32U);
+
+ hex_dump_to_buffer(&skb->data[i], len, 32, 1,
+ buffer, sizeof(buffer), false);
+ netdev_dbg(netdev, " %#06x: %s\n", i, buffer);
}
- if (i % 32)
- netdev_dbg(netdev, " %#06x: %s\n", i - (i % 32), buffer);
netdev_dbg(netdev, "\n************** SKB dump ****************\n");
}
--
1.9.1
^ permalink raw reply related
* Re: [B.A.T.M.A.N.] [PATCH 00/19] pull request for net-next: batman-adv 2017-12-20
From: Sven Eckelmann @ 2017-12-21 5:58 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: David Miller, sw, netdev
In-Reply-To: <20171220.143946.211997742797133128.davem@davemloft.net>
[-- Attachment #1: Type: text/plain, Size: 485 bytes --]
On Mittwoch, 20. Dezember 2017 14:39:46 CET David Miller wrote:
[...]
> Pulled, but there was a minor docbook annotation conflict I had to
> address.
>
> This pull added () to the function names in the docbook comments,
> but this overlapped with the fix of a variable name in the docbook
> info for the same function.
>
> It was trivial, but please take a look.
Thanks, looks exactly like the merge I did while testing the net fixes with
the net-next changes.
Kind regards,
Sven
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply
* Re: [pull request][for-next 00/11] Mellanox, mlx5 E-Switch updates 2017-12-19
From: Saeed Mahameed @ 2017-12-21 6:19 UTC (permalink / raw)
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Leon Romanovsky, dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
In-Reply-To: <20171220.125631.1837619997849298593.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
On Wed, 2017-12-20 at 12:56 -0500, David Miller wrote:
> From: Saeed Mahameed <saeedm@mellanox.com>
> Date: Tue, 19 Dec 2017 12:33:29 -0800
>
> > This patchset is based on rc4 and I see that net-next is still on
> > rc3, i hope
> > this is not a problem.
>
> If it doesn't pull cleanly into net-next, then it would be a problem.
It does pull cleanly.
Thanks.
^ permalink raw reply
* Re: [PATCH RFC v2 0/5] Support asynchronous crypto for IPsec GSO.
From: Steffen Klassert @ 2017-12-21 6:39 UTC (permalink / raw)
To: netdev
In-Reply-To: <20171215091308.23626-1-steffen.klassert@secunet.com>
On Fri, Dec 15, 2017 at 10:13:03AM +0100, Steffen Klassert wrote:
> This patchset implements asynchronous crypto handling
> in the layer 2 TX path. With this we can allow IPsec
> ESP GSO for software crypto. This also merges the IPsec
> GSO and non-GSO paths to both use validate_xmit_xfrm().
>
> 1) Separate ESP handling from segmentation for GRO packets.
> This unifies the IPsec GSO and non GSO codepath.
>
> 2) Add asynchronous callbacks for xfrm on layer 2. This
> adds the necessary infrastructure to core networking.
>
> 3) Allow to use the layer2 IPsec GSO codepath for software
> crypto, all infrastructure is there now.
>
> 4) Also allow IPsec GSO with software crypto for local sockets.
>
> 5) Don't require synchronous crypto fallback on IPsec offloading,
> it is not needed anymore.
>
> I plan to merge this to ipsec-next during this development cycle.
This is now applied to ipsec-next.
^ permalink raw reply
* Re: [PATCH v3 next-queue 00/10] ixgbe: Add ipsec offload
From: Yanjun Zhu @ 2017-12-21 6:39 UTC (permalink / raw)
To: Shannon Nelson, intel-wired-lan, jeffrey.t.kirsher
Cc: steffen.klassert, sowmini.varadhan, netdev
In-Reply-To: <1513728002-7643-1-git-send-email-shannon.nelson@oracle.com>
On 2017/12/20 7:59, Shannon Nelson wrote:
> This is an implementation of the ipsec hardware offload feature for
> the ixgbe driver and Intel's 10Gbe series NICs: x540, x550, 82599.
Hi, Nelson
I notice that the ipsec feature is based on x540, x550, 82599. But this
ixgbe driver
will also work with 82598.
Does this ipsec feature also work with 82598?
Thanks a lot.
Zhu Yanjun
> These patches apply to net-next v4.14 as well as Jeff Kirsher's next-queue
> v4.15-rc1-206-ge47375b.
>
> The ixgbe NICs support ipsec offload for 1024 Rx and 1024 Tx Security
> Associations (SAs), using up to 128 inbound IP addresses, and using the
> rfc4106(gcm(aes)) encryption. This code does not yet support IPv6,
> checksum offload, or TSO in conjunction with the ipsec offload - those
> will be added in the future.
>
> This code shows improvements in both packet throughput and CPU utilization.
> For example, here are some quicky numbers that show the magnitude of the
> performance gain on a single run of "iperf -c <dest>" with the ipsec
> offload on both ends of a point-to-point connection:
>
> 9.4 Gbps - normal case
> 7.6 Gbps - ipsec with offload
> 343 Mbps - ipsec no offload
>
> To set up a similar test case, you first need to be sure you have a recent
> version of iproute2 that supports the ipsec offload tag, probably something
> from ip 4.12 or newer would be best. I have a shell script that builds
> up the appropriate commands for me, but here are the resulting commands
> for all tcp traffic between 14.0.0.52 and 14.0.0.70:
>
> For the left side (14.0.0.52):
> ip x p add dir out src 14.0.0.52/24 dst 14.0.0.70/24 proto tcp tmpl \
> proto esp src 14.0.0.52 dst 14.0.0.70 spi 0x07 mode transport reqid 0x07
> ip x p add dir in src 14.0.0.70/24 dst 14.0.0.52/24 proto tcp tmpl \
> proto esp dst 14.0.0.52 src 14.0.0.70 spi 0x07 mode transport reqid 0x07
> ip x s add proto esp src 14.0.0.52 dst 14.0.0.70 spi 0x07 mode transport \
> reqid 0x07 replay-window 32 \
> aead 'rfc4106(gcm(aes))' 0x44434241343332312423222114131211f4f3f2f1 128 \
> sel src 14.0.0.52/24 dst 14.0.0.70/24 proto tcp offload dev eth4 dir out
> ip x s add proto esp dst 14.0.0.52 src 14.0.0.70 spi 0x07 mode transport \
> reqid 0x07 replay-window 32 \
> aead 'rfc4106(gcm(aes))' 0x44434241343332312423222114131211f4f3f2f1 128 \
> sel src 14.0.0.70/24 dst 14.0.0.52/24 proto tcp offload dev eth4 dir in
>
> For the right side (14.0.0.70):
> ip x p add dir out src 14.0.0.70/24 dst 14.0.0.52/24 proto tcp tmpl \
> proto esp src 14.0.0.70 dst 14.0.0.52 spi 0x07 mode transport reqid 0x07
> ip x p add dir in src 14.0.0.52/24 dst 14.0.0.70/24 proto tcp tmpl \
> proto esp dst 14.0.0.70 src 14.0.0.52 spi 0x07 mode transport reqid 0x07
> ip x s add proto esp src 14.0.0.70 dst 14.0.0.52 spi 0x07 mode transport \
> reqid 0x07 replay-window 32 \
> aead 'rfc4106(gcm(aes))' 0x44434241343332312423222114131211f4f3f2f1 128 \
> sel src 14.0.0.70/24 dst 14.0.0.52/24 proto tcp offload dev eth4 dir out
> ip x s add proto esp dst 14.0.0.70 src 14.0.0.52 spi 0x07 mode transport \
> reqid 0x07 replay-window 32 \
> aead 'rfc4106(gcm(aes))' 0x44434241343332312423222114131211f4f3f2f1 128 \
> sel src 14.0.0.52/24 dst 14.0.0.70/24 proto tcp offload dev eth4 dir in
>
> In both cases, the command "ip x s flush ; ip x p flush" will clean
> it all out and remove the offloads.
>
> Lastly, thanks to Alex Duyck for his early comments.
>
> Please see the individual patches for specific update info.
>
> v3: fixes after comments from those wonderfully pesky kbuild robots
> v2: fixes after comments from Alex
>
> Shannon Nelson (10):
> ixgbe: clean up ipsec defines
> ixgbe: add ipsec register access routines
> ixgbe: add ipsec engine start and stop routines
> ixgbe: add ipsec data structures
> ixgbe: add ipsec offload add and remove SA
> ixgbe: restore offloaded SAs after a reset
> ixgbe: process the Rx ipsec offload
> ixgbe: process the Tx ipsec offload
> ixgbe: ipsec offload stats
> ixgbe: register ipsec offload with the xfrm subsystem
>
> drivers/net/ethernet/intel/ixgbe/Makefile | 1 +
> drivers/net/ethernet/intel/ixgbe/ixgbe.h | 33 +-
> drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 2 +
> drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c | 923 +++++++++++++++++++++++
> drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.h | 92 +++
> drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c | 4 +-
> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 39 +-
> drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | 22 +-
> 8 files changed, 1093 insertions(+), 23 deletions(-)
> create mode 100644 drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
> create mode 100644 drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.h
>
^ permalink raw reply
* [PATCH net] l2tp: fix missing print session offset info
From: Hangbin Liu @ 2017-12-21 6:45 UTC (permalink / raw)
To: netdev; +Cc: James Chapman, David S. Miller, Hangbin Liu
Fixes: 309795f4bec ("l2tp: Add netlink control API for L2TP")
Reported-by: Jianlin Shi <jishi@redhat.com>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
net/l2tp/l2tp_netlink.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c
index a1f24fb..36378b4 100644
--- a/net/l2tp/l2tp_netlink.c
+++ b/net/l2tp/l2tp_netlink.c
@@ -761,6 +761,8 @@ static int l2tp_nl_session_send(struct sk_buff *skb, u32 portid, u32 seq, int fl
if ((session->ifname[0] &&
nla_put_string(skb, L2TP_ATTR_IFNAME, session->ifname)) ||
+ (session->offset &&
+ nla_put_u16(skb, L2TP_ATTR_OFFSET, session->offset) ||
(session->cookie_len &&
nla_put(skb, L2TP_ATTR_COOKIE, session->cookie_len,
&session->cookie[0])) ||
--
2.5.5
^ permalink raw reply related
* Re: [PATCH V3 net-next 00/17] add some features and fix some bugs for HNS3 driver
From: lipeng (Y) @ 2017-12-21 6:57 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-kernel, linuxarm, salil.mehta
In-Reply-To: <20171220.230452.1688628876856367788.davem@davemloft.net>
On 2017/12/21 12:04, David Miller wrote:
> From: "lipeng (Y)" <lipeng321@huawei.com>
> Date: Thu, 21 Dec 2017 09:30:01 +0800
>
>>
>> On 2017/12/21 3:28, David Miller wrote:
>>> From: Lipeng <lipeng321@huawei.com>
>>> Date: Wed, 20 Dec 2017 16:43:02 +0800
>>>
>>>> This patchset adds some new feature support and fixes some bugs:
>>>> [Patch 1/17 - 5/17] add the support to modify/query the tqp number
>>>> through ethtool -L/l command, and also fix some related bugs for
>>>> change tqp number.
>>>> [Patch 6/17 - 9-17] add support vlan tag offload on tx&&rx direction
>>>> for pf, and fix some related bugs.
>>>> [patch 10/17 - 11/17] fix bugs for auto negotiation.
>>>> [patch 12/17] adds support for ethtool command set_pauseparam.
>>>> [patch 13/17 - 14/17] add support to update flow control settings
>>>> after
>>>> autoneg.
>>>> [patch 15/17 - 17/17] fix some other bugs in net-next.
>>> In your From: email field, as well as you and your colleagues signoffs
>>> you are not using your full, real, name:
>>> ====================
>>> From: Lipeng <lipeng321@huawei.com>
>> My first name is 'Peng' and Surname is 'Li'.
>> But it is usually spelled as 'Lipeng' in one go when referring.
>> This is quite usual convention with full names originating from
>> China. Surnames comes first, followed by the first name and they
>> both are inseparable while they are written as well.
>> "Lipeng" is my full real name, and my sign-off's appear like above.
> The same applies to "qumingguang"? Why is it not capitalized?
> It seems to just be a copy of the email address username.
have checked with him, and will fix his name spelling to "Mingguang Qu".
Thanks
Lipeng
> .
>
^ permalink raw reply
* Re: [Intel-wired-lan] [PATCH] e1000e: Fix e1000_check_for_copper_link_ich8lan return value.
From: Neftin, Sasha @ 2017-12-21 6:57 UTC (permalink / raw)
To: Benjamin Poirier, Jeff Kirsher
Cc: Ben Hutchings, Gabriel C, netdev, Christian Hesse, stable,
linux-kernel, intel-wired-lan
In-Reply-To: <20171211072640.7935-1-bpoirier@suse.com>
On 11/12/2017 9:26, Benjamin Poirier wrote:
> e1000e_check_for_copper_link() and e1000_check_for_copper_link_ich8lan()
> are the two functions that may be assigned to mac.ops.check_for_link when
> phy.media_type == e1000_media_type_copper. Commit 19110cfbb34d ("e1000e:
> Separate signaling for link check/link up") changed the meaning of the
> return value of check_for_link for copper media but only adjusted the first
> function. This patch adjusts the second function likewise.
>
> Reported-by: Christian Hesse <list@eworm.de>
> Reported-by: Gabriel C <nix.or.die@gmail.com>
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=198047
> Fixes: 19110cfbb34d ("e1000e: Separate signaling for link check/link up")
> Tested-by: Christian Hesse <list@eworm.de>
> Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
> ---
> drivers/net/ethernet/intel/e1000e/ich8lan.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c
> index d6d4ed7acf03..31277d3bb7dc 100644
> --- a/drivers/net/ethernet/intel/e1000e/ich8lan.c
> +++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c
> @@ -1367,6 +1367,9 @@ static s32 e1000_disable_ulp_lpt_lp(struct e1000_hw *hw, bool force)
> * Checks to see of the link status of the hardware has changed. If a
> * change in link status has been detected, then we read the PHY registers
> * to get the current speed/duplex if link exists.
> + *
> + * Returns a negative error code (-E1000_ERR_*) or 0 (link down) or 1 (link
> + * up).
> **/
> static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
> {
> @@ -1382,7 +1385,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
> * Change or Rx Sequence Error interrupt.
> */
> if (!mac->get_link_status)
> - return 0;
> + return 1;
>
> /* First we want to see if the MII Status Register reports
> * link. If so, then we want to get the current speed/duplex
> @@ -1613,10 +1616,12 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
> * different link partner.
> */
> ret_val = e1000e_config_fc_after_link_up(hw);
> - if (ret_val)
> + if (ret_val) {
> e_dbg("Error configuring flow control\n");
> + return ret_val;
> + }
>
> - return ret_val;
> + return 1;
> }
>
> static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter)
Acked by sasha.neftin@intel.com
^ permalink raw reply
* [PATCH V4 net-next 01/17] net: hns3: add support to query tqps number
From: Lipeng @ 2017-12-21 7:28 UTC (permalink / raw)
To: davem; +Cc: netdev, linux-kernel, linuxarm, salil.mehta, lipeng321
In-Reply-To: <1513841343-60964-1-git-send-email-lipeng321@huawei.com>
This patch adds the support to query tqps number for PF driver
by using ehtool -l command.
Signed-off-by: Lipeng <lipeng321@huawei.com>
Signed-off-by: Mingguang Qu <qumingguang@huawei.com>
---
drivers/net/ethernet/hisilicon/hns3/hnae3.h | 2 ++
drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 10 ++++++++++
.../net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 21 +++++++++++++++++++++
3 files changed, 33 insertions(+)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
index a9e2b32..d887721 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
@@ -386,6 +386,8 @@ struct hnae3_ae_ops {
u16 vlan, u8 qos, __be16 proto);
void (*reset_event)(struct hnae3_handle *handle,
enum hnae3_reset_type reset);
+ void (*get_channels)(struct hnae3_handle *handle,
+ struct ethtool_channels *ch);
};
struct hnae3_dcb_ops {
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
index 65a69b4..23af36c 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
@@ -849,6 +849,15 @@ static int hns3_nway_reset(struct net_device *netdev)
return genphy_restart_aneg(phy);
}
+void hns3_get_channels(struct net_device *netdev,
+ struct ethtool_channels *ch)
+{
+ struct hnae3_handle *h = hns3_get_handle(netdev);
+
+ if (h->ae_algo->ops->get_channels)
+ h->ae_algo->ops->get_channels(h, ch);
+}
+
static const struct ethtool_ops hns3vf_ethtool_ops = {
.get_drvinfo = hns3_get_drvinfo,
.get_ringparam = hns3_get_ringparam,
@@ -883,6 +892,7 @@ static int hns3_nway_reset(struct net_device *netdev)
.get_link_ksettings = hns3_get_link_ksettings,
.set_link_ksettings = hns3_set_link_ksettings,
.nway_reset = hns3_nway_reset,
+ .get_channels = hns3_get_channels,
};
void hns3_ethtool_set_ops(struct net_device *netdev)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index e97fd66..a3101bc 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -5002,6 +5002,26 @@ static void hclge_uninit_ae_dev(struct hnae3_ae_dev *ae_dev)
ae_dev->priv = NULL;
}
+static u32 hclge_get_max_channels(struct hnae3_handle *handle)
+{
+ struct hnae3_knic_private_info *kinfo = &handle->kinfo;
+ struct hclge_vport *vport = hclge_get_vport(handle);
+ struct hclge_dev *hdev = vport->back;
+
+ return min_t(u32, hdev->rss_size_max * kinfo->num_tc, hdev->num_tqps);
+}
+
+static void hclge_get_channels(struct hnae3_handle *handle,
+ struct ethtool_channels *ch)
+{
+ struct hclge_vport *vport = hclge_get_vport(handle);
+
+ ch->max_combined = hclge_get_max_channels(handle);
+ ch->other_count = 1;
+ ch->max_other = 1;
+ ch->combined_count = vport->alloc_tqps;
+}
+
static const struct hnae3_ae_ops hclge_ops = {
.init_ae_dev = hclge_init_ae_dev,
.uninit_ae_dev = hclge_uninit_ae_dev,
@@ -5046,6 +5066,7 @@ static void hclge_uninit_ae_dev(struct hnae3_ae_dev *ae_dev)
.set_vlan_filter = hclge_set_port_vlan_filter,
.set_vf_vlan_filter = hclge_set_vf_vlan_filter,
.reset_event = hclge_reset_event,
+ .get_channels = hclge_get_channels,
};
static struct hnae3_ae_algo ae_algo = {
--
1.9.1
^ permalink raw reply related
* [PATCH V4 net-next 02/17] net: hns3: add support to modify tqps number
From: Lipeng @ 2017-12-21 7:28 UTC (permalink / raw)
To: davem; +Cc: netdev, linux-kernel, linuxarm, salil.mehta, lipeng321
In-Reply-To: <1513841343-60964-1-git-send-email-lipeng321@huawei.com>
This patch adds the support to change tqps number for PF driver
by using ehtool -L command.
Signed-off-by: Lipeng <lipeng321@huawei.com>
Signed-off-by: Mingguang Qu <qumingguang@huawei.com>
---
drivers/net/ethernet/hisilicon/hns3/hnae3.h | 3 +
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 122 +++++++++++++++++++++
drivers/net/ethernet/hisilicon/hns3/hns3_enet.h | 2 +
drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 1 +
.../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 112 +++++++++++++++++++
5 files changed, 240 insertions(+)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
index d887721..a5d3d22 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
@@ -388,6 +388,9 @@ struct hnae3_ae_ops {
enum hnae3_reset_type reset);
void (*get_channels)(struct hnae3_handle *handle,
struct ethtool_channels *ch);
+ void (*get_tqps_and_rss_info)(struct hnae3_handle *h,
+ u16 *free_tqps, u16 *max_rss_size);
+ int (*set_channels)(struct hnae3_handle *handle, u32 new_tqps_num);
};
struct hnae3_dcb_ops {
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index c2c1323..7e92068 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -2651,6 +2651,19 @@ static int hns3_get_ring_config(struct hns3_nic_priv *priv)
return ret;
}
+static void hns3_put_ring_config(struct hns3_nic_priv *priv)
+{
+ struct hnae3_handle *h = priv->ae_handle;
+ int i;
+
+ for (i = 0; i < h->kinfo.num_tqps; i++) {
+ devm_kfree(priv->dev, priv->ring_data[i].ring);
+ devm_kfree(priv->dev,
+ priv->ring_data[i + h->kinfo.num_tqps].ring);
+ }
+ devm_kfree(priv->dev, priv->ring_data);
+}
+
static int hns3_alloc_ring_memory(struct hns3_enet_ring *ring)
{
int ret;
@@ -3162,6 +3175,115 @@ static int hns3_reset_notify(struct hnae3_handle *handle,
return ret;
}
+static u16 hns3_get_max_available_channels(struct net_device *netdev)
+{
+ struct hnae3_handle *h = hns3_get_handle(netdev);
+ u16 free_tqps, max_rss_size, max_tqps;
+
+ h->ae_algo->ops->get_tqps_and_rss_info(h, &free_tqps, &max_rss_size);
+ max_tqps = h->kinfo.num_tc * max_rss_size;
+
+ return min_t(u16, max_tqps, (free_tqps + h->kinfo.num_tqps));
+}
+
+static int hns3_modify_tqp_num(struct net_device *netdev, u16 new_tqp_num)
+{
+ struct hns3_nic_priv *priv = netdev_priv(netdev);
+ struct hnae3_handle *h = hns3_get_handle(netdev);
+ int ret;
+
+ ret = h->ae_algo->ops->set_channels(h, new_tqp_num);
+ if (ret)
+ return ret;
+
+ ret = hns3_get_ring_config(priv);
+ if (ret)
+ return ret;
+
+ ret = hns3_nic_init_vector_data(priv);
+ if (ret)
+ goto err_uninit_vector;
+
+ ret = hns3_init_all_ring(priv);
+ if (ret)
+ goto err_put_ring;
+
+ return 0;
+
+err_put_ring:
+ hns3_put_ring_config(priv);
+err_uninit_vector:
+ hns3_nic_uninit_vector_data(priv);
+ return ret;
+}
+
+static int hns3_adjust_tqps_num(u8 num_tc, u32 new_tqp_num)
+{
+ return (new_tqp_num / num_tc) * num_tc;
+}
+
+int hns3_set_channels(struct net_device *netdev,
+ struct ethtool_channels *ch)
+{
+ struct hns3_nic_priv *priv = netdev_priv(netdev);
+ struct hnae3_handle *h = hns3_get_handle(netdev);
+ struct hnae3_knic_private_info *kinfo = &h->kinfo;
+ bool if_running = netif_running(netdev);
+ u32 new_tqp_num = ch->combined_count;
+ u16 org_tqp_num;
+ int ret;
+
+ if (ch->rx_count || ch->tx_count)
+ return -EINVAL;
+
+ if (new_tqp_num > hns3_get_max_available_channels(netdev) ||
+ new_tqp_num < kinfo->num_tc) {
+ dev_err(&netdev->dev,
+ "Change tqps fail, the tqp range is from %d to %d",
+ kinfo->num_tc,
+ hns3_get_max_available_channels(netdev));
+ return -EINVAL;
+ }
+
+ new_tqp_num = hns3_adjust_tqps_num(kinfo->num_tc, new_tqp_num);
+ if (kinfo->num_tqps == new_tqp_num)
+ return 0;
+
+ if (if_running)
+ dev_close(netdev);
+
+ hns3_clear_all_ring(h);
+
+ ret = hns3_nic_uninit_vector_data(priv);
+ if (ret) {
+ dev_err(&netdev->dev,
+ "Unbind vector with tqp fail, nothing is changed");
+ goto open_netdev;
+ }
+
+ hns3_uninit_all_ring(priv);
+
+ org_tqp_num = h->kinfo.num_tqps;
+ ret = hns3_modify_tqp_num(netdev, new_tqp_num);
+ if (ret) {
+ ret = hns3_modify_tqp_num(netdev, org_tqp_num);
+ if (ret) {
+ /* If revert to old tqp failed, fatal error occurred */
+ dev_err(&netdev->dev,
+ "Revert to old tqp num fail, ret=%d", ret);
+ return ret;
+ }
+ dev_info(&netdev->dev,
+ "Change tqp num fail, Revert to old tqp num");
+ }
+
+open_netdev:
+ if (if_running)
+ dev_open(netdev);
+
+ return ret;
+}
+
static const struct hnae3_client_ops client_ops = {
.init_instance = hns3_client_init,
.uninit_instance = hns3_client_uninit,
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h
index 8a9de75..a2a7ea3 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h
@@ -595,6 +595,8 @@ static inline void hns3_write_reg(void __iomem *base, u32 reg, u32 value)
(((struct hns3_nic_priv *)netdev_priv(ndev))->ae_handle)
void hns3_ethtool_set_ops(struct net_device *netdev);
+int hns3_set_channels(struct net_device *netdev,
+ struct ethtool_channels *ch);
bool hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget);
int hns3_init_all_ring(struct hns3_nic_priv *priv);
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
index 23af36c..1b2d79b 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
@@ -893,6 +893,7 @@ void hns3_get_channels(struct net_device *netdev,
.set_link_ksettings = hns3_set_link_ksettings,
.nway_reset = hns3_nway_reset,
.get_channels = hns3_get_channels,
+ .set_channels = hns3_set_channels,
};
void hns3_ethtool_set_ops(struct net_device *netdev)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index a3101bc..7fab102 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -5022,6 +5022,116 @@ static void hclge_get_channels(struct hnae3_handle *handle,
ch->combined_count = vport->alloc_tqps;
}
+static void hclge_get_tqps_and_rss_info(struct hnae3_handle *handle,
+ u16 *free_tqps, u16 *max_rss_size)
+{
+ struct hclge_vport *vport = hclge_get_vport(handle);
+ struct hclge_dev *hdev = vport->back;
+ u16 temp_tqps = 0;
+ int i;
+
+ for (i = 0; i < hdev->num_tqps; i++) {
+ if (!hdev->htqp[i].alloced)
+ temp_tqps++;
+ }
+ *free_tqps = temp_tqps;
+ *max_rss_size = hdev->rss_size_max;
+}
+
+static void hclge_release_tqp(struct hclge_vport *vport)
+{
+ struct hnae3_knic_private_info *kinfo = &vport->nic.kinfo;
+ struct hclge_dev *hdev = vport->back;
+ int i;
+
+ for (i = 0; i < kinfo->num_tqps; i++) {
+ struct hclge_tqp *tqp =
+ container_of(kinfo->tqp[i], struct hclge_tqp, q);
+
+ tqp->q.handle = NULL;
+ tqp->q.tqp_index = 0;
+ tqp->alloced = false;
+ }
+
+ devm_kfree(&hdev->pdev->dev, kinfo->tqp);
+ kinfo->tqp = NULL;
+}
+
+static int hclge_set_channels(struct hnae3_handle *handle, u32 new_tqps_num)
+{
+ struct hclge_vport *vport = hclge_get_vport(handle);
+ struct hnae3_knic_private_info *kinfo = &vport->nic.kinfo;
+ struct hclge_dev *hdev = vport->back;
+ int cur_rss_size = kinfo->rss_size;
+ int cur_tqps = kinfo->num_tqps;
+ u16 tc_offset[HCLGE_MAX_TC_NUM];
+ u16 tc_valid[HCLGE_MAX_TC_NUM];
+ u16 tc_size[HCLGE_MAX_TC_NUM];
+ u16 roundup_size;
+ u32 *rss_indir;
+ int ret, i;
+
+ hclge_release_tqp(vport);
+
+ ret = hclge_knic_setup(vport, new_tqps_num);
+ if (ret) {
+ dev_err(&hdev->pdev->dev, "setup nic fail, ret =%d\n", ret);
+ return ret;
+ }
+
+ ret = hclge_map_tqp_to_vport(hdev, vport);
+ if (ret) {
+ dev_err(&hdev->pdev->dev, "map vport tqp fail, ret =%d\n", ret);
+ return ret;
+ }
+
+ ret = hclge_tm_schd_init(hdev);
+ if (ret) {
+ dev_err(&hdev->pdev->dev, "tm schd init fail, ret =%d\n", ret);
+ return ret;
+ }
+
+ roundup_size = roundup_pow_of_two(kinfo->rss_size);
+ roundup_size = ilog2(roundup_size);
+ /* Set the RSS TC mode according to the new RSS size */
+ for (i = 0; i < HCLGE_MAX_TC_NUM; i++) {
+ tc_valid[i] = 0;
+
+ if (!(hdev->hw_tc_map & BIT(i)))
+ continue;
+
+ tc_valid[i] = 1;
+ tc_size[i] = roundup_size;
+ tc_offset[i] = kinfo->rss_size * i;
+ }
+ ret = hclge_set_rss_tc_mode(hdev, tc_valid, tc_size, tc_offset);
+ if (ret)
+ return ret;
+
+ /* Reinitializes the rss indirect table according to the new RSS size */
+ rss_indir = kcalloc(HCLGE_RSS_IND_TBL_SIZE, sizeof(u32), GFP_KERNEL);
+ if (!rss_indir)
+ return -ENOMEM;
+
+ for (i = 0; i < HCLGE_RSS_IND_TBL_SIZE; i++)
+ rss_indir[i] = i % kinfo->rss_size;
+
+ ret = hclge_set_rss(handle, rss_indir, NULL, 0);
+ if (ret)
+ dev_err(&hdev->pdev->dev, "set rss indir table fail, ret=%d\n",
+ ret);
+
+ kfree(rss_indir);
+
+ if (!ret)
+ dev_info(&hdev->pdev->dev,
+ "Channels changed, rss_size from %d to %d, tqps from %d to %d",
+ cur_rss_size, kinfo->rss_size,
+ cur_tqps, kinfo->rss_size * kinfo->num_tc);
+
+ return ret;
+}
+
static const struct hnae3_ae_ops hclge_ops = {
.init_ae_dev = hclge_init_ae_dev,
.uninit_ae_dev = hclge_uninit_ae_dev,
@@ -5066,6 +5176,8 @@ static void hclge_get_channels(struct hnae3_handle *handle,
.set_vlan_filter = hclge_set_port_vlan_filter,
.set_vf_vlan_filter = hclge_set_vf_vlan_filter,
.reset_event = hclge_reset_event,
+ .get_tqps_and_rss_info = hclge_get_tqps_and_rss_info,
+ .set_channels = hclge_set_channels,
.get_channels = hclge_get_channels,
};
--
1.9.1
^ permalink raw reply related
* [PATCH V4 net-next 07/17] net: hns3: add vlan offload config command
From: Lipeng @ 2017-12-21 7:28 UTC (permalink / raw)
To: davem; +Cc: netdev, linux-kernel, linuxarm, salil.mehta, lipeng321
In-Reply-To: <1513841343-60964-1-git-send-email-lipeng321@huawei.com>
This patch adds vlan offload config commands, initializes
the rules of tx/rx vlan tag handle for hw.
Signed-off-by: Lipeng <lipeng321@huawei.com>
Signed-off-by: Jian Shen <shenjian15@huawei.com>
---
.../net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h | 45 ++++++
.../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 158 ++++++++++++++++++++-
.../ethernet/hisilicon/hns3/hns3pf/hclge_main.h | 36 +++++
3 files changed, 233 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h
index 10adf86..f5baba21 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h
@@ -180,6 +180,10 @@ enum hclge_opcode_type {
/* Promisuous mode command */
HCLGE_OPC_CFG_PROMISC_MODE = 0x0E01,
+ /* Vlan offload command */
+ HCLGE_OPC_VLAN_PORT_TX_CFG = 0x0F01,
+ HCLGE_OPC_VLAN_PORT_RX_CFG = 0x0F02,
+
/* Interrupts cmd */
HCLGE_OPC_ADD_RING_TO_VECTOR = 0x1503,
HCLGE_OPC_DEL_RING_TO_VECTOR = 0x1504,
@@ -670,6 +674,47 @@ struct hclge_vlan_filter_vf_cfg_cmd {
u8 vf_bitmap[16];
};
+#define HCLGE_ACCEPT_TAG_B 0
+#define HCLGE_ACCEPT_UNTAG_B 1
+#define HCLGE_PORT_INS_TAG1_EN_B 2
+#define HCLGE_PORT_INS_TAG2_EN_B 3
+#define HCLGE_CFG_NIC_ROCE_SEL_B 4
+struct hclge_vport_vtag_tx_cfg_cmd {
+ u8 vport_vlan_cfg;
+ u8 vf_offset;
+ u8 rsv1[2];
+ __le16 def_vlan_tag1;
+ __le16 def_vlan_tag2;
+ u8 vf_bitmap[8];
+ u8 rsv2[8];
+};
+
+#define HCLGE_REM_TAG1_EN_B 0
+#define HCLGE_REM_TAG2_EN_B 1
+#define HCLGE_SHOW_TAG1_EN_B 2
+#define HCLGE_SHOW_TAG2_EN_B 3
+struct hclge_vport_vtag_rx_cfg_cmd {
+ u8 vport_vlan_cfg;
+ u8 vf_offset;
+ u8 rsv1[6];
+ u8 vf_bitmap[8];
+ u8 rsv2[8];
+};
+
+struct hclge_tx_vlan_type_cfg_cmd {
+ __le16 ot_vlan_type;
+ __le16 in_vlan_type;
+ u8 rsv[20];
+};
+
+struct hclge_rx_vlan_type_cfg_cmd {
+ __le16 ot_fst_vlan_type;
+ __le16 ot_sec_vlan_type;
+ __le16 in_fst_vlan_type;
+ __le16 in_sec_vlan_type;
+ u8 rsv[16];
+};
+
struct hclge_cfg_com_tqp_queue_cmd {
__le16 tqp_id;
__le16 stream_id;
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index a1d9398..113b859 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -4380,23 +4380,169 @@ static int hclge_set_vf_vlan_filter(struct hnae3_handle *handle, int vfid,
return hclge_set_vf_vlan_common(hdev, vfid, false, vlan, qos, proto);
}
+static int hclge_set_vlan_tx_offload_cfg(struct hclge_vport *vport)
+{
+ struct hclge_tx_vtag_cfg *vcfg = &vport->txvlan_cfg;
+ struct hclge_vport_vtag_tx_cfg_cmd *req;
+ struct hclge_dev *hdev = vport->back;
+ struct hclge_desc desc;
+ int status;
+
+ hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_VLAN_PORT_TX_CFG, false);
+
+ req = (struct hclge_vport_vtag_tx_cfg_cmd *)desc.data;
+ req->def_vlan_tag1 = cpu_to_le16(vcfg->default_tag1);
+ req->def_vlan_tag2 = cpu_to_le16(vcfg->default_tag2);
+ hnae_set_bit(req->vport_vlan_cfg, HCLGE_ACCEPT_TAG_B,
+ vcfg->accept_tag ? 1 : 0);
+ hnae_set_bit(req->vport_vlan_cfg, HCLGE_ACCEPT_UNTAG_B,
+ vcfg->accept_untag ? 1 : 0);
+ hnae_set_bit(req->vport_vlan_cfg, HCLGE_PORT_INS_TAG1_EN_B,
+ vcfg->insert_tag1_en ? 1 : 0);
+ hnae_set_bit(req->vport_vlan_cfg, HCLGE_PORT_INS_TAG2_EN_B,
+ vcfg->insert_tag2_en ? 1 : 0);
+ hnae_set_bit(req->vport_vlan_cfg, HCLGE_CFG_NIC_ROCE_SEL_B, 0);
+
+ req->vf_offset = vport->vport_id / HCLGE_VF_NUM_PER_CMD;
+ req->vf_bitmap[req->vf_offset] =
+ 1 << (vport->vport_id % HCLGE_VF_NUM_PER_BYTE);
+
+ status = hclge_cmd_send(&hdev->hw, &desc, 1);
+ if (status)
+ dev_err(&hdev->pdev->dev,
+ "Send port txvlan cfg command fail, ret =%d\n",
+ status);
+
+ return status;
+}
+
+static int hclge_set_vlan_rx_offload_cfg(struct hclge_vport *vport)
+{
+ struct hclge_rx_vtag_cfg *vcfg = &vport->rxvlan_cfg;
+ struct hclge_vport_vtag_rx_cfg_cmd *req;
+ struct hclge_dev *hdev = vport->back;
+ struct hclge_desc desc;
+ int status;
+
+ hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_VLAN_PORT_RX_CFG, false);
+
+ req = (struct hclge_vport_vtag_rx_cfg_cmd *)desc.data;
+ hnae_set_bit(req->vport_vlan_cfg, HCLGE_REM_TAG1_EN_B,
+ vcfg->strip_tag1_en ? 1 : 0);
+ hnae_set_bit(req->vport_vlan_cfg, HCLGE_REM_TAG2_EN_B,
+ vcfg->strip_tag2_en ? 1 : 0);
+ hnae_set_bit(req->vport_vlan_cfg, HCLGE_SHOW_TAG1_EN_B,
+ vcfg->vlan1_vlan_prionly ? 1 : 0);
+ hnae_set_bit(req->vport_vlan_cfg, HCLGE_SHOW_TAG2_EN_B,
+ vcfg->vlan2_vlan_prionly ? 1 : 0);
+
+ req->vf_offset = vport->vport_id / HCLGE_VF_NUM_PER_CMD;
+ req->vf_bitmap[req->vf_offset] =
+ 1 << (vport->vport_id % HCLGE_VF_NUM_PER_BYTE);
+
+ status = hclge_cmd_send(&hdev->hw, &desc, 1);
+ if (status)
+ dev_err(&hdev->pdev->dev,
+ "Send port rxvlan cfg command fail, ret =%d\n",
+ status);
+
+ return status;
+}
+
+static int hclge_set_vlan_protocol_type(struct hclge_dev *hdev)
+{
+ struct hclge_rx_vlan_type_cfg_cmd *rx_req;
+ struct hclge_tx_vlan_type_cfg_cmd *tx_req;
+ struct hclge_desc desc;
+ int status;
+
+ hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_MAC_VLAN_TYPE_ID, false);
+ rx_req = (struct hclge_rx_vlan_type_cfg_cmd *)desc.data;
+ rx_req->ot_fst_vlan_type =
+ cpu_to_le16(hdev->vlan_type_cfg.rx_ot_fst_vlan_type);
+ rx_req->ot_sec_vlan_type =
+ cpu_to_le16(hdev->vlan_type_cfg.rx_ot_sec_vlan_type);
+ rx_req->in_fst_vlan_type =
+ cpu_to_le16(hdev->vlan_type_cfg.rx_in_fst_vlan_type);
+ rx_req->in_sec_vlan_type =
+ cpu_to_le16(hdev->vlan_type_cfg.rx_in_sec_vlan_type);
+
+ status = hclge_cmd_send(&hdev->hw, &desc, 1);
+ if (status) {
+ dev_err(&hdev->pdev->dev,
+ "Send rxvlan protocol type command fail, ret =%d\n",
+ status);
+ return status;
+ }
+
+ hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_MAC_VLAN_INSERT, false);
+
+ tx_req = (struct hclge_tx_vlan_type_cfg_cmd *)&desc.data;
+ tx_req->ot_vlan_type = cpu_to_le16(hdev->vlan_type_cfg.tx_ot_vlan_type);
+ tx_req->in_vlan_type = cpu_to_le16(hdev->vlan_type_cfg.tx_in_vlan_type);
+
+ status = hclge_cmd_send(&hdev->hw, &desc, 1);
+ if (status)
+ dev_err(&hdev->pdev->dev,
+ "Send txvlan protocol type command fail, ret =%d\n",
+ status);
+
+ return status;
+}
+
static int hclge_init_vlan_config(struct hclge_dev *hdev)
{
-#define HCLGE_VLAN_TYPE_VF_TABLE 0
-#define HCLGE_VLAN_TYPE_PORT_TABLE 1
+#define HCLGE_FILTER_TYPE_VF 0
+#define HCLGE_FILTER_TYPE_PORT 1
+#define HCLGE_DEF_VLAN_TYPE 0x8100
+
struct hnae3_handle *handle;
+ struct hclge_vport *vport;
int ret;
+ int i;
+
+ ret = hclge_set_vlan_filter_ctrl(hdev, HCLGE_FILTER_TYPE_VF, true);
+ if (ret)
+ return ret;
- ret = hclge_set_vlan_filter_ctrl(hdev, HCLGE_VLAN_TYPE_VF_TABLE,
- true);
+ ret = hclge_set_vlan_filter_ctrl(hdev, HCLGE_FILTER_TYPE_PORT, true);
if (ret)
return ret;
- ret = hclge_set_vlan_filter_ctrl(hdev, HCLGE_VLAN_TYPE_PORT_TABLE,
- true);
+ hdev->vlan_type_cfg.rx_in_fst_vlan_type = HCLGE_DEF_VLAN_TYPE;
+ hdev->vlan_type_cfg.rx_in_sec_vlan_type = HCLGE_DEF_VLAN_TYPE;
+ hdev->vlan_type_cfg.rx_ot_fst_vlan_type = HCLGE_DEF_VLAN_TYPE;
+ hdev->vlan_type_cfg.rx_ot_sec_vlan_type = HCLGE_DEF_VLAN_TYPE;
+ hdev->vlan_type_cfg.tx_ot_vlan_type = HCLGE_DEF_VLAN_TYPE;
+ hdev->vlan_type_cfg.tx_in_vlan_type = HCLGE_DEF_VLAN_TYPE;
+
+ ret = hclge_set_vlan_protocol_type(hdev);
if (ret)
return ret;
+ for (i = 0; i < hdev->num_alloc_vport; i++) {
+ vport = &hdev->vport[i];
+ vport->txvlan_cfg.accept_tag = true;
+ vport->txvlan_cfg.accept_untag = true;
+ vport->txvlan_cfg.insert_tag1_en = false;
+ vport->txvlan_cfg.insert_tag2_en = false;
+ vport->txvlan_cfg.default_tag1 = 0;
+ vport->txvlan_cfg.default_tag2 = 0;
+
+ ret = hclge_set_vlan_tx_offload_cfg(vport);
+ if (ret)
+ return ret;
+
+ vport->rxvlan_cfg.strip_tag1_en = false;
+ vport->rxvlan_cfg.strip_tag2_en = true;
+ vport->rxvlan_cfg.vlan1_vlan_prionly = false;
+ vport->rxvlan_cfg.vlan2_vlan_prionly = false;
+
+ ret = hclge_set_vlan_rx_offload_cfg(vport);
+ if (ret)
+ return ret;
+ }
+
handle = &hdev->vport[0].nic;
return hclge_set_port_vlan_filter(handle, htons(ETH_P_8021Q), 0, false);
}
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
index 4858909..cda520c 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
@@ -79,6 +79,10 @@
#define HCLGE_PHY_MDIX_STATUS_B (6)
#define HCLGE_PHY_SPEED_DUP_RESOLVE_B (11)
+/* Factor used to calculate offset and bitmap of VF num */
+#define HCLGE_VF_NUM_PER_CMD 64
+#define HCLGE_VF_NUM_PER_BYTE 8
+
/* Reset related Registers */
#define HCLGE_MISC_RESET_STS_REG 0x20700
#define HCLGE_GLOBAL_RESET_REG 0x20A00
@@ -424,6 +428,15 @@ struct hclge_hw_stats {
struct hclge_32_bit_stats all_32_bit_stats;
};
+struct hclge_vlan_type_cfg {
+ u16 rx_ot_fst_vlan_type;
+ u16 rx_ot_sec_vlan_type;
+ u16 rx_in_fst_vlan_type;
+ u16 rx_in_sec_vlan_type;
+ u16 tx_ot_vlan_type;
+ u16 tx_in_vlan_type;
+};
+
struct hclge_dev {
struct pci_dev *pdev;
struct hnae3_ae_dev *ae_dev;
@@ -510,6 +523,26 @@ struct hclge_dev {
enum hclge_mta_dmac_sel_type mta_mac_sel_type;
bool enable_mta; /* Mutilcast filter enable */
bool accept_mta_mc; /* Whether accept mta filter multicast */
+
+ struct hclge_vlan_type_cfg vlan_type_cfg;
+};
+
+/* VPort level vlan tag configuration for TX direction */
+struct hclge_tx_vtag_cfg {
+ bool accept_tag; /* Whether accept tagged packet from host */
+ bool accept_untag; /* Whether accept untagged packet from host */
+ bool insert_tag1_en; /* Whether insert inner vlan tag */
+ bool insert_tag2_en; /* Whether insert outer vlan tag */
+ u16 default_tag1; /* The default inner vlan tag to insert */
+ u16 default_tag2; /* The default outer vlan tag to insert */
+};
+
+/* VPort level vlan tag configuration for RX direction */
+struct hclge_rx_vtag_cfg {
+ bool strip_tag1_en; /* Whether strip inner vlan tag */
+ bool strip_tag2_en; /* Whether strip outer vlan tag */
+ bool vlan1_vlan_prionly;/* Inner VLAN Tag up to descriptor Enable */
+ bool vlan2_vlan_prionly;/* Outer VLAN Tag up to descriptor Enable */
};
struct hclge_vport {
@@ -524,6 +557,9 @@ struct hclge_vport {
u16 bw_limit; /* VSI BW Limit (0 = disabled) */
u8 dwrr;
+ struct hclge_tx_vtag_cfg txvlan_cfg;
+ struct hclge_rx_vtag_cfg rxvlan_cfg;
+
int vport_id;
struct hclge_dev *back; /* Back reference to associated dev */
struct hnae3_handle nic;
--
1.9.1
^ permalink raw reply related
* [PATCH V4 net-next 14/17] net: hns3: add Asym Pause support to phy default features
From: Lipeng @ 2017-12-21 7:29 UTC (permalink / raw)
To: davem; +Cc: netdev, linux-kernel, linuxarm, salil.mehta, lipeng321
In-Reply-To: <1513841343-60964-1-git-send-email-lipeng321@huawei.com>
From: Fuyun Liang <liangfuyun1@huawei.com>
commit c4fb2cdf575d ("net: hns3: fix a bug for phy supported feature
initialization") adds default supported features for phy, but our hardware
also supports Asym Pause. This patch adds Asym Pause support to phy
default features to prevent Asym Pause can not be advertised when the phy
negotiates flow control.
Fixes: c4fb2cdf575d ("net: hns3: fix a bug for phy supported feature initialization")
Signed-off-by: Fuyun Liang <liangfuyun1@huawei.com>
Signed-off-by: Lipeng <lipeng321@huawei.com>
---
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c
index 3745153..c1dea3a 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c
@@ -17,6 +17,7 @@
#define HCLGE_PHY_SUPPORTED_FEATURES (SUPPORTED_Autoneg | \
SUPPORTED_TP | \
SUPPORTED_Pause | \
+ SUPPORTED_Asym_Pause | \
PHY_10BT_FEATURES | \
PHY_100BT_FEATURES | \
PHY_1000BT_FEATURES)
--
1.9.1
^ permalink raw reply related
* [PATCH V4 net-next 12/17] net: hns3: add support for set_pauseparam
From: Lipeng @ 2017-12-21 7:28 UTC (permalink / raw)
To: davem; +Cc: netdev, linux-kernel, linuxarm, salil.mehta, lipeng321
In-Reply-To: <1513841343-60964-1-git-send-email-lipeng321@huawei.com>
This patch adds set_pauseparam support for ethtool cmd.
Signed-off-by: Lipeng <lipeng321@huawei.com>
Signed-off-by: Fuyun Liang <liangfuyun1@huawei.com>
---
drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 13 ++++
.../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 83 ++++++++++++++++++++++
.../net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 2 +-
.../net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h | 1 +
4 files changed, 98 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
index 2fd2656..b829ec7 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
@@ -559,6 +559,18 @@ static void hns3_get_pauseparam(struct net_device *netdev,
¶m->rx_pause, ¶m->tx_pause);
}
+static int hns3_set_pauseparam(struct net_device *netdev,
+ struct ethtool_pauseparam *param)
+{
+ struct hnae3_handle *h = hns3_get_handle(netdev);
+
+ if (h->ae_algo->ops->set_pauseparam)
+ return h->ae_algo->ops->set_pauseparam(h, param->autoneg,
+ param->rx_pause,
+ param->tx_pause);
+ return -EOPNOTSUPP;
+}
+
static int hns3_get_link_ksettings(struct net_device *netdev,
struct ethtool_link_ksettings *cmd)
{
@@ -880,6 +892,7 @@ void hns3_get_channels(struct net_device *netdev,
.get_ringparam = hns3_get_ringparam,
.set_ringparam = hns3_set_ringparam,
.get_pauseparam = hns3_get_pauseparam,
+ .set_pauseparam = hns3_set_pauseparam,
.get_strings = hns3_get_strings,
.get_ethtool_stats = hns3_get_stats,
.get_sset_count = hns3_get_sset_count,
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index 14e1054..0f55ee6 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -4660,6 +4660,53 @@ static u32 hclge_get_fw_version(struct hnae3_handle *handle)
return hdev->fw_version;
}
+static void hclge_set_flowctrl_adv(struct hclge_dev *hdev, u32 rx_en, u32 tx_en)
+{
+ struct phy_device *phydev = hdev->hw.mac.phydev;
+
+ if (!phydev)
+ return;
+
+ phydev->advertising &= ~(ADVERTISED_Pause | ADVERTISED_Asym_Pause);
+
+ if (rx_en)
+ phydev->advertising |= ADVERTISED_Pause | ADVERTISED_Asym_Pause;
+
+ if (tx_en)
+ phydev->advertising ^= ADVERTISED_Asym_Pause;
+}
+
+static int hclge_cfg_pauseparam(struct hclge_dev *hdev, u32 rx_en, u32 tx_en)
+{
+ enum hclge_fc_mode fc_mode;
+ int ret;
+
+ if (rx_en && tx_en)
+ fc_mode = HCLGE_FC_FULL;
+ else if (rx_en && !tx_en)
+ fc_mode = HCLGE_FC_RX_PAUSE;
+ else if (!rx_en && tx_en)
+ fc_mode = HCLGE_FC_TX_PAUSE;
+ else
+ fc_mode = HCLGE_FC_NONE;
+
+ if (hdev->tm_info.fc_mode == HCLGE_FC_PFC) {
+ hdev->fc_mode_last_time = fc_mode;
+ return 0;
+ }
+
+ ret = hclge_mac_pause_en_cfg(hdev, tx_en, rx_en);
+ if (ret) {
+ dev_err(&hdev->pdev->dev, "configure pauseparam error, ret = %d.\n",
+ ret);
+ return ret;
+ }
+
+ hdev->tm_info.fc_mode = fc_mode;
+
+ return 0;
+}
+
static void hclge_get_pauseparam(struct hnae3_handle *handle, u32 *auto_neg,
u32 *rx_en, u32 *tx_en)
{
@@ -4689,6 +4736,41 @@ static void hclge_get_pauseparam(struct hnae3_handle *handle, u32 *auto_neg,
}
}
+static int hclge_set_pauseparam(struct hnae3_handle *handle, u32 auto_neg,
+ u32 rx_en, u32 tx_en)
+{
+ struct hclge_vport *vport = hclge_get_vport(handle);
+ struct hclge_dev *hdev = vport->back;
+ struct phy_device *phydev = hdev->hw.mac.phydev;
+ u32 fc_autoneg;
+
+ /* Only support flow control negotiation for netdev with
+ * phy attached for now.
+ */
+ if (!phydev)
+ return -EOPNOTSUPP;
+
+ fc_autoneg = hclge_get_autoneg(handle);
+ if (auto_neg != fc_autoneg) {
+ dev_info(&hdev->pdev->dev,
+ "To change autoneg please use: ethtool -s <dev> autoneg <on|off>\n");
+ return -EOPNOTSUPP;
+ }
+
+ if (hdev->tm_info.fc_mode == HCLGE_FC_PFC) {
+ dev_info(&hdev->pdev->dev,
+ "Priority flow control enabled. Cannot set link flow control.\n");
+ return -EOPNOTSUPP;
+ }
+
+ hclge_set_flowctrl_adv(hdev, rx_en, tx_en);
+
+ if (!fc_autoneg)
+ return hclge_cfg_pauseparam(hdev, rx_en, tx_en);
+
+ return phy_start_aneg(phydev);
+}
+
static void hclge_get_ksettings_an_result(struct hnae3_handle *handle,
u8 *auto_neg, u32 *speed, u8 *duplex)
{
@@ -5344,6 +5426,7 @@ static int hclge_set_channels(struct hnae3_handle *handle, u32 new_tqps_num)
.set_autoneg = hclge_set_autoneg,
.get_autoneg = hclge_get_autoneg,
.get_pauseparam = hclge_get_pauseparam,
+ .set_pauseparam = hclge_set_pauseparam,
.set_mtu = hclge_set_mtu,
.reset_queue = hclge_reset_tqp,
.get_stats = hclge_get_stats,
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
index 7bfa2e5..7cfe1eb 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
@@ -112,7 +112,7 @@ static int hclge_shaper_para_calc(u32 ir, u8 shaper_level,
return 0;
}
-static int hclge_mac_pause_en_cfg(struct hclge_dev *hdev, bool tx, bool rx)
+int hclge_mac_pause_en_cfg(struct hclge_dev *hdev, bool tx, bool rx)
{
struct hclge_desc desc;
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h
index bf59961..16f4139 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h
@@ -118,4 +118,5 @@ struct hclge_port_shapping_cmd {
int hclge_tm_dwrr_cfg(struct hclge_dev *hdev);
int hclge_tm_map_cfg(struct hclge_dev *hdev);
int hclge_tm_init_hw(struct hclge_dev *hdev);
+int hclge_mac_pause_en_cfg(struct hclge_dev *hdev, bool tx, bool rx);
#endif
--
1.9.1
^ permalink raw reply related
* Re: [Intel-wired-lan] v4.15-rc2 on thinkpad x60: ethernet stopped working
From: Neftin, Sasha @ 2017-12-21 7:13 UTC (permalink / raw)
To: Pavel Machek, Fujinaka, Todd
Cc: Keller, Jacob E, bpoirier@suse.com, nix.or.die@gmail.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
intel-wired-lan@lists.osuosl.org, lsorense@csclub.uwaterloo.ca,
David Miller
In-Reply-To: <20171220160135.GA3841@amd>
On 20/12/2017 18:01, Pavel Machek wrote:
> On Wed 2017-12-20 16:54:21, Pavel Machek wrote:
>> Hi!
>>
>>>>> Before ask for reverting 19110cfbb..., please, check if follow patch
>>>>> of Benjamin work for you http://patchwork.ozlabs.org/patch/846825/
>>> Pavel, before ask for revert - let's check Benjamin's patch following to his previous patch. Previous patch was not competed and latest one come to complete changes.
>>>
>> v4.15-rc4+:
>>
>> Ethernet works with 19110cfbb reverted.
>>
>> Ethernet works With patchwork.ozlabs.org/patch/846825/ applied.
> Hmm. So... ethernet originally did not work with patch/846825/ applied
> or 19110cfbb reverted, so I re-plugged ethernet cables. Now it works
> even with plain v4.15-rc4+.
>
> So it looks like the bug was fixed in the mainline in the meantime...?
>
> Sorry for the noise,
> Pavel
Good Pavel, thanks for update us, let's keep both patch applied and see
ethernet adapter behavior.
^ permalink raw reply
* Re: [PATCH v3 next-queue 00/10] ixgbe: Add ipsec offload
From: Yanjun Zhu @ 2017-12-21 7:09 UTC (permalink / raw)
To: Shannon Nelson, intel-wired-lan, jeffrey.t.kirsher
Cc: steffen.klassert, sowmini.varadhan, netdev
In-Reply-To: <e576cb0e-4b4f-12d9-c817-246d26cb0ada@oracle.com>
On 2017/12/21 14:39, Yanjun Zhu wrote:
>
>
> On 2017/12/20 7:59, Shannon Nelson wrote:
>> This is an implementation of the ipsec hardware offload feature for
>> the ixgbe driver and Intel's 10Gbe series NICs: x540, x550, 82599.
> Hi, Nelson
>
> I notice that the ipsec feature is based on x540, x550, 82599. But
> this ixgbe driver
> will also work with 82598.
>
> Does this ipsec feature also work with 82598?
Sorry. I mean, after these ipsec patches are applied, whether ipsec
offload enabled or not,
can this ixgbe driver still work well with 82598?
Zhu Yanjun
>
> Thanks a lot.
> Zhu Yanjun
>> These patches apply to net-next v4.14 as well as Jeff Kirsher's
>> next-queue
>> v4.15-rc1-206-ge47375b.
>>
>> The ixgbe NICs support ipsec offload for 1024 Rx and 1024 Tx Security
>> Associations (SAs), using up to 128 inbound IP addresses, and using the
>> rfc4106(gcm(aes)) encryption. This code does not yet support IPv6,
>> checksum offload, or TSO in conjunction with the ipsec offload - those
>> will be added in the future.
>>
>> This code shows improvements in both packet throughput and CPU
>> utilization.
>> For example, here are some quicky numbers that show the magnitude of the
>> performance gain on a single run of "iperf -c <dest>" with the ipsec
>> offload on both ends of a point-to-point connection:
>>
>> 9.4 Gbps - normal case
>> 7.6 Gbps - ipsec with offload
>> 343 Mbps - ipsec no offload
>>
>> To set up a similar test case, you first need to be sure you have a
>> recent
>> version of iproute2 that supports the ipsec offload tag, probably
>> something
>> from ip 4.12 or newer would be best. I have a shell script that builds
>> up the appropriate commands for me, but here are the resulting commands
>> for all tcp traffic between 14.0.0.52 and 14.0.0.70:
>>
>> For the left side (14.0.0.52):
>> ip x p add dir out src 14.0.0.52/24 dst 14.0.0.70/24 proto tcp tmpl \
>> proto esp src 14.0.0.52 dst 14.0.0.70 spi 0x07 mode transport
>> reqid 0x07
>> ip x p add dir in src 14.0.0.70/24 dst 14.0.0.52/24 proto tcp tmpl \
>> proto esp dst 14.0.0.52 src 14.0.0.70 spi 0x07 mode transport
>> reqid 0x07
>> ip x s add proto esp src 14.0.0.52 dst 14.0.0.70 spi 0x07 mode
>> transport \
>> reqid 0x07 replay-window 32 \
>> aead 'rfc4106(gcm(aes))'
>> 0x44434241343332312423222114131211f4f3f2f1 128 \
>> sel src 14.0.0.52/24 dst 14.0.0.70/24 proto tcp offload dev
>> eth4 dir out
>> ip x s add proto esp dst 14.0.0.52 src 14.0.0.70 spi 0x07 mode
>> transport \
>> reqid 0x07 replay-window 32 \
>> aead 'rfc4106(gcm(aes))'
>> 0x44434241343332312423222114131211f4f3f2f1 128 \
>> sel src 14.0.0.70/24 dst 14.0.0.52/24 proto tcp offload dev
>> eth4 dir in
>> For the right side (14.0.0.70):
>> ip x p add dir out src 14.0.0.70/24 dst 14.0.0.52/24 proto tcp tmpl \
>> proto esp src 14.0.0.70 dst 14.0.0.52 spi 0x07 mode transport
>> reqid 0x07
>> ip x p add dir in src 14.0.0.52/24 dst 14.0.0.70/24 proto tcp tmpl \
>> proto esp dst 14.0.0.70 src 14.0.0.52 spi 0x07 mode transport
>> reqid 0x07
>> ip x s add proto esp src 14.0.0.70 dst 14.0.0.52 spi 0x07 mode
>> transport \
>> reqid 0x07 replay-window 32 \
>> aead 'rfc4106(gcm(aes))'
>> 0x44434241343332312423222114131211f4f3f2f1 128 \
>> sel src 14.0.0.70/24 dst 14.0.0.52/24 proto tcp offload dev
>> eth4 dir out
>> ip x s add proto esp dst 14.0.0.70 src 14.0.0.52 spi 0x07 mode
>> transport \
>> reqid 0x07 replay-window 32 \
>> aead 'rfc4106(gcm(aes))'
>> 0x44434241343332312423222114131211f4f3f2f1 128 \
>> sel src 14.0.0.52/24 dst 14.0.0.70/24 proto tcp offload dev
>> eth4 dir in
>>
>> In both cases, the command "ip x s flush ; ip x p flush" will clean
>> it all out and remove the offloads.
>>
>> Lastly, thanks to Alex Duyck for his early comments.
>>
>> Please see the individual patches for specific update info.
>>
>> v3: fixes after comments from those wonderfully pesky kbuild robots
>> v2: fixes after comments from Alex
>>
>> Shannon Nelson (10):
>> ixgbe: clean up ipsec defines
>> ixgbe: add ipsec register access routines
>> ixgbe: add ipsec engine start and stop routines
>> ixgbe: add ipsec data structures
>> ixgbe: add ipsec offload add and remove SA
>> ixgbe: restore offloaded SAs after a reset
>> ixgbe: process the Rx ipsec offload
>> ixgbe: process the Tx ipsec offload
>> ixgbe: ipsec offload stats
>> ixgbe: register ipsec offload with the xfrm subsystem
>>
>> drivers/net/ethernet/intel/ixgbe/Makefile | 1 +
>> drivers/net/ethernet/intel/ixgbe/ixgbe.h | 33 +-
>> drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 2 +
>> drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c | 923
>> +++++++++++++++++++++++
>> drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.h | 92 +++
>> drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c | 4 +-
>> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 39 +-
>> drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | 22 +-
>> 8 files changed, 1093 insertions(+), 23 deletions(-)
>> create mode 100644 drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
>> create mode 100644 drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.h
>>
>
>
^ permalink raw reply
* [Patch net] net_sched: fix a missing rcu barrier in mini_qdisc_pair_swap()
From: Cong Wang @ 2017-12-21 7:26 UTC (permalink / raw)
To: netdev; +Cc: Cong Wang, Jiri Pirko, John Fastabend
The rcu_barrier_bh() in mini_qdisc_pair_swap() is to wait for
flying RCU callback installed by a previous mini_qdisc_pair_swap(),
however we miss it on the tp_head==NULL path, which leads to that
the RCU callback still uses miniq_old->rcu after it is freed together
with qdisc in qdisc_graft(). So just add it on that path too.
Fixes: 46209401f8f6 ("net: core: introduce mini_Qdisc and eliminate usage of tp->q for clsact fastpath ")
Reported-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Tested-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Cc: Jiri Pirko <jiri@mellanox.com>
Cc: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
net/sched/sch_generic.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index cd1b200acae7..661c7144b53a 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -1040,6 +1040,8 @@ void mini_qdisc_pair_swap(struct mini_Qdisc_pair *miniqp,
if (!tp_head) {
RCU_INIT_POINTER(*miniqp->p_miniq, NULL);
+ /* Wait for flying RCU callback before it is freed. */
+ rcu_barrier_bh();
return;
}
@@ -1055,7 +1057,7 @@ void mini_qdisc_pair_swap(struct mini_Qdisc_pair *miniqp,
rcu_assign_pointer(*miniqp->p_miniq, miniq);
if (miniq_old)
- /* This is counterpart of the rcu barrier above. We need to
+ /* This is counterpart of the rcu barriers above. We need to
* block potential new user of miniq_old until all readers
* are not seeing it.
*/
--
2.13.6
^ permalink raw reply related
* Re: RCU callback crashes
From: Cong Wang @ 2017-12-21 7:24 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: Jiri Pirko, netdev@vger.kernel.org
In-Reply-To: <20171220163710.7a5f06e5@cakuba.netronome.com>
On Wed, Dec 20, 2017 at 4:37 PM, Jakub Kicinski <kubakici@wp.pl> wrote:
> On Wed, 20 Dec 2017 16:03:49 -0800, Cong Wang wrote:
>> On Wed, Dec 20, 2017 at 10:31 AM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
>> > On Wed, Dec 20, 2017 at 10:17 AM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
>> >>
>> >> I guess it is q->miniqp which is freed in qdisc_graft() without properly
>> >> waiting for rcu readers?
>> >
>> > It is probably so, the call_rcu_bh(&miniq_old->rcu, mini_qdisc_rcu_func)
>> > in the end of mini_qdisc_pair_swap() is invoked on miniq_old->rcu,
>> > but miniq is being freed, no rcu barrier waits for it...
>> >
>> > You can try to add a rcu_barrier_bh() at the end to see if this crash
>> > is gone, but I don't think people like adding yet another rcu barrier...
>>
>> Hi, Jakub
>>
>> Can you test the following fix? I am not a fan of rcu barrier but we
>> already have one so...
>>
>> diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
>> index 876fab2604b8..1b68fedea124 100644
>> --- a/net/sched/sch_generic.c
>> +++ b/net/sched/sch_generic.c
>> @@ -1240,6 +1240,8 @@ void mini_qdisc_pair_swap(struct mini_Qdisc_pair *miniqp,
>>
>> if (!tp_head) {
>> RCU_INIT_POINTER(*miniqp->p_miniq, NULL);
>> + /* Wait for existing flying RCU callback before being freed. */
>> + rcu_barrier_bh();
>> return;
>> }
>
> Looks good after 30 minutes, feel free to add if you post officially:
>
> Tested-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Thanks for testing! I just sent a formal patch out.
^ permalink raw reply
* Re: RCU callback crashes
From: Cong Wang @ 2017-12-21 7:27 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: John Fastabend, Jiri Pirko, netdev@vger.kernel.org
In-Reply-To: <20171220164419.42c63ebf@cakuba.netronome.com>
On Wed, Dec 20, 2017 at 4:50 PM, Jakub Kicinski <kubakici@wp.pl> wrote:
> On Wed, 20 Dec 2017 16:41:14 -0800, Jakub Kicinski wrote:
>> Just as I hit send... :) but this looks unrelated, "Comm: sshd" -
>> so probably from the management interface.
>>
>> [ 154.604041] ==================================================================
>> [ 154.612245] BUG: KASAN: slab-out-of-bounds in pfifo_fast_dequeue+0x140/0x2d0
>> [ 154.620219] Read of size 8 at addr ffff88086bb64040 by task sshd/983
>> [ 154.627403]
>> [ 154.629161] CPU: 10 PID: 983 Comm: sshd Not tainted 4.15.0-rc3-perf-00984-g82d3fc87a4aa-dirty #13
>> [ 154.639190] Hardware name: Dell Inc. PowerEdge R730/072T6D, BIOS 2.3.4 11/08/2016
>> [ 154.647665] Call Trace:
>> [ 154.650494] dump_stack+0xa6/0x118
>> [ 154.654387] ? _atomic_dec_and_lock+0xe8/0xe8
>> [ 154.659355] ? trace_event_raw_event_rcu_torture_read+0x190/0x190
>> [ 154.666263] ? rcu_segcblist_enqueue+0xe9/0x120
>> [ 154.671422] ? _raw_spin_unlock_bh+0x91/0xc0
>> [ 154.676286] ? pfifo_fast_dequeue+0x140/0x2d0
>> [ 154.681251] print_address_description+0x6a/0x270
>> [ 154.686601] ? pfifo_fast_dequeue+0x140/0x2d0
>> [ 154.691565] kasan_report+0x23f/0x350
>> [ 154.695752] pfifo_fast_dequeue+0x140/0x2d0
>
> If we trust stack decode it's:
>
> 615 static struct sk_buff *pfifo_fast_dequeue(struct Qdisc *qdisc)
> 616 {
> 617 struct pfifo_fast_priv *priv = qdisc_priv(qdisc);
> 618 struct sk_buff *skb = NULL;
> 619 int band;
> 620
> 621 for (band = 0; band < PFIFO_FAST_BANDS && !skb; band++) {
> 622 struct skb_array *q = band2list(priv, band);
> 623
>>> 624 if (__skb_array_empty(q))
> 625 continue;
> 626
> 627 skb = skb_array_consume_bh(q);
> 628 }
> 629 if (likely(skb)) {
> 630 qdisc_qstats_cpu_backlog_dec(qdisc, skb);
> 631 qdisc_bstats_cpu_update(qdisc, skb);
> 632 qdisc_qstats_cpu_qlen_dec(qdisc);
> 633 }
> 634
> 635 return skb;
> 636 }
Yeah, this one is clearly a different one and it is introduced by John's
"lockless" patchset.
I will take a look tomorrow if John doesn't.
^ 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