* Re: [PATCH net-next] net: ethtool: silence kmalloc warning
From: David Miller @ 2017-01-30 20:50 UTC (permalink / raw)
To: ast; +Cc: edumazet, netdev
In-Reply-To: <1485652625-2881838-1-git-send-email-ast@fb.com>
From: Alexei Starovoitov <ast@fb.com>
Date: Sat, 28 Jan 2017 17:17:05 -0800
> under memory pressure 'ethtool -S' command may warn:
> [ 2374.385195] ethtool: page allocation failure: order:4, mode:0x242c0c0
...
> ~1160 mlx5 counters ~= order 4 allocation which is unlikely to succeed
> under memory pressure. Since 'get stats' command is not critical
> avoid reclaim and warning.
> Also convert to safer kmalloc_array.
>
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Let's just fix this right, just like in ethtool_get_regs().
Just use vzalloc() unconditionally. It is an entirely similar
situation. But please be careful with the size calculations when
you make this adjustment.
Thank you.
^ permalink raw reply
* [PATCH net-next v5 3/4] net: dsa: b53: Add support for port mirroring
From: Florian Fainelli @ 2017-01-30 20:41 UTC (permalink / raw)
To: netdev; +Cc: davem, andrew, vivien.didelot, jiri, Florian Fainelli
In-Reply-To: <20170130204143.539-1-f.fainelli@gmail.com>
Add support for configuring port mirroring through the cls_matchall
classifier. We do a full ingress or egress capture towards the capture
port. Future improvements could include leveraging the divider to allow
less frames to be captured, as well as matching specific MAC DA/SA.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/dsa/b53/b53_common.c | 67 ++++++++++++++++++++++++++++++++++++++++
drivers/net/dsa/b53/b53_priv.h | 4 +++
2 files changed, 71 insertions(+)
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 3a7d16b6c3eb..8cf4801994e8 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -1450,6 +1450,71 @@ static enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds)
return DSA_TAG_PROTO_NONE;
}
+int b53_mirror_add(struct dsa_switch *ds, int port,
+ struct dsa_mall_mirror_tc_entry *mirror, bool ingress)
+{
+ struct b53_device *dev = ds->priv;
+ u16 reg, loc;
+
+ if (ingress)
+ loc = B53_IG_MIR_CTL;
+ else
+ loc = B53_EG_MIR_CTL;
+
+ b53_read16(dev, B53_MGMT_PAGE, loc, ®);
+ reg &= ~MIRROR_MASK;
+ reg |= BIT(port);
+ b53_write16(dev, B53_MGMT_PAGE, loc, reg);
+
+ b53_read16(dev, B53_MGMT_PAGE, B53_MIR_CAP_CTL, ®);
+ reg &= ~CAP_PORT_MASK;
+ reg |= mirror->to_local_port;
+ reg |= MIRROR_EN;
+ b53_write16(dev, B53_MGMT_PAGE, B53_MIR_CAP_CTL, reg);
+
+ return 0;
+}
+EXPORT_SYMBOL(b53_mirror_add);
+
+void b53_mirror_del(struct dsa_switch *ds, int port,
+ struct dsa_mall_mirror_tc_entry *mirror)
+{
+ struct b53_device *dev = ds->priv;
+ bool loc_disable = false, other_loc_disable = false;
+ u16 reg, loc;
+
+ if (mirror->ingress)
+ loc = B53_IG_MIR_CTL;
+ else
+ loc = B53_EG_MIR_CTL;
+
+ /* Update the desired ingress/egress register */
+ b53_read16(dev, B53_MGMT_PAGE, loc, ®);
+ reg &= ~BIT(port);
+ if (!(reg & MIRROR_MASK))
+ loc_disable = true;
+ b53_write16(dev, B53_MGMT_PAGE, loc, reg);
+
+ /* Now look at the other one to know if we can disable mirroring
+ * entirely
+ */
+ if (mirror->ingress)
+ b53_read16(dev, B53_MGMT_PAGE, B53_EG_MIR_CTL, ®);
+ else
+ b53_read16(dev, B53_MGMT_PAGE, B53_IG_MIR_CTL, ®);
+ if (!(reg & MIRROR_MASK))
+ other_loc_disable = true;
+
+ b53_read16(dev, B53_MGMT_PAGE, B53_MIR_CAP_CTL, ®);
+ /* Both no longer have ports, let's disable mirroring */
+ if (loc_disable && other_loc_disable) {
+ reg &= ~MIRROR_EN;
+ reg &= ~mirror->to_local_port;
+ }
+ b53_write16(dev, B53_MGMT_PAGE, B53_MIR_CAP_CTL, reg);
+}
+EXPORT_SYMBOL(b53_mirror_del);
+
static const struct dsa_switch_ops b53_switch_ops = {
.get_tag_protocol = b53_get_tag_protocol,
.setup = b53_setup,
@@ -1474,6 +1539,8 @@ static const struct dsa_switch_ops b53_switch_ops = {
.port_fdb_dump = b53_fdb_dump,
.port_fdb_add = b53_fdb_add,
.port_fdb_del = b53_fdb_del,
+ .port_mirror_add = b53_mirror_add,
+ .port_mirror_del = b53_mirror_del,
};
struct b53_chip_data {
diff --git a/drivers/net/dsa/b53/b53_priv.h b/drivers/net/dsa/b53/b53_priv.h
index 9d87889728ac..a9dc90a01438 100644
--- a/drivers/net/dsa/b53/b53_priv.h
+++ b/drivers/net/dsa/b53/b53_priv.h
@@ -407,5 +407,9 @@ int b53_fdb_del(struct dsa_switch *ds, int port,
int b53_fdb_dump(struct dsa_switch *ds, int port,
struct switchdev_obj_port_fdb *fdb,
int (*cb)(struct switchdev_obj *obj));
+int b53_mirror_add(struct dsa_switch *ds, int port,
+ struct dsa_mall_mirror_tc_entry *mirror, bool ingress);
+void b53_mirror_del(struct dsa_switch *ds, int port,
+ struct dsa_mall_mirror_tc_entry *mirror);
#endif
--
2.9.3
^ permalink raw reply related
* [PATCH net-next v5 1/4] net: dsa: Add plumbing for port mirroring
From: Florian Fainelli @ 2017-01-30 20:41 UTC (permalink / raw)
To: netdev; +Cc: davem, andrew, vivien.didelot, jiri, Florian Fainelli
In-Reply-To: <20170130204143.539-1-f.fainelli@gmail.com>
Add necessary plumbing at the slave network device level to have switch
drivers implement ndo_setup_tc() and most particularly the cls_matchall
classifier. We add support for two switch operations:
port_add_mirror and port_del_mirror() which configure, on a per-port
basis the mirror parameters requested from the cls_matchall classifier.
Code is largely borrowed from the Mellanox Spectrum switch driver.
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
include/net/dsa.h | 33 +++++++++++++
net/dsa/dsa_priv.h | 3 ++
net/dsa/slave.c | 137 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 172 insertions(+), 1 deletion(-)
diff --git a/include/net/dsa.h b/include/net/dsa.h
index d5d618c3de64..2cb77e64d648 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -20,6 +20,8 @@
#include <linux/phy_fixed.h>
#include <linux/ethtool.h>
+struct tc_action;
+
enum dsa_tag_protocol {
DSA_TAG_PROTO_NONE = 0,
DSA_TAG_PROTO_DSA,
@@ -139,6 +141,28 @@ struct dsa_switch_tree {
const struct dsa_device_ops *tag_ops;
};
+/* TC matchall action types, only mirroring for now */
+enum dsa_port_mall_action_type {
+ DSA_PORT_MALL_MIRROR,
+};
+
+/* TC mirroring entry */
+struct dsa_mall_mirror_tc_entry {
+ u8 to_local_port;
+ bool ingress;
+};
+
+/* TC matchall entry */
+struct dsa_mall_tc_entry {
+ struct list_head list;
+ unsigned long cookie;
+ enum dsa_port_mall_action_type type;
+ union {
+ struct dsa_mall_mirror_tc_entry mirror;
+ };
+};
+
+
struct dsa_port {
struct dsa_switch *ds;
unsigned int index;
@@ -385,6 +409,15 @@ struct dsa_switch_ops {
struct ethtool_rxnfc *nfc, u32 *rule_locs);
int (*set_rxnfc)(struct dsa_switch *ds, int port,
struct ethtool_rxnfc *nfc);
+
+ /*
+ * TC integration
+ */
+ int (*port_mirror_add)(struct dsa_switch *ds, int port,
+ struct dsa_mall_mirror_tc_entry *mirror,
+ bool ingress);
+ void (*port_mirror_del)(struct dsa_switch *ds, int port,
+ struct dsa_mall_mirror_tc_entry *mirror);
};
struct dsa_switch_driver {
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index 3022f2e42cdc..a5509b765fc0 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -41,6 +41,9 @@ struct dsa_slave_priv {
#ifdef CONFIG_NET_POLL_CONTROLLER
struct netpoll *netpoll;
#endif
+
+ /* TC context */
+ struct list_head mall_tc_list;
};
/* dsa.c */
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 6881889e1a9b..09fc3e9462c1 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -16,12 +16,17 @@
#include <linux/of_net.h>
#include <linux/of_mdio.h>
#include <linux/mdio.h>
+#include <linux/list.h>
#include <net/rtnetlink.h>
#include <net/switchdev.h>
+#include <net/pkt_cls.h>
+#include <net/tc_act/tc_mirred.h>
#include <linux/if_bridge.h>
#include <linux/netpoll.h>
#include "dsa_priv.h"
+static bool dsa_slave_dev_check(struct net_device *dev);
+
/* slave mii_bus handling ***************************************************/
static int dsa_slave_phy_read(struct mii_bus *bus, int addr, int reg)
{
@@ -995,6 +1000,133 @@ static int dsa_slave_get_phys_port_name(struct net_device *dev,
return 0;
}
+static struct dsa_mall_tc_entry *
+dsa_slave_mall_tc_entry_find(struct dsa_slave_priv *p,
+ unsigned long cookie)
+{
+ struct dsa_mall_tc_entry *mall_tc_entry;
+
+ list_for_each_entry(mall_tc_entry, &p->mall_tc_list, list)
+ if (mall_tc_entry->cookie == cookie)
+ return mall_tc_entry;
+
+ return NULL;
+}
+
+static int dsa_slave_add_cls_matchall(struct net_device *dev,
+ __be16 protocol,
+ struct tc_cls_matchall_offload *cls,
+ bool ingress)
+{
+ struct dsa_slave_priv *p = netdev_priv(dev);
+ struct dsa_mall_tc_entry *mall_tc_entry;
+ struct dsa_switch *ds = p->dp->ds;
+ struct net *net = dev_net(dev);
+ struct dsa_slave_priv *to_p;
+ struct net_device *to_dev;
+ const struct tc_action *a;
+ int err = -EOPNOTSUPP;
+ LIST_HEAD(actions);
+ int ifindex;
+
+ if (!ds->ops->port_mirror_add)
+ return err;
+
+ if (!tc_single_action(cls->exts))
+ return err;
+
+ tcf_exts_to_list(cls->exts, &actions);
+ a = list_first_entry(&actions, struct tc_action, list);
+
+ if (is_tcf_mirred_egress_mirror(a) && protocol == htons(ETH_P_ALL)) {
+ struct dsa_mall_mirror_tc_entry *mirror;
+
+ ifindex = tcf_mirred_ifindex(a);
+ to_dev = __dev_get_by_index(net, ifindex);
+ if (!to_dev)
+ return -EINVAL;
+
+ if (!dsa_slave_dev_check(to_dev))
+ return -EOPNOTSUPP;
+
+ mall_tc_entry = kzalloc(sizeof(*mall_tc_entry), GFP_KERNEL);
+ if (!mall_tc_entry)
+ return -ENOMEM;
+
+ mall_tc_entry->cookie = cls->cookie;
+ mall_tc_entry->type = DSA_PORT_MALL_MIRROR;
+ mirror = &mall_tc_entry->mirror;
+
+ to_p = netdev_priv(to_dev);
+
+ mirror->to_local_port = to_p->dp->index;
+ mirror->ingress = ingress;
+
+ err = ds->ops->port_mirror_add(ds, p->dp->index, mirror,
+ ingress);
+ if (err) {
+ kfree(mall_tc_entry);
+ return err;
+ }
+
+ list_add_tail(&mall_tc_entry->list, &p->mall_tc_list);
+ }
+
+ return 0;
+}
+
+static void dsa_slave_del_cls_matchall(struct net_device *dev,
+ struct tc_cls_matchall_offload *cls)
+{
+ struct dsa_slave_priv *p = netdev_priv(dev);
+ struct dsa_mall_tc_entry *mall_tc_entry;
+ struct dsa_switch *ds = p->dp->ds;
+
+ if (!ds->ops->port_mirror_del)
+ return;
+
+ mall_tc_entry = dsa_slave_mall_tc_entry_find(p, cls->cookie);
+ if (!mall_tc_entry)
+ return;
+
+ list_del(&mall_tc_entry->list);
+
+ switch (mall_tc_entry->type) {
+ case DSA_PORT_MALL_MIRROR:
+ ds->ops->port_mirror_del(ds, p->dp->index,
+ &mall_tc_entry->mirror);
+ break;
+ default:
+ WARN_ON(1);
+ }
+
+ kfree(mall_tc_entry);
+}
+
+static int dsa_slave_setup_tc(struct net_device *dev, u32 handle,
+ __be16 protocol, struct tc_to_netdev *tc)
+{
+ bool ingress = TC_H_MAJ(handle) == TC_H_MAJ(TC_H_INGRESS);
+ int ret = -EOPNOTSUPP;
+
+ switch (tc->type) {
+ case TC_SETUP_MATCHALL:
+ switch (tc->cls_mall->command) {
+ case TC_CLSMATCHALL_REPLACE:
+ return dsa_slave_add_cls_matchall(dev, protocol,
+ tc->cls_mall,
+ ingress);
+ case TC_CLSMATCHALL_DESTROY:
+ dsa_slave_del_cls_matchall(dev, tc->cls_mall);
+ return 0;
+ }
+ default:
+ break;
+ }
+
+ return ret;
+}
+
void dsa_cpu_port_ethtool_init(struct ethtool_ops *ops)
{
ops->get_sset_count = dsa_cpu_port_get_sset_count;
@@ -1069,6 +1201,7 @@ static const struct net_device_ops dsa_slave_netdev_ops = {
.ndo_bridge_setlink = switchdev_port_bridge_setlink,
.ndo_bridge_dellink = switchdev_port_bridge_dellink,
.ndo_get_phys_port_name = dsa_slave_get_phys_port_name,
+ .ndo_setup_tc = dsa_slave_setup_tc,
};
static const struct switchdev_ops dsa_slave_switchdev_ops = {
@@ -1285,7 +1418,8 @@ int dsa_slave_create(struct dsa_switch *ds, struct device *parent,
if (slave_dev == NULL)
return -ENOMEM;
- slave_dev->features = master->vlan_features;
+ slave_dev->features = master->vlan_features | NETIF_F_HW_TC;
+ slave_dev->hw_features |= NETIF_F_HW_TC;
slave_dev->ethtool_ops = &dsa_slave_ethtool_ops;
eth_hw_addr_inherit(slave_dev, master);
slave_dev->priv_flags |= IFF_NO_QUEUE;
@@ -1304,6 +1438,7 @@ int dsa_slave_create(struct dsa_switch *ds, struct device *parent,
p = netdev_priv(slave_dev);
p->dp = &ds->ports[port];
+ INIT_LIST_HEAD(&p->mall_tc_list);
p->xmit = dst->tag_ops->xmit;
p->old_pause = -1;
--
2.9.3
^ permalink raw reply related
* [PATCH net-next v5 4/4] net: dsa: bcm_sf2: Add support for port mirroring
From: Florian Fainelli @ 2017-01-30 20:41 UTC (permalink / raw)
To: netdev; +Cc: davem, andrew, vivien.didelot, jiri, Florian Fainelli
In-Reply-To: <20170130204143.539-1-f.fainelli@gmail.com>
We can use b53_mirror_add and b53_mirror_del because the Starfighter 2
is register compatible in that specific case.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/dsa/bcm_sf2.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index be282b430c50..2be963252ca5 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -1047,6 +1047,8 @@ static const struct dsa_switch_ops bcm_sf2_ops = {
.port_fdb_del = b53_fdb_del,
.get_rxnfc = bcm_sf2_get_rxnfc,
.set_rxnfc = bcm_sf2_set_rxnfc,
+ .port_mirror_add = b53_mirror_add,
+ .port_mirror_del = b53_mirror_del,
};
struct bcm_sf2_of_data {
--
2.9.3
^ permalink raw reply related
* Re: [PATCH net-next v4 0/4] net: dsa: Port mirroring support
From: David Miller @ 2017-01-30 20:36 UTC (permalink / raw)
To: f.fainelli; +Cc: netdev, andrew, vivien.didelot, cphealy, jiri
In-Reply-To: <182b4342-8e78-c2ce-eb25-ed39cb4ab50f@gmail.com>
From: Florian Fainelli <f.fainelli@gmail.com>
Date: Mon, 30 Jan 2017 12:32:59 -0800
> On 01/29/2017 08:30 PM, Florian Fainelli wrote:
>> Hi all,
>>
>> This patch series adds support for port mirroring in the two
>> Broadcom switch drivers. The major part of the functional are actually with
>> the plumbing between tc and the drivers.
>>
>> David, this will most likely conflict a little bit with my other series:
>> net: dsa: bcm_sf2: CFP support, so just let me know if that happens, and
>> I will provide a rebased version. Thanks!
>
> David, since you have applied the CFP series, there are few conflicts,
> will post a v5. Thanks!
Ok. A lot of cross traffic in this area past few days :)
^ permalink raw reply
* Re: [PATCH net] net/mlx4_core: Avoid command timeouts during VF driver device shutdown
From: David Miller @ 2017-01-30 20:45 UTC (permalink / raw)
To: tariqt; +Cc: netdev, eranbe, jackm
In-Reply-To: <1485781905-1511-1-git-send-email-tariqt@mellanox.com>
From: Tariq Toukan <tariqt@mellanox.com>
Date: Mon, 30 Jan 2017 15:11:45 +0200
> From: Jack Morgenstein <jackm@dev.mellanox.co.il>
>
> Some Hypervisors detach VFs from VMs by instantly causing an FLR event
> to be generated for a VF.
>
> In the mlx4 case, this will cause that VF's comm channel to be disabled
> before the VM has an opportunity to invoke the VF device's "shutdown"
> method.
>
> The result is that the VF driver on the VM will experience a command
> timeout during the shutdown process when the Hypervisor does not deliver
> a command-completion event to the VM.
>
> To avoid FW command timeouts on the VM when the driver's shutdown method
> is invoked, we detect the absence of the VF's comm channel at the very
> start of the shutdown process. If the comm-channel has already been
> disabled, we cause all FW commands during the device shutdown process to
> immediately return success (and thus avoid all command timeouts).
>
> Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
> Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Applied, thanks.
^ permalink raw reply
* Re: [pull request][net V2 0/8] Mellanox mlx5 fixes 2017-01-27
From: David Miller @ 2017-01-30 20:45 UTC (permalink / raw)
To: saeedm; +Cc: netdev
In-Reply-To: <20170129214626.21977-1-saeedm@mellanox.com>
From: Saeed Mahameed <saeedm@mellanox.com>
Date: Sun, 29 Jan 2017 23:46:18 +0200
> This pull request includes some mlx5 fixes for net, please see details
> below.
>
> Please pull and let me know if there's any problem.
Pulled...
> For -stable:
> net/mlx5e: Modify TIRs hash only when it's needed
> net/mlx5e: Fix update of hash function/key via ethtool
And queued up for -stable, thank you.
^ permalink raw reply
* Re: [PATCH net-next 1/3] trace: add variant without spacing in trace_print_hex_seq
From: Steven Rostedt @ 2017-01-30 20:44 UTC (permalink / raw)
To: Daniel Borkmann
Cc: davem, ast, netdev, linux-kernel, Arnaldo Carvalho de Melo
In-Reply-To: <f860273ed9fd0c423f4d1ee2ab93565992d76ff4.1485306168.git.daniel@iogearbox.net>
On Wed, 25 Jan 2017 02:28:16 +0100
Daniel Borkmann <daniel@iogearbox.net> wrote:
> For upcoming tracepoint support for BPF, we want to dump the program's
> tag. Format should be similar to __print_hex(), but without spacing.
> Add a __print_hex_str() variant for exactly that purpose that reuses
> trace_print_hex_seq().
>
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
> include/linux/trace_events.h | 3 ++-
> include/trace/trace_events.h | 8 +++++++-
> kernel/trace/trace_output.c | 7 ++++---
> 3 files changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h
> index be00761..cfa475a 100644
> --- a/include/linux/trace_events.h
> +++ b/include/linux/trace_events.h
> @@ -33,7 +33,8 @@ const char *trace_print_bitmask_seq(struct trace_seq *p, void *bitmask_ptr,
> unsigned int bitmask_size);
>
> const char *trace_print_hex_seq(struct trace_seq *p,
> - const unsigned char *buf, int len);
> + const unsigned char *buf, int len,
> + bool spacing);
Hmm, "spacing" doesn't really mean much. What about the invert of it,
and have "concatenate"?
>
> const char *trace_print_array_seq(struct trace_seq *p,
> const void *buf, int count,
> diff --git a/include/trace/trace_events.h b/include/trace/trace_events.h
> index 467e12f..9f68462 100644
> --- a/include/trace/trace_events.h
> +++ b/include/trace/trace_events.h
> @@ -297,7 +297,12 @@
> #endif
>
> #undef __print_hex
> -#define __print_hex(buf, buf_len) trace_print_hex_seq(p, buf, buf_len)
> +#define __print_hex(buf, buf_len) \
> + trace_print_hex_seq(p, buf, buf_len, true)
> +
> +#undef __print_hex_str
> +#define __print_hex_str(buf, buf_len) \
> + trace_print_hex_seq(p, buf, buf_len, false)
>
> #undef __print_array
> #define __print_array(array, count, el_size) \
> @@ -711,6 +716,7 @@
> #undef __print_flags
> #undef __print_symbolic
> #undef __print_hex
> +#undef __print_hex_str
> #undef __get_dynamic_array
> #undef __get_dynamic_array_len
> #undef __get_str
> diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
> index 5d33a73..30a144b1 100644
> --- a/kernel/trace/trace_output.c
> +++ b/kernel/trace/trace_output.c
> @@ -163,14 +163,15 @@ enum print_line_t trace_print_printk_msg_only(struct trace_iterator *iter)
> EXPORT_SYMBOL_GPL(trace_print_bitmask_seq);
>
With the addition of this boolean parameter, this function shold
probably have a kernel doc header, that can explain the parameters.
-- Steve
> const char *
> -trace_print_hex_seq(struct trace_seq *p, const unsigned char *buf, int buf_len)
> +trace_print_hex_seq(struct trace_seq *p, const unsigned char *buf, int buf_len,
> + bool spacing)
> {
> int i;
> const char *ret = trace_seq_buffer_ptr(p);
>
> for (i = 0; i < buf_len; i++)
> - trace_seq_printf(p, "%s%2.2x", i == 0 ? "" : " ", buf[i]);
> -
> + trace_seq_printf(p, "%s%2.2x", !spacing || i == 0 ? "" : " ",
> + buf[i]);
> trace_seq_putc(p, 0);
>
> return ret;
^ permalink raw reply
* new patch state in patchwork...
From: David Miller @ 2017-01-30 20:38 UTC (permalink / raw)
To: netdev; +Cc: linux-wireless, netfilter-devel
I noticed there is a new state "Needs Review / ACK" in patchwork.
I am going to use this for situations where I am explicitly waiting
either for a maintainer, or someone referenced directly in the patch
discussion, to review and ACK/NACK the change.
Just FYI...
^ permalink raw reply
* Re: [PATCHv3 perf/core 0/6] Libbpf object pinning
From: Arnaldo Carvalho de Melo @ 2017-01-30 20:37 UTC (permalink / raw)
To: Joe Stringer; +Cc: wangnan0, ast, daniel, linux-kernel, netdev
In-Reply-To: <20170126212001.14103-1-joe@ovn.org>
Em Thu, Jan 26, 2017 at 01:19:55PM -0800, Joe Stringer escreveu:
> This series adds pinning functionality for maps, programs, and objects.
> Library users may call bpf_map__pin(map, path) or bpf_program__pin(prog, path)
> to pin maps and programs separately, or use bpf_object__pin(obj, path) to
> pin all maps and programs from the BPF object to the path. The map and program
> variations require a path where it will be pinned in the filesystem,
> and the object variation will create named directories for each program with
> instances within, and mount the maps by name under the path.
>
> For example, with the directory '/sys/fs/bpf/foo' and a BPF object which
> contains two instances of a program named 'bar', and a map named 'baz':
> /sys/fs/bpf/foo/bar/0
> /sys/fs/bpf/foo/bar/1
> /sys/fs/bpf/foo/baz
Thanks, applied, after some minor fixes.
- Arnaldo
> ---
> v3: Split out bpf_program__pin_instance().
> Change the paths from PATH/{maps,progs}/foo to the above.
> Drop the patches that were applied.
> Add a perf test to check that pinning works.
> v2: Wang Nan provided improvements to patch 1.
> Dropped patch 2 from v1.
> Added acks for acked patches.
> Split the bpf_obj__pin() to also provide map / program pinning APIs.
> Allow users to provide full filesystem path (don't autodetect/mount BPFFS).
> v1: Initial post.
>
> Joe Stringer (6):
> tools lib bpf: Add BPF program pinning APIs.
> tools lib bpf: Add bpf_map__pin()
> tools lib bpf: Add bpf_object__pin()
> tools perf util: Make rm_rf(path) argument const
> tools lib api fs: Add bpf_fs filesystem detector
> perf test: Add libbpf pinning test
>
> tools/lib/api/fs/fs.c | 16 +++++
> tools/lib/api/fs/fs.h | 1 +
> tools/lib/bpf/libbpf.c | 188 +++++++++++++++++++++++++++++++++++++++++++++++++
> tools/lib/bpf/libbpf.h | 5 ++
> tools/perf/tests/bpf.c | 42 ++++++++++-
> tools/perf/util/util.c | 2 +-
> tools/perf/util/util.h | 2 +-
> 7 files changed, 253 insertions(+), 3 deletions(-)
>
> --
> 2.11.0
^ permalink raw reply
* [PATCH net-next] mpls: allow TTL propagation to/from IP packets to be configured
From: Robert Shearman @ 2017-01-30 20:36 UTC (permalink / raw)
To: davem; +Cc: netdev, roopa, ebiederm, Robert Shearman
It is sometimes desirable to present an MPLS transport network as a
single hop to traffic transiting it because it prevents confusion when
diagnosing failures. An example of where confusion can be generated is
when addresses used in the provider network overlap with addresses in
the overlay network and the addresses get exposed through ICMP errors
generated as packets transit the provider network.
Therefore, provide the ability to control whether the TTL value from
an MPLS packet is propagated to an IPv4/IPv6 packet when the last
label is popped through the addition of a new per-namespace sysctl:
"net.mpls.ip_ttl_propagate" which defaults to enabled.
Use the same sysctl to control whether the TTL is propagated from IP
packets into the MPLS header. If the TTL isn't propagated then a
default TTL value is used which can be configured via a new sysctl:
"net.mpls.default_ttl".
Signed-off-by: Robert Shearman <rshearma@brocade.com>
---
Documentation/networking/mpls-sysctl.txt | 19 +++++++++
include/net/netns/mpls.h | 3 ++
net/mpls/af_mpls.c | 70 ++++++++++++++++++++++++--------
net/mpls/mpls_iptunnel.c | 12 +++++-
4 files changed, 85 insertions(+), 19 deletions(-)
diff --git a/Documentation/networking/mpls-sysctl.txt b/Documentation/networking/mpls-sysctl.txt
index 15d8d16934fd..b8f0725ff09e 100644
--- a/Documentation/networking/mpls-sysctl.txt
+++ b/Documentation/networking/mpls-sysctl.txt
@@ -19,6 +19,25 @@ platform_labels - INTEGER
Possible values: 0 - 1048575
Default: 0
+ip_ttl_propagate - BOOL
+ Control whether TTL is propagated from the IPv4/IPv6 header to
+ the MPLS header on imposing labels and propagated from the
+ MPLS header to the IPv4/IPv6 header on popping the last label.
+
+ If disabled, the MPLS transport network will appear as a
+ single hop to transit traffic.
+
+ 0 - disabled
+ 1 - enabled (default)
+
+default_ttl - BOOL
+ Default TTL value to use for MPLS packets where it cannot be
+ propagated from an IP header, either because one isn't present
+ or ip_ttl_propagate has been disabled.
+
+ Possible values: 1 - 255
+ Default: 255
+
conf/<interface>/input - BOOL
Control whether packets can be input on this interface.
diff --git a/include/net/netns/mpls.h b/include/net/netns/mpls.h
index d29203651c01..1b68aed6e1b9 100644
--- a/include/net/netns/mpls.h
+++ b/include/net/netns/mpls.h
@@ -10,7 +10,10 @@ struct ctl_table_header;
struct netns_mpls {
size_t platform_labels;
+ int ip_ttl_propagate;
+ int default_ttl;
struct mpls_route __rcu * __rcu *platform_label;
+
struct ctl_table_header *ctl;
};
diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
index 64d3bf269a26..bf5f0792e8a2 100644
--- a/net/mpls/af_mpls.c
+++ b/net/mpls/af_mpls.c
@@ -31,7 +31,9 @@
#define MPLS_NEIGH_TABLE_UNSPEC (NEIGH_LINK_TABLE + 1)
static int zero = 0;
+static int one = 1;
static int label_limit = (1 << 20) - 1;
+static int ttl_max = 255;
static void rtmsg_lfib(int event, u32 label, struct mpls_route *rt,
struct nlmsghdr *nlh, struct net *net, u32 portid,
@@ -219,8 +221,8 @@ static struct mpls_nh *mpls_select_multipath(struct mpls_route *rt,
return &rt->rt_nh[nh_index];
}
-static bool mpls_egress(struct mpls_route *rt, struct sk_buff *skb,
- struct mpls_entry_decoded dec)
+static bool mpls_egress(struct net *net, struct mpls_route *rt,
+ struct sk_buff *skb, struct mpls_entry_decoded dec)
{
enum mpls_payload_type payload_type;
bool success = false;
@@ -243,24 +245,29 @@ static bool mpls_egress(struct mpls_route *rt, struct sk_buff *skb,
payload_type = ip_hdr(skb)->version;
switch (payload_type) {
- case MPT_IPV4: {
- struct iphdr *hdr4 = ip_hdr(skb);
- skb->protocol = htons(ETH_P_IP);
- csum_replace2(&hdr4->check,
- htons(hdr4->ttl << 8),
- htons(dec.ttl << 8));
- hdr4->ttl = dec.ttl;
+ case MPT_IPV4:
+ if (net->mpls.ip_ttl_propagate) {
+ struct iphdr *hdr4 = ip_hdr(skb);
+
+ skb->protocol = htons(ETH_P_IP);
+ csum_replace2(&hdr4->check,
+ htons(hdr4->ttl << 8),
+ htons(dec.ttl << 8));
+ hdr4->ttl = dec.ttl;
+ }
success = true;
break;
- }
- case MPT_IPV6: {
- struct ipv6hdr *hdr6 = ipv6_hdr(skb);
- skb->protocol = htons(ETH_P_IPV6);
- hdr6->hop_limit = dec.ttl;
+ case MPT_IPV6:
+ if (net->mpls.ip_ttl_propagate) {
+ struct ipv6hdr *hdr6 = ipv6_hdr(skb);
+
+ skb->protocol = htons(ETH_P_IPV6);
+ hdr6->hop_limit = dec.ttl;
+ }
success = true;
break;
- }
case MPT_UNSPEC:
+ /* Should have decided which protocol it is by now */
break;
}
@@ -360,7 +367,7 @@ static int mpls_forward(struct sk_buff *skb, struct net_device *dev,
if (unlikely(!new_header_size && dec.bos)) {
/* Penultimate hop popping */
- if (!mpls_egress(rt, skb, dec))
+ if (!mpls_egress(dev_net(out_dev), rt, skb, dec))
goto err;
} else {
bool bos;
@@ -1764,6 +1771,9 @@ static int mpls_platform_labels(struct ctl_table *table, int write,
return ret;
}
+#define MPLS_NS_SYSCTL_OFFSET(field) \
+ (&((struct net *)0)->field)
+
static const struct ctl_table mpls_table[] = {
{
.procname = "platform_labels",
@@ -1772,21 +1782,47 @@ static const struct ctl_table mpls_table[] = {
.mode = 0644,
.proc_handler = mpls_platform_labels,
},
+ {
+ .procname = "ip_ttl_propagate",
+ .data = MPLS_NS_SYSCTL_OFFSET(mpls.ip_ttl_propagate),
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = proc_dointvec_minmax,
+ .extra1 = &zero,
+ .extra2 = &one,
+ },
+ {
+ .procname = "default_ttl",
+ .data = MPLS_NS_SYSCTL_OFFSET(mpls.default_ttl),
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = proc_dointvec_minmax,
+ .extra1 = &one,
+ .extra2 = &ttl_max,
+ },
{ }
};
static int mpls_net_init(struct net *net)
{
struct ctl_table *table;
+ int i;
net->mpls.platform_labels = 0;
net->mpls.platform_label = NULL;
+ net->mpls.ip_ttl_propagate = 1;
+ net->mpls.default_ttl = 255;
table = kmemdup(mpls_table, sizeof(mpls_table), GFP_KERNEL);
if (table == NULL)
return -ENOMEM;
- table[0].data = net;
+ /* Table data contains only offsets relative to the base of
+ * the mdev at this point, so make them absolute.
+ */
+ for (i = 0; i < ARRAY_SIZE(mpls_table) - 1; i++)
+ table[i].data = (char *)net + (uintptr_t)table[i].data;
+
net->mpls.ctl = register_net_sysctl(net, "net/mpls", table);
if (net->mpls.ctl == NULL) {
kfree(table);
diff --git a/net/mpls/mpls_iptunnel.c b/net/mpls/mpls_iptunnel.c
index 67b7a955de65..c6a8e1c7c5f5 100644
--- a/net/mpls/mpls_iptunnel.c
+++ b/net/mpls/mpls_iptunnel.c
@@ -49,6 +49,7 @@ static int mpls_xmit(struct sk_buff *skb)
struct rtable *rt = NULL;
struct rt6_info *rt6 = NULL;
struct mpls_dev *out_mdev;
+ struct net *net;
int err = 0;
bool bos;
int i;
@@ -56,13 +57,20 @@ static int mpls_xmit(struct sk_buff *skb)
/* Find the output device */
out_dev = dst->dev;
+ net = dev_net(out_dev);
/* Obtain the ttl */
if (dst->ops->family == AF_INET) {
- ttl = ip_hdr(skb)->ttl;
+ if (net->mpls.ip_ttl_propagate)
+ ttl = ip_hdr(skb)->ttl;
+ else
+ ttl = net->mpls.default_ttl;
rt = (struct rtable *)dst;
} else if (dst->ops->family == AF_INET6) {
- ttl = ipv6_hdr(skb)->hop_limit;
+ if (net->mpls.ip_ttl_propagate)
+ ttl = ipv6_hdr(skb)->hop_limit;
+ else
+ ttl = net->mpls.default_ttl;
rt6 = (struct rt6_info *)dst;
} else {
goto drop;
--
2.1.4
^ permalink raw reply related
* Re: [PATCH net-next v4 0/4] net: dsa: Port mirroring support
From: Florian Fainelli @ 2017-01-30 20:32 UTC (permalink / raw)
To: davem; +Cc: netdev, andrew, vivien.didelot, cphealy, jiri
In-Reply-To: <20170130043026.28867-1-f.fainelli@gmail.com>
On 01/29/2017 08:30 PM, Florian Fainelli wrote:
> Hi all,
>
> This patch series adds support for port mirroring in the two
> Broadcom switch drivers. The major part of the functional are actually with
> the plumbing between tc and the drivers.
>
> David, this will most likely conflict a little bit with my other series:
> net: dsa: bcm_sf2: CFP support, so just let me know if that happens, and
> I will provide a rebased version. Thanks!
David, since you have applied the CFP series, there are few conflicts,
will post a v5. Thanks!
>
> Changes in v4:
>
> - rebased against latest net-next/master after Vivien's changes
>
> Changes in v3:
>
> - removed multiline comments from added structures
> - simplify error handling in dsa_slave_add_cls_matchall
>
> Changes in v2:
>
> - fixed filter removal logic to disable the ingress or egress mirroring
> when there are no longer ports being monitored in ingress or egress
>
> - removed a stray list_head in dsa_port structure that is not used
>
> Tested using the two iproute2 examples:
>
> # ingress
> tc qdisc add dev eth1 handle ffff: ingress
> tc filter add dev eth1 parent ffff: \
> matchall skip_sw \
> action mirred egress mirror \
> dev eth2
> # egress
> tc qdisc add dev eth1 handle 1: root prio
> tc filter add dev eth1 parent 1: \
> matchall skip_sw \
> action mirred egress mirror \
> dev eth2
>
>
> Florian Fainelli (4):
> net: dsa: Add plumbing for port mirroring
> net: dsa: b53: Add mirror capture register definitions
> net: dsa: b53: Add support for port mirroring
> net: dsa: bcm_sf2: Add support for port mirroring
>
> drivers/net/dsa/b53/b53_common.c | 67 +++++++++++++++++++
> drivers/net/dsa/b53/b53_priv.h | 4 ++
> drivers/net/dsa/b53/b53_regs.h | 32 ++++++++++
> drivers/net/dsa/bcm_sf2.c | 2 +
> include/net/dsa.h | 33 ++++++++++
> net/dsa/dsa_priv.h | 3 +
> net/dsa/slave.c | 135 ++++++++++++++++++++++++++++++++++++++-
> 7 files changed, 275 insertions(+), 1 deletion(-)
>
--
Florian
^ permalink raw reply
* Re: [PATCHv3 perf/core 1/6] tools lib bpf: Add BPF program pinning APIs.
From: Arnaldo Carvalho de Melo @ 2017-01-30 20:28 UTC (permalink / raw)
To: Joe Stringer; +Cc: wangnan0, ast, daniel, linux-kernel, netdev
In-Reply-To: <20170130202506.GF4546@kernel.org>
Em Mon, Jan 30, 2017 at 05:25:06PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Thu, Jan 26, 2017 at 01:19:56PM -0800, Joe Stringer escreveu:
> > Add new APIs to pin a BPF program (or specific instances) to the filesystem.
> > The user can specify the path full path within a BPF filesystem to pin the
> > program.
> >
> > bpf_program__pin_instance(prog, path, n) will pin the nth instance of
> > 'prog' to the specified path.
> > bpf_program__pin(prog, path) will create the directory 'path' (if it
> > does not exist) and pin each instance within that directory. For
> > instance, path/0, path/1, path/2.
> >
> > Signed-off-by: Joe Stringer <joe@ovn.org>
>
> make: Entering directory '/home/acme/git/linux/tools/perf'
> BUILD: Doing 'make -j4' parallel build
> CC /tmp/build/perf/builtin-record.o
> CC /tmp/build/perf/libbpf.o
> CC /tmp/build/perf/util/parse-events.o
> INSTALL trace_plugins
> libbpf.c: In function ‘make_dir’:
> libbpf.c:1303:6: error: implicit declaration of function ‘mkdir’ [-Werror=implicit-function-declaration]
> if (mkdir(path, 0700) && errno != EEXIST)
> ^~~~~
> libbpf.c:1303:2: error: nested extern declaration of ‘mkdir’ [-Werror=nested-externs]
> if (mkdir(path, 0700) && errno != EEXIST)
> ^~
> cc1: all warnings being treated as errors
> mv: cannot stat '/tmp/build/perf/.libbpf.o.tmp': No such file or directory
> /home/acme/git/linux/tools/build/Makefile.build:101: recipe for target '/tmp/build/perf/libbpf.o' failed
>
>
> And strdup() is not checked for failure, I'm fixing those,
>
> +++ b/tools/lib/bpf/libbpf.c
> @@ -36,6 +36,8 @@
> #include <linux/magic.h>
> #include <linux/list.h>
> #include <linux/limits.h>
> +#include <sys/stat.h>
> +#include <sys/types.h>
> #include <sys/vfs.h>
This as well:
@@ -1338,7 +1343,7 @@ int bpf_program__pin(struct bpf_program *prog,
const char *path)
len = snprintf(buf, PATH_MAX, "%s/%d", path, i);
if (len < 0)
return -EINVAL;
- else if (len > PATH_MAX)
+ else if (len >= PATH_MAX)
return -ENAMETOOLONG;
See 'man snprintf', return value:
---
Thus, a return value of size or more means that the output was
truncated.
---
^ permalink raw reply
* Re: [PATCH net-next V3 0/8] mlx4 misc improvements
From: David Miller @ 2017-01-30 20:27 UTC (permalink / raw)
To: tariqt; +Cc: netdev, eranbe
In-Reply-To: <1485708980-23468-1-git-send-email-tariqt@mellanox.com>
From: Tariq Toukan <tariqt@mellanox.com>
Date: Sun, 29 Jan 2017 18:56:12 +0200
> This patchset contains several improvements and cleanups
> from the team to the mlx4 Eth and core drivers.
>
> Series generated against net-next commit:
> 4e8f2fc1a55d Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
...
> v3:
> * Patch 6/9: forgot to actually update the commit message in v2, now it is.
>
> v2:
> * Patch 1/9: used EOPNOTSUPP and not ENOTSUPP.
> * Patch 3/9: dropped, to be submitted separately in the future.
> * Patch 6/9: updated commit message.
Series applied, thank you.
^ permalink raw reply
* Re: [PATCH net-next V3 5/8] net/mlx4_en: Adding support of turning off link autonegotiation via ethtool
From: David Miller @ 2017-01-30 20:25 UTC (permalink / raw)
To: David.Laight; +Cc: tariqt, netdev, eranbe, lariel
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6DB0273B7E@AcuExch.aculab.com>
From: David Laight <David.Laight@ACULAB.COM>
Date: Mon, 30 Jan 2017 14:00:28 +0000
> From: Tariq Toukan
>> Sent: 29 January 2017 16:56
>> From: Ariel Levkovich <lariel@mellanox.com>
>>
>> This feature will allow the user to disable auto negotiation
>> on the port for mlx4 devices while setting the speed is limited
>> to 1GbE speeds.
>> Other speeds will not be accepted in autoneg off mode.
>
> What is the rationale behind this change?
Because it's an ethtool user feature we've had to two decades
and it allows the user greater control over the link state.
> When I was writing ethernet drivers it was always better to
> leave autonegotiation enabled with restricted modes than to
> fix the speed.
Nothing about this change effects this. The user is just given
the ability to turn autonegotiation off if they wish to do so.
^ permalink raw reply
* Re: [PATCHv3 perf/core 1/6] tools lib bpf: Add BPF program pinning APIs.
From: Arnaldo Carvalho de Melo @ 2017-01-30 20:25 UTC (permalink / raw)
To: Joe Stringer; +Cc: wangnan0, ast, daniel, linux-kernel, netdev
In-Reply-To: <20170126212001.14103-2-joe@ovn.org>
Em Thu, Jan 26, 2017 at 01:19:56PM -0800, Joe Stringer escreveu:
> Add new APIs to pin a BPF program (or specific instances) to the filesystem.
> The user can specify the path full path within a BPF filesystem to pin the
> program.
>
> bpf_program__pin_instance(prog, path, n) will pin the nth instance of
> 'prog' to the specified path.
> bpf_program__pin(prog, path) will create the directory 'path' (if it
> does not exist) and pin each instance within that directory. For
> instance, path/0, path/1, path/2.
>
> Signed-off-by: Joe Stringer <joe@ovn.org>
make: Entering directory '/home/acme/git/linux/tools/perf'
BUILD: Doing 'make -j4' parallel build
CC /tmp/build/perf/builtin-record.o
CC /tmp/build/perf/libbpf.o
CC /tmp/build/perf/util/parse-events.o
INSTALL trace_plugins
libbpf.c: In function ‘make_dir’:
libbpf.c:1303:6: error: implicit declaration of function ‘mkdir’ [-Werror=implicit-function-declaration]
if (mkdir(path, 0700) && errno != EEXIST)
^~~~~
libbpf.c:1303:2: error: nested extern declaration of ‘mkdir’ [-Werror=nested-externs]
if (mkdir(path, 0700) && errno != EEXIST)
^~
cc1: all warnings being treated as errors
mv: cannot stat '/tmp/build/perf/.libbpf.o.tmp': No such file or directory
/home/acme/git/linux/tools/build/Makefile.build:101: recipe for target '/tmp/build/perf/libbpf.o' failed
And strdup() is not checked for failure, I'm fixing those,
+++ b/tools/lib/bpf/libbpf.c
@@ -36,6 +36,8 @@
#include <linux/magic.h>
#include <linux/list.h>
#include <linux/limits.h>
+#include <sys/stat.h>
+#include <sys/types.h>
#include <sys/vfs.h>
- Arnaldo
> ---
> v3: Add per-instance pinning.
> Use path for bpf_program__pin() as directory.
> v2: Don't automount BPF filesystem
> Split program, map, object pinning into separate APIs and separate
> patches.
> ---
> tools/lib/bpf/libbpf.c | 112 +++++++++++++++++++++++++++++++++++++++++++++++++
> tools/lib/bpf/libbpf.h | 3 ++
> 2 files changed, 115 insertions(+)
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index e6cd62b1264b..d1d7638b7c21 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -4,6 +4,7 @@
> * Copyright (C) 2013-2015 Alexei Starovoitov <ast@kernel.org>
> * Copyright (C) 2015 Wang Nan <wangnan0@huawei.com>
> * Copyright (C) 2015 Huawei Inc.
> + * Copyright (C) 2017 Nicira, Inc.
> *
> * This program is free software; you can redistribute it and/or
> * modify it under the terms of the GNU Lesser General Public
> @@ -22,6 +23,7 @@
> #include <stdlib.h>
> #include <stdio.h>
> #include <stdarg.h>
> +#include <libgen.h>
> #include <inttypes.h>
> #include <string.h>
> #include <unistd.h>
> @@ -31,7 +33,10 @@
> #include <linux/err.h>
> #include <linux/kernel.h>
> #include <linux/bpf.h>
> +#include <linux/magic.h>
> #include <linux/list.h>
> +#include <linux/limits.h>
> +#include <sys/vfs.h>
> #include <libelf.h>
> #include <gelf.h>
>
> @@ -1237,6 +1242,113 @@ int bpf_object__load(struct bpf_object *obj)
> return err;
> }
>
> +static int check_path(const char *path)
> +{
> + struct statfs st_fs;
> + char *dname, *dir;
> + int err = 0;
> +
> + if (path == NULL)
> + return -EINVAL;
> +
> + dname = strdup(path);
> + dir = dirname(dname);
> + if (statfs(dir, &st_fs)) {
> + pr_warning("failed to statfs %s: %s\n", dir, strerror(errno));
> + err = -errno;
> + }
> + free(dname);
> +
> + if (!err && st_fs.f_type != BPF_FS_MAGIC) {
> + pr_warning("specified path %s is not on BPF FS\n", path);
> + err = -EINVAL;
> + }
> +
> + return err;
> +}
> +
> +int bpf_program__pin_instance(struct bpf_program *prog, const char *path,
> + int instance)
> +{
> + int err;
> +
> + err = check_path(path);
> + if (err)
> + return err;
> +
> + if (prog == NULL) {
> + pr_warning("invalid program pointer\n");
> + return -EINVAL;
> + }
> +
> + if (instance < 0 || instance >= prog->instances.nr) {
> + pr_warning("invalid prog instance %d of prog %s (max %d)\n",
> + instance, prog->section_name, prog->instances.nr);
> + return -EINVAL;
> + }
> +
> + if (bpf_obj_pin(prog->instances.fds[instance], path)) {
> + pr_warning("failed to pin program: %s\n", strerror(errno));
> + return -errno;
> + }
> + pr_debug("pinned program '%s'\n", path);
> +
> + return 0;
> +}
> +
> +static int make_dir(const char *path)
> +{
> + int err = 0;
> +
> + if (mkdir(path, 0700) && errno != EEXIST)
> + err = -errno;
> +
> + if (err)
> + pr_warning("failed to mkdir %s: %s\n", path, strerror(-err));
> + return err;
> +}
> +
> +int bpf_program__pin(struct bpf_program *prog, const char *path)
> +{
> + int i, err;
> +
> + err = check_path(path);
> + if (err)
> + return err;
> +
> + if (prog == NULL) {
> + pr_warning("invalid program pointer\n");
> + return -EINVAL;
> + }
> +
> + if (prog->instances.nr <= 0) {
> + pr_warning("no instances of prog %s to pin\n",
> + prog->section_name);
> + return -EINVAL;
> + }
> +
> + err = make_dir(path);
> + if (err)
> + return err;
> +
> + for (i = 0; i < prog->instances.nr; i++) {
> + char buf[PATH_MAX];
> + int len;
> +
> + len = snprintf(buf, PATH_MAX, "%s/%d", path, i);
> + if (len < 0)
> + return -EINVAL;
> + else if (len > PATH_MAX)
> + return -ENAMETOOLONG;
> +
> + err = bpf_program__pin_instance(prog, buf, i);
> + if (err)
> + return err;
> + }
> +
> + return 0;
> +}
> +
> void bpf_object__close(struct bpf_object *obj)
> {
> size_t i;
> diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
> index 4014d1ba5e3d..9f8aa63b95f4 100644
> --- a/tools/lib/bpf/libbpf.h
> +++ b/tools/lib/bpf/libbpf.h
> @@ -106,6 +106,9 @@ void *bpf_program__priv(struct bpf_program *prog);
> const char *bpf_program__title(struct bpf_program *prog, bool needs_copy);
>
> int bpf_program__fd(struct bpf_program *prog);
> +int bpf_program__pin_instance(struct bpf_program *prog, const char *path,
> + int instance);
> +int bpf_program__pin(struct bpf_program *prog, const char *path);
>
> struct bpf_insn;
>
> --
> 2.11.0
^ permalink raw reply
* Re: pull-request: wireless-drivers 2017-01-29
From: David Miller @ 2017-01-30 20:19 UTC (permalink / raw)
To: kvalo; +Cc: linux-wireless, netdev, linux-kernel
In-Reply-To: <87a8a9udk1.fsf@kamboji.qca.qualcomm.com>
From: Kalle Valo <kvalo@codeaurora.org>
Date: Sun, 29 Jan 2017 16:49:02 +0200
> small but important fixes for 4.10. Hopefully is the last pull request
> for 4.10.
>
> Please let me know if there are any problems.
Pulled, thanks Kalle.
^ permalink raw reply
* Re: [PATCH net-next v2] lwtunnel: remove device arg to lwtunnel_build_state
From: David Miller @ 2017-01-30 20:14 UTC (permalink / raw)
To: dsa; +Cc: netdev, roopa
In-Reply-To: <1485806857-3651-1-git-send-email-dsa@cumulusnetworks.com>
From: David Ahern <dsa@cumulusnetworks.com>
Date: Mon, 30 Jan 2017 12:07:37 -0800
> Nothing about lwt state requires a device reference, so remove the
> input argument.
>
> Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
> ---
> v2
> - rebased to top of net-next tree
Looks fine, applied, thanks David.
^ permalink raw reply
* Re: [PATCH net-next] drivers: net: generalize napi_complete_done()
From: David Miller @ 2017-01-30 20:11 UTC (permalink / raw)
To: edumazet; +Cc: netdev
In-Reply-To: <20170130162201.8459-1-edumazet@google.com>
From: Eric Dumazet <edumazet@google.com>
Date: Mon, 30 Jan 2017 08:22:01 -0800
> napi_complete_done() allows to opt-in for gro_flush_timeout,
> added back in linux-3.19, commit 3b47d30396ba
> ("net: gro: add a per device gro flush timer")
>
> This allows for more efficient GRO aggregation without
> sacrifying latencies.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Looks good to me.
Will push it out assuming it passes my build tests.
Thanks!
^ permalink raw reply
* Re: [PATCH net] net: Avoid receiving packets with an l3mdev on unbound UDP sockets
From: David Miller @ 2017-01-30 20:01 UTC (permalink / raw)
To: dsa; +Cc: rshearma, netdev
In-Reply-To: <e5618218-0de4-6bb6-1bb8-9e53e0ecb183@cumulusnetworks.com>
From: David Ahern <dsa@cumulusnetworks.com>
Date: Mon, 30 Jan 2017 11:52:01 -0700
> On 1/26/17 11:02 AM, Robert Shearman wrote:
>> Packets arriving in a VRF currently are delivered to UDP sockets that
>> aren't bound to any interface. TCP defaults to not delivering packets
>> arriving in a VRF to unbound sockets. IP route lookup and socket
>> transmit both assume that unbound means using the default table and
>> UDP applications that haven't been changed to be aware of VRFs may not
>> function correctly in this case since they may not be able to handle
>> overlapping IP address ranges, or be able to send packets back to the
>> original sender if required.
>>
>> So add a sysctl, udp_l3mdev_accept, to control this behaviour with it
>> being analgous to the existing tcp_l3mdev_accept, namely to allow a
>> process to have a VRF-global listen socket. Have this default to off
>> as this is the behaviour that users will expect, given that there is
>> no explicit mechanism to set unmodified VRF-unaware application into a
>> default VRF.
>>
>> Signed-off-by: Robert Shearman <rshearma@brocade.com>
>> ---
>> I've targetted this for the net tree because I believe the expected
>> behaviour is different enough from the current behaviour to be
>> considered a bug. However, this should also apply to the net-next tree
>> as-is if this not deemed a bug.
>
> Does not apply to net-next; collision in sysctl_net_ipv4.c
>
> As for the code change, I have updated my unit tests and they all pass with this patch. Not sure why I marked my version as not working last November, but it is all good now.
>
> Acked-by: David Ahern <dsa@cumulusnetworks.com>
> Tested-by: David Ahern <dsa@cumulusnetworks.com>
The conflict was easy enough to fix up, so I did it myself.
Applied to net-next, thanks.
^ permalink raw reply
* [PATCH net-next v2] lwtunnel: remove device arg to lwtunnel_build_state
From: David Ahern @ 2017-01-30 20:07 UTC (permalink / raw)
To: netdev; +Cc: roopa, David Ahern
Nothing about lwt state requires a device reference, so remove the
input argument.
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
---
v2
- rebased to top of net-next tree
include/net/lwtunnel.h | 6 +++---
net/core/lwt_bpf.c | 2 +-
net/core/lwtunnel.c | 4 ++--
net/ipv4/fib_semantics.c | 27 ++++++++-------------------
net/ipv4/ip_tunnel_core.c | 4 ++--
net/ipv6/ila/ila_lwt.c | 2 +-
net/ipv6/route.c | 2 +-
net/ipv6/seg6_iptunnel.c | 2 +-
net/mpls/mpls_iptunnel.c | 2 +-
9 files changed, 20 insertions(+), 31 deletions(-)
diff --git a/include/net/lwtunnel.h b/include/net/lwtunnel.h
index 73dd87647460..45399ed132bf 100644
--- a/include/net/lwtunnel.h
+++ b/include/net/lwtunnel.h
@@ -33,7 +33,7 @@ struct lwtunnel_state {
};
struct lwtunnel_encap_ops {
- int (*build_state)(struct net_device *dev, struct nlattr *encap,
+ int (*build_state)(struct nlattr *encap,
unsigned int family, const void *cfg,
struct lwtunnel_state **ts);
void (*destroy_state)(struct lwtunnel_state *lws);
@@ -109,7 +109,7 @@ int lwtunnel_encap_del_ops(const struct lwtunnel_encap_ops *op,
unsigned int num);
int lwtunnel_valid_encap_type(u16 encap_type);
int lwtunnel_valid_encap_type_attr(struct nlattr *attr, int len);
-int lwtunnel_build_state(struct net_device *dev, u16 encap_type,
+int lwtunnel_build_state(u16 encap_type,
struct nlattr *encap,
unsigned int family, const void *cfg,
struct lwtunnel_state **lws);
@@ -181,7 +181,7 @@ static inline int lwtunnel_valid_encap_type_attr(struct nlattr *attr, int len)
return -EOPNOTSUPP;
}
-static inline int lwtunnel_build_state(struct net_device *dev, u16 encap_type,
+static inline int lwtunnel_build_state(u16 encap_type,
struct nlattr *encap,
unsigned int family, const void *cfg,
struct lwtunnel_state **lws)
diff --git a/net/core/lwt_bpf.c b/net/core/lwt_bpf.c
index 03600459bcfd..0cfe7b0216c3 100644
--- a/net/core/lwt_bpf.c
+++ b/net/core/lwt_bpf.c
@@ -237,7 +237,7 @@ static const struct nla_policy bpf_nl_policy[LWT_BPF_MAX + 1] = {
[LWT_BPF_XMIT_HEADROOM] = { .type = NLA_U32 },
};
-static int bpf_build_state(struct net_device *dev, struct nlattr *nla,
+static int bpf_build_state(struct nlattr *nla,
unsigned int family, const void *cfg,
struct lwtunnel_state **ts)
{
diff --git a/net/core/lwtunnel.c b/net/core/lwtunnel.c
index c23465005f2f..6df9f8fabf0c 100644
--- a/net/core/lwtunnel.c
+++ b/net/core/lwtunnel.c
@@ -101,7 +101,7 @@ int lwtunnel_encap_del_ops(const struct lwtunnel_encap_ops *ops,
}
EXPORT_SYMBOL(lwtunnel_encap_del_ops);
-int lwtunnel_build_state(struct net_device *dev, u16 encap_type,
+int lwtunnel_build_state(u16 encap_type,
struct nlattr *encap, unsigned int family,
const void *cfg, struct lwtunnel_state **lws)
{
@@ -116,7 +116,7 @@ int lwtunnel_build_state(struct net_device *dev, u16 encap_type,
rcu_read_lock();
ops = rcu_dereference(lwtun_encaps[encap_type]);
if (likely(ops && ops->build_state && try_module_get(ops->owner))) {
- ret = ops->build_state(dev, encap, family, cfg, lws);
+ ret = ops->build_state(encap, family, cfg, lws);
if (ret)
module_put(ops->owner);
}
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 319c66de92eb..6306a67880e8 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -471,7 +471,6 @@ static int fib_count_nexthops(struct rtnexthop *rtnh, int remaining)
static int fib_get_nhs(struct fib_info *fi, struct rtnexthop *rtnh,
int remaining, struct fib_config *cfg)
{
- struct net *net = cfg->fc_nlinfo.nl_net;
int ret;
change_nexthops(fi) {
@@ -503,16 +502,14 @@ static int fib_get_nhs(struct fib_info *fi, struct rtnexthop *rtnh,
nla = nla_find(attrs, attrlen, RTA_ENCAP);
if (nla) {
struct lwtunnel_state *lwtstate;
- struct net_device *dev = NULL;
struct nlattr *nla_entype;
nla_entype = nla_find(attrs, attrlen,
RTA_ENCAP_TYPE);
if (!nla_entype)
goto err_inval;
- if (cfg->fc_oif)
- dev = __dev_get_by_index(net, cfg->fc_oif);
- ret = lwtunnel_build_state(dev, nla_get_u16(
+
+ ret = lwtunnel_build_state(nla_get_u16(
nla_entype),
nla, AF_INET, cfg,
&lwtstate);
@@ -597,21 +594,18 @@ static inline void fib_add_weight(struct fib_info *fi,
#endif /* CONFIG_IP_ROUTE_MULTIPATH */
-static int fib_encap_match(struct net *net, u16 encap_type,
+static int fib_encap_match(u16 encap_type,
struct nlattr *encap,
- int oif, const struct fib_nh *nh,
+ const struct fib_nh *nh,
const struct fib_config *cfg)
{
struct lwtunnel_state *lwtstate;
- struct net_device *dev = NULL;
int ret, result = 0;
if (encap_type == LWTUNNEL_ENCAP_NONE)
return 0;
- if (oif)
- dev = __dev_get_by_index(net, oif);
- ret = lwtunnel_build_state(dev, encap_type, encap,
+ ret = lwtunnel_build_state(encap_type, encap,
AF_INET, cfg, &lwtstate);
if (!ret) {
result = lwtunnel_cmp_encap(lwtstate, nh->nh_lwtstate);
@@ -623,7 +617,6 @@ static int fib_encap_match(struct net *net, u16 encap_type,
int fib_nh_match(struct fib_config *cfg, struct fib_info *fi)
{
- struct net *net = cfg->fc_nlinfo.nl_net;
#ifdef CONFIG_IP_ROUTE_MULTIPATH
struct rtnexthop *rtnh;
int remaining;
@@ -634,9 +627,8 @@ int fib_nh_match(struct fib_config *cfg, struct fib_info *fi)
if (cfg->fc_oif || cfg->fc_gw) {
if (cfg->fc_encap) {
- if (fib_encap_match(net, cfg->fc_encap_type,
- cfg->fc_encap, cfg->fc_oif,
- fi->fib_nh, cfg))
+ if (fib_encap_match(cfg->fc_encap_type,
+ cfg->fc_encap, fi->fib_nh, cfg))
return 1;
}
if ((!cfg->fc_oif || cfg->fc_oif == fi->fib_nh->nh_oif) &&
@@ -1093,13 +1085,10 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
if (cfg->fc_encap) {
struct lwtunnel_state *lwtstate;
- struct net_device *dev = NULL;
if (cfg->fc_encap_type == LWTUNNEL_ENCAP_NONE)
goto err_inval;
- if (cfg->fc_oif)
- dev = __dev_get_by_index(net, cfg->fc_oif);
- err = lwtunnel_build_state(dev, cfg->fc_encap_type,
+ err = lwtunnel_build_state(cfg->fc_encap_type,
cfg->fc_encap, AF_INET, cfg,
&lwtstate);
if (err)
diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c
index 9d6c10096d44..a31f47ccaad9 100644
--- a/net/ipv4/ip_tunnel_core.c
+++ b/net/ipv4/ip_tunnel_core.c
@@ -226,7 +226,7 @@ static const struct nla_policy ip_tun_policy[LWTUNNEL_IP_MAX + 1] = {
[LWTUNNEL_IP_FLAGS] = { .type = NLA_U16 },
};
-static int ip_tun_build_state(struct net_device *dev, struct nlattr *attr,
+static int ip_tun_build_state(struct nlattr *attr,
unsigned int family, const void *cfg,
struct lwtunnel_state **ts)
{
@@ -323,7 +323,7 @@ static const struct nla_policy ip6_tun_policy[LWTUNNEL_IP6_MAX + 1] = {
[LWTUNNEL_IP6_FLAGS] = { .type = NLA_U16 },
};
-static int ip6_tun_build_state(struct net_device *dev, struct nlattr *attr,
+static int ip6_tun_build_state(struct nlattr *attr,
unsigned int family, const void *cfg,
struct lwtunnel_state **ts)
{
diff --git a/net/ipv6/ila/ila_lwt.c b/net/ipv6/ila/ila_lwt.c
index 13b5e85fe0d5..ce1aae4a7fc8 100644
--- a/net/ipv6/ila/ila_lwt.c
+++ b/net/ipv6/ila/ila_lwt.c
@@ -115,7 +115,7 @@ static const struct nla_policy ila_nl_policy[ILA_ATTR_MAX + 1] = {
[ILA_ATTR_CSUM_MODE] = { .type = NLA_U8, },
};
-static int ila_build_state(struct net_device *dev, struct nlattr *nla,
+static int ila_build_state(struct nlattr *nla,
unsigned int family, const void *cfg,
struct lwtunnel_state **ts)
{
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 61d7006324ed..2563331b0532 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1897,7 +1897,7 @@ static struct rt6_info *ip6_route_info_create(struct fib6_config *cfg)
if (cfg->fc_encap) {
struct lwtunnel_state *lwtstate;
- err = lwtunnel_build_state(dev, cfg->fc_encap_type,
+ err = lwtunnel_build_state(cfg->fc_encap_type,
cfg->fc_encap, AF_INET6, cfg,
&lwtstate);
if (err)
diff --git a/net/ipv6/seg6_iptunnel.c b/net/ipv6/seg6_iptunnel.c
index c46f8cbf5ab5..6124e159c882 100644
--- a/net/ipv6/seg6_iptunnel.c
+++ b/net/ipv6/seg6_iptunnel.c
@@ -303,7 +303,7 @@ int seg6_output(struct net *net, struct sock *sk, struct sk_buff *skb)
return err;
}
-static int seg6_build_state(struct net_device *dev, struct nlattr *nla,
+static int seg6_build_state(struct nlattr *nla,
unsigned int family, const void *cfg,
struct lwtunnel_state **ts)
{
diff --git a/net/mpls/mpls_iptunnel.c b/net/mpls/mpls_iptunnel.c
index 67b7a955de65..e4e4424f9eb1 100644
--- a/net/mpls/mpls_iptunnel.c
+++ b/net/mpls/mpls_iptunnel.c
@@ -133,7 +133,7 @@ static int mpls_xmit(struct sk_buff *skb)
return -EINVAL;
}
-static int mpls_build_state(struct net_device *dev, struct nlattr *nla,
+static int mpls_build_state(struct nlattr *nla,
unsigned int family, const void *cfg,
struct lwtunnel_state **ts)
{
--
2.1.4
^ permalink raw reply related
* Re: [PATCH net] net: Avoid receiving packets with an l3mdev on unbound UDP sockets
From: Robert Shearman @ 2017-01-30 20:06 UTC (permalink / raw)
To: David Miller, dsa; +Cc: netdev
In-Reply-To: <20170130.150114.249644236631741676.davem@davemloft.net>
On 30/01/17 20:01, David Miller wrote:
> From: David Ahern <dsa@cumulusnetworks.com>
> Date: Mon, 30 Jan 2017 11:52:01 -0700
>
>> On 1/26/17 11:02 AM, Robert Shearman wrote:
>>> Packets arriving in a VRF currently are delivered to UDP sockets that
>>> aren't bound to any interface. TCP defaults to not delivering packets
>>> arriving in a VRF to unbound sockets. IP route lookup and socket
>>> transmit both assume that unbound means using the default table and
>>> UDP applications that haven't been changed to be aware of VRFs may not
>>> function correctly in this case since they may not be able to handle
>>> overlapping IP address ranges, or be able to send packets back to the
>>> original sender if required.
>>>
>>> So add a sysctl, udp_l3mdev_accept, to control this behaviour with it
>>> being analgous to the existing tcp_l3mdev_accept, namely to allow a
>>> process to have a VRF-global listen socket. Have this default to off
>>> as this is the behaviour that users will expect, given that there is
>>> no explicit mechanism to set unmodified VRF-unaware application into a
>>> default VRF.
>>>
>>> Signed-off-by: Robert Shearman <rshearma@brocade.com>
>>> ---
>>> I've targetted this for the net tree because I believe the expected
>>> behaviour is different enough from the current behaviour to be
>>> considered a bug. However, this should also apply to the net-next tree
>>> as-is if this not deemed a bug.
>>
>> Does not apply to net-next; collision in sysctl_net_ipv4.c
>>
>> As for the code change, I have updated my unit tests and they all pass with this patch. Not sure why I marked my version as not working last November, but it is all good now.
>>
>> Acked-by: David Ahern <dsa@cumulusnetworks.com>
>> Tested-by: David Ahern <dsa@cumulusnetworks.com>
>
> The conflict was easy enough to fix up, so I did it myself.
>
> Applied to net-next, thanks.
Great, thanks.
^ permalink raw reply
* Re: [PATCH net-next 0/4] mlx5: Create build configuration options
From: Tom Herbert @ 2017-01-30 20:00 UTC (permalink / raw)
To: Saeed Mahameed
Cc: Saeed Mahameed, David S. Miller, Linux Netdev List, Kernel Team
In-Reply-To: <CALzJLG9U8TB5rq40-uZ_ZvzqeTNObzu2gcfVBZL0swEqM4r9yw@mail.gmail.com>
On Sun, Jan 29, 2017 at 12:07 AM, Saeed Mahameed
<saeedm@dev.mellanox.co.il> wrote:
> On Sat, Jan 28, 2017 at 7:19 PM, Tom Herbert <tom@herbertland.com> wrote:
>> On Sat, Jan 28, 2017 at 3:38 AM, Saeed Mahameed
>> <saeedm@dev.mellanox.co.il> wrote:
>>> On Fri, Jan 27, 2017 at 8:13 PM, Tom Herbert <tom@herbertland.com> wrote:
>>>> On Fri, Jan 27, 2017 at 9:58 AM, Saeed Mahameed
>>>> <saeedm@dev.mellanox.co.il> wrote:
>>>>> On Fri, Jan 27, 2017 at 1:32 AM, Tom Herbert <tom@herbertland.com> wrote:
>>>>>> This patchset creates configuration options for sriov, vxlan, eswitch,
>>>>>> and tc features in the mlx5 driver. The purpose of this is to allow not
>>>>>> building these features. These features are optional advanced features
>>>>>> that are not required for a core Ethernet driver. A user can disable
>>>>>> these features which resuces the amount of code in the driver. Disabling
>>>>>> these features (and DCB) reduces the size of mlx5_core.o by about 16%.
>>>>>> This is also can reduce the complexity of backport and rebases since
>>>>>> user would no longer need to worry about dependencies with the rest of
>>>>>> the kernel that features which might not be of any interest to a user
>>>>>> may bring in.
>>>>>>
>>>>>> Tested: Build and ran the driver with all features enabled (the default)
>>>>>> and with none enabled (including DCB). Did not see any issues. I did
>>>>>> not explicity test operation of ayy of features in the list.
>>>>>>
>>>>>
>>>>> Basically I am not against this kind of change, infact i am with it,
>>>>> although I would have done some restructuring in the driver before i
>>>>> did such change ;), filling the code with ifdefs is not a neat thing.
>>>>>
>>>> If you wish, please take this as an RFC and feel free to structure the
>>>> code the right way. I think the intent is clear enough and looks like
>>>> davem isn't going to allow the directory restructuring so something
>>>> like this seems to be the best course of action now.
>>>>
>>>
>>> Right.
>>>
>>>>> I agree this will simplify backporting and provide some kind of
>>>>> feature separation inside the driver.
>>>>> But this will also increase the testing matrix we need to cover and
>>>>> increase the likelihood of kbuild breaks by an order of magnitude.
>>>>>
>>>> The testing matrix already exploded with the proliferation of
>>>> supported features. If anything this reduces the test matrix problem.
>>>> For instance, if we make a change to the core driver and functionality
>>>> properly isolated there is a much better chance that this won't affect
>>>> peripheral functionality and vice versa. It is just not feasible for
>>>> us to test every combination of NIC features for every change being
>>>> made.
>>>>
>>>
>>> Yes for isolated features, but for base functionality, we need to test
>>> it with all new device specific kconfig combinations on every patch!
>>
>> Sorry, but that is the price you need to pay for a feature rich device.
>>
>> On the subject of testing, I don't really see any indication in these
>> patches on how patches are being tested. Also, there are patches that
>> fix things without any mention of how to repro the problems. It is
>
> I Will do my best to provide more information in fixes commit
> messages, Thanks for the input.
>
>> critical that we know IPv6 is tested as much or more than IPv4 (just
>
> For the record, for every IPv4 test in our automatic regression system
> we have an IPv6 equivalent test,
> not to mention IPv6-only directed tests.
>
Great to know. Is there a publicly available description of what
specific tests are in the suite?
>> last week with hit yet another IPv6-only issue in an another upstream
>> driver that should have been caught with a simple load test-- this
>
> Is there any IPv6-only functionality issues with mlx4/mlx5 that we
> don't know about ?
> If you do see any of those, please report them so we take the needed
> corrective actions to fix them and cover them in our regression.
>
If we see them we will certainly let you know. This is not just
functionality either, performance regression versus IPv4 should also
be considered serious issues.
>> really is not acceptable any more!). Please add a description of how
>> patches were tested to commit logs.
>>
>
> Acknowledge.
>
Thanks,
Tom
>> Tom
>>
>>> since a misplaced code inside or outside the correct ifdef
>>> can easily go unnoticed and break functionality.
>>>
>>>>> One more thing, do we really need a device specific flag per feature
>>>>> per vendor per device? can't we just use the same kconfig flag for
>>>>> all drivers and if there is a more generic system wide flag that
>>>>> covers the same feature
>>>>> can't we just use it, for instance instead of
>>>>> CONFIG_<DRIVER_NAME>_SRIOV why not use already existing CONFIG_PCI_IOV
>>>>> for all drivers ?
>>>>>
>>>> That sounds good to me. We already have CONFIG_RFS_ACCEL and others
>>>> that do that.
>>>>
>>>> Tom
>>>>
>>>>> Saeed.
>>>>>
>>>>>>
>>>>>>
>>>>>> Tom Herbert (4):
>>>>>> mlx5: Make building eswitch configurable
>>>>>> mlx5: Make building SR-IOV configurable
>>>>>> mlx5: Make building tc hardware offload configurable
>>>>>> mlx5: Make building vxlan hardware offload configurable
>>>>>>
>>>>>> drivers/net/ethernet/mellanox/mlx5/core/Kconfig | 35 ++++++
>>>>>> drivers/net/ethernet/mellanox/mlx5/core/Makefile | 16 ++-
>>>>>> drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 129 ++++++++++++++++------
>>>>>> drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 39 +++++--
>>>>>> drivers/net/ethernet/mellanox/mlx5/core/eq.c | 4 +-
>>>>>> drivers/net/ethernet/mellanox/mlx5/core/lag.c | 2 +
>>>>>> drivers/net/ethernet/mellanox/mlx5/core/main.c | 32 ++++--
>>>>>> drivers/net/ethernet/mellanox/mlx5/core/sriov.c | 6 +-
>>>>>> 8 files changed, 205 insertions(+), 58 deletions(-)
>>>>>>
>>>>>> --
>>>>>> 2.9.3
>>>>>>
^ permalink raw reply
* Re: [PATCH net] packet: call fanout_release, while UNREGISTERING a netdev
From: Eric Dumazet @ 2017-01-30 19:44 UTC (permalink / raw)
To: Anoob Soman; +Cc: David Miller, netdev
In-Reply-To: <10e9ac4b-585e-2878-0141-f00020a027f0@citrix.com>
On Mon, 2017-01-30 at 19:08 +0000, Anoob Soman wrote:
>
> On 30/01/17 17:26, Eric Dumazet wrote:
> > On Thu, 2016-10-06 at 20:50 -0400, David Miller wrote:
> >> From: Anoob Soman <anoob.soman@citrix.com>
> >> Date: Wed, 5 Oct 2016 15:12:54 +0100
> >>
> >>> If a socket has FANOUT sockopt set, a new proto_hook is registered
> >>> as part of fanout_add(). When processing a NETDEV_UNREGISTER event in
> >>> af_packet, __fanout_unlink is called for all sockets, but prot_hook which was
> >>> registered as part of fanout_add is not removed. Call fanout_release, on a
> >>> NETDEV_UNREGISTER, which removes prot_hook and removes fanout from the
> >>> fanout_list.
> >>>
> >>> This fixes BUG_ON(!list_empty(&dev->ptype_specific)) in netdev_run_todo()
> >>>
> >>> Signed-off-by: Anoob Soman <anoob.soman@citrix.com>
> >> Applied and queued up for -stable, thanks.
> > This commit (6664498280cf "packet: call fanout_release, while
> > UNREGISTERING a netdev")
> > looks buggy :
> >
> > We end up calling fanout_release() while holding a spinlock
> > ( spin_lock(&po->bind_lock); )
> >
> > But fanout_release() grabs a mutex ( mutex_lock(&fanout_mutex) ), and
> > this is absolutely not valid while holding a spinlock.
>
> Yes, that is wrong.
>
> >
> > Anoob, can you cook a fix, I guess you have a way to reproduce the thing
> > that wanted a kernel patch ?
> >
> > (Please build your test kernel with CONFIG_LOCKDEP=y)
>
> Sure, I am planning to move fanout_release(sk) after
> spin_unlock(bind_lock). Something like this.
> }
> if (msg == NETDEV_UNREGISTER) {
> packet_cached_dev_reset(po);
> - fanout_release(sk);
> po->ifindex = -1;
> if (po->prot_hook.dev)
> dev_put(po->prot_hook.dev);
> po->prot_hook.dev = NULL;
> }
> spin_unlock(&po->bind_lock);
> + if (msg == NETDEV_UNREGISTER) {
> + fanout_release(sk);
> + }
> }
> break;
>
> I will quickly test it out.
It wont be enough.
You need to also fix a race if two cpus call fanout_release(sk) at the
same time.
Thanks.
^ permalink raw reply
* Re: [PATCH net-next v3 0/4] net: dsa: bcm_sf2: CFP support
From: David Miller @ 2017-01-30 19:50 UTC (permalink / raw)
To: f.fainelli; +Cc: netdev, andrew, vivien.didelot, cphealy
In-Reply-To: <20170130174843.29497-1-f.fainelli@gmail.com>
From: Florian Fainelli <f.fainelli@gmail.com>
Date: Mon, 30 Jan 2017 09:48:39 -0800
> Changes in v3:
>
> - rebased against latest net-next/master after Vivien's changes
Ok this looks better, series applied, thanks!
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox