* Re: [PATCH net 0/5] rxrpc: Fixes
From: David Miller @ 2018-05-11 19:56 UTC (permalink / raw)
To: dhowells; +Cc: netdev, linux-afs, linux-kernel
In-Reply-To: <152599231687.26376.15020977491573449830.stgit@warthog.procyon.org.uk>
From: David Howells <dhowells@redhat.com>
Date: Thu, 10 May 2018 23:45:17 +0100
> Here are three fixes for AF_RXRPC and two tracepoints that were useful for
> finding them:
...
> The patches are tagged here:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git
> rxrpc-fixes-20180510
Pulled, thanks David.
^ permalink raw reply
* Re: [PATCH v2 1/3] selinux: add AF_UNSPEC and INADDR_ANY checks to selinux_socket_bind()
From: Richard Haines via Selinux @ 2018-05-11 19:56 UTC (permalink / raw)
To: Alexey Kodanev, selinux-+05T5uksL2qpZYMLLGbcSA
Cc: linux-security-module-u79uwXL29TY76Z2rM5mHXA, Stephen Smalley,
netdev
In-Reply-To: <1526058913-14198-1-git-send-email-alexey.kodanev-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
On Fri, 2018-05-11 at 20:15 +0300, Alexey Kodanev wrote:
> Commit d452930fd3b9 ("selinux: Add SCTP support") breaks
> compatibility
> with the old programs that can pass sockaddr_in structure with
> AF_UNSPEC
> and INADDR_ANY to bind(). As a result, bind() returns EAFNOSUPPORT
> error.
> This was found with LTP/asapi_01 test.
>
> Similar to commit 29c486df6a20 ("net: ipv4: relax AF_INET check in
> bind()"), which relaxed AF_INET check for compatibility, add
> AF_UNSPEC
> case to AF_INET and make sure that the address is INADDR_ANY.
>
> Fixes: d452930fd3b9 ("selinux: Add SCTP support")
> Signed-off-by: Alexey Kodanev <alexey.kodanev-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> ---
>
> v2: As suggested by Paul:
> * return EINVAL for SCTP socket if sa_family is AF_UNSPEC and
> address is not INADDR_ANY
> * add new 'sa_family' variable so that it equals either AF_INET
> or AF_INET6. Besides, it it will be used in the next patch that
> fixes audit record.
>
> security/selinux/hooks.c | 29 +++++++++++++++++++----------
> 1 file changed, 19 insertions(+), 10 deletions(-)
>
> diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> index 4cafe6a..1ed7004 100644
> --- a/security/selinux/hooks.c
> +++ b/security/selinux/hooks.c
> @@ -4576,6 +4576,7 @@ static int selinux_socket_post_create(struct
> socket *sock, int family,
> static int selinux_socket_bind(struct socket *sock, struct sockaddr
> *address, int addrlen)
> {
> struct sock *sk = sock->sk;
> + struct sk_security_struct *sksec = sk->sk_security;
> u16 family;
> int err;
>
> @@ -4587,11 +4588,11 @@ static int selinux_socket_bind(struct socket
> *sock, struct sockaddr *address, in
> family = sk->sk_family;
> if (family == PF_INET || family == PF_INET6) {
> char *addrp;
> - struct sk_security_struct *sksec = sk->sk_security;
> struct common_audit_data ad;
> struct lsm_network_audit net = {0,};
> struct sockaddr_in *addr4 = NULL;
> struct sockaddr_in6 *addr6 = NULL;
> + u16 family_sa = address->sa_family;
> unsigned short snum;
> u32 sid, node_perm;
>
> @@ -4601,11 +4602,20 @@ static int selinux_socket_bind(struct socket
> *sock, struct sockaddr *address, in
> * need to check address->sa_family as it is
> possible to have
> * sk->sk_family = PF_INET6 with addr->sa_family =
> AF_INET.
> */
> - switch (address->sa_family) {
> + switch (family_sa) {
> + case AF_UNSPEC:
> case AF_INET:
> if (addrlen < sizeof(struct sockaddr_in))
> return -EINVAL;
> addr4 = (struct sockaddr_in *)address;
> + if (family_sa == AF_UNSPEC) {
> + /* see __inet_bind(), we only want
> to allow
> + * AF_UNSPEC if the address is
> INADDR_ANY
> + */
> + if (addr4->sin_addr.s_addr !=
> htonl(INADDR_ANY))
> + goto err_af;
> + family_sa = AF_INET;
> + }
> snum = ntohs(addr4->sin_port);
> addrp = (char *)&addr4->sin_addr.s_addr;
> break;
> @@ -4617,13 +4627,7 @@ static int selinux_socket_bind(struct socket
> *sock, struct sockaddr *address, in
> addrp = (char *)&addr6->sin6_addr.s6_addr;
> break;
> default:
> - /* Note that SCTP services expect -EINVAL,
> whereas
> - * others expect -EAFNOSUPPORT.
> - */
> - if (sksec->sclass == SECCLASS_SCTP_SOCKET)
> - return -EINVAL;
> - else
> - return -EAFNOSUPPORT;
> + goto err_af;
> }
>
> if (snum) {
> @@ -4681,7 +4685,7 @@ static int selinux_socket_bind(struct socket
> *sock, struct sockaddr *address, in
> ad.u.net->sport = htons(snum);
> ad.u.net->family = family;
>
> - if (address->sa_family == AF_INET)
> + if (family_sa == AF_INET)
> ad.u.net->v4info.saddr = addr4-
> >sin_addr.s_addr;
> else
> ad.u.net->v6info.saddr = addr6->sin6_addr;
> @@ -4694,6 +4698,11 @@ static int selinux_socket_bind(struct socket
> *sock, struct sockaddr *address, in
> }
> out:
> return err;
> +err_af:
> + /* Note that SCTP services expect -EINVAL, others
> -EAFNOSUPPORT. */
> + if (sksec->sclass == SECCLASS_SCTP_SOCKET)
> + return -EINVAL;
> + return -EAFNOSUPPORT;
> }
>
> /* This supports connect(2) and SCTP connect services such as
> sctp_connectx(3)
Tested all three patches with no unexpected problems on kernel from [1]
using:
1) lksctp-tools - Passed except test_1_to_1_events as per [2]
2) sctp-tests - As above
3) selinux-testsuite with my SCTP patch [3] - Passes all sctp and
inet_socket tests.
4) The LTP "./runltp -pq -f connect-syscall" (see [4]) - Passes
[1] https://github.com/SELinuxProject/selinux-kernel/tree/next
[2] https://github.com/sctp/lksctp-tools/issues/24
[3] https://marc.info/?l=selinux&m=152156947715709&w=2
[4] https://marc.info/?l=selinux&m=151990968221563&w=2
^ permalink raw reply
* Re: [net 0/4][pull request] Intel Wired LAN Driver Updates 2018-05-11
From: David Miller @ 2018-05-11 19:57 UTC (permalink / raw)
To: jeffrey.t.kirsher; +Cc: netdev, nhorman, sassmann, jogreene
In-Reply-To: <20180511194722.28325-1-jeffrey.t.kirsher@intel.com>
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Fri, 11 May 2018 12:47:18 -0700
> This series contains fixes to the ice, ixgbe and ixgbevf drivers.
...
> The following are changes since commit 5ae4bbf76928b401fe467e837073d939300adbf0:
> Merge tag 'mlx5-fixes-2018-05-10' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
> and are available in the git repository at:
> git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-queue 10GbE
Pulled, thanks Jeff.
^ permalink raw reply
* Re: [PATCH] dt-bindings: net: ravb: Add support for r8a77990 SoC
From: David Miller @ 2018-05-11 19:59 UTC (permalink / raw)
To: yoshihiro.shimoda.uh
Cc: netdev, linux-renesas-soc, robh+dt, mark.rutland, sergei.shtylyov,
devicetree
In-Reply-To: <1526008736-26496-1-git-send-email-yoshihiro.shimoda.uh@renesas.com>
From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Date: Fri, 11 May 2018 12:18:56 +0900
> Add documentation for r8a77990 compatible string to renesas ravb device
> tree bindings documentation.
>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
I'm assuming this isn't targetted at one of my trees. Just FYI.
^ permalink raw reply
* Re: [PATCH net-next 0/2] mlxsw: spectrum_span: Two minor adjustments
From: David Miller @ 2018-05-11 20:01 UTC (permalink / raw)
To: idosch; +Cc: netdev, jiri, petrm, mlxsw
In-Reply-To: <20180511085731.9256-1-idosch@mellanox.com>
From: Ido Schimmel <idosch@mellanox.com>
Date: Fri, 11 May 2018 11:57:29 +0300
> Petr says:
>
> This patch set fixes a couple of nits in mlxsw's SPAN implementation:
> two counts of inaccurate variable name and one count of unsuitable error
> code, fixed, respectively, in patches #1 and #2.
Series applied, thanks.
^ permalink raw reply
* Re: [PATCH net-next] erspan: auto detect truncated ipv6 packets.
From: David Miller @ 2018-05-11 20:04 UTC (permalink / raw)
To: u9012063; +Cc: netdev
In-Reply-To: <1526042987-20015-1-git-send-email-u9012063@gmail.com>
From: William Tu <u9012063@gmail.com>
Date: Fri, 11 May 2018 05:49:47 -0700
> Currently the truncated bit is set only when 1) the mirrored packet
> is larger than mtu and 2) the ipv4 packet tot_len is larger than
> the actual skb->len. This patch adds another case for detecting
> whether ipv6 packet is truncated or not, by checking the ipv6 header
> payload_len and the skb->len.
>
> Reported-by: Xiaoyan Jin <xiaoyanj@vmware.com>
> Signed-off-by: William Tu <u9012063@gmail.com>
Applied, thanks William.
^ permalink raw reply
* Re: [PATCH 1/3] bonding: replace the return value type
From: David Miller @ 2018-05-11 20:08 UTC (permalink / raw)
To: xiangxia.m.yue; +Cc: netdev
In-Reply-To: <1526032354-65731-1-git-send-email-xiangxia.m.yue@gmail.com>
From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Date: Fri, 11 May 2018 02:52:32 -0700
> The method ndo_start_xmit is defined as returning a
> netdev_tx_t, which is a typedef for an enum type,
> but the implementation in this driver returns an int.
>
> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Applied to net-next
^ permalink raw reply
* Re: [PATCH 2/3] bonding: use the skb_get/set_queue_mapping
From: David Miller @ 2018-05-11 20:09 UTC (permalink / raw)
To: xiangxia.m.yue; +Cc: netdev
In-Reply-To: <1526032392-65791-2-git-send-email-xiangxia.m.yue@gmail.com>
From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Date: Fri, 11 May 2018 02:53:11 -0700
> Use the skb_get_queue_mapping, skb_set_queue_mapping
> and skb_rx_queue_recorded for skb queue_mapping in bonding
> driver, but not use it directly.
>
> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Applied to net-next
^ permalink raw reply
* Re: [PATCH 3/3] net: doc: fix spelling mistake: "modrobe.d" -> "modprobe.d"
From: David Miller @ 2018-05-11 20:09 UTC (permalink / raw)
To: xiangxia.m.yue; +Cc: netdev
In-Reply-To: <1526032392-65791-3-git-send-email-xiangxia.m.yue@gmail.com>
From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Date: Fri, 11 May 2018 02:53:12 -0700
> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Applied to net-next.
^ permalink raw reply
* Re: [PATCH net-next] cxgb4: Add new T5 device id
From: David Miller @ 2018-05-11 20:10 UTC (permalink / raw)
To: ganeshgr; +Cc: netdev, nirranjan, indranil, venkatesh
In-Reply-To: <1526044054-6709-1-git-send-email-ganeshgr@chelsio.com>
From: Ganesh Goudar <ganeshgr@chelsio.com>
Date: Fri, 11 May 2018 18:37:34 +0530
> Add 0x50ad device id for new T5 card.
>
> Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next 1/3] cxgb4: Fix {vxlan/geneve}_port initialization
From: David Miller @ 2018-05-11 20:12 UTC (permalink / raw)
To: ganeshgr; +Cc: netdev, nirranjan, indranil, venkatesh, arjun
In-Reply-To: <1526043883-6522-1-git-send-email-ganeshgr@chelsio.com>
From: Ganesh Goudar <ganeshgr@chelsio.com>
Date: Fri, 11 May 2018 18:34:43 +0530
> From: Arjun Vynipadath <arjun@chelsio.com>
>
> adapter->rawf_cnt was not initialized, thereby
> ndo_udp_tunnel_{add/del} was returning immediately
> without initializing {vxlan/geneve}_port.
> Also initializes mps_encap_entry refcnt.
>
> Fixes: 846eac3fccec ("cxgb4: implement udp tunnel callbacks")
> Signed-off-by: Arjun Vynipadath <arjun@chelsio.com>
> Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next 2/3] cxgb4: enable inner header checksum calculation
From: David Miller @ 2018-05-11 20:12 UTC (permalink / raw)
To: ganeshgr; +Cc: netdev, nirranjan, indranil, venkatesh, arjun
In-Reply-To: <1526043933-6569-1-git-send-email-ganeshgr@chelsio.com>
From: Ganesh Goudar <ganeshgr@chelsio.com>
Date: Fri, 11 May 2018 18:35:33 +0530
> set cntrl bits to indicate whether inner header checksum
> needs to be calculated whenever the packet is an encapsulated
> packet and enable supported encap features.
>
> Fixes: d0a1299c6bf7 ("cxgb4: add support for vxlan segmentation offload")
> Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next 3/3] cxgb4: avoid schedule while atomic
From: David Miller @ 2018-05-11 20:12 UTC (permalink / raw)
To: ganeshgr; +Cc: netdev, nirranjan, indranil, venkatesh, arjun
In-Reply-To: <1526043976-6616-1-git-send-email-ganeshgr@chelsio.com>
From: Ganesh Goudar <ganeshgr@chelsio.com>
Date: Fri, 11 May 2018 18:36:16 +0530
> do not sleep while adding or deleting udp tunnel.
>
> Fixes: 846eac3fccec ("cxgb4: implement udp tunnel callbacks")
> Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
Applied.
^ permalink raw reply
* Re: [patch net] net: sched: fix error path in tcf_proto_create() when modules are not configured
From: David Miller @ 2018-05-11 20:35 UTC (permalink / raw)
To: jiri; +Cc: netdev, jhs, xiyou.wangcong, mlxsw
In-Reply-To: <20180511154532.2391-1-jiri@resnulli.us>
From: Jiri Pirko <jiri@resnulli.us>
Date: Fri, 11 May 2018 17:45:32 +0200
> From: Jiri Pirko <jiri@mellanox.com>
>
> In case modules are not configured, error out when tp->ops is null
> and prevent later null pointer dereference.
>
> Fixes: 33a48927c193 ("sched: push TC filter protocol creation into a separate function")
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Applied and queued up for -stable.
^ permalink raw reply
* Re: [PATCH v3] net: phy: DP83TC811: Introduce support for the DP83TC811 phy
From: David Miller @ 2018-05-11 20:36 UTC (permalink / raw)
To: dmurphy; +Cc: andrew, f.fainelli, netdev, linux-kernel
In-Reply-To: <20180511180819.5036-1-dmurphy@ti.com>
From: Dan Murphy <dmurphy@ti.com>
Date: Fri, 11 May 2018 13:08:19 -0500
> Add support for the DP83811 phy.
>
> The DP83811 supports both rgmii and sgmii interfaces.
> There are 2 part numbers for this the DP83TC811R does not
> reliably support the SGMII interface but the DP83TC811S will.
>
> There is not a way to differentiate these parts from the
> hardware or register set. So this is controlled via the DT
> to indicate which phy mode is required. Or the part can be
> strapped to a certain interface.
>
> Data sheet can be found here:
> http://www.ti.com/product/DP83TC811S-Q1/description
> http://www.ti.com/product/DP83TC811R-Q1/description
>
> Signed-off-by: Dan Murphy <dmurphy@ti.com>
Applied to net-next, thank you.
^ permalink raw reply
* Re: [PATCH net 1/1] net sched actions: fix refcnt leak in skbmod
From: David Miller @ 2018-05-11 20:37 UTC (permalink / raw)
To: mrv; +Cc: netdev, kernel, jhs, xiyou.wangcong, jiri
In-Reply-To: <1526063733-7813-1-git-send-email-mrv@mojatatu.com>
From: Roman Mashak <mrv@mojatatu.com>
Date: Fri, 11 May 2018 14:35:33 -0400
> When application fails to pass flags in netlink TLV when replacing
> existing skbmod action, the kernel will leak refcnt:
>
> $ tc actions get action skbmod index 1
> total acts 0
>
> action order 0: skbmod pipe set smac 00:11:22:33:44:55
> index 1 ref 1 bind 0
>
> For example, at this point a buggy application replaces the action with
> index 1 with new smac 00:aa:22:33:44:55, it fails because of zero flags,
> however refcnt gets bumped:
>
> $ tc actions get actions skbmod index 1
> total acts 0
>
> action order 0: skbmod pipe set smac 00:11:22:33:44:55
> index 1 ref 2 bind 0
> $
>
> Tha patch fixes this by calling tcf_idr_release() on existing actions.
>
> Fixes: 86da71b57383d ("net_sched: Introduce skbmod action")
> Signed-off-by: Roman Mashak <mrv@mojatatu.com>
Applied and queued up for -stable, thanks.
^ permalink raw reply
* Re: INFO: rcu detected stall in kfree_skbmem
From: Marcelo Ricardo Leitner @ 2018-05-11 20:42 UTC (permalink / raw)
To: Eric Dumazet
Cc: Dmitry Vyukov, syzbot, Vladislav Yasevich, Neil Horman,
linux-sctp, Andrei Vagin, David Miller, Kirill Tkhai, LKML,
netdev, syzkaller-bugs
In-Reply-To: <683d1ead-d35b-27ee-0f0c-f7e815d989fc@gmail.com>
On Fri, May 11, 2018 at 12:08:33PM -0700, Eric Dumazet wrote:
>
>
> On 05/11/2018 11:41 AM, Marcelo Ricardo Leitner wrote:
>
> > But calling ip6_xmit with rcu_read_lock is expected. tcp stack also
> > does it.
> > Thus I think this is more of an issue with IPv6 stack. If a host has
> > an extensive ip6tables ruleset, it probably generates this more
> > easily.
> >
> >>> sctp_v6_xmit+0x4a5/0x6b0 net/sctp/ipv6.c:225
> >>> sctp_packet_transmit+0x26f6/0x3ba0 net/sctp/output.c:650
> >>> sctp_outq_flush+0x1373/0x4370 net/sctp/outqueue.c:1197
> >>> sctp_outq_uncork+0x6a/0x80 net/sctp/outqueue.c:776
> >>> sctp_cmd_interpreter net/sctp/sm_sideeffect.c:1820 [inline]
> >>> sctp_side_effects net/sctp/sm_sideeffect.c:1220 [inline]
> >>> sctp_do_sm+0x596/0x7160 net/sctp/sm_sideeffect.c:1191
> >>> sctp_generate_heartbeat_event+0x218/0x450 net/sctp/sm_sideeffect.c:406
> >>> call_timer_fn+0x230/0x940 kernel/time/timer.c:1326
> >>> expire_timers kernel/time/timer.c:1363 [inline]
> >
> > Having this call from a timer means it wasn't processing sctp stack
> > for too long.
> >
>
> I feel the problem is that this part is looping, in some infinite loop.
>
> I have seen this stack traces in other reports.
Checked mail history now, seems at least two other reports on RCU
stalls had sctp_generate_heartbeat_event involved.
>
> Maybe some kind of list corruption.
Could be.
Do we know if it generated a flood of packets?
Marcelo
^ permalink raw reply
* Re: [PATCH net-next 2/4] bonding: use common mac addr checks
From: Jay Vosburgh @ 2018-05-11 20:53 UTC (permalink / raw)
To: Debabrata Banerjee
Cc: David S . Miller, netdev, Veaceslav Falico, Andy Gospodarek
In-Reply-To: <20180511192548.8119-3-dbanerje@akamai.com>
Debabrata Banerjee <dbanerje@akamai.com> wrote:
>Replace homegrown mac addr checks with faster defs from etherdevice.h
>
>Signed-off-by: Debabrata Banerjee <dbanerje@akamai.com>
>---
> drivers/net/bonding/bond_alb.c | 28 +++++++++-------------------
> 1 file changed, 9 insertions(+), 19 deletions(-)
>
>diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
>index c2f6c58e4e6a..180e50f7806f 100644
>--- a/drivers/net/bonding/bond_alb.c
>+++ b/drivers/net/bonding/bond_alb.c
>@@ -40,11 +40,6 @@
> #include <net/bonding.h>
> #include <net/bond_alb.h>
>
>-
>-
>-static const u8 mac_bcast[ETH_ALEN + 2] __long_aligned = {
>- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
>-};
> static const u8 mac_v6_allmcast[ETH_ALEN + 2] __long_aligned = {
> 0x33, 0x33, 0x00, 0x00, 0x00, 0x01
> };
>@@ -420,9 +415,7 @@ static void rlb_clear_slave(struct bonding *bond, struct slave *slave)
>
> if (assigned_slave) {
> rx_hash_table[index].slave = assigned_slave;
>- if (!ether_addr_equal_64bits(rx_hash_table[index].mac_dst,
>- mac_bcast) &&
>- !is_zero_ether_addr(rx_hash_table[index].mac_dst)) {
>+ if (is_valid_ether_addr(rx_hash_table[index].mac_dst)) {
This change and the similar ones below will now fail
non-broadcast multicast Ethernet addresses, where the prior code would
not. Is this an intentional change?
-J
> bond_info->rx_hashtbl[index].ntt = 1;
> bond_info->rx_ntt = 1;
> /* A slave has been removed from the
>@@ -525,8 +518,7 @@ static void rlb_req_update_slave_clients(struct bonding *bond, struct slave *sla
> client_info = &(bond_info->rx_hashtbl[hash_index]);
>
> if ((client_info->slave == slave) &&
>- !ether_addr_equal_64bits(client_info->mac_dst, mac_bcast) &&
>- !is_zero_ether_addr(client_info->mac_dst)) {
>+ is_valid_ether_addr(client_info->mac_dst)) {
> client_info->ntt = 1;
> ntt = 1;
> }
>@@ -567,8 +559,7 @@ static void rlb_req_update_subnet_clients(struct bonding *bond, __be32 src_ip)
> if ((client_info->ip_src == src_ip) &&
> !ether_addr_equal_64bits(client_info->slave->dev->dev_addr,
> bond->dev->dev_addr) &&
>- !ether_addr_equal_64bits(client_info->mac_dst, mac_bcast) &&
>- !is_zero_ether_addr(client_info->mac_dst)) {
>+ is_valid_ether_addr(client_info->mac_dst)) {
> client_info->ntt = 1;
> bond_info->rx_ntt = 1;
> }
>@@ -596,7 +587,7 @@ static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bon
> if ((client_info->ip_src == arp->ip_src) &&
> (client_info->ip_dst == arp->ip_dst)) {
> /* the entry is already assigned to this client */
>- if (!ether_addr_equal_64bits(arp->mac_dst, mac_bcast)) {
>+ if (!is_broadcast_ether_addr(arp->mac_dst)) {
> /* update mac address from arp */
> ether_addr_copy(client_info->mac_dst, arp->mac_dst);
> }
>@@ -644,8 +635,7 @@ static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bon
> ether_addr_copy(client_info->mac_src, arp->mac_src);
> client_info->slave = assigned_slave;
>
>- if (!ether_addr_equal_64bits(client_info->mac_dst, mac_bcast) &&
>- !is_zero_ether_addr(client_info->mac_dst)) {
>+ if (is_valid_ether_addr(client_info->mac_dst)) {
> client_info->ntt = 1;
> bond->alb_info.rx_ntt = 1;
> } else {
>@@ -1418,9 +1408,9 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
> case ETH_P_IP: {
> const struct iphdr *iph = ip_hdr(skb);
>
>- if (ether_addr_equal_64bits(eth_data->h_dest, mac_bcast) ||
>- (iph->daddr == ip_bcast) ||
>- (iph->protocol == IPPROTO_IGMP)) {
>+ if (is_broadcast_ether_addr(eth_data->h_dest) ||
>+ iph->daddr == ip_bcast ||
>+ iph->protocol == IPPROTO_IGMP) {
> do_tx_balance = false;
> break;
> }
>@@ -1432,7 +1422,7 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
> /* IPv6 doesn't really use broadcast mac address, but leave
> * that here just in case.
> */
>- if (ether_addr_equal_64bits(eth_data->h_dest, mac_bcast)) {
>+ if (is_broadcast_ether_addr(eth_data->h_dest)) {
> do_tx_balance = false;
> break;
> }
>--
>2.17.0
>
^ permalink raw reply
* [GIT] Networking
From: David Miller @ 2018-05-11 21:00 UTC (permalink / raw)
To: torvalds; +Cc: akpm, netdev, linux-kernel
1) Verify lengths of keys provided by the user is AF_KEY, from
Kevin Easton.
2) Add device ID for BCM89610 PHY. Thanks to Bhadram Varka.
3) Add Spectre guards to some ATM code, courtesy of Gustavo
A. R. Silva.
4) Fix infinite loop in NSH protocol code. To Eric Dumazet
we are most grateful for this fix.
5) Line up /proc/net/netlink headers properly. This fix from YU Bo,
we do appreciate.
6) Use after free in TLS code. Once again we are blessed by the
honorable Eric Dumazet with this fix.
7) Fix regression in TLS code causing stalls on partial TLS records.
This fix is bestowed upon us by Andrew Tomt.
8) Deal with too small MTUs properly in LLC code, another great gift
from Eric Dumazet.
9) Handle cached route flushing properly wrt. MTU locking in ipv4,
to Hangbin Liu we give thanks for this.
10) Fix regression in SO_BINDTODEVIC handling wrt. UDP socket demux.
Paolo Abeni, he gave us this.
11) Range check coalescing parameters in mlx4 driver, thank you
Moshe Shemesh.
12) Some ipv6 ICMP error handling fixes in rxrpc, from our good
brother David Howells.
13) Fix kexec on mlx5 by freeing IRQs in shutdown path. Daniel
Juergens, you're the best!
14) Don't send bonding RLB updates to invalid MAC addresses.
Debabrata Benerjee saved us!
15) Uh oh, we were leaking in udp_sendmsg and ping_v4_sendmsg. The
ship is now water tight, thanks to Andrey Ignatov.
16) IPSEC memory leak in ixgbe from Colin Ian King, man we've got
holes everywhere!
17) Fix error path in tcf_proto_create, Jiri Pirko what would we
do without you!
Please pull, thanks a lot!
The following changes since commit 1504269814263c9676b4605a6a91e14dc6ceac21:
Merge tag 'linux-kselftest-4.17-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest (2018-05-03 19:26:51 -1000)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git
for you to fetch changes up to a52956dfc503f8cc5cfe6454959b7049fddb4413:
net sched actions: fix refcnt leak in skbmod (2018-05-11 16:37:03 -0400)
----------------------------------------------------------------
Adi Nissim (1):
net/mlx5: E-Switch, Include VF RDMA stats in vport statistics
Alexander Aring (1):
net: ieee802154: 6lowpan: fix frag reassembly
Anders Roxell (1):
selftests: net: use TEST_PROGS_EXTENDED
Andre Tomt (1):
net/tls: Fix connection stall on partial tls record
Andrew Lunn (1):
net: dsa: mv88e6xxx: Fix PHY interrupts by parameterising PHY base address
Andrey Ignatov (1):
ipv4: fix memory leaks in udp_sendmsg, ping_v4_sendmsg
Antoine Tenart (1):
net: phy: sfp: fix the BR,min computation
Bhadram Varka (1):
net: phy: broadcom: add support for BCM89610 PHY
Christophe JAILLET (2):
net/mlx4_en: Fix an error handling path in 'mlx4_en_init_netdev()'
mlxsw: core: Fix an error handling path in 'mlxsw_core_bus_device_register()'
Colin Ian King (5):
firestream: fix spelling mistake: "reseverd" -> "reserved"
sctp: fix spelling mistake: "max_retans" -> "max_retrans"
net/9p: fix spelling mistake: "suspsend" -> "suspend"
qed: fix spelling mistake: "taskelt" -> "tasklet"
ixgbe: fix memory leak on ipsec allocation
Daniel Borkmann (1):
bpf: use array_index_nospec in find_prog_type
Daniel Jurgens (1):
net/mlx5: Free IRQs in shutdown path
David Howells (5):
rxrpc: Fix missing start of call timeout
rxrpc: Fix error reception on AF_INET6 sockets
rxrpc: Fix the min security level for kernel calls
rxrpc: Add a tracepoint to log ICMP/ICMP6 and error messages
rxrpc: Trace UDP transmission failure
David S. Miller (13):
Merge git://git.kernel.org/.../bpf/bpf
Merge branch 'for-upstream' of git://git.kernel.org/.../bluetooth/bluetooth
Merge branch 'master' of git://git.kernel.org/.../klassert/ipsec
Merge branch 'Aquantia-various-patches-2018-05'
Merge branch 'ieee802154-for-davem-2018-05-08' of git://git.kernel.org/.../sschmidt/wpan
Merge tag 'linux-can-fixes-for-4.17-20180508' of ssh://gitolite.kernel.org/.../mkl/linux-can
Merge branch 'qed-rdma-fixes'
Merge tag 'mac80211-for-davem-2018-05-09' of git://git.kernel.org/.../jberg/mac80211
Merge tag 'linux-can-fixes-for-4.17-20180510' of ssh://gitolite.kernel.org/.../mkl/linux-can
Merge branch 'bonding-bug-fixes-and-regressions'
Merge tag 'mlx5-fixes-2018-05-10' of git://git.kernel.org/.../saeed/linux
Merge tag 'rxrpc-fixes-20180510' of git://git.kernel.org/.../dhowells/linux-fs
Merge branch '10GbE' of git://git.kernel.org/.../jkirsher/net-queue
Davide Caratti (1):
tc-testing: fix tdc tests for 'bpf' action
Debabrata Banerjee (2):
bonding: do not allow rlb updates to invalid mac
bonding: send learning packets for vlans on slave
Emil Tantilov (1):
ixgbe: return error on unsupported SFP module when resetting
Eric Dumazet (4):
nsh: fix infinite loop
tls: fix use after free in tls_sk_proto_close
llc: better deal with too small mtu
tipc: fix one byte leak in tipc_sk_set_orig_addr()
Ganesh Goudar (2):
cxgb4: zero the HMA memory
cxgb4: copy mbox log size to PF0-3 adap instances
Geert Uytterhoeven (1):
dt-bindings: can: rcar_can: Fix R8A7796 SoC name
Georg Hofmann (1):
trivial: fix inconsistent help texts
Gustavo A. R. Silva (3):
ieee802154: mcr20a: Fix memory leak in mcr20a_probe
atm: zatm: Fix potential Spectre v1
net: atm: Fix potential Spectre v1
Hangbin Liu (1):
ipv4: reset fnhe_mtu_locked after cache route flushed
Hans de Goede (3):
Revert "Bluetooth: btusb: Fix quirk for Atheros 1525/QCA6174"
Bluetooth: btusb: Only check needs_reset_resume DMI table for QCA rome chipsets
Bluetooth: btusb: Add Dell XPS 13 9360 to btusb_needs_reset_resume_table
Heiner Kallweit (1):
r8169: fix powering up RTL8168h
Igor Russkikh (2):
net: aquantia: driver should correctly declare vlan_features bits
net: aquantia: Limit number of vectors to actually allocated irqs
Ilan Peer (2):
mac80211: Fix condition validating WMM IE
mac80211: Adjust SAE authentication timeout
Jakob Unterwurzacher (1):
can: dev: increase bus-off message severity
Jeff Shaw (1):
ice: Set rq_last_status when cleaning rq
Jia-Ju Bai (1):
net: ieee802154: atusb: Replace GFP_ATOMIC with GFP_KERNEL in atusb_probe
Jimmy Assarsson (1):
can: kvaser_usb: Increase correct stats counter in kvaser_usb_rx_can_msg()
Jiri Pirko (1):
net: sched: fix error path in tcf_proto_create() when modules are not configured
Johan Hovold (1):
rfkill: gpio: fix memory leak in probe error path
Johannes Berg (1):
cfg80211: limit wiphy names to 128 bytes
Kevin Easton (1):
af_key: Always verify length of provided sadb_key
Luc Van Oostenryck (1):
ixgbevf: fix ixgbevf_xmit_frame()'s return type
Lukas Wunner (2):
can: hi311x: Acquire SPI lock on ->do_get_berr_counter
can: hi311x: Work around TX complete interrupt erratum
Mark Rutland (1):
bpf: fix possible spectre-v1 in find_and_alloc_map()
Michael Chan (1):
tg3: Fix vunmap() BUG_ON() triggered from tg3_free_consistent().
Michal Kalderon (2):
qed: Fix l2 initializations over iWARP personality
qede: Fix gfp flags sent to rdma event node allocation
Mohammed Gamal (1):
hv_netvsc: Fix net device attach on older Windows hosts
Moritz Fischer (2):
net: nixge: Fix error path for obtaining mac address
net: nixge: Address compiler warnings about signedness
Moshe Shemesh (1):
net/mlx4_en: Verify coalescing parameters are in range
Paolo Abeni (1):
udp: fix SO_BINDTODEVICE
Pieter Jansen van Vuuren (1):
nfp: flower: remove headroom from max MTU calculation
Randy Dunlap (1):
mac80211: fix kernel-doc "bad line" warning
Rob Taglang (1):
net: ethernet: sun: niu set correct packet size in skb
Roi Dayan (1):
net/mlx5e: Err if asked to offload TC match on frag being first
Roman Mashak (2):
net sched actions: fix invalid pointer dereferencing if skbedit flags missing
net sched actions: fix refcnt leak in skbmod
Sara Sharon (1):
mac80211: use timeout from the AddBA response instead of the request
Sergei Shtylyov (2):
DT: net: can: rcar_canfd: document R8A77970 bindings
DT: net: can: rcar_canfd: document R8A77980 bindings
Srinivas Dasari (1):
nl80211: Free connkeys on external authentication failure
Stefan Schmidt (1):
net: ieee802154: mcr20a: do not leak resources on error path
Stefano Brivio (2):
vti6: Change minimum MTU to IPV4_MIN_MTU, vti6 can carry IPv4 too
openvswitch: Don't swap table in nlattr_set() after OVS_ATTR_NESTED is found
Steffen Klassert (2):
xfrm: Fix warning in xfrm6_tunnel_net_exit.
MAINTAINERS: Update the 3c59x network driver entry
Stephen Hemminger (1):
hv_netvsc: set master device
Sun Lianwen (1):
net/9p: correct some comment errors in 9p file system code
Uwe Kleine-König (2):
can: flexcan: fix endianess detection
arm: dts: imx[35]*: declare flexcan devices to be compatible to imx25's flexcan
Wolfram Sang (1):
net: flow_dissector: fix typo 'can by' to 'can be'
Xin Long (2):
sctp: delay the authentication for the duplicated cookie-echo chunk
sctp: remove sctp_chunk_put from fail_mark err path in sctp_ulpevent_make_rcvmsg
YU Bo (1):
net/netlink: make sure the headers line up actual value output
Ying Xue (1):
tipc: eliminate KMSAN uninit-value in strcmp complaint
YueHaibing (1):
mac80211_hwsim: fix a possible memory leak in hwsim_new_radio_nl()
weiyongjun (A) (1):
cfg80211: fix possible memory leak in regdb_query_country()
Documentation/devicetree/bindings/net/can/rcar_canfd.txt | 4 ++-
MAINTAINERS | 4 +--
arch/arm/boot/dts/imx35.dtsi | 4 +--
arch/arm/boot/dts/imx53.dtsi | 4 +--
drivers/atm/firestream.c | 2 +-
drivers/atm/zatm.c | 3 +++
drivers/bluetooth/btusb.c | 19 +++++++++++---
drivers/net/bonding/bond_alb.c | 15 ++++++-----
drivers/net/bonding/bond_main.c | 2 ++
drivers/net/can/dev.c | 2 +-
drivers/net/can/flexcan.c | 26 ++++++++++---------
drivers/net/can/spi/hi311x.c | 11 +++++---
drivers/net/can/usb/kvaser_usb.c | 2 +-
drivers/net/dsa/mv88e6xxx/chip.c | 26 +++++++++++++++++++
drivers/net/dsa/mv88e6xxx/chip.h | 1 +
drivers/net/dsa/mv88e6xxx/global2.c | 2 +-
drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 3 +++
drivers/net/ethernet/aquantia/atlantic/aq_nic.h | 1 +
drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c | 20 +++++++-------
drivers/net/ethernet/broadcom/tg3.c | 9 ++++---
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 7 +++--
drivers/net/ethernet/intel/ice/ice_controlq.c | 2 +-
drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c | 2 +-
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 3 +++
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 2 +-
drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 16 ++++++++++++
drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 8 +-----
drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 7 +++--
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 4 +++
drivers/net/ethernet/mellanox/mlx5/core/eq.c | 28 ++++++++++++++++++++
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 11 +++++++-
drivers/net/ethernet/mellanox/mlx5/core/main.c | 8 ++++++
drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h | 2 ++
drivers/net/ethernet/mellanox/mlxsw/core.c | 4 +--
drivers/net/ethernet/netronome/nfp/flower/main.c | 19 --------------
drivers/net/ethernet/ni/nixge.c | 10 ++++---
drivers/net/ethernet/qlogic/qed/qed_l2.c | 6 ++---
drivers/net/ethernet/qlogic/qed/qed_main.c | 2 +-
drivers/net/ethernet/qlogic/qede/qede_rdma.c | 2 +-
drivers/net/ethernet/realtek/r8169.c | 3 +++
drivers/net/ethernet/sun/niu.c | 5 ++--
drivers/net/hyperv/netvsc_drv.c | 3 ++-
drivers/net/hyperv/rndis_filter.c | 2 +-
drivers/net/ieee802154/atusb.c | 2 +-
drivers/net/ieee802154/mcr20a.c | 15 +++++++----
drivers/net/phy/broadcom.c | 10 +++++++
drivers/net/phy/sfp-bus.c | 2 +-
drivers/net/wireless/mac80211_hwsim.c | 1 +
include/linux/brcmphy.h | 1 +
include/net/bonding.h | 1 +
include/net/flow_dissector.h | 2 +-
include/net/mac80211.h | 2 +-
include/net/xfrm.h | 1 +
include/trace/events/rxrpc.h | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
include/uapi/linux/nl80211.h | 2 ++
kernel/bpf/syscall.c | 19 ++++++++++----
net/9p/trans_common.c | 2 +-
net/9p/trans_fd.c | 4 +--
net/9p/trans_rdma.c | 4 +--
net/9p/trans_virtio.c | 5 ++--
net/9p/trans_xen.c | 2 +-
net/atm/lec.c | 9 +++++--
net/ieee802154/6lowpan/6lowpan_i.h | 4 +--
net/ieee802154/6lowpan/reassembly.c | 14 +++++-----
net/ipv4/ping.c | 7 +++--
net/ipv4/route.c | 1 +
net/ipv4/udp.c | 11 +++++---
net/ipv6/Kconfig | 9 +++----
net/ipv6/ip6_vti.c | 4 +--
net/ipv6/udp.c | 4 +--
net/ipv6/xfrm6_tunnel.c | 3 +++
net/key/af_key.c | 45 +++++++++++++++++++++++++-------
net/llc/af_llc.c | 3 +++
net/mac80211/agg-tx.c | 4 +++
net/mac80211/mlme.c | 27 +++++++++++++------
net/mac80211/tx.c | 3 ++-
net/netlink/af_netlink.c | 6 ++---
net/nsh/nsh.c | 4 +++
net/openvswitch/flow_netlink.c | 9 +++----
net/rfkill/rfkill-gpio.c | 7 ++++-
net/rxrpc/af_rxrpc.c | 2 +-
net/rxrpc/ar-internal.h | 1 +
net/rxrpc/conn_event.c | 11 +++++---
net/rxrpc/input.c | 2 +-
net/rxrpc/local_event.c | 3 ++-
net/rxrpc/local_object.c | 57 +++++++++++++++++++++++++++++-----------
net/rxrpc/output.c | 34 ++++++++++++++++++++++--
net/rxrpc/peer_event.c | 46 ++++++++++++++++-----------------
net/rxrpc/rxkad.c | 6 +++--
net/rxrpc/sendmsg.c | 10 +++++++
net/sched/act_skbedit.c | 3 ++-
net/sched/act_skbmod.c | 5 +++-
net/sched/cls_api.c | 2 +-
net/sctp/associola.c | 30 ++++++++++++++++++++-
net/sctp/sm_make_chunk.c | 2 +-
net/sctp/sm_statefuns.c | 86 +++++++++++++++++++++++++++++++++----------------------------
net/sctp/ulpevent.c | 1 -
net/tipc/node.c | 15 +++++++++--
net/tipc/socket.c | 3 ++-
net/tls/tls_main.c | 12 ++++-----
net/wireless/core.c | 3 +++
net/wireless/nl80211.c | 1 +
net/wireless/reg.c | 1 +
net/xfrm/xfrm_state.c | 6 +++++
tools/testing/selftests/net/Makefile | 2 +-
tools/testing/selftests/tc-testing/tc-tests/actions/bpf.json | 11 +++++---
106 files changed, 714 insertions(+), 291 deletions(-)
^ permalink raw reply
* Re: [RFC bpf-next 07/11] bpf: Add helper to retrieve socket in BPF
From: Joe Stringer @ 2018-05-11 21:08 UTC (permalink / raw)
To: Martin KaFai Lau; +Cc: Joe Stringer, daniel, netdev, ast, john fastabend
In-Reply-To: <20180511045722.p7r4tbog66omohs6@kafai-mbp.dhcp.thefacebook.com>
On 10 May 2018 at 22:00, Martin KaFai Lau <kafai@fb.com> wrote:
> On Wed, May 09, 2018 at 02:07:05PM -0700, Joe Stringer wrote:
>> This patch adds a new BPF helper function, sk_lookup() which allows BPF
>> programs to find out if there is a socket listening on this host, and
>> returns a socket pointer which the BPF program can then access to
>> determine, for instance, whether to forward or drop traffic. sk_lookup()
>> takes a reference on the socket, so when a BPF program makes use of this
>> function, it must subsequently pass the returned pointer into the newly
>> added sk_release() to return the reference.
>>
>> By way of example, the following pseudocode would filter inbound
>> connections at XDP if there is no corresponding service listening for
>> the traffic:
>>
>> struct bpf_sock_tuple tuple;
>> struct bpf_sock_ops *sk;
>>
>> populate_tuple(ctx, &tuple); // Extract the 5tuple from the packet
>> sk = bpf_sk_lookup(ctx, &tuple, sizeof tuple, netns, 0);
>> if (!sk) {
>> // Couldn't find a socket listening for this traffic. Drop.
>> return TC_ACT_SHOT;
>> }
>> bpf_sk_release(sk, 0);
>> return TC_ACT_OK;
>>
>> Signed-off-by: Joe Stringer <joe@wand.net.nz>
>> ---
...
>> @@ -4032,6 +4036,96 @@ static const struct bpf_func_proto bpf_skb_get_xfrm_state_proto = {
>> };
>> #endif
>>
>> +struct sock *
>> +sk_lookup(struct net *net, struct bpf_sock_tuple *tuple) {
> Would it be possible to have another version that
> returns a sk without taking its refcnt?
> It may have performance benefit.
Not really. The sockets are not RCU-protected, and established sockets
may be torn down without notice. If we don't take a reference, there's
no guarantee that the socket will continue to exist for the duration
of running the BPF program.
>From what I follow, the comment below has a hidden implication which
is that sockets without SOCK_RCU_FREE, eg established sockets, may be
directly freed regardless of RCU.
/* Sockets having SOCK_RCU_FREE will call this function after one RCU
* grace period. This is the case for UDP sockets and TCP listeners.
*/
static void __sk_destruct(struct rcu_head *head)
...
Therefore without the refcount, it won't be safe.
^ permalink raw reply
* Re: [bpf-next V2 PATCH 4/4] xdp: change ndo_xdp_xmit API to support bulking
From: Jesper Dangaard Brouer @ 2018-05-11 21:10 UTC (permalink / raw)
To: netdev, Daniel Borkmann, Alexei Starovoitov,
Jesper Dangaard Brouer
Cc: Christoph Hellwig, BjörnTöpel, Magnus Karlsson
In-Reply-To: <152606233283.30376.3367467095674418599.stgit@firesoul>
On Fri, 11 May 2018 20:12:12 +0200 Jesper Dangaard Brouer <brouer@redhat.com> wrote:
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 03ed492c4e14..debdb6286170 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -1185,9 +1185,13 @@ struct dev_ifalias {
> * This function is used to set or query state related to XDP on the
> * netdevice and manage BPF offload. See definition of
> * enum bpf_netdev_command for details.
> - * int (*ndo_xdp_xmit)(struct net_device *dev, struct xdp_frame *xdp);
> - * This function is used to submit a XDP packet for transmit on a
> - * netdevice.
> + * int (*ndo_xdp_xmit)(struct net_device *dev, int n, struct xdp_frame **xdp);
> + * This function is used to submit @n XDP packets for transmit on a
> + * netdevice. Returns number of frames successfully transmitted, frames
> + * that got dropped are freed/returned via xdp_return_frame().
> + * Returns negative number, means general error invoking ndo, meaning
> + * no frames were xmit'ed and core-caller will free all frames.
> + * TODO: Consider add flag to allow sending flush operation.
Another reason for adding a flag to ndo_xdp_xmit, is to allow calling
it from other contexts. Like from AF_XDP TX code path, which in the
sendmsg is not protected by NAPI.
> * void (*ndo_xdp_flush)(struct net_device *dev);
> * This function is used to inform the driver to flush a particular
> * xdp tx queue. Must be called on same CPU as xdp_xmit.
> @@ -1375,8 +1379,8 @@ struct net_device_ops {
> int needed_headroom);
> int (*ndo_bpf)(struct net_device *dev,
> struct netdev_bpf *bpf);
> - int (*ndo_xdp_xmit)(struct net_device *dev,
> - struct xdp_frame *xdp);
> + int (*ndo_xdp_xmit)(struct net_device *dev, int n,
> + struct xdp_frame **xdp);
> void (*ndo_xdp_flush)(struct net_device *dev);
> };
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
^ permalink raw reply
* [PATCH net-next 0/3] net: dsa: mv88e6xxx: remove Global 1 setup
From: Vivien Didelot @ 2018-05-11 21:16 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel, kernel, Vivien Didelot, davem, andrew, f.fainelli
The mv88e6xxx driver is still writing arbitrary registers at setup time,
e.g. priority override bits. Add ops for them and provide specific setup
functions for priority and stats before getting rid of the erroneous
mv88e6xxx_g1_setup code, as previously done with Global 2.
Vivien Didelot (3):
net: dsa: mv88e6xxx: use helper for 6390 histogram
net: dsa: mv88e6xxx: add IEEE and IP mapping ops
net: dsa: mv88e6xxx: add a stats setup function
drivers/net/dsa/mv88e6xxx/chip.c | 121 +++++++++++++++++-----------
drivers/net/dsa/mv88e6xxx/chip.h | 3 +
drivers/net/dsa/mv88e6xxx/global1.c | 73 ++++++++++++++---
drivers/net/dsa/mv88e6xxx/global1.h | 15 +++-
4 files changed, 149 insertions(+), 63 deletions(-)
--
2.17.0
^ permalink raw reply
* [PATCH net-next 1/3] net: dsa: mv88e6xxx: use helper for 6390 histogram
From: Vivien Didelot @ 2018-05-11 21:16 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel, kernel, Vivien Didelot, davem, andrew, f.fainelli
In-Reply-To: <20180511211636.25995-1-vivien.didelot@savoirfairelinux.com>
The Marvell 88E6390 model has its histogram mode bits moved in the
Global 1 Control 2 register. Use the previously introduced
mv88e6xxx_g1_ctl2_mask helper to set them.
At the same time complete the documentation of the said register.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
drivers/net/dsa/mv88e6xxx/global1.c | 15 +++------------
drivers/net/dsa/mv88e6xxx/global1.h | 12 +++++++++---
2 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/drivers/net/dsa/mv88e6xxx/global1.c b/drivers/net/dsa/mv88e6xxx/global1.c
index 244ee1ff9edc..0f2b05342c18 100644
--- a/drivers/net/dsa/mv88e6xxx/global1.c
+++ b/drivers/net/dsa/mv88e6xxx/global1.c
@@ -393,18 +393,9 @@ int mv88e6390_g1_rmu_disable(struct mv88e6xxx_chip *chip)
int mv88e6390_g1_stats_set_histogram(struct mv88e6xxx_chip *chip)
{
- u16 val;
- int err;
-
- err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL2, &val);
- if (err)
- return err;
-
- val |= MV88E6XXX_G1_CTL2_HIST_RX_TX;
-
- err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_CTL2, val);
-
- return err;
+ return mv88e6xxx_g1_ctl2_mask(chip, MV88E6390_G1_CTL2_HIST_MODE_MASK,
+ MV88E6390_G1_CTL2_HIST_MODE_RX |
+ MV88E6390_G1_CTL2_HIST_MODE_TX);
}
int mv88e6xxx_g1_set_device_number(struct mv88e6xxx_chip *chip, int index)
diff --git a/drivers/net/dsa/mv88e6xxx/global1.h b/drivers/net/dsa/mv88e6xxx/global1.h
index e186a026e1b1..c357b3ca9a09 100644
--- a/drivers/net/dsa/mv88e6xxx/global1.h
+++ b/drivers/net/dsa/mv88e6xxx/global1.h
@@ -201,12 +201,13 @@
/* Offset 0x1C: Global Control 2 */
#define MV88E6XXX_G1_CTL2 0x1c
-#define MV88E6XXX_G1_CTL2_HIST_RX 0x0040
-#define MV88E6XXX_G1_CTL2_HIST_TX 0x0080
-#define MV88E6XXX_G1_CTL2_HIST_RX_TX 0x00c0
#define MV88E6185_G1_CTL2_CASCADE_PORT_MASK 0xf000
#define MV88E6185_G1_CTL2_CASCADE_PORT_NONE 0xe000
#define MV88E6185_G1_CTL2_CASCADE_PORT_MULTI 0xf000
+#define MV88E6352_G1_CTL2_HEADER_TYPE_MASK 0xc000
+#define MV88E6352_G1_CTL2_HEADER_TYPE_ORIG 0x0000
+#define MV88E6352_G1_CTL2_HEADER_TYPE_MGMT 0x4000
+#define MV88E6390_G1_CTL2_HEADER_TYPE_LAG 0x8000
#define MV88E6352_G1_CTL2_RMU_MODE_MASK 0x3000
#define MV88E6352_G1_CTL2_RMU_MODE_DISABLED 0x0000
#define MV88E6352_G1_CTL2_RMU_MODE_PORT_4 0x1000
@@ -223,6 +224,11 @@
#define MV88E6390_G1_CTL2_RMU_MODE_PORT_10 0x0300
#define MV88E6390_G1_CTL2_RMU_MODE_ALL_DSA 0x0600
#define MV88E6390_G1_CTL2_RMU_MODE_DISABLED 0x0700
+#define MV88E6390_G1_CTL2_HIST_MODE_MASK 0x00c0
+#define MV88E6390_G1_CTL2_HIST_MODE_RX 0x0040
+#define MV88E6390_G1_CTL2_HIST_MODE_TX 0x0080
+#define MV88E6352_G1_CTL2_CTR_MODE_MASK 0x0060
+#define MV88E6390_G1_CTL2_CTR_MODE 0x0020
#define MV88E6XXX_G1_CTL2_DEVICE_NUMBER_MASK 0x001f
/* Offset 0x1D: Stats Operation Register */
--
2.17.0
^ permalink raw reply related
* [PATCH net-next 2/3] net: dsa: mv88e6xxx: add IEEE and IP mapping ops
From: Vivien Didelot @ 2018-05-11 21:16 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel, kernel, Vivien Didelot, davem, andrew, f.fainelli
In-Reply-To: <20180511211636.25995-1-vivien.didelot@savoirfairelinux.com>
All Marvell switch families except 88E6390 have direct registers in
Global 1 for IEEE and IP priorities override mapping. The 88E6390 uses
indirect tables instead.
Add .ieee_pri_map and .ip_pri_map ops to distinct that and call them
from a mv88e6xxx_pri_setup helper. Only non-6390 are concerned ATM.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
drivers/net/dsa/mv88e6xxx/chip.c | 94 +++++++++++++++++++----------
drivers/net/dsa/mv88e6xxx/chip.h | 3 +
drivers/net/dsa/mv88e6xxx/global1.c | 58 ++++++++++++++++++
drivers/net/dsa/mv88e6xxx/global1.h | 3 +
4 files changed, 127 insertions(+), 31 deletions(-)
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 1cebde80b101..df92fed44674 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -1104,6 +1104,25 @@ static void mv88e6xxx_port_stp_state_set(struct dsa_switch *ds, int port,
dev_err(ds->dev, "p%d: failed to update state\n", port);
}
+static int mv88e6xxx_pri_setup(struct mv88e6xxx_chip *chip)
+{
+ int err;
+
+ if (chip->info->ops->ieee_pri_map) {
+ err = chip->info->ops->ieee_pri_map(chip);
+ if (err)
+ return err;
+ }
+
+ if (chip->info->ops->ip_pri_map) {
+ err = chip->info->ops->ip_pri_map(chip);
+ if (err)
+ return err;
+ }
+
+ return 0;
+}
+
static int mv88e6xxx_devmap_setup(struct mv88e6xxx_chip *chip)
{
int target, port;
@@ -2252,37 +2271,6 @@ static int mv88e6xxx_g1_setup(struct mv88e6xxx_chip *chip)
{
int err;
- /* Configure the IP ToS mapping registers. */
- err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_0, 0x0000);
- if (err)
- return err;
- err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_1, 0x0000);
- if (err)
- return err;
- err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_2, 0x5555);
- if (err)
- return err;
- err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_3, 0x5555);
- if (err)
- return err;
- err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_4, 0xaaaa);
- if (err)
- return err;
- err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_5, 0xaaaa);
- if (err)
- return err;
- err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_6, 0xffff);
- if (err)
- return err;
- err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_7, 0xffff);
- if (err)
- return err;
-
- /* Configure the IEEE 802.1p priority mapping register. */
- err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IEEE_PRI, 0xfa41);
- if (err)
- return err;
-
/* Initialize the statistics unit */
err = mv88e6xxx_stats_set_histogram(chip);
if (err)
@@ -2365,6 +2353,10 @@ static int mv88e6xxx_setup(struct dsa_switch *ds)
if (err)
goto unlock;
+ err = mv88e6xxx_pri_setup(chip);
+ if (err)
+ goto unlock;
+
/* Setup PTP Hardware Clock and timestamping */
if (chip->info->ptp_support) {
err = mv88e6xxx_ptp_setup(chip);
@@ -2592,6 +2584,8 @@ static int mv88e6xxx_set_eeprom(struct dsa_switch *ds,
static const struct mv88e6xxx_ops mv88e6085_ops = {
/* MV88E6XXX_FAMILY_6097 */
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
.irl_init_all = mv88e6352_g2_irl_init_all,
.set_switch_mac = mv88e6xxx_g1_set_switch_mac,
.phy_read = mv88e6185_phy_ppu_read,
@@ -2628,6 +2622,8 @@ static const struct mv88e6xxx_ops mv88e6085_ops = {
static const struct mv88e6xxx_ops mv88e6095_ops = {
/* MV88E6XXX_FAMILY_6095 */
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
.set_switch_mac = mv88e6xxx_g1_set_switch_mac,
.phy_read = mv88e6185_phy_ppu_read,
.phy_write = mv88e6185_phy_ppu_write,
@@ -2652,6 +2648,8 @@ static const struct mv88e6xxx_ops mv88e6095_ops = {
static const struct mv88e6xxx_ops mv88e6097_ops = {
/* MV88E6XXX_FAMILY_6097 */
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
.irl_init_all = mv88e6352_g2_irl_init_all,
.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
.phy_read = mv88e6xxx_g2_smi_phy_read,
@@ -2686,6 +2684,8 @@ static const struct mv88e6xxx_ops mv88e6097_ops = {
static const struct mv88e6xxx_ops mv88e6123_ops = {
/* MV88E6XXX_FAMILY_6165 */
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
.irl_init_all = mv88e6352_g2_irl_init_all,
.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
.phy_read = mv88e6xxx_g2_smi_phy_read,
@@ -2714,6 +2714,8 @@ static const struct mv88e6xxx_ops mv88e6123_ops = {
static const struct mv88e6xxx_ops mv88e6131_ops = {
/* MV88E6XXX_FAMILY_6185 */
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
.set_switch_mac = mv88e6xxx_g1_set_switch_mac,
.phy_read = mv88e6185_phy_ppu_read,
.phy_write = mv88e6185_phy_ppu_write,
@@ -2747,6 +2749,8 @@ static const struct mv88e6xxx_ops mv88e6131_ops = {
static const struct mv88e6xxx_ops mv88e6141_ops = {
/* MV88E6XXX_FAMILY_6341 */
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
.irl_init_all = mv88e6352_g2_irl_init_all,
.get_eeprom = mv88e6xxx_g2_get_eeprom8,
.set_eeprom = mv88e6xxx_g2_set_eeprom8,
@@ -2784,6 +2788,8 @@ static const struct mv88e6xxx_ops mv88e6141_ops = {
static const struct mv88e6xxx_ops mv88e6161_ops = {
/* MV88E6XXX_FAMILY_6165 */
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
.irl_init_all = mv88e6352_g2_irl_init_all,
.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
.phy_read = mv88e6xxx_g2_smi_phy_read,
@@ -2817,6 +2823,8 @@ static const struct mv88e6xxx_ops mv88e6161_ops = {
static const struct mv88e6xxx_ops mv88e6165_ops = {
/* MV88E6XXX_FAMILY_6165 */
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
.irl_init_all = mv88e6352_g2_irl_init_all,
.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
.phy_read = mv88e6165_phy_read,
@@ -2843,6 +2851,8 @@ static const struct mv88e6xxx_ops mv88e6165_ops = {
static const struct mv88e6xxx_ops mv88e6171_ops = {
/* MV88E6XXX_FAMILY_6351 */
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
.irl_init_all = mv88e6352_g2_irl_init_all,
.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
.phy_read = mv88e6xxx_g2_smi_phy_read,
@@ -2877,6 +2887,8 @@ static const struct mv88e6xxx_ops mv88e6171_ops = {
static const struct mv88e6xxx_ops mv88e6172_ops = {
/* MV88E6XXX_FAMILY_6352 */
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
.irl_init_all = mv88e6352_g2_irl_init_all,
.get_eeprom = mv88e6xxx_g2_get_eeprom16,
.set_eeprom = mv88e6xxx_g2_set_eeprom16,
@@ -2916,6 +2928,8 @@ static const struct mv88e6xxx_ops mv88e6172_ops = {
static const struct mv88e6xxx_ops mv88e6175_ops = {
/* MV88E6XXX_FAMILY_6351 */
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
.irl_init_all = mv88e6352_g2_irl_init_all,
.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
.phy_read = mv88e6xxx_g2_smi_phy_read,
@@ -2951,6 +2965,8 @@ static const struct mv88e6xxx_ops mv88e6175_ops = {
static const struct mv88e6xxx_ops mv88e6176_ops = {
/* MV88E6XXX_FAMILY_6352 */
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
.irl_init_all = mv88e6352_g2_irl_init_all,
.get_eeprom = mv88e6xxx_g2_get_eeprom16,
.set_eeprom = mv88e6xxx_g2_set_eeprom16,
@@ -2990,6 +3006,8 @@ static const struct mv88e6xxx_ops mv88e6176_ops = {
static const struct mv88e6xxx_ops mv88e6185_ops = {
/* MV88E6XXX_FAMILY_6185 */
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
.set_switch_mac = mv88e6xxx_g1_set_switch_mac,
.phy_read = mv88e6185_phy_ppu_read,
.phy_write = mv88e6185_phy_ppu_write,
@@ -3129,6 +3147,8 @@ static const struct mv88e6xxx_ops mv88e6191_ops = {
static const struct mv88e6xxx_ops mv88e6240_ops = {
/* MV88E6XXX_FAMILY_6352 */
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
.irl_init_all = mv88e6352_g2_irl_init_all,
.get_eeprom = mv88e6xxx_g2_get_eeprom16,
.set_eeprom = mv88e6xxx_g2_set_eeprom16,
@@ -3208,6 +3228,8 @@ static const struct mv88e6xxx_ops mv88e6290_ops = {
static const struct mv88e6xxx_ops mv88e6320_ops = {
/* MV88E6XXX_FAMILY_6320 */
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
.irl_init_all = mv88e6352_g2_irl_init_all,
.get_eeprom = mv88e6xxx_g2_get_eeprom16,
.set_eeprom = mv88e6xxx_g2_set_eeprom16,
@@ -3244,6 +3266,8 @@ static const struct mv88e6xxx_ops mv88e6320_ops = {
static const struct mv88e6xxx_ops mv88e6321_ops = {
/* MV88E6XXX_FAMILY_6320 */
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
.irl_init_all = mv88e6352_g2_irl_init_all,
.get_eeprom = mv88e6xxx_g2_get_eeprom16,
.set_eeprom = mv88e6xxx_g2_set_eeprom16,
@@ -3278,6 +3302,8 @@ static const struct mv88e6xxx_ops mv88e6321_ops = {
static const struct mv88e6xxx_ops mv88e6341_ops = {
/* MV88E6XXX_FAMILY_6341 */
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
.irl_init_all = mv88e6352_g2_irl_init_all,
.get_eeprom = mv88e6xxx_g2_get_eeprom8,
.set_eeprom = mv88e6xxx_g2_set_eeprom8,
@@ -3316,6 +3342,8 @@ static const struct mv88e6xxx_ops mv88e6341_ops = {
static const struct mv88e6xxx_ops mv88e6350_ops = {
/* MV88E6XXX_FAMILY_6351 */
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
.irl_init_all = mv88e6352_g2_irl_init_all,
.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
.phy_read = mv88e6xxx_g2_smi_phy_read,
@@ -3350,6 +3378,8 @@ static const struct mv88e6xxx_ops mv88e6350_ops = {
static const struct mv88e6xxx_ops mv88e6351_ops = {
/* MV88E6XXX_FAMILY_6351 */
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
.irl_init_all = mv88e6352_g2_irl_init_all,
.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
.phy_read = mv88e6xxx_g2_smi_phy_read,
@@ -3385,6 +3415,8 @@ static const struct mv88e6xxx_ops mv88e6351_ops = {
static const struct mv88e6xxx_ops mv88e6352_ops = {
/* MV88E6XXX_FAMILY_6352 */
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map,
+ .ip_pri_map = mv88e6085_g1_ip_pri_map,
.irl_init_all = mv88e6352_g2_irl_init_all,
.get_eeprom = mv88e6xxx_g2_get_eeprom16,
.set_eeprom = mv88e6xxx_g2_set_eeprom16,
diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h
index a1bedb0a888b..83d6a8531eaa 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.h
+++ b/drivers/net/dsa/mv88e6xxx/chip.h
@@ -293,6 +293,9 @@ struct mv88e6xxx_mdio_bus {
};
struct mv88e6xxx_ops {
+ int (*ieee_pri_map)(struct mv88e6xxx_chip *chip);
+ int (*ip_pri_map)(struct mv88e6xxx_chip *chip);
+
/* Ingress Rate Limit unit (IRL) operations */
int (*irl_init_all)(struct mv88e6xxx_chip *chip, int port);
diff --git a/drivers/net/dsa/mv88e6xxx/global1.c b/drivers/net/dsa/mv88e6xxx/global1.c
index 0f2b05342c18..d721ccf7d8be 100644
--- a/drivers/net/dsa/mv88e6xxx/global1.c
+++ b/drivers/net/dsa/mv88e6xxx/global1.c
@@ -241,6 +241,64 @@ int mv88e6185_g1_ppu_disable(struct mv88e6xxx_chip *chip)
return mv88e6185_g1_wait_ppu_disabled(chip);
}
+/* Offset 0x10: IP-PRI Mapping Register 0
+ * Offset 0x11: IP-PRI Mapping Register 1
+ * Offset 0x12: IP-PRI Mapping Register 2
+ * Offset 0x13: IP-PRI Mapping Register 3
+ * Offset 0x14: IP-PRI Mapping Register 4
+ * Offset 0x15: IP-PRI Mapping Register 5
+ * Offset 0x16: IP-PRI Mapping Register 6
+ * Offset 0x17: IP-PRI Mapping Register 7
+ */
+
+int mv88e6085_g1_ip_pri_map(struct mv88e6xxx_chip *chip)
+{
+ int err;
+
+ /* Reset the IP TOS/DiffServ/Traffic priorities to defaults */
+ err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_0, 0x0000);
+ if (err)
+ return err;
+
+ err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_1, 0x0000);
+ if (err)
+ return err;
+
+ err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_2, 0x5555);
+ if (err)
+ return err;
+
+ err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_3, 0x5555);
+ if (err)
+ return err;
+
+ err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_4, 0xaaaa);
+ if (err)
+ return err;
+
+ err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_5, 0xaaaa);
+ if (err)
+ return err;
+
+ err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_6, 0xffff);
+ if (err)
+ return err;
+
+ err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IP_PRI_7, 0xffff);
+ if (err)
+ return err;
+
+ return 0;
+}
+
+/* Offset 0x18: IEEE-PRI Register */
+
+int mv88e6085_g1_ieee_pri_map(struct mv88e6xxx_chip *chip)
+{
+ /* Reset the IEEE Tag priorities to defaults */
+ return mv88e6xxx_g1_write(chip, MV88E6XXX_G1_IEEE_PRI, 0xfa41);
+}
+
/* Offset 0x1a: Monitor Control */
/* Offset 0x1a: Monitor & MGMT Control on some devices */
diff --git a/drivers/net/dsa/mv88e6xxx/global1.h b/drivers/net/dsa/mv88e6xxx/global1.h
index c357b3ca9a09..7c791c1da4b9 100644
--- a/drivers/net/dsa/mv88e6xxx/global1.h
+++ b/drivers/net/dsa/mv88e6xxx/global1.h
@@ -277,6 +277,9 @@ int mv88e6095_g1_set_cpu_port(struct mv88e6xxx_chip *chip, int port);
int mv88e6390_g1_set_cpu_port(struct mv88e6xxx_chip *chip, int port);
int mv88e6390_g1_mgmt_rsvd2cpu(struct mv88e6xxx_chip *chip);
+int mv88e6085_g1_ip_pri_map(struct mv88e6xxx_chip *chip);
+int mv88e6085_g1_ieee_pri_map(struct mv88e6xxx_chip *chip);
+
int mv88e6185_g1_set_cascade_port(struct mv88e6xxx_chip *chip, int port);
int mv88e6085_g1_rmu_disable(struct mv88e6xxx_chip *chip);
--
2.17.0
^ permalink raw reply related
* [PATCH net-next 3/3] net: dsa: mv88e6xxx: add a stats setup function
From: Vivien Didelot @ 2018-05-11 21:16 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel, kernel, Vivien Didelot, davem, andrew, f.fainelli
In-Reply-To: <20180511211636.25995-1-vivien.didelot@savoirfairelinux.com>
Now that the Global 1 specific setup function only setup the statistics
unit, kill it in favor of a mv88e6xxx_stats_setup function.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
drivers/net/dsa/mv88e6xxx/chip.c | 27 ++++++++++-----------------
1 file changed, 10 insertions(+), 17 deletions(-)
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index df92fed44674..a4efc6544c0d 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -995,14 +995,6 @@ static void mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds, int port,
}
-static int mv88e6xxx_stats_set_histogram(struct mv88e6xxx_chip *chip)
-{
- if (chip->info->ops->stats_set_histogram)
- return chip->info->ops->stats_set_histogram(chip);
-
- return 0;
-}
-
static int mv88e6xxx_get_regs_len(struct dsa_switch *ds, int port)
{
return 32 * sizeof(u16);
@@ -2267,14 +2259,16 @@ static int mv88e6xxx_set_ageing_time(struct dsa_switch *ds,
return err;
}
-static int mv88e6xxx_g1_setup(struct mv88e6xxx_chip *chip)
+static int mv88e6xxx_stats_setup(struct mv88e6xxx_chip *chip)
{
int err;
/* Initialize the statistics unit */
- err = mv88e6xxx_stats_set_histogram(chip);
- if (err)
- return err;
+ if (chip->info->ops->stats_set_histogram) {
+ err = chip->info->ops->stats_set_histogram(chip);
+ if (err)
+ return err;
+ }
return mv88e6xxx_g1_stats_clear(chip);
}
@@ -2300,11 +2294,6 @@ static int mv88e6xxx_setup(struct dsa_switch *ds)
goto unlock;
}
- /* Setup Switch Global 1 Registers */
- err = mv88e6xxx_g1_setup(chip);
- if (err)
- goto unlock;
-
err = mv88e6xxx_irl_setup(chip);
if (err)
goto unlock;
@@ -2368,6 +2357,10 @@ static int mv88e6xxx_setup(struct dsa_switch *ds)
goto unlock;
}
+ err = mv88e6xxx_stats_setup(chip);
+ if (err)
+ goto unlock;
+
unlock:
mutex_unlock(&chip->reg_lock);
--
2.17.0
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox