Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH net-next 3/4] bonding: allow use of tx hashing in balance-alb
From: Jay Vosburgh @ 2018-05-11 21:49 UTC (permalink / raw)
  To: Debabrata Banerjee
  Cc: David S . Miller, netdev, Veaceslav Falico, Andy Gospodarek
In-Reply-To: <20180511192548.8119-4-dbanerje@akamai.com>

Debabrata Banerjee <dbanerje@akamai.com> wrote:

>The rx load balancing provided by balance-alb is not mutually
>exclusive with using hashing for tx selection, and should provide a decent
>speed increase because this eliminates spinlocks and cache contention.
>
>Signed-off-by: Debabrata Banerjee <dbanerje@akamai.com>
>---
> drivers/net/bonding/bond_alb.c     | 20 ++++++++++++++++++--
> drivers/net/bonding/bond_main.c    | 25 +++++++++++++++----------
> drivers/net/bonding/bond_options.c |  2 +-
> include/net/bonding.h              | 10 +++++++++-
> 4 files changed, 43 insertions(+), 14 deletions(-)
>
>diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
>index 180e50f7806f..6228635880d5 100644
>--- a/drivers/net/bonding/bond_alb.c
>+++ b/drivers/net/bonding/bond_alb.c
>@@ -1478,8 +1478,24 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
> 	}
> 
> 	if (do_tx_balance) {
>-		hash_index = _simple_hash(hash_start, hash_size);
>-		tx_slave = tlb_choose_channel(bond, hash_index, skb->len);
>+		if (bond->params.tlb_dynamic_lb) {
>+			hash_index = _simple_hash(hash_start, hash_size);
>+			tx_slave = tlb_choose_channel(bond, hash_index, skb->len);
>+		} else {
>+			/*
>+			 * do_tx_balance means we are free to select the tx_slave
>+			 * So we do exactly what tlb would do for hash selection
>+			 */
>+
>+			struct bond_up_slave *slaves;
>+			unsigned int count;
>+
>+			slaves = rcu_dereference(bond->slave_arr);
>+			count = slaves ? READ_ONCE(slaves->count) : 0;
>+			if (likely(count))
>+				tx_slave = slaves->arr[bond_xmit_hash(bond, skb) %
>+						       count];
>+		}
> 	}
> 
> 	return bond_do_alb_xmit(skb, bond, tx_slave);
>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>index 1f1e97b26f95..f7f8a49cb32b 100644
>--- a/drivers/net/bonding/bond_main.c
>+++ b/drivers/net/bonding/bond_main.c
>@@ -159,7 +159,7 @@ module_param(min_links, int, 0);
> MODULE_PARM_DESC(min_links, "Minimum number of available links before turning on carrier");
> 
> module_param(xmit_hash_policy, charp, 0);
>-MODULE_PARM_DESC(xmit_hash_policy, "balance-xor and 802.3ad hashing method; "
>+MODULE_PARM_DESC(xmit_hash_policy, "balance-alb, balance-tlb, balance-xor, 802.3ad hashing method; "
> 				   "0 for layer 2 (default), 1 for layer 3+4, "
> 				   "2 for layer 2+3, 3 for encap layer 2+3, "
> 				   "4 for encap layer 3+4");
>@@ -1735,7 +1735,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
> 		unblock_netpoll_tx();
> 	}
> 
>-	if (bond_mode_uses_xmit_hash(bond))
>+	if (bond_mode_can_use_xmit_hash(bond))
> 		bond_update_slave_arr(bond, NULL);
> 
> 	bond->nest_level = dev_get_nest_level(bond_dev);
>@@ -1870,7 +1870,7 @@ static int __bond_release_one(struct net_device *bond_dev,
> 	if (BOND_MODE(bond) == BOND_MODE_8023AD)
> 		bond_3ad_unbind_slave(slave);
> 
>-	if (bond_mode_uses_xmit_hash(bond))
>+	if (bond_mode_can_use_xmit_hash(bond))
> 		bond_update_slave_arr(bond, slave);
> 
> 	netdev_info(bond_dev, "Releasing %s interface %s\n",
>@@ -3102,7 +3102,7 @@ static int bond_slave_netdev_event(unsigned long event,
> 		 * events. If these (miimon/arpmon) parameters are configured
> 		 * then array gets refreshed twice and that should be fine!
> 		 */
>-		if (bond_mode_uses_xmit_hash(bond))
>+		if (bond_mode_can_use_xmit_hash(bond))
> 			bond_update_slave_arr(bond, NULL);
> 		break;
> 	case NETDEV_CHANGEMTU:
>@@ -3322,7 +3322,7 @@ static int bond_open(struct net_device *bond_dev)
> 		 */
> 		if (bond_alb_initialize(bond, (BOND_MODE(bond) == BOND_MODE_ALB)))
> 			return -ENOMEM;
>-		if (bond->params.tlb_dynamic_lb)
>+		if (bond->params.tlb_dynamic_lb || BOND_MODE(bond) == BOND_MODE_ALB)
> 			queue_delayed_work(bond->wq, &bond->alb_work, 0);
> 	}
> 
>@@ -3341,7 +3341,7 @@ static int bond_open(struct net_device *bond_dev)
> 		bond_3ad_initiate_agg_selection(bond, 1);
> 	}
> 
>-	if (bond_mode_uses_xmit_hash(bond))
>+	if (bond_mode_can_use_xmit_hash(bond))
> 		bond_update_slave_arr(bond, NULL);
> 
> 	return 0;
>@@ -3892,7 +3892,7 @@ static void bond_slave_arr_handler(struct work_struct *work)
>  * to determine the slave interface -
>  * (a) BOND_MODE_8023AD
>  * (b) BOND_MODE_XOR
>- * (c) BOND_MODE_TLB && tlb_dynamic_lb == 0
>+ * (c) (BOND_MODE_TLB || BOND_MODE_ALB) && tlb_dynamic_lb == 0
>  *
>  * The caller is expected to hold RTNL only and NO other lock!
>  */
>@@ -3945,6 +3945,11 @@ int bond_update_slave_arr(struct bonding *bond, struct slave *skipslave)
> 			continue;
> 		if (skipslave == slave)
> 			continue;
>+
>+		netdev_dbg(bond->dev,
>+			   "Adding slave dev %s to tx hash array[%d]\n",
>+			   slave->dev->name, new_arr->count);
>+
> 		new_arr->arr[new_arr->count++] = slave;
> 	}
> 
>@@ -4320,9 +4325,9 @@ static int bond_check_params(struct bond_params *params)
> 	}
> 
> 	if (xmit_hash_policy) {
>-		if ((bond_mode != BOND_MODE_XOR) &&
>-		    (bond_mode != BOND_MODE_8023AD) &&
>-		    (bond_mode != BOND_MODE_TLB)) {
>+		if (bond_mode == BOND_MODE_ROUNDROBIN ||
>+		    bond_mode == BOND_MODE_ACTIVEBACKUP ||
>+		    bond_mode == BOND_MODE_BROADCAST) {
> 			pr_info("xmit_hash_policy param is irrelevant in mode %s\n",
> 				bond_mode_name(bond_mode));
> 		} else {
>diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
>index 58c705f24f96..8a945c9341d6 100644
>--- a/drivers/net/bonding/bond_options.c
>+++ b/drivers/net/bonding/bond_options.c
>@@ -395,7 +395,7 @@ static const struct bond_option bond_opts[BOND_OPT_LAST] = {
> 		.id = BOND_OPT_TLB_DYNAMIC_LB,
> 		.name = "tlb_dynamic_lb",
> 		.desc = "Enable dynamic flow shuffling",
>-		.unsuppmodes = BOND_MODE_ALL_EX(BIT(BOND_MODE_TLB)),
>+		.unsuppmodes = BOND_MODE_ALL_EX(BIT(BOND_MODE_TLB) | BIT(BOND_MODE_ALB)),
> 		.values = bond_tlb_dynamic_lb_tbl,
> 		.flags = BOND_OPTFLAG_IFDOWN,
> 		.set = bond_option_tlb_dynamic_lb_set,
>diff --git a/include/net/bonding.h b/include/net/bonding.h
>index b52235158836..9a41a50b0bd2 100644
>--- a/include/net/bonding.h
>+++ b/include/net/bonding.h
>@@ -285,10 +285,18 @@ static inline bool bond_needs_speed_duplex(const struct bonding *bond)
> 
> static inline bool bond_is_nondyn_tlb(const struct bonding *bond)
> {
>-	return (BOND_MODE(bond) == BOND_MODE_TLB)  &&
>+	return (BOND_MODE(bond) == BOND_MODE_TLB || BOND_MODE(bond) == BOND_MODE_ALB) &&

	I believe this could use bond_is_lb(bond) instead.

	-J
	
> 	       (bond->params.tlb_dynamic_lb == 0);
> }
> 
>+static inline bool bond_mode_can_use_xmit_hash(const struct bonding *bond)
>+{
>+	return (BOND_MODE(bond) == BOND_MODE_8023AD ||
>+		BOND_MODE(bond) == BOND_MODE_XOR ||
>+		BOND_MODE(bond) == BOND_MODE_TLB ||
>+		BOND_MODE(bond) == BOND_MODE_ALB);
>+}
>+
> static inline bool bond_mode_uses_xmit_hash(const struct bonding *bond)
> {
> 	return (BOND_MODE(bond) == BOND_MODE_8023AD ||
>-- 
>2.17.0
>

^ permalink raw reply

* Re: [PATCH net v2] rps: Correct wrong skb_flow_limit check when enable RPS
From: Willem de Bruijn @ 2018-05-11 21:47 UTC (permalink / raw)
  To: Gao Feng
  Cc: David Miller, Daniel Borkmann, Eric Dumazet, Willem de Bruijn,
	jakub.kicinski, ktkhai, Alexei Starovoitov, Rasmus Villemoes,
	John Fastabend, Jesper Dangaard Brouer, David Ahern,
	Network Development
In-Reply-To: <1525990182-12042-1-git-send-email-gfree.wind@vip.163.com>

On Thu, May 10, 2018 at 6:09 PM,  <gfree.wind@vip.163.com> wrote:
> From: Gao Feng <gfree.wind@vip.163.com>
>
> The skb flow limit is implemented for each CPU independently. In the
> current codes, the function skb_flow_limit gets the softnet_data by
> this_cpu_ptr. But the target cpu of enqueue_to_backlog would be not
> the current cpu when enable RPS. As the result, the skb_flow_limit checks
> the stats of current CPU, while the skb is going to append the queue of
> another CPU. It isn't the expected behavior.
>
> Now pass the softnet_data as a param to make consistent.
>
> Fixes: 99bbc7074190 ("rps: selective flow shedding during softnet overflow")
> Signed-off-by: Gao Feng <gfree.wind@vip.163.com>

See also the discussion in the v1 of this patch.

The merits of moving flow_limit state from irq to rps cpu can
be argued, but the existing behavior is intentional and correct,
so this should not be applied to net and be backported to stable
branches.

My bad for reviving the discussion in the v1 thread while v2 was
already pending, sorry.

^ permalink raw reply

* Re: [PATCH bpf-next 3/7] samples: bpf: compile and link against full libbpf
From: Jakub Kicinski @ 2018-05-11 21:47 UTC (permalink / raw)
  To: alexei.starovoitov, daniel; +Cc: oss-drivers, netdev
In-Reply-To: <20180510172443.17238-4-jakub.kicinski@netronome.com>

On Thu, 10 May 2018 10:24:39 -0700, Jakub Kicinski wrote:
> samples/bpf currently cherry-picks object files from tools/lib/bpf
> to link against.  Just compile the full library and link statically
> against it.
> 
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>

Looks like this breaks some build configs :(  Fix is forthcoming, sorry!

^ permalink raw reply

* Re: [RFC bpf-next 07/11] bpf: Add helper to retrieve socket in BPF
From: Martin KaFai Lau @ 2018-05-11 21:41 UTC (permalink / raw)
  To: Joe Stringer; +Cc: daniel, netdev, ast, john fastabend
In-Reply-To: <CAOftzPg-2JdMOgvwTtubKijaF8mMO+s5w7CdYmFDuBDK3gAiog@mail.gmail.com>

On Fri, May 11, 2018 at 02:08:01PM -0700, Joe Stringer wrote:
> 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.
Right, SOCK_RCU_FREE sk is the one I am concern about.
For example, TCP_LISTEN socket does not require taking a refcnt
now.  Doing a bpf_sk_lookup() may have a rather big
impact on handling TCP syn flood.  or the usual intention
is to redirect instead of passing it up to the stack?


> 
> /* 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: [PATCH net-next 2/4] bonding: use common mac addr checks
From: Jay Vosburgh @ 2018-05-11 21:29 UTC (permalink / raw)
  To: Banerjee, Debabrata
  Cc: David S . Miller, netdev@vger.kernel.org, Veaceslav Falico,
	Andy Gospodarek
In-Reply-To: <9b51c882f54244e5972da43d7955c959@usma1ex-dag1mb2.msg.corp.akamai.com>

Banerjee, Debabrata <dbanerje@akamai.com> wrote:

>> From: Jay Vosburgh [mailto:jay.vosburgh@canonical.com]
>> Debabrata Banerjee <dbanerje@akamai.com> wrote:
>
>> >-				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?
>
>Yes I don't see how it makes sense to use multicast addresses at all, but I may be missing something. It's also illegal according to rfc1812 3.3.2, but obviously this balancing mode is trying to be very clever. We probably shouldn't violate the rfc anyway.

	Fair enough, but I think it would be good to call this out in
the change log just in case it does somehow cause a regression.

	-J

---
	-Jay Vosburgh, jay.vosburgh@canonical.com

^ permalink raw reply

* Re: [GIT] Networking
From: Linus Torvalds @ 2018-05-11 21:25 UTC (permalink / raw)
  To: David Miller
  Cc: Andrew Morton, Network Development, Linux Kernel Mailing List
In-Reply-To: <20180511.170018.656888133931954275.davem@davemloft.net>

David, is there something you want to tell us?

Drugs are bad, m'kay..

               Linus

On Fri, May 11, 2018 at 2:00 PM David Miller <davem@davemloft.net> wrote:

> "from Kevin Easton", "Thanks to Bhadram Varka", "courtesy of Gustavo A.
> R.  Silva", "To Eric Dumazet we are most grateful for this fix", "This
> fix from YU Bo, we do appreciate", "Once again we are blessed by the
> honorable Eric Dumazet with this fix", "This fix is bestowed upon us by
> Andrew Tomt", "another great gift from Eric Dumazet", "to Hangbin Liu we
> give thanks for this", "Paolo Abeni, he gave us this", "thank you Moshe
> Shemesh", "from our good brother David Howells", "Daniel Juergens,
> you're the best!", "Debabrata Benerjee saved us!", "The ship is now
> water tight, thanks to Andrey Ignatov", "from Colin Ian King, man we've
> got holes everywhere!", "Jiri Pirko what would we do without you!

^ permalink raw reply

* RE: [PATCH net-next 2/4] bonding: use common mac addr checks
From: Banerjee, Debabrata @ 2018-05-11 21:25 UTC (permalink / raw)
  To: 'Jay Vosburgh'
  Cc: David S . Miller, netdev@vger.kernel.org, Veaceslav Falico,
	Andy Gospodarek
In-Reply-To: <4921.1526072038@famine>

> From: Jay Vosburgh [mailto:jay.vosburgh@canonical.com]
> Debabrata Banerjee <dbanerje@akamai.com> wrote:

> >-				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?

Yes I don't see how it makes sense to use multicast addresses at all, but I may be missing something. It's also illegal according to rfc1812 3.3.2, but obviously this balancing mode is trying to be very clever. We probably shouldn't violate the rfc anyway.

^ permalink raw reply

* [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

* [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 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 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

* 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

* 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

* [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: [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

* 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 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: [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] 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 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-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 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] 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 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 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


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox