* [PATCH net-next v2 3/4] net: dsa: b53: Add support for port mirroring
From: Florian Fainelli @ 2017-01-28 1:25 UTC (permalink / raw)
To: netdev; +Cc: davem, andrew, vivien.didelot, cphealy, Florian Fainelli
In-Reply-To: <20170128012528.30524-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 bb210b12ad1b..052ff4c22667 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -1453,6 +1453,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,
@@ -1477,6 +1542,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 a8031b382c55..28ffe255276f 100644
--- a/drivers/net/dsa/b53/b53_priv.h
+++ b/drivers/net/dsa/b53/b53_priv.h
@@ -408,5 +408,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 v2 2/4] net: dsa: b53: Add mirror capture register definitions
From: Florian Fainelli @ 2017-01-28 1:25 UTC (permalink / raw)
To: netdev; +Cc: davem, andrew, vivien.didelot, cphealy, Florian Fainelli
In-Reply-To: <20170128012528.30524-1-f.fainelli@gmail.com>
Add definitions for the different Roboswitch registers relevant for
ingress and egress mirroring.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/dsa/b53/b53_regs.h | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/drivers/net/dsa/b53/b53_regs.h b/drivers/net/dsa/b53/b53_regs.h
index dac0af4e2cd0..9fd24c418fa4 100644
--- a/drivers/net/dsa/b53/b53_regs.h
+++ b/drivers/net/dsa/b53/b53_regs.h
@@ -206,6 +206,38 @@
#define BRCM_HDR_P8_EN BIT(0) /* Enable tagging on port 8 */
#define BRCM_HDR_P5_EN BIT(1) /* Enable tagging on port 5 */
+/* Mirror capture control register (16 bit) */
+#define B53_MIR_CAP_CTL 0x10
+#define CAP_PORT_MASK 0xf
+#define BLK_NOT_MIR BIT(14)
+#define MIRROR_EN BIT(15)
+
+/* Ingress mirror control register (16 bit) */
+#define B53_IG_MIR_CTL 0x12
+#define MIRROR_MASK 0x1ff
+#define DIV_EN BIT(13)
+#define MIRROR_FILTER_MASK 0x3
+#define MIRROR_FILTER_SHIFT 14
+#define MIRROR_ALL 0
+#define MIRROR_DA 1
+#define MIRROR_SA 2
+
+/* Ingress mirror divider register (16 bit) */
+#define B53_IG_MIR_DIV 0x14
+#define IN_MIRROR_DIV_MASK 0x3ff
+
+/* Ingress mirror MAC address register (48 bit) */
+#define B53_IG_MIR_MAC 0x16
+
+/* Egress mirror control register (16 bit) */
+#define B53_EG_MIR_CTL 0x1C
+
+/* Egress mirror divider register (16 bit) */
+#define B53_EG_MIR_DIV 0x1E
+
+/* Egress mirror MAC address register (48 bit) */
+#define B53_EG_MIR_MAC 0x20
+
/* Device ID register (8 or 32 bit) */
#define B53_DEVICE_ID 0x30
--
2.9.3
^ permalink raw reply related
* [PATCH net-next v2 4/4] net: dsa: bcm_sf2: Add support for port mirroring
From: Florian Fainelli @ 2017-01-28 1:25 UTC (permalink / raw)
To: netdev; +Cc: davem, andrew, vivien.didelot, cphealy, Florian Fainelli
In-Reply-To: <20170128012528.30524-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 8eecfd227e06..3e514d7af218 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -1036,6 +1036,8 @@ static const struct dsa_switch_ops bcm_sf2_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 bcm_sf2_of_data {
--
2.9.3
^ permalink raw reply related
* Re: net: suspicious RCU usage in nf_hook
From: Eric Dumazet @ 2017-01-28 1:31 UTC (permalink / raw)
To: Cong Wang
Cc: Dmitry Vyukov, David Miller, Alexey Kuznetsov, Eric Dumazet,
James Morris, Hideaki YOSHIFUJI, Patrick McHardy, netdev, LKML,
Pablo Neira Ayuso, netfilter-devel, syzkaller
In-Reply-To: <CAM_iQpVvBPhP4q=Egsaoqf8ym-73jLZow8xDMbOq9RhYmL5XAQ@mail.gmail.com>
On Fri, 2017-01-27 at 17:00 -0800, Cong Wang wrote:
> On Fri, Jan 27, 2017 at 3:35 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> > Oh well, I forgot to submit the official patch I think, Jan 9th.
> >
> > https://groups.google.com/forum/#!topic/syzkaller/BhyN5OFd7sQ
> >
>
> Hmm, but why only fragments need skb_orphan()? It seems like
> any kfree_skb() inside a nf hook needs to have a preceding
> skb_orphan().
>
> Also, I am not convinced it is similar to commit 8282f27449bf15548
> which is on RX path.
Well, we clearly see IPv6 reassembly being part of the equation in both
cases.
I was replying to first part of the splat [1], which was already
diagnosed and had a non official patch.
use after free is also a bug, regardless of jump label being used or
not.
I still do not really understand this nf_hook issue, I thought we were
disabling BH in netfilter.
So the in_interrupt() check in net_disable_timestamp() should trigger,
this was the intent of netstamp_needed_deferred existence.
Not sure if we can test for rcu_read_lock() as well.
[1]
sk_destruct+0x47/0x80 net/core/sock.c:1460
__sk_free+0x57/0x230 net/core/sock.c:1468
sock_wfree+0xae/0x120 net/core/sock.c:1645
skb_release_head_state+0xfc/0x200 net/core/skbuff.c:655
skb_release_all+0x15/0x60 net/core/skbuff.c:668
__kfree_skb+0x15/0x20 net/core/skbuff.c:684
kfree_skb+0x16e/0x4c0 net/core/skbuff.c:705
inet_frag_destroy+0x121/0x290 net/ipv4/inet_fragment.c:304
inet_frag_put include/net/inet_frag.h:133 [inline]
nf_ct_frag6_gather+0x1106/0x3840
net/ipv6/netfilter/nf_conntrack_reasm.c:617
ipv6_defrag+0x1be/0x2b0 net/ipv6/netfilter/nf_defrag_ipv6_hooks.c:68
nf_hook_entry_hookfn include/linux/netfilter.h:102 [inline]
nf_hook_slow+0xc3/0x290 net/netfilter/core.c:310
nf_hook include/linux/netfilter.h:212 [inline]
__ip6_local_out+0x489/0x840 net/ipv6/output_core.c:160
ip6_local_out+0x2d/0x170 net/ipv6/output_core.c:170
^ permalink raw reply
* Re: [PATCH net-next 1/2] qed: Add infrastructure for PTP support.
From: kbuild test robot @ 2017-01-28 1:48 UTC (permalink / raw)
To: Sudarsana Kalluru
Cc: kbuild-all, davem, netdev, Yuval.Mintz, Sudarsana Reddy Kalluru
In-Reply-To: <1485531020-8905-2-git-send-email-Sudarsana.Kalluru@cavium.com>
[-- Attachment #1: Type: text/plain, Size: 642 bytes --]
Hi Sudarsana,
[auto build test ERROR on net-next/master]
url: https://github.com/0day-ci/linux/commits/Sudarsana-Kalluru/qed-Add-infrastructure-for-PTP-support/20170127-233853
config: i386-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
>> ERROR: "__divdi3" [drivers/net/ethernet/qlogic/qed/qed.ko] undefined!
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 57922 bytes --]
^ permalink raw reply
* Re: [net-next v2] openvswitch: Simplify do_execute_actions().
From: Pravin Shelar @ 2017-01-28 5:35 UTC (permalink / raw)
To: Andy Zhou; +Cc: David S. Miller, Linux Kernel Network Developers
In-Reply-To: <1485553528-16248-1-git-send-email-azhou@ovn.org>
On Fri, Jan 27, 2017 at 1:45 PM, Andy Zhou <azhou@ovn.org> wrote:
> do_execute_actions() implements a worthwhile optimization: in case
> an output action is the last action in an action list, skb_clone()
> can be avoided by outputing the current skb. However, the
> implementation is more complicated than necessary. This patch
> simplify this logic.
>
> Signed-off-by: Andy Zhou <azhou@ovn.org>
> ---
> v1->v2: drop skb NULL check in do_output()
>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Thanks.
^ permalink raw reply
* Re: [PATCH net-next 1/2] qed: Add infrastructure for PTP support.
From: kbuild test robot @ 2017-01-28 5:37 UTC (permalink / raw)
To: Sudarsana Kalluru
Cc: kbuild-all, davem, netdev, Yuval.Mintz, Sudarsana Reddy Kalluru
In-Reply-To: <1485531020-8905-2-git-send-email-Sudarsana.Kalluru@cavium.com>
[-- Attachment #1: Type: text/plain, Size: 824 bytes --]
Hi Sudarsana,
[auto build test ERROR on net-next/master]
url: https://github.com/0day-ci/linux/commits/Sudarsana-Kalluru/qed-Add-infrastructure-for-PTP-support/20170127-233853
config: i386-randconfig-c0-01281020 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
drivers/built-in.o: In function `qed_ptp_hw_adjfreq':
>> qed_ptp.c:(.text+0x19f3c3): undefined reference to `__divdi3'
qed_ptp.c:(.text+0x19f45a): undefined reference to `__divdi3'
qed_ptp.c:(.text+0x19f498): undefined reference to `__divdi3'
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 34418 bytes --]
^ permalink raw reply
* [PATCH net] mlx4: xdp_prog becomes inactive after ethtool '-L' or '-G'
From: Martin KaFai Lau @ 2017-01-28 7:40 UTC (permalink / raw)
To: netdev; +Cc: Brenden Blanco, Saeed Mahameed, Tariq Toukan, Kernel Team
If the rx-queues ever get re-initialized (e.g. by changing the
number of rx-queues with ethtool -L), the existing xdp_prog becomes
inactive.
The bug is that the xdp_prog ptr has not been carried over from
the old rx-queues to the new rx-queues
Fixes: 47a38e155037 ("net/mlx4_en: add support for fast rx drop bpf program")
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
---
drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 4 +-
drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 52 ++++++++++++++++++++-----
drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 3 +-
3 files changed, 47 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
index d5a9372ed84d..9aa422691954 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
@@ -1099,7 +1099,7 @@ static int mlx4_en_set_ringparam(struct net_device *dev,
memcpy(&new_prof, priv->prof, sizeof(struct mlx4_en_port_profile));
new_prof.tx_ring_size = tx_size;
new_prof.rx_ring_size = rx_size;
- err = mlx4_en_try_alloc_resources(priv, tmp, &new_prof);
+ err = mlx4_en_try_alloc_resources(priv, tmp, &new_prof, true);
if (err)
goto out;
@@ -1774,7 +1774,7 @@ static int mlx4_en_set_channels(struct net_device *dev,
new_prof.tx_ring_num[TX_XDP] = xdp_count;
new_prof.rx_ring_num = channel->rx_count;
- err = mlx4_en_try_alloc_resources(priv, tmp, &new_prof);
+ err = mlx4_en_try_alloc_resources(priv, tmp, &new_prof, true);
if (err)
goto out;
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 761f8b12399c..f4179086b3c6 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -2184,23 +2184,57 @@ static void mlx4_en_update_priv(struct mlx4_en_priv *dst,
int mlx4_en_try_alloc_resources(struct mlx4_en_priv *priv,
struct mlx4_en_priv *tmp,
- struct mlx4_en_port_profile *prof)
+ struct mlx4_en_port_profile *prof,
+ bool carry_xdp_prog)
{
- int t;
+ struct bpf_prog *xdp_prog = NULL;
+ int err;
+ int i;
mlx4_en_copy_priv(tmp, priv, prof);
+ if (carry_xdp_prog) {
+ /* All rx_rings has the same xdp_prog. Pick the first one */
+ xdp_prog = rcu_dereference_protected(
+ priv->rx_ring[0]->xdp_prog,
+ lockdep_is_held(&priv->mdev->state_lock));
+
+ if (xdp_prog) {
+ xdp_prog = bpf_prog_add(xdp_prog, tmp->rx_ring_num);
+ if (IS_ERR(xdp_prog)) {
+ err = PTR_ERR(xdp_prog);
+ xdp_prog = NULL;
+ goto err_free;
+ }
+ }
+ }
+
if (mlx4_en_alloc_resources(tmp)) {
en_warn(priv,
"%s: Resource allocation failed, using previous configuration\n",
__func__);
- for (t = 0; t < MLX4_EN_NUM_TX_TYPES; t++) {
- kfree(tmp->tx_ring[t]);
- kfree(tmp->tx_cq[t]);
- }
- return -ENOMEM;
+ err = -ENOMEM;
+ goto err_free;
+ }
+
+ if (xdp_prog) {
+ for (i = 0; i < tmp->rx_ring_num; i++)
+ rcu_assign_pointer(tmp->rx_ring[i]->xdp_prog,
+ xdp_prog);
}
+
return 0;
+
+err_free:
+ if (xdp_prog)
+ bpf_prog_sub(xdp_prog, tmp->rx_ring_num);
+
+ for (i = 0; i < MLX4_EN_NUM_TX_TYPES; i++) {
+ kfree(tmp->tx_ring[i]);
+ kfree(tmp->tx_cq[i]);
+ }
+
+ return err;
}
void mlx4_en_safe_replace_resources(struct mlx4_en_priv *priv,
@@ -2755,7 +2789,7 @@ static int mlx4_xdp_set(struct net_device *dev, struct bpf_prog *prog)
en_warn(priv, "Reducing the number of TX rings, to not exceed the max total rings number.\n");
}
- err = mlx4_en_try_alloc_resources(priv, tmp, &new_prof);
+ err = mlx4_en_try_alloc_resources(priv, tmp, &new_prof, false);
if (err) {
if (prog)
bpf_prog_sub(prog, priv->rx_ring_num - 1);
@@ -3499,7 +3533,7 @@ int mlx4_en_reset_config(struct net_device *dev,
memcpy(&new_prof, priv->prof, sizeof(struct mlx4_en_port_profile));
memcpy(&new_prof.hwtstamp_config, &ts_config, sizeof(ts_config));
- err = mlx4_en_try_alloc_resources(priv, tmp, &new_prof);
+ err = mlx4_en_try_alloc_resources(priv, tmp, &new_prof, true);
if (err)
goto out;
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
index ba1c6cd0cc79..cec59bc264c9 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
@@ -679,7 +679,8 @@ void mlx4_en_set_stats_bitmap(struct mlx4_dev *dev,
int mlx4_en_try_alloc_resources(struct mlx4_en_priv *priv,
struct mlx4_en_priv *tmp,
- struct mlx4_en_port_profile *prof);
+ struct mlx4_en_port_profile *prof,
+ bool carry_xdp_prog);
void mlx4_en_safe_replace_resources(struct mlx4_en_priv *priv,
struct mlx4_en_priv *tmp);
--
2.5.1
^ permalink raw reply related
* Re: [PATCH net-next v2 1/4] net: dsa: Add plumbing for port mirroring
From: Jiri Pirko @ 2017-01-28 9:14 UTC (permalink / raw)
To: Florian Fainelli; +Cc: netdev, davem, andrew, vivien.didelot, cphealy
In-Reply-To: <20170128012528.30524-2-f.fainelli@gmail.com>
Sat, Jan 28, 2017 at 02:25:25AM CET, f.fainelli@gmail.com wrote:
>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.
>
>Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>---
[...]
>+/*
>+ * Mirroring TC entry
>+ */
>+struct dsa_mall_mirror_tc_entry {
>+ u8 to_local_port;
>+ bool ingress;
>+};
>+
>+/*
>+ * TC matchall entry
>+ */
Why are you using multiline comment format for single line comments?
>+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 net_device *netdev;
> struct device_node *dn;
>@@ -370,6 +397,15 @@ struct dsa_switch_ops {
> int (*port_mdb_dump)(struct dsa_switch *ds, int port,
> struct switchdev_obj_port_mdb *mdb,
> int (*cb)(struct switchdev_obj *obj));
>+
>+ /*
>+ * 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);
> };
[...]
>+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->parent;
>+ 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)) {
>+ netdev_err(dev, "only singular actions are supported\n");
Why you note the user in this case, but in case he tries to add
non-supported action you don't note him?
>+ return err;
>+ }
>+
>+ mall_tc_entry = kzalloc(sizeof(*mall_tc_entry), GFP_KERNEL);
>+ if (!mall_tc_entry)
>+ return -ENOMEM;
>+ mall_tc_entry->cookie = cls->cookie;
Hmm, I believe that this allocation and initialization should go into
the "is_mirred if". You can do the checks in advance. That would also
make the error path simplier.
>+
>+ 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;
>+
>+ mall_tc_entry->type = DSA_PORT_MALL_MIRROR;
>+ mirror = &mall_tc_entry->mirror;
>+
>+ ifindex = tcf_mirred_ifindex(a);
>+ to_dev = __dev_get_by_index(net, ifindex);
>+ if (!to_dev) {
>+ err = -EINVAL;
>+ goto err_add_action;
>+ }
>+
>+ if (!dsa_slave_dev_check(to_dev)) {
>+ err = -EOPNOTSUPP;
>+ goto err_add_action;
>+ }
>+
>+ to_p = netdev_priv(to_dev);
>+
>+ mirror->to_local_port = to_p->port;
>+ mirror->ingress = ingress;
>+
>+ err = ds->ops->port_mirror_add(ds, p->port, mirror, ingress);
>+ }
>+
>+ if (err)
>+ goto err_add_action;
>+
>+ list_add_tail(&mall_tc_entry->list, &p->mall_tc_list);
>+ return 0;
>+
>+err_add_action:
>+ kfree(mall_tc_entry);
>+ return err;
>+}
^ permalink raw reply
* [PATCH 0/4] DCB netlink: Fine-tuning for some function implementations
From: SF Markus Elfring @ 2017-01-28 9:32 UTC (permalink / raw)
To: netdev, David S. Miller, Pan Bian; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 28 Jan 2017 10:28:19 +0100
A few update suggestions were taken into account
from static source code analysis.
Markus Elfring (4):
Use kmalloc_array() in dcbnl_build_peer_app()
Adjust four function calls together with a variable assignment
Adjust five checks for null pointers
Add some spaces for better code readability
net/dcb/dcbnl.c | 36 ++++++++++++++++++++----------------
1 file changed, 20 insertions(+), 16 deletions(-)
--
2.11.0
^ permalink raw reply
* [PATCH 1/4] dcbnl: Use kmalloc_array() in dcbnl_build_peer_app()
From: SF Markus Elfring @ 2017-01-28 9:33 UTC (permalink / raw)
To: netdev, David S. Miller, Pan Bian; +Cc: LKML, kernel-janitors
In-Reply-To: <ab981a3f-e73e-9bef-09c5-9c6d077aef00@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 27 Jan 2017 22:30:09 +0100
* A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".
This issue was detected by using the Coccinelle software.
* Replace the specification of a data structure by a pointer dereference
to make the corresponding size determination a bit safer according to
the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
net/dcb/dcbnl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index 3202d75329b5..76fd727e2eb4 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -990,7 +990,7 @@ static int dcbnl_build_peer_app(struct net_device *netdev, struct sk_buff* skb,
*/
err = ops->peer_getappinfo(netdev, &info, &app_count);
if (!err && app_count) {
- table = kmalloc(sizeof(struct dcb_app) * app_count, GFP_KERNEL);
+ table = kmalloc_array(app_count, sizeof(*table), GFP_KERNEL);
if (!table)
return -ENOMEM;
--
2.11.0
^ permalink raw reply related
* [PATCH 3/4] dcbnl: Adjust five checks for null pointers
From: SF Markus Elfring @ 2017-01-28 9:36 UTC (permalink / raw)
To: netdev, David S. Miller, Pan Bian; +Cc: LKML, kernel-janitors
In-Reply-To: <ab981a3f-e73e-9bef-09c5-9c6d077aef00@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 28 Jan 2017 09:56:36 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The script "checkpatch.pl" pointed information out like the following.
Comparison to NULL could be written !…
Thus fix the affected source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
net/dcb/dcbnl.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index f29e19d962ec..0903081a1212 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -398,7 +398,7 @@ static int dcbnl_setnumtcs(struct net_device *netdev, struct nlmsghdr *nlh,
return ret;
for (i = DCB_NUMTCS_ATTR_ALL+1; i <= DCB_NUMTCS_ATTR_MAX; i++) {
- if (data[i] == NULL)
+ if (!data[i])
continue;
value = nla_get_u8(data[i]);
@@ -741,7 +741,7 @@ static int dcbnl_setpfccfg(struct net_device *netdev, struct nlmsghdr *nlh,
return ret;
for (i = DCB_PFC_UP_ATTR_0; i <= DCB_PFC_UP_ATTR_7; i++) {
- if (data[i] == NULL)
+ if (!data[i])
continue;
value = nla_get_u8(data[i]);
netdev->dcbnl_ops->setpfccfg(netdev,
@@ -955,7 +955,7 @@ static int dcbnl_bcn_setcfg(struct net_device *netdev, struct nlmsghdr *nlh,
return ret;
for (i = DCB_BCN_ATTR_RP_0; i <= DCB_BCN_ATTR_RP_7; i++) {
- if (data[i] == NULL)
+ if (!data[i])
continue;
value_byte = nla_get_u8(data[i]);
netdev->dcbnl_ops->setbcnrp(netdev,
@@ -963,7 +963,7 @@ static int dcbnl_bcn_setcfg(struct net_device *netdev, struct nlmsghdr *nlh,
}
for (i = DCB_BCN_ATTR_BCNA_0; i <= DCB_BCN_ATTR_RI; i++) {
- if (data[i] == NULL)
+ if (!data[i])
continue;
value_int = nla_get_u32(data[i]);
netdev->dcbnl_ops->setbcncfg(netdev,
@@ -1632,7 +1632,7 @@ static int dcbnl_setfeatcfg(struct net_device *netdev, struct nlmsghdr *nlh,
goto err;
for (i = DCB_FEATCFG_ATTR_ALL+1; i <= DCB_FEATCFG_ATTR_MAX; i++) {
- if (data[i] == NULL)
+ if (!data[i])
continue;
value = nla_get_u8(data[i]);
--
2.11.0
^ permalink raw reply related
* [PATCH 4/4] dcbnl: Add some spaces for better code readability
From: SF Markus Elfring @ 2017-01-28 9:37 UTC (permalink / raw)
To: netdev, David S. Miller, Pan Bian; +Cc: LKML, kernel-janitors
In-Reply-To: <ab981a3f-e73e-9bef-09c5-9c6d077aef00@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 28 Jan 2017 10:15:59 +0100
Use space characters at some source code places according to
the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
net/dcb/dcbnl.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index 0903081a1212..0150de92c8ba 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -315,7 +315,7 @@ static int dcbnl_getcap(struct net_device *netdev, struct nlmsghdr *nlh,
if (data[DCB_CAP_ATTR_ALL])
getall = 1;
- for (i = DCB_CAP_ATTR_ALL+1; i <= DCB_CAP_ATTR_MAX; i++) {
+ for (i = DCB_CAP_ATTR_ALL + 1; i <= DCB_CAP_ATTR_MAX; i++) {
if (!getall && !data[i])
continue;
@@ -359,7 +359,7 @@ static int dcbnl_getnumtcs(struct net_device *netdev, struct nlmsghdr *nlh,
if (data[DCB_NUMTCS_ATTR_ALL])
getall = 1;
- for (i = DCB_NUMTCS_ATTR_ALL+1; i <= DCB_NUMTCS_ATTR_MAX; i++) {
+ for (i = DCB_NUMTCS_ATTR_ALL + 1; i <= DCB_NUMTCS_ATTR_MAX; i++) {
if (!getall && !data[i])
continue;
@@ -397,7 +397,7 @@ static int dcbnl_setnumtcs(struct net_device *netdev, struct nlmsghdr *nlh,
if (ret)
return ret;
- for (i = DCB_NUMTCS_ATTR_ALL+1; i <= DCB_NUMTCS_ATTR_MAX; i++) {
+ for (i = DCB_NUMTCS_ATTR_ALL + 1; i <= DCB_NUMTCS_ATTR_MAX; i++) {
if (!data[i])
continue;
@@ -1593,7 +1593,7 @@ static int dcbnl_getfeatcfg(struct net_device *netdev, struct nlmsghdr *nlh,
if (data[DCB_FEATCFG_ATTR_ALL])
getall = 1;
- for (i = DCB_FEATCFG_ATTR_ALL+1; i <= DCB_FEATCFG_ATTR_MAX; i++) {
+ for (i = DCB_FEATCFG_ATTR_ALL + 1; i <= DCB_FEATCFG_ATTR_MAX; i++) {
if (!getall && !data[i])
continue;
@@ -1631,7 +1631,7 @@ static int dcbnl_setfeatcfg(struct net_device *netdev, struct nlmsghdr *nlh,
if (ret)
goto err;
- for (i = DCB_FEATCFG_ATTR_ALL+1; i <= DCB_FEATCFG_ATTR_MAX; i++) {
+ for (i = DCB_FEATCFG_ATTR_ALL + 1; i <= DCB_FEATCFG_ATTR_MAX; i++) {
if (!data[i])
continue;
@@ -1669,7 +1669,7 @@ struct reply_func {
struct nlattr **, struct sk_buff *);
};
-static const struct reply_func reply_funcs[DCB_CMD_MAX+1] = {
+static const struct reply_func reply_funcs[DCB_CMD_MAX + 1] = {
[DCB_CMD_GSTATE] = { RTM_GETDCB, dcbnl_getstate },
[DCB_CMD_SSTATE] = { RTM_SETDCB, dcbnl_setstate },
[DCB_CMD_PFC_GCFG] = { RTM_GETDCB, dcbnl_getpfccfg },
--
2.11.0
^ permalink raw reply related
* [PATCH 2/4] dcbnl: Adjust four function calls together with a variable assignment
From: SF Markus Elfring @ 2017-01-28 9:34 UTC (permalink / raw)
To: netdev, David S. Miller, Pan Bian; +Cc: LKML, kernel-janitors
In-Reply-To: <ab981a3f-e73e-9bef-09c5-9c6d077aef00@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 28 Jan 2017 09:19:58 +0100
The script "checkpatch.pl" pointed information out like the following.
ERROR: do not use assignment in if condition
Thus fix the affected source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
net/dcb/dcbnl.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index 76fd727e2eb4..f29e19d962ec 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -1799,7 +1799,8 @@ u8 dcb_getapp(struct net_device *dev, struct dcb_app *app)
u8 prio = 0;
spin_lock_bh(&dcb_lock);
- if ((itr = dcb_app_lookup(app, dev->ifindex, 0)))
+ itr = dcb_app_lookup(app, dev->ifindex, 0);
+ if (itr)
prio = itr->app.priority;
spin_unlock_bh(&dcb_lock);
@@ -1827,7 +1828,8 @@ int dcb_setapp(struct net_device *dev, struct dcb_app *new)
spin_lock_bh(&dcb_lock);
/* Search for existing match and replace */
- if ((itr = dcb_app_lookup(new, dev->ifindex, 0))) {
+ itr = dcb_app_lookup(new, dev->ifindex, 0);
+ if (itr) {
if (new->priority)
itr->app.priority = new->priority;
else {
@@ -1860,7 +1862,8 @@ u8 dcb_ieee_getapp_mask(struct net_device *dev, struct dcb_app *app)
u8 prio = 0;
spin_lock_bh(&dcb_lock);
- if ((itr = dcb_app_lookup(app, dev->ifindex, 0)))
+ itr = dcb_app_lookup(app, dev->ifindex, 0);
+ if (itr)
prio |= 1 << itr->app.priority;
spin_unlock_bh(&dcb_lock);
@@ -1920,7 +1923,8 @@ int dcb_ieee_delapp(struct net_device *dev, struct dcb_app *del)
spin_lock_bh(&dcb_lock);
/* Search for existing match and remove it. */
- if ((itr = dcb_app_lookup(del, dev->ifindex, del->priority))) {
+ itr = dcb_app_lookup(del, dev->ifindex, del->priority);
+ if (itr) {
list_del(&itr->list);
kfree(itr);
err = 0;
--
2.11.0
^ permalink raw reply related
* [PATCH 0/2] pull request for net-next: batman-adv 2017-01-28
From: Simon Wunderlich @ 2017-01-28 10:56 UTC (permalink / raw)
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r
Hi David,
here is another pull request for batman-adv in net-next. One of them fixes
a regression introduced by a patch in the previous pull request two days ago.
Please pull or let me know of any problem!
Thank you,
Simon
The following changes since commit c33705188c493b7de3b8dc2956d67de91b444727:
batman-adv: Treat NET_XMIT_CN as transmit successfully (2017-01-26 08:41:18 +0100)
are available in the git repository at:
git://git.open-mesh.org/linux-merge.git tags/batadv-next-for-davem-20170128
for you to fetch changes up to 3e7514afc7d728dd47c5fe9d7a1f5216fe659cda:
batman-adv: Fix includes for IS_ERR/ERR_PTR (2017-01-28 10:40:35 +0100)
----------------------------------------------------------------
Here are two fixes for batman-adv for net-next:
- fix double call of dev_queue_xmit(), caused by the recent introduction
of net_xmit_eval(), by Sven Eckelmann
- Fix includes for IS_ERR/ERR_PTR, by Sven Eckelmann
----------------------------------------------------------------
Sven Eckelmann (2):
batman-adv: Fix double call of dev_queue_xmit
batman-adv: Fix includes for IS_ERR/ERR_PTR
net/batman-adv/debugfs.c | 2 +-
net/batman-adv/send.c | 4 +++-
net/batman-adv/tp_meter.c | 2 +-
3 files changed, 5 insertions(+), 3 deletions(-)
^ permalink raw reply
* [PATCH 1/2] batman-adv: Fix double call of dev_queue_xmit
From: Simon Wunderlich @ 2017-01-28 10:56 UTC (permalink / raw)
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r
In-Reply-To: <20170128105651.3061-1-sw-2YrNx6rUIHYiY0qSoAWiAoQuADTiUCJX@public.gmane.org>
From: Sven Eckelmann <sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
The net_xmit_eval has side effects because it is not making sure that e
isn't evaluated twice.
#define net_xmit_eval(e) ((e) == NET_XMIT_CN ? 0 : (e))
The code requested by David Miller [1]
return net_xmit_eval(dev_queue_xmit(skb));
will get transformed into
return ((dev_queue_xmit(skb)) == NET_XMIT_CN ? 0 : (dev_queue_xmit(skb)))
dev_queue_xmit will therefore be tried again (with an already consumed skb)
whenever the return code is not NET_XMIT_CN.
[1] https://lkml.kernel.org/r/20170125.225624.965229145391320056.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org
Fixes: c33705188c49 ("batman-adv: Treat NET_XMIT_CN as transmit successfully")
Signed-off-by: Sven Eckelmann <sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
Signed-off-by: Simon Wunderlich <sw-2YrNx6rUIHYiY0qSoAWiAoQuADTiUCJX@public.gmane.org>
---
net/batman-adv/send.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c
index d9b2889064a6..1489ec27daff 100644
--- a/net/batman-adv/send.c
+++ b/net/batman-adv/send.c
@@ -77,6 +77,7 @@ int batadv_send_skb_packet(struct sk_buff *skb,
{
struct batadv_priv *bat_priv;
struct ethhdr *ethhdr;
+ int ret;
bat_priv = netdev_priv(hard_iface->soft_iface);
@@ -115,7 +116,8 @@ int batadv_send_skb_packet(struct sk_buff *skb,
* congestion and traffic shaping, it drops and returns NET_XMIT_DROP
* (which is > 0). This will not be treated as an error.
*/
- return net_xmit_eval(dev_queue_xmit(skb));
+ ret = dev_queue_xmit(skb);
+ return net_xmit_eval(ret);
send_skb_err:
kfree_skb(skb);
return NET_XMIT_DROP;
--
2.11.0
^ permalink raw reply related
* [PATCH 2/2] batman-adv: Fix includes for IS_ERR/ERR_PTR
From: Simon Wunderlich @ 2017-01-28 10:56 UTC (permalink / raw)
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r
In-Reply-To: <20170128105651.3061-1-sw-2YrNx6rUIHYiY0qSoAWiAoQuADTiUCJX@public.gmane.org>
From: Sven Eckelmann <sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
IS_ERR/ERR_PTR are not defined in linux/device.h but in linux/err.h. The
files using these macros therefore have to include the correct one.
Reported-by: Linus Luessing <linus.luessing-S0/GAf8tV78@public.gmane.org>
Signed-off-by: Sven Eckelmann <sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
Signed-off-by: Simon Wunderlich <sw-2YrNx6rUIHYiY0qSoAWiAoQuADTiUCJX@public.gmane.org>
---
net/batman-adv/debugfs.c | 2 +-
net/batman-adv/tp_meter.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/batman-adv/debugfs.c b/net/batman-adv/debugfs.c
index 5406148b9497..e32ad47c6efd 100644
--- a/net/batman-adv/debugfs.c
+++ b/net/batman-adv/debugfs.c
@@ -19,7 +19,7 @@
#include "main.h"
#include <linux/debugfs.h>
-#include <linux/device.h>
+#include <linux/err.h>
#include <linux/errno.h>
#include <linux/export.h>
#include <linux/fs.h>
diff --git a/net/batman-adv/tp_meter.c b/net/batman-adv/tp_meter.c
index 07f64b60b528..c94ebdecdc3d 100644
--- a/net/batman-adv/tp_meter.c
+++ b/net/batman-adv/tp_meter.c
@@ -23,7 +23,7 @@
#include <linux/byteorder/generic.h>
#include <linux/cache.h>
#include <linux/compiler.h>
-#include <linux/device.h>
+#include <linux/err.h>
#include <linux/etherdevice.h>
#include <linux/fs.h>
#include <linux/if_ether.h>
--
2.11.0
^ permalink raw reply related
* Re: [net 7/8] net/mlx5e: Fix update of hash function/key via ethtool
From: Saeed Mahameed @ 2017-01-28 11:06 UTC (permalink / raw)
To: Tom Herbert
Cc: Saeed Mahameed, David S. Miller, Linux Kernel Network Developers,
Gal Pressman
In-Reply-To: <CALx6S35H0n5MTjzjMJxnRegWBsznqccAohih-GkioifBqZTR5g@mail.gmail.com>
On Fri, Jan 27, 2017 at 11:50 PM, Tom Herbert <tom@herbertland.com> wrote:
> On Fri, Jan 27, 2017 at 12:38 PM, Saeed Mahameed <saeedm@mellanox.com> wrote:
>> From: Gal Pressman <galp@mellanox.com>
>>
>> Modifying TIR hash should change selected fields bitmask in addition to
>> the function and key.
>> Formerly, we would not set this field resulting in zeroing of its value,
>> which means no packet fields are used for RX RSS hash calculation thus
>> causing all traffic to arrive in RQ[0].
>>
> This commit log is rather scant in details. Does this mean that RSS is
> somehow broken in mlx5? What is exact test that demonstrates bad
> behavior? Did you verify that this doesn't break IPv4 or IPv6?
>
before this fix out of the box RSS worked fine for both IPv4/IPv6, the
only broken flow is when the user explicitly uses ethtoo -X to update
the RSS indirection table or hash function.
We did verify both IPv6 and IPv4 RSS worked fine after the user
changes RSS configuration via ethtool -X
^ permalink raw reply
* Re: [iproute PATCH] man: tc-csum.8: Fix example
From: Phil Sutter @ 2017-01-28 11:16 UTC (permalink / raw)
To: Guillaume Nault; +Cc: Stephen Hemminger, netdev
In-Reply-To: <20170127204958.uo5ssloejdirohsj@alphalink.fr>
On Fri, Jan 27, 2017 at 09:49:58PM +0100, Guillaume Nault wrote:
> On Fri, Jan 27, 2017 at 12:15:01PM +0100, Phil Sutter wrote:
> > +# tc filter add dev eth0 prio 1 protocol ip parent ffff: \\
> > u32 match ip src 192.168.1.100/32 flowid :1 \\
> > - action pedit munge ip dst set 0x12345678 pipe \\
> > + action pedit munge ip dst set 1.2.3.4 pipe \\
> >
> Just nitpicking here, but IMHO examples like this should better use IP
> addresses reserved for documentation (192.0.2.0/24, 198.51.100.0/24 or
> 203.0.113.0/24).
Good point! This wasn't on my radar yet and I didn't know there were
IPv4 ranges specifically for that purpose. I guess the reasoning here is
analogous to why one shouldn't use 'example.com' everywhere.
Luckily, 1.2.3.0/24 seems to be reserved by APNIC for testing purposes.
:)
I'll respin using another example address.
Thanks, Phil
^ permalink raw reply
* Re: [PATCH net-next 1/4] mlx5: Make building eswitch configurable
From: Saeed Mahameed @ 2017-01-28 11:20 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: Tom Herbert, Or Gerlitz, Saeed Mahameed, David Miller,
Linux Netdev List, Kernel Team
In-Reply-To: <588BD66E.2050201@fb.com>
On Sat, Jan 28, 2017 at 1:23 AM, Alexei Starovoitov <ast@fb.com> wrote:
> On 1/27/17 1:15 PM, Saeed Mahameed wrote:
>>
>> It is only mandatory for configurations that needs eswitch, where the
>> driver has no way to know about them, for a good old bare metal box,
>> eswitch is not needed.
>>
>> we can do some work to strip the l2 table logic - needed for PFs to
>> work on multi-host - out of eswitch but again that would further
>> complicate the driver code since eswitch will still need to update l2
>> tables for VFs.
>
>
> Saeed,
> for multi-host setups every host in that multi-host doesn't
> actually see the eswitch, no? Otherwise broken driver on one machine
> can affect the other hosts in the same bundle? Please double check,
each host (PF) has its own eswitch, and each eswitch lives in its own
"steering-space"
and it can't affect others.
> since this is absolutely critical HW requirement.
>
The only shared HW resources between hosts (PFs) is the simple l2 table,
and the only thing a host can ask from the l2 talbe (FW) is: "forward
UC MAC to me", and it is the responsibility of the the driver eswitch
to do so.
the l2 table is created and managed by FW, SW eswitch can only request
from FW, and the FW is trusted.
^ permalink raw reply
* Re: [PATCH net-next 0/4] mlx5: Create build configuration options
From: Saeed Mahameed @ 2017-01-28 11:38 UTC (permalink / raw)
To: Tom Herbert
Cc: Saeed Mahameed, David S. Miller, Linux Netdev List, Kernel Team
In-Reply-To: <CALx6S355U1g+OyEM9mC12TRtYZqwOciT=+OpsKXPwkuX-Xq0LQ@mail.gmail.com>
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!
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] cfg80211 debugfs: Cleanup some checkpatch issues
From: Dmitriy Pichugin @ 2017-01-28 11:49 UTC (permalink / raw)
To: Joe Perches; +Cc: johannes, davem, linux-wireless, netdev, linux-kernel
In-Reply-To: <1485546515.12563.138.camel@perches.com>
On Fri, Jan 27, 2017 at 11:48:35AM -0800, Joe Perches wrote:
> On Fri, 2017-01-27 at 22:26 +0300, Pichugin Dmitry wrote:
> > This fixes the checkpatch.pl warnings:
> > * Macros should not use a trailing semicolon.
> > * Spaces required around that '='.
> > * Symbolic permissions 'S_IRUGO' are not preferred.
>
> OK
>
> > * Macro argument reuse 'buflen' - possible side-effects
>
> Not all checkpatch messages need fixing.
> This is one of them.
>
> > diff --git a/net/wireless/debugfs.c b/net/wireless/debugfs.c
> []
> > @@ -17,11 +17,12 @@
> > static ssize_t name## _read(struct file *file, char __user *userbuf, \
> > size_t count, loff_t *ppos) \
> > { \
> > - struct wiphy *wiphy= file->private_data; \
> > - char buf[buflen]; \
> > + struct wiphy *wiphy = file->private_data; \
> > + int __buflen = __builtin_constant_p(buflen) ? buflen : -1; \
> > + char buf[__buflen]; \
>
> That's rather an odd change too
>
OK. I will update the patch.
Best Regards,
Dmitriy.
^ permalink raw reply
* [iproute PATCH v2] man: tc-csum.8: Fix example
From: Phil Sutter @ 2017-01-28 11:59 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
This fixes two issues with the provided example:
- Add missing 'dev' keyword to second command.
- Use a real IPv4 address instead of a bogus hex value since that will
be rejected by get_addr_ipv4().
Fixes: dbfb17a67f9c7 ("man: tc-csum.8: Add an example")
Reported-by: Davide Caratti <dcaratti@redhat.com>
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
Changes since v1:
- Instead of using potentially valid IP addresses, use RFC 5737 ones.
---
man/man8/tc-csum.8 | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/man/man8/tc-csum.8 b/man/man8/tc-csum.8
index 3a64c82f09ba8..68e5610513a51 100644
--- a/man/man8/tc-csum.8
+++ b/man/man8/tc-csum.8
@@ -57,9 +57,9 @@ packets, both IP and UDP checksums have to be recalculated:
.RS
.EX
# tc qdisc add dev eth0 ingress handle ffff:
-# tc filter add eth0 prio 1 protocol ip parent ffff: \\
- u32 match ip src 192.168.1.100/32 flowid :1 \\
- action pedit munge ip dst set 0x12345678 pipe \\
+# tc filter add dev eth0 prio 1 protocol ip parent ffff: \\
+ u32 match ip src 192.0.2.100/32 flowid :1 \\
+ action pedit munge ip dst set 198.51.100.1 pipe \\
csum ip and udp
.EE
.RE
--
2.11.0
^ permalink raw reply related
* [PATCH] net: aquantia: atlantic: use new api ethtool_{get|set}_link_ksettings
From: Philippe Reynes @ 2017-01-28 13:37 UTC (permalink / raw)
To: Alexander.Loktionov, Pavel.Belous, davem, Dmitry.Bezrukov,
vomlehn
Cc: netdev, linux-kernel, Philippe Reynes
The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.
As I don't have the hardware, I'd be very pleased if
someone may test this patch.
Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
---
.../net/ethernet/aquantia/atlantic/aq_ethtool.c | 23 +++++----
drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 49 ++++++++++++-------
drivers/net/ethernet/aquantia/atlantic/aq_nic.h | 6 ++-
3 files changed, 47 insertions(+), 31 deletions(-)
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c b/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
index c5b025e..a761e91 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
@@ -35,24 +35,25 @@ static u32 aq_ethtool_get_link(struct net_device *ndev)
return ethtool_op_get_link(ndev);
}
-static int aq_ethtool_get_settings(struct net_device *ndev,
- struct ethtool_cmd *cmd)
+static int aq_ethtool_get_link_ksettings(struct net_device *ndev,
+ struct ethtool_link_ksettings *cmd)
{
struct aq_nic_s *aq_nic = netdev_priv(ndev);
- aq_nic_get_link_settings(aq_nic, cmd);
- ethtool_cmd_speed_set(cmd, netif_carrier_ok(ndev) ?
- aq_nic_get_link_speed(aq_nic) : 0U);
+ aq_nic_get_link_ksettings(aq_nic, cmd);
+ cmd->base.speed = netif_carrier_ok(ndev) ?
+ aq_nic_get_link_speed(aq_nic) : 0U;
return 0;
}
-static int aq_ethtool_set_settings(struct net_device *ndev,
- struct ethtool_cmd *cmd)
+static int
+aq_ethtool_set_link_ksettings(struct net_device *ndev,
+ const struct ethtool_link_ksettings *cmd)
{
struct aq_nic_s *aq_nic = netdev_priv(ndev);
- return aq_nic_set_link_settings(aq_nic, cmd);
+ return aq_nic_set_link_ksettings(aq_nic, cmd);
}
/* there "5U" is number of queue[#] stats lines (InPackets+...+InErrors) */
@@ -248,8 +249,6 @@ static int aq_ethtool_get_rxnfc(struct net_device *ndev,
.get_link = aq_ethtool_get_link,
.get_regs_len = aq_ethtool_get_regs_len,
.get_regs = aq_ethtool_get_regs,
- .get_settings = aq_ethtool_get_settings,
- .set_settings = aq_ethtool_set_settings,
.get_drvinfo = aq_ethtool_get_drvinfo,
.get_strings = aq_ethtool_get_strings,
.get_rxfh_indir_size = aq_ethtool_get_rss_indir_size,
@@ -257,5 +256,7 @@ static int aq_ethtool_get_rxnfc(struct net_device *ndev,
.get_rxfh = aq_ethtool_get_rss,
.get_rxnfc = aq_ethtool_get_rxnfc,
.get_sset_count = aq_ethtool_get_sset_count,
- .get_ethtool_stats = aq_ethtool_stats
+ .get_ethtool_stats = aq_ethtool_stats,
+ .get_link_ksettings = aq_ethtool_get_link_ksettings,
+ .set_link_ksettings = aq_ethtool_set_link_ksettings,
};
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
index 84bb441..ea86801 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
@@ -734,50 +734,63 @@ void aq_nic_get_stats(struct aq_nic_s *self, u64 *data)
(void)err;
}
-void aq_nic_get_link_settings(struct aq_nic_s *self, struct ethtool_cmd *cmd)
+void aq_nic_get_link_ksettings(struct aq_nic_s *self,
+ struct ethtool_link_ksettings *cmd)
{
- cmd->port = PORT_TP;
- cmd->transceiver = XCVR_EXTERNAL;
+ u32 supported, advertising;
+
+ cmd->base.port = PORT_TP;
/* This driver supports only 10G capable adapters, so DUPLEX_FULL */
- cmd->duplex = DUPLEX_FULL;
- cmd->autoneg = self->aq_nic_cfg.is_autoneg;
+ cmd->base.duplex = DUPLEX_FULL;
+ cmd->base.autoneg = self->aq_nic_cfg.is_autoneg;
+
+ ethtool_convert_link_mode_to_legacy_u32(&supported,
+ cmd->link_modes.supported);
+ ethtool_convert_link_mode_to_legacy_u32(&advertising,
+ cmd->link_modes.advertising);
- cmd->supported |= (self->aq_hw_caps.link_speed_msk & AQ_NIC_RATE_10G) ?
+ supported |= (self->aq_hw_caps.link_speed_msk & AQ_NIC_RATE_10G) ?
ADVERTISED_10000baseT_Full : 0U;
- cmd->supported |= (self->aq_hw_caps.link_speed_msk & AQ_NIC_RATE_1G) ?
+ supported |= (self->aq_hw_caps.link_speed_msk & AQ_NIC_RATE_1G) ?
ADVERTISED_1000baseT_Full : 0U;
- cmd->supported |= (self->aq_hw_caps.link_speed_msk & AQ_NIC_RATE_100M) ?
+ supported |= (self->aq_hw_caps.link_speed_msk & AQ_NIC_RATE_100M) ?
ADVERTISED_100baseT_Full : 0U;
- cmd->supported |= self->aq_hw_caps.flow_control ? SUPPORTED_Pause : 0;
- cmd->supported |= SUPPORTED_Autoneg;
+ supported |= self->aq_hw_caps.flow_control ? SUPPORTED_Pause : 0;
+ supported |= SUPPORTED_Autoneg;
- cmd->advertising = (self->aq_nic_cfg.is_autoneg) ?
+ advertising = (self->aq_nic_cfg.is_autoneg) ?
ADVERTISED_Autoneg : 0U;
- cmd->advertising |=
+ advertising |=
(self->aq_nic_cfg.link_speed_msk & AQ_NIC_RATE_10G) ?
ADVERTISED_10000baseT_Full : 0U;
- cmd->advertising |=
+ advertising |=
(self->aq_nic_cfg.link_speed_msk & AQ_NIC_RATE_1G) ?
ADVERTISED_1000baseT_Full : 0U;
- cmd->advertising |=
+ advertising |=
(self->aq_nic_cfg.link_speed_msk & AQ_NIC_RATE_100M) ?
ADVERTISED_100baseT_Full : 0U;
- cmd->advertising |= (self->aq_nic_cfg.flow_control) ?
+ advertising |= (self->aq_nic_cfg.flow_control) ?
ADVERTISED_Pause : 0U;
+
+ ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported,
+ supported);
+ ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising,
+ advertising);
}
-int aq_nic_set_link_settings(struct aq_nic_s *self, struct ethtool_cmd *cmd)
+int aq_nic_set_link_ksettings(struct aq_nic_s *self,
+ const struct ethtool_link_ksettings *cmd)
{
u32 speed = 0U;
u32 rate = 0U;
int err = 0;
- if (cmd->autoneg == AUTONEG_ENABLE) {
+ if (cmd->base.autoneg == AUTONEG_ENABLE) {
rate = self->aq_hw_caps.link_speed_msk;
self->aq_nic_cfg.is_autoneg = true;
} else {
- speed = ethtool_cmd_speed(cmd);
+ speed = cmd->base.speed;
switch (speed) {
case SPEED_100:
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.h b/drivers/net/ethernet/aquantia/atlantic/aq_nic.h
index 055e2cd..7fc2a5e 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.h
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.h
@@ -99,8 +99,10 @@ void aq_nic_set_tx_ring(struct aq_nic_s *self, unsigned int idx,
int aq_nic_set_packet_filter(struct aq_nic_s *self, unsigned int flags);
int aq_nic_set_multicast_list(struct aq_nic_s *self, struct net_device *ndev);
unsigned int aq_nic_get_link_speed(struct aq_nic_s *self);
-void aq_nic_get_link_settings(struct aq_nic_s *self, struct ethtool_cmd *cmd);
-int aq_nic_set_link_settings(struct aq_nic_s *self, struct ethtool_cmd *cmd);
+void aq_nic_get_link_ksettings(struct aq_nic_s *self,
+ struct ethtool_link_ksettings *cmd);
+int aq_nic_set_link_ksettings(struct aq_nic_s *self,
+ const struct ethtool_link_ksettings *cmd);
struct aq_nic_cfg_s *aq_nic_get_cfg(struct aq_nic_s *self);
u32 aq_nic_get_fw_version(struct aq_nic_s *self);
int aq_nic_change_pm_state(struct aq_nic_s *self, pm_message_t *pm_msg);
--
1.7.4.4
^ permalink raw reply related
* [PATCH v2] cfg80211 debugfs: Cleanup some checkpatch issues
From: Dmitriy Pichugin @ 2017-01-28 14:06 UTC (permalink / raw)
To: johannes, davem; +Cc: linux-wireless, netdev, linux-kernel
This fixes the checkpatch.pl warnings:
* Macros should not use a trailing semicolon.
* Spaces required around that '='.
* Symbolic permissions 'S_IRUGO' are not preferred.
Signed-off-by: Dmitriy Pichugin <smokeman85@gmail.com>
---
net/wireless/debugfs.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/net/wireless/debugfs.c b/net/wireless/debugfs.c
index 5d45391..30fc6eb 100644
--- a/net/wireless/debugfs.c
+++ b/net/wireless/debugfs.c
@@ -17,7 +17,7 @@
static ssize_t name## _read(struct file *file, char __user *userbuf, \
size_t count, loff_t *ppos) \
{ \
- struct wiphy *wiphy= file->private_data; \
+ struct wiphy *wiphy = file->private_data; \
char buf[buflen]; \
int res; \
\
@@ -29,14 +29,14 @@
.read = name## _read, \
.open = simple_open, \
.llseek = generic_file_llseek, \
-};
+}
DEBUGFS_READONLY_FILE(rts_threshold, 20, "%d",
- wiphy->rts_threshold)
+ wiphy->rts_threshold);
DEBUGFS_READONLY_FILE(fragmentation_threshold, 20, "%d",
wiphy->frag_threshold);
DEBUGFS_READONLY_FILE(short_retry_limit, 20, "%d",
- wiphy->retry_short)
+ wiphy->retry_short);
DEBUGFS_READONLY_FILE(long_retry_limit, 20, "%d",
wiphy->retry_long);
@@ -103,7 +103,7 @@ static ssize_t ht40allow_map_read(struct file *file,
};
#define DEBUGFS_ADD(name) \
- debugfs_create_file(#name, S_IRUGO, phyd, &rdev->wiphy, &name## _ops);
+ debugfs_create_file(#name, 0444, phyd, &rdev->wiphy, &name## _ops)
void cfg80211_debugfs_rdev_add(struct cfg80211_registered_device *rdev)
{
--
1.9.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox