* Re: [PATCH 3/3] batman-adv: Add missing kerneldoc for extack
From: David Ahern @ 2017-10-07 14:23 UTC (permalink / raw)
To: Sven Eckelmann, b.a.t.m.a.n; +Cc: davem, netdev
In-Reply-To: <20171007122122.6470-1-sven@narfation.org>
On 10/7/17 6:21 AM, Sven Eckelmann wrote:
> The parameter extack was added to batadv_softif_slave_add without adding
> the kernel-doc for it. This caused kernel-doc warnings.
>
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> Cc: David Ahern <dsahern@gmail.com>
> ---
> net/batman-adv/soft-interface.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
> index 543d2c3e..9f673cdf 100644
> --- a/net/batman-adv/soft-interface.c
> +++ b/net/batman-adv/soft-interface.c
> @@ -863,6 +863,7 @@ static int batadv_softif_init_late(struct net_device *dev)
> * batadv_softif_slave_add - Add a slave interface to a batadv_soft_interface
> * @dev: batadv_soft_interface used as master interface
> * @slave_dev: net_device which should become the slave interface
> + * @extack: extended ACK report struct
> *
> * Return: 0 if successful or error otherwise.
> */
>
Thanks for the cleanup.
Acked-by: David Ahern <dsahern@gmail.com>
^ permalink raw reply
* Re: Fw: [Bug 197099] New: Kernel panic in interrupt [l2tp_ppp]
From: Denys Fedoryshchenko @ 2017-10-07 16:38 UTC (permalink / raw)
To: SviMik; +Cc: James Chapman, netdev, Guillaume Nault, netdev-owner
In-Reply-To: <CA++DawbMB8aFa3s-0jW2CC5pRTU2Ui4ec6GSRCkhMotGGj_Ytg@mail.gmail.com>
On 2017-10-07 15:09, SviMik wrote:
>
> Unfortunately, netconsole has managed to send a kernel panic trace
> only once, and it's not related to this bug. Looks like something
> crashes really hard to make netconsole unusable.
In some cases i had luck with pstore, when netconsole failed me
(especially networking bugs), it stores panic messages more reliably,
especially on recent platforms who have ERST and EFI.
https://www.kernel.org/doc/Documentation/ABI/testing/pstore
^ permalink raw reply
* Re: [PATCH 3/3] batman-adv: Add missing kerneldoc for extack
From: David Miller @ 2017-10-07 19:59 UTC (permalink / raw)
To: sven; +Cc: b.a.t.m.a.n, netdev, dsahern
In-Reply-To: <20171007122122.6470-1-sven@narfation.org>
From: Sven Eckelmann <sven@narfation.org>
Date: Sat, 7 Oct 2017 14:21:22 +0200
> The parameter extack was added to batadv_softif_slave_add without adding
> the kernel-doc for it. This caused kernel-doc warnings.
>
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> Cc: David Ahern <dsahern@gmail.com>
I'm happy to apply this but where are the other two patches of this
series and the series header posting?
^ permalink raw reply
* Re: [PATCH net-next 00/16] ipv6: replace rwlock with rcu and spinlock in fib6 table
From: David Miller @ 2017-10-07 20:28 UTC (permalink / raw)
To: hideaki.yoshifuji; +Cc: eric.dumazet, weiwan, netdev, edumazet, kafai, yoshfuji
In-Reply-To: <CAPA1RqBSKi9ra_UBur6L9HHExZzk9BxSrwSKn2xtvAC5K54N+A@mail.gmail.com>
From: 吉藤英明 <hideaki.yoshifuji@miraclelinux.com>
Date: Sat, 7 Oct 2017 18:25:13 +0900
> Hi,
>
> 2017-10-07 8:49 GMT+09:00 Eric Dumazet <eric.dumazet@gmail.com>:
>> On Fri, 2017-10-06 at 12:05 -0700, Wei Wang wrote:
>>> From: Wei Wang <weiwan@google.com>
>>>
>>> Currently, fib6 table is protected by rwlock. During route lookup,
>>> reader lock is taken and during route insertion, deletion or
>>> modification, writer lock is taken. This is a very inefficient
>>> implementation because the fastpath always has to do the operation
>>> to grab the reader lock.
>>> According to my latest syn flood test on an iota ivybridage machine
>>> with 2 10G mlx nics bonded together, each with 8 rx queues on 2 NUMA
>>> nodes, and with the upstream net-next kernel:
>>> ipv4 stack can handle around 4.2Mpps
>>> ipv6 stack can handle around 1.3Mpps
>>>
>>> In order to close the gap of the performance number between ipv4
>>> and ipv6 stack, this patch series tries to get rid of the usage of
>>> the rwlock and replace it with rcu and spinlock protection. This will
>>> greatly speed up the fastpath performance as it only needs to hold
>>> rcu which is much less expensive than grabbing the reader lock. It
>>> also makes ipv6 fib implementation more consistent with ipv4.
...
>> Awesome work Wei.
>>
>> For the whole series :
>>
>> Reviewed-by: Eric Dumazet <edumazet@google.com>
>
> It looks ok to me.
> Reviewed-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
I have some reservations about these changes, fib6_info gets bigger,
etc.
And even with the amazing developers that helped review and
audit these changes already, I can guarantee there are some
bugs in here just like there were bugs in the ipv4 routing
cache removal I did :-)
But those don't block integration, for sure.
So series applied, thanks a lot for doing this!
I think there is some code that doesn't use proper RCU accessors
for rt6i_exception_bucket. For example there are some assignments
of it to NULL that should use RCU_ASSIGN_FOO() or similar. Please
take a lok and fix those up.
Thanks!
^ permalink raw reply
* Re: [PATCH v6 1/1] ip_tunnel: add mpls over gre support
From: David Miller @ 2017-10-07 20:39 UTC (permalink / raw)
To: amine.kherbouche; +Cc: tom, roopa, netdev, equinox
In-Reply-To: <e2d0ce36a2e811df680cad29d1ae283b6ba0f13d.1507129836.git.amine.kherbouche@6wind.com>
From: Amine Kherbouche <amine.kherbouche@6wind.com>
Date: Wed, 4 Oct 2017 19:35:57 +0200
> This commit introduces the MPLSoGRE support (RFC 4023), using ip tunnel
> API by simply adding ipgre_tunnel_encap_(add|del)_mpls_ops() and the new
> tunnel type TUNNEL_ENCAP_MPLS.
>
> Signed-off-by: Amine Kherbouche <amine.kherbouche@6wind.com>
Applied, thanks.
^ permalink raw reply
* Re: [patch net-next 0/6] mlxsw: Offload bridge device mrouter
From: David Miller @ 2017-10-07 20:42 UTC (permalink / raw)
To: jiri
Cc: netdev, yotamg, idosch, nogahf, mlxsw, ivecera, nikolay, andrew,
stephen, nbd, roopa
In-Reply-To: <20171005103642.1414-1-jiri@resnulli.us>
From: Jiri Pirko <jiri@resnulli.us>
Date: Thu, 5 Oct 2017 12:36:36 +0200
> From: Jiri Pirko <jiri@mellanox.com>
>
> Yotam says:
>
> Similarly to a bridged port, the bridge device itself can be configured by
> the user to be an mrouter port. In this case, all multicast traffic should
> be forwarded to it. Make the mlxsw Spectrum driver offload these directives
> to the Spectrum hardware.
>
> Patches 1-3 add a new switchdev notification for bridge device mrouter
> port status and make the bridge module notify about it.
>
> Patches 4-6 change the mlxsw Spectrum driver to handle these notifications
> by adding the Spectrum router port to the bridge MDB entries.
It looks like Nikolay wants some feedback addressed for patch #1.
Thanks.
^ permalink raw reply
* Re: [PATCH net-next v7 0/5] bpf: add two helpers to read perf event enabled/running time
From: David Miller @ 2017-10-07 22:06 UTC (permalink / raw)
To: yhs; +Cc: peterz, rostedt, ast, daniel, netdev, kernel-team
In-Reply-To: <20171005161923.332790-1-yhs@fb.com>
From: Yonghong Song <yhs@fb.com>
Date: Thu, 5 Oct 2017 09:19:18 -0700
> Hardware pmu counters are limited resources. When there are more
> pmu based perf events opened than available counters, kernel will
> multiplex these events so each event gets certain percentage
> (but not 100%) of the pmu time. In case that multiplexing happens,
> the number of samples or counter value will not reflect the
> case compared to no multiplexing. This makes comparison between
> different runs difficult.
>
> Typically, the number of samples or counter value should be
> normalized before comparing to other experiments. The typical
> normalization is done like:
> normalized_num_samples = num_samples * time_enabled / time_running
> normalized_counter_value = counter_value * time_enabled / time_running
> where time_enabled is the time enabled for event and time_running is
> the time running for event since last normalization.
>
> This patch set implements two helper functions.
> The helper bpf_perf_event_read_value reads counter/time_enabled/time_running
> for perf event array map. The helper bpf_perf_prog_read_value read
> counter/time_enabled/time_running for bpf prog with type BPF_PROG_TYPE_PERF_EVENT.
Series applied to net-next, thanks.
^ permalink raw reply
* Re: [PATCH] ipv6: fix net.ipv6.conf.all.accept_dad behaviour for real
From: David Miller @ 2017-10-07 22:11 UTC (permalink / raw)
To: mcroce; +Cc: netdev, ek
In-Reply-To: <20171005170305.30065-1-mcroce@redhat.com>
From: Matteo Croce <mcroce@redhat.com>
Date: Thu, 5 Oct 2017 19:03:05 +0200
> Commit 35e015e1f577 ("ipv6: fix net.ipv6.conf.all interface DAD handlers")
> was intended to affect accept_dad flag handling in such a way that
> DAD operation and mode on a given interface would be selected
> according to the maximum value of conf/{all,interface}/accept_dad.
>
> However, addrconf_dad_begin() checks for particular cases in which we
> need to skip DAD, and this check was modified in the wrong way.
>
> Namely, it was modified so that, if the accept_dad flag is 0 for the
> given interface *or* for all interfaces, DAD would be skipped.
>
> We have instead to skip DAD if accept_dad is 0 for the given interface
> *and* for all interfaces.
>
> Fixes: 35e015e1f577 ("ipv6: fix net.ipv6.conf.all interface DAD handlers")
> Acked-by: Stefano Brivio <sbrivio@redhat.com>
> Signed-off-by: Matteo Croce <mcroce@redhat.com>
Applied.
^ permalink raw reply
* Re: [PATCH v3 1/2] net: phonet: mark header_ops as const
From: David Miller @ 2017-10-07 22:15 UTC (permalink / raw)
To: xiaolou4617; +Cc: courmisch, netdev
In-Reply-To: <1507225049-45910-1-git-send-email-xiaolou4617@gmail.com>
From: Lin Zhang <xiaolou4617@gmail.com>
Date: Fri, 6 Oct 2017 01:37:29 +0800
> Signed-off-by: Lin Zhang <xiaolou4617@gmail.com>
Applied.
^ permalink raw reply
* Re: [PATCH v3 2/2] net: phonet: mark phonet_protocol as const
From: David Miller @ 2017-10-07 22:16 UTC (permalink / raw)
To: xiaolou4617; +Cc: courmisch, netdev
In-Reply-To: <1507225235-46033-1-git-send-email-xiaolou4617@gmail.com>
From: Lin Zhang <xiaolou4617@gmail.com>
Date: Fri, 6 Oct 2017 01:40:35 +0800
> The phonet_protocol structs don't need to be written by anyone and
> so can be marked as const.
>
> Signed-off-by: Lin Zhang <xiaolou4617@gmail.com>
Applied.
^ permalink raw reply
* Re: [net-next,v2] ip_gre: check packet length and mtu correctly in erspan tx
From: David Miller @ 2017-10-07 22:17 UTC (permalink / raw)
To: u9012063; +Cc: netdev, lucien.xin, David.Laight
In-Reply-To: <1507230432-56495-1-git-send-email-u9012063@gmail.com>
From: William Tu <u9012063@gmail.com>
Date: Thu, 5 Oct 2017 12:07:12 -0700
> Similarly to early patch for erspan_xmit(), the ARPHDR_ETHER device
> is the length of the whole ether packet. So skb->len should subtract
> the dev->hard_header_len.
>
> Fixes: 1a66a836da63 ("gre: add collect_md mode to ERSPAN tunnel")
> Fixes: 84e54fe0a5ea ("gre: introduce native tunnel support for ERSPAN")
> Signed-off-by: William Tu <u9012063@gmail.com>
Applied.
^ permalink raw reply
* [PATCH] net: make ->ndo_get_phys_port_name accept 32-bit len
From: Alexey Dobriyan @ 2017-10-07 22:19 UTC (permalink / raw)
To: davem
Cc: netdev, michael.chan, saeedm, simon.horman, jiri, ecree,
vivien.didelot
Buffer length passed into this hook is always IFNAMSIZ which is 16.
Code savings on x86_64:
add/remove: 0/0 grow/shrink: 1/9 up/down: 2/-45 (-43)
function old new delta
rocker_cmd_get_port_settings_phys_name_proc 179 181 +2
rocker_port_get_phys_port_name 62 61 -1
mlxsw_sx_port_get_phys_port_name 54 50 -4
mlx5e_rep_get_phys_port_name 61 57 -4
efx_get_phys_port_name 50 46 -4
dsa_slave_get_phys_port_name 54 50 -4
bnxt_vf_rep_get_phys_port_name 69 65 -4
bnxt_get_phys_port_name 70 65 -5
mlxsw_sp_port_get_phys_port_name 116 107 -9
nfp_port_get_phys_port_name 180 170 -10
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +-
drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 2 +-
drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 2 +-
drivers/net/ethernet/mellanox/mlxsw/switchx2.c | 2 +-
drivers/net/ethernet/netronome/nfp/nfp_port.c | 4 ++--
drivers/net/ethernet/netronome/nfp/nfp_port.h | 3 +--
drivers/net/ethernet/rocker/rocker_main.c | 8 ++++----
drivers/net/ethernet/sfc/efx.c | 2 +-
include/linux/netdevice.h | 4 ++--
net/core/dev.c | 2 +-
net/dsa/slave.c | 2 +-
12 files changed, 17 insertions(+), 18 deletions(-)
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -7619,7 +7619,7 @@ static int bnxt_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh,
}
static int bnxt_get_phys_port_name(struct net_device *dev, char *buf,
- size_t len)
+ unsigned int len)
{
struct bnxt *bp = netdev_priv(dev);
int rc;
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c
@@ -155,7 +155,7 @@ void bnxt_vf_rep_rx(struct bnxt *bp, struct sk_buff *skb)
}
static int bnxt_vf_rep_get_phys_port_name(struct net_device *dev, char *buf,
- size_t len)
+ unsigned int len)
{
struct bnxt_vf_rep *vf_rep = netdev_priv(dev);
struct pci_dev *pf_pdev = vf_rep->bp->pdev;
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -643,7 +643,7 @@ static int mlx5e_rep_close(struct net_device *dev)
}
static int mlx5e_rep_get_phys_port_name(struct net_device *dev,
- char *buf, size_t len)
+ char *buf, unsigned int len)
{
struct mlx5e_priv *priv = netdev_priv(dev);
struct mlx5e_rep_priv *rpriv = priv->ppriv;
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -1498,7 +1498,7 @@ static int mlxsw_sp_port_kill_vid(struct net_device *dev,
}
static int mlxsw_sp_port_get_phys_port_name(struct net_device *dev, char *name,
- size_t len)
+ unsigned int len)
{
struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);
u8 module = mlxsw_sp_port->mapping.module;
--- a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
@@ -414,7 +414,7 @@ mlxsw_sx_port_get_stats64(struct net_device *dev,
}
static int mlxsw_sx_port_get_phys_port_name(struct net_device *dev, char *name,
- size_t len)
+ unsigned int len)
{
struct mlxsw_sx_port *mlxsw_sx_port = netdev_priv(dev);
int err;
--- a/drivers/net/ethernet/netronome/nfp/nfp_port.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_port.c
@@ -139,8 +139,8 @@ struct nfp_eth_table_port *nfp_port_get_eth_port(struct nfp_port *port)
return __nfp_port_get_eth_port(port);
}
-int
-nfp_port_get_phys_port_name(struct net_device *netdev, char *name, size_t len)
+int nfp_port_get_phys_port_name(struct net_device *netdev,
+ char *name, unsigned int len)
{
struct nfp_eth_table_port *eth_port;
struct nfp_port *port;
--- a/drivers/net/ethernet/netronome/nfp/nfp_port.h
+++ b/drivers/net/ethernet/netronome/nfp/nfp_port.h
@@ -127,8 +127,7 @@ nfp_port_from_id(struct nfp_pf *pf, enum nfp_port_type type, unsigned int id);
struct nfp_eth_table_port *__nfp_port_get_eth_port(struct nfp_port *port);
struct nfp_eth_table_port *nfp_port_get_eth_port(struct nfp_port *port);
-int
-nfp_port_get_phys_port_name(struct net_device *netdev, char *name, size_t len);
+int nfp_port_get_phys_port_name(struct net_device *netdev, char *name, unsigned int len);
int nfp_port_configure(struct net_device *netdev, bool configed);
struct nfp_port *
--- a/drivers/net/ethernet/rocker/rocker_main.c
+++ b/drivers/net/ethernet/rocker/rocker_main.c
@@ -1204,7 +1204,7 @@ rocker_cmd_get_port_settings_mode_proc(const struct rocker_port *rocker_port,
struct port_name {
char *buf;
- size_t len;
+ unsigned int len;
};
static int
@@ -1216,7 +1216,7 @@ rocker_cmd_get_port_settings_phys_name_proc(const struct rocker_port *rocker_por
const struct rocker_tlv *attrs[ROCKER_TLV_CMD_MAX + 1];
struct port_name *name = priv;
const struct rocker_tlv *attr;
- size_t i, j, len;
+ unsigned int i, j, len;
const char *str;
rocker_tlv_parse_desc(attrs, ROCKER_TLV_CMD_MAX, desc_info);
@@ -1229,7 +1229,7 @@ rocker_cmd_get_port_settings_phys_name_proc(const struct rocker_port *rocker_por
if (!attr)
return -EIO;
- len = min_t(size_t, rocker_tlv_len(attr), name->len);
+ len = min_t(unsigned int, rocker_tlv_len(attr), name->len);
str = rocker_tlv_data(attr);
/* make sure name only contains alphanumeric characters */
@@ -1986,7 +1986,7 @@ static int rocker_port_change_mtu(struct net_device *dev, int new_mtu)
}
static int rocker_port_get_phys_port_name(struct net_device *dev,
- char *buf, size_t len)
+ char *buf, unsigned int len)
{
struct rocker_port *rocker_port = netdev_priv(dev);
struct port_name name = { .buf = buf, .len = len };
--- a/drivers/net/ethernet/sfc/efx.c
+++ b/drivers/net/ethernet/sfc/efx.c
@@ -2340,7 +2340,7 @@ static int efx_get_phys_port_id(struct net_device *net_dev,
}
static int efx_get_phys_port_name(struct net_device *net_dev,
- char *name, size_t len)
+ char *name, unsigned int len)
{
struct efx_nic *efx = netdev_priv(net_dev);
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1292,7 +1292,7 @@ struct net_device_ops {
int (*ndo_get_phys_port_id)(struct net_device *dev,
struct netdev_phys_item_id *ppid);
int (*ndo_get_phys_port_name)(struct net_device *dev,
- char *name, size_t len);
+ char *name, unsigned int len);
void (*ndo_udp_tunnel_add)(struct net_device *dev,
struct udp_tunnel_info *ti);
void (*ndo_udp_tunnel_del)(struct net_device *dev,
@@ -3299,7 +3299,7 @@ int dev_change_carrier(struct net_device *, bool new_carrier);
int dev_get_phys_port_id(struct net_device *dev,
struct netdev_phys_item_id *ppid);
int dev_get_phys_port_name(struct net_device *dev,
- char *name, size_t len);
+ char *name, unsigned int len);
int dev_change_proto_down(struct net_device *dev, bool proto_down);
struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev);
struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -7031,7 +7031,7 @@ EXPORT_SYMBOL(dev_get_phys_port_id);
* Get device physical port name
*/
int dev_get_phys_port_name(struct net_device *dev,
- char *name, size_t len)
+ char *name, unsigned int len)
{
const struct net_device_ops *ops = dev->netdev_ops;
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -674,7 +674,7 @@ static void dsa_slave_poll_controller(struct net_device *dev)
#endif
static int dsa_slave_get_phys_port_name(struct net_device *dev,
- char *name, size_t len)
+ char *name, unsigned int len)
{
struct dsa_slave_priv *p = netdev_priv(dev);
^ permalink raw reply
* Re: [PATCH] doc: Fix typo "8023.ad" in bonding documentation
From: David Miller @ 2017-10-07 22:19 UTC (permalink / raw)
To: abe; +Cc: netdev, corbet, trivial
In-Reply-To: <20171005200032.GN4665@sym.noone.org>
From: Axel Beckert <abe@deuxchevaux.org>
Date: Thu, 5 Oct 2017 22:00:33 +0200
> Should be "802.3ad" like everywhere else in the document.
>
> Signed-off-by: Axel Beckert <abe@deuxchevaux.org>
Applied.
^ permalink raw reply
* Re: [PATCH net-next 1/1] [net] bonding: Add NUMA notice
From: David Miller @ 2017-10-07 22:20 UTC (permalink / raw)
To: ptalbert; +Cc: netdev
In-Reply-To: <1507235025-21689-1-git-send-email-ptalbert@redhat.com>
From: Patrick Talbert <ptalbert@redhat.com>
Date: Thu, 5 Oct 2017 16:23:45 -0400
> Network performance can suffer when a load balancing bond uses slave
> interfaces which are in different NUMA domains.
>
> This compares the NUMA domain of a newly enslaved interface against any
> existing enslaved interfaces and prints a warning if they do not match.
>
> Signed-off-by: Patrick Talbert <ptalbert@redhat.com>
This is a bit over the top, and doesn't even handle cases where
the device has no specific NUMA node (-1).
^ permalink raw reply
* Re: [patch net-next 0/2] mlxsw: Add more extack error reporting
From: David Miller @ 2017-10-07 22:23 UTC (permalink / raw)
To: jiri; +Cc: netdev, idosch, mlxsw
In-Reply-To: <20171005214000.14022-1-jiri@resnulli.us>
From: Jiri Pirko <jiri@resnulli.us>
Date: Thu, 5 Oct 2017 23:39:58 +0200
> From: Jiri Pirko <jiri@mellanox.com>
>
> Ido says:
>
> Add error messages to VLAN and bridge enslavements to help users
> understand why the enslavement failed.
For some reason patch #2 didn't make it to the list and patchwork,
could you please resend (and add in David Ahern's ACK of course).
^ permalink raw reply
* Re: [PATCH net] bpf: fix liveness marking
From: David Miller @ 2017-10-07 22:29 UTC (permalink / raw)
To: ast; +Cc: daniel, ecree, netdev, kernel-team
In-Reply-To: <20171005232056.2234669-1-ast@fb.com>
From: Alexei Starovoitov <ast@fb.com>
Date: Thu, 5 Oct 2017 16:20:56 -0700
> while processing Rx = Ry instruction the verifier does
> regs[insn->dst_reg] = regs[insn->src_reg]
> which often clears write mark (when Ry doesn't have it)
> that was just set by check_reg_arg(Rx) prior to the assignment.
> That causes mark_reg_read() to keep marking Rx in this block as
> REG_LIVE_READ (since the logic incorrectly misses that it's
> screened by the write) and in many of its parents (until lucky
> write into the same Rx or beginning of the program).
> That causes is_state_visited() logic to miss many pruning opportunities.
>
> Furthermore mark_reg_read() logic propagates the read mark
> for BPF_REG_FP as well (though it's readonly) which causes
> harmless but unnecssary work during is_state_visited().
> Note that do_propagate_liveness() skips FP correctly,
> so do the same in mark_reg_read() as well.
> It saves 0.2 seconds for the test below
>
> program before after
> bpf_lb-DLB_L3.o 2604 2304
> bpf_lb-DLB_L4.o 11159 3723
> bpf_lb-DUNKNOWN.o 1116 1110
> bpf_lxc-DDROP_ALL.o 34566 28004
> bpf_lxc-DUNKNOWN.o 53267 39026
> bpf_netdev.o 17843 16943
> bpf_overlay.o 8672 7929
> time ~11 sec ~4 sec
>
> Fixes: dc503a8ad984 ("bpf/verifier: track liveness for pruning")
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Looks great, applied.
^ permalink raw reply
* Re: [PATCH net-next 0/3] bpf: Misc improvements and a new usage on bpf obj name
From: David Miller @ 2017-10-07 22:29 UTC (permalink / raw)
To: kafai; +Cc: netdev, ast, daniel, kernel-team
In-Reply-To: <20171006045213.752372-1-kafai@fb.com>
From: Martin KaFai Lau <kafai@fb.com>
Date: Thu, 5 Oct 2017 21:52:10 -0700
> The first two patches make improvements on the bpf obj name.
>
> The last patch adds the prog name to kallsyms.
Series applied, thanks Martin.
^ permalink raw reply
* [PATCH net-next 0/6] ipv6: ipv6_dev_get_saddr() rcu works
From: Eric Dumazet @ 2017-10-08 2:30 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet, Hideaki YOSHIFUJI
Sending IPv6 udp packets on non connected sockets is quite slow,
because ipv6_dev_get_saddr() is still using an rwlock and silly
references games on ifa.
Tested:
$ ./super_netperf 16 -H 4444::555:0786 -l 2000 -t UDP_STREAM -- -m 100 &
[1] 12527
Performance is boosted from 2.02 Mpps to 4.28 Mpps
Kernel profile before patches :
22.62% [kernel] [k] _raw_read_lock_bh
7.04% [kernel] [k] refcount_sub_and_test
6.56% [kernel] [k] ipv6_get_saddr_eval
5.67% [kernel] [k] _raw_read_unlock_bh
5.34% [kernel] [k] __ipv6_dev_get_saddr
4.95% [kernel] [k] refcount_inc_not_zero
4.03% [kernel] [k] __ip6addrlbl_match
3.70% [kernel] [k] _raw_spin_lock
3.44% [kernel] [k] ipv6_dev_get_saddr
3.24% [kernel] [k] ip6_pol_route
3.06% [kernel] [k] refcount_add_not_zero
2.30% [kernel] [k] __local_bh_enable_ip
1.81% [kernel] [k] mlx4_en_xmit
1.20% [kernel] [k] __ip6_append_data
1.12% [kernel] [k] __ip6_make_skb
1.11% [kernel] [k] __dev_queue_xmit
1.06% [kernel] [k] l3mdev_master_ifindex_rcu
Kernel profile after patches :
11.36% [kernel] [k] ip6_pol_route
7.65% [kernel] [k] _raw_spin_lock
7.16% [kernel] [k] __ipv6_dev_get_saddr
6.49% [kernel] [k] ipv6_get_saddr_eval
6.04% [kernel] [k] refcount_add_not_zero
3.34% [kernel] [k] __ip6addrlbl_match
2.62% [kernel] [k] __dev_queue_xmit
2.37% [kernel] [k] mlx4_en_xmit
2.26% [kernel] [k] dst_release
1.89% [kernel] [k] __ip6_make_skb
1.87% [kernel] [k] __ip6_append_data
1.86% [kernel] [k] udpv6_sendmsg
1.86% [kernel] [k] ip6t_do_table
1.64% [kernel] [k] ipv6_dev_get_saddr
1.64% [kernel] [k] find_match
1.51% [kernel] [k] l3mdev_master_ifindex_rcu
1.24% [kernel] [k] ipv6_addr_label
Eric Dumazet (6):
ipv6: prepare RCU lookups for idev->addr_list
ipv6: rcu conversion of ipv6_count_addresses()
ipv6: ipv6_chk_custom_prefix() rcu conversion
ipv6: ipv6_chk_prefix() rcu conversion
ipv6: __ipv6_dev_get_saddr() rcu conversion
ipv6: avoid cache line dirtying in ipv6_dev_get_saddr()
net/ipv6/addrconf.c | 70 +++++++++++++++++++----------------------------------
1 file changed, 25 insertions(+), 45 deletions(-)
^ permalink raw reply
* [PATCH net-next 1/6] ipv6: prepare RCU lookups for idev->addr_list
From: Eric Dumazet @ 2017-10-08 2:30 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet, Hideaki YOSHIFUJI
In-Reply-To: <20171008023028.32071-1-edumazet@google.com>
inet6_ifa_finish_destroy() already uses kfree_rcu() to free
inet6_ifaddr structs.
We need to use proper list additions/deletions in order
to allow readers to use RCU instead of idev->lock rwlock.
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
net/ipv6/addrconf.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 9854d93e45bb5ca919d55e6b875f7dc392a5dae5..d1ff0955b709eaa6b5d94bd8d740334eb1eed6d7 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -945,7 +945,7 @@ ipv6_link_dev_addr(struct inet6_dev *idev, struct inet6_ifaddr *ifp)
break;
}
- list_add_tail(&ifp->if_list, p);
+ list_add_tail_rcu(&ifp->if_list, p);
}
static u32 inet6_addr_hash(const struct in6_addr *addr)
@@ -1204,7 +1204,7 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
if (ifp->flags & IFA_F_PERMANENT && !(ifp->flags & IFA_F_NOPREFIXROUTE))
action = check_cleanup_prefix_route(ifp, &expires);
- list_del_init(&ifp->if_list);
+ list_del_rcu(&ifp->if_list);
__in6_ifa_put(ifp);
write_unlock_bh(&ifp->idev->lock);
@@ -3562,7 +3562,6 @@ static int addrconf_ifdown(struct net_device *dev, int how)
struct net *net = dev_net(dev);
struct inet6_dev *idev;
struct inet6_ifaddr *ifa, *tmp;
- struct list_head del_list;
int _keep_addr;
bool keep_addr;
int state, i;
@@ -3654,7 +3653,6 @@ static int addrconf_ifdown(struct net_device *dev, int how)
*/
keep_addr = (!how && _keep_addr > 0 && !idev->cnf.disable_ipv6);
- INIT_LIST_HEAD(&del_list);
list_for_each_entry_safe(ifa, tmp, &idev->addr_list, if_list) {
struct rt6_info *rt = NULL;
bool keep;
@@ -3663,8 +3661,6 @@ static int addrconf_ifdown(struct net_device *dev, int how)
keep = keep_addr && (ifa->flags & IFA_F_PERMANENT) &&
!addr_is_local(&ifa->addr);
- if (!keep)
- list_move(&ifa->if_list, &del_list);
write_unlock_bh(&idev->lock);
spin_lock_bh(&ifa->lock);
@@ -3698,19 +3694,14 @@ static int addrconf_ifdown(struct net_device *dev, int how)
}
write_lock_bh(&idev->lock);
+ if (!keep) {
+ list_del_rcu(&ifa->if_list);
+ in6_ifa_put(ifa);
+ }
}
write_unlock_bh(&idev->lock);
- /* now clean up addresses to be removed */
- while (!list_empty(&del_list)) {
- ifa = list_first_entry(&del_list,
- struct inet6_ifaddr, if_list);
- list_del(&ifa->if_list);
-
- in6_ifa_put(ifa);
- }
-
/* Step 5: Discard anycast and multicast list */
if (how) {
ipv6_ac_destroy_dev(idev);
--
2.14.2.920.gcf0c67979c-goog
^ permalink raw reply related
* [PATCH net-next 2/6] ipv6: ipv6_count_addresses() rcu conversion
From: Eric Dumazet @ 2017-10-08 2:30 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet, Hideaki YOSHIFUJI
In-Reply-To: <20171008023028.32071-1-edumazet@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
net/ipv6/addrconf.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index d1ff0955b709eaa6b5d94bd8d740334eb1eed6d7..2e029c8be1f2e2746e804a47bb5a3eb632adaa5d 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -152,7 +152,7 @@ static void ipv6_regen_rndid(struct inet6_dev *idev);
static void ipv6_try_regen_rndid(struct inet6_dev *idev, struct in6_addr *tmpaddr);
static int ipv6_generate_eui64(u8 *eui, struct net_device *dev);
-static int ipv6_count_addresses(struct inet6_dev *idev);
+static int ipv6_count_addresses(const struct inet6_dev *idev);
static int ipv6_generate_stable_address(struct in6_addr *addr,
u8 dad_count,
const struct inet6_dev *idev);
@@ -1785,15 +1785,15 @@ int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *addr,
return err;
}
-static int ipv6_count_addresses(struct inet6_dev *idev)
+static int ipv6_count_addresses(const struct inet6_dev *idev)
{
+ const struct inet6_ifaddr *ifp;
int cnt = 0;
- struct inet6_ifaddr *ifp;
- read_lock_bh(&idev->lock);
- list_for_each_entry(ifp, &idev->addr_list, if_list)
+ rcu_read_lock();
+ list_for_each_entry_rcu(ifp, &idev->addr_list, if_list)
cnt++;
- read_unlock_bh(&idev->lock);
+ rcu_read_unlock();
return cnt;
}
--
2.14.2.920.gcf0c67979c-goog
^ permalink raw reply related
* [PATCH net-next 3/6] ipv6: ipv6_chk_custom_prefix() rcu conversion
From: Eric Dumazet @ 2017-10-08 2:30 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet, Hideaki YOSHIFUJI
In-Reply-To: <20171008023028.32071-1-edumazet@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
net/ipv6/addrconf.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 2e029c8be1f2e2746e804a47bb5a3eb632adaa5d..33ee84c2512b50e316a0a6ed38a604a382ce5319 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1859,20 +1859,18 @@ static bool ipv6_chk_same_addr(struct net *net, const struct in6_addr *addr,
bool ipv6_chk_custom_prefix(const struct in6_addr *addr,
const unsigned int prefix_len, struct net_device *dev)
{
- struct inet6_dev *idev;
- struct inet6_ifaddr *ifa;
+ const struct inet6_ifaddr *ifa;
+ const struct inet6_dev *idev;
bool ret = false;
rcu_read_lock();
idev = __in6_dev_get(dev);
if (idev) {
- read_lock_bh(&idev->lock);
- list_for_each_entry(ifa, &idev->addr_list, if_list) {
+ list_for_each_entry_rcu(ifa, &idev->addr_list, if_list) {
ret = ipv6_prefix_equal(addr, &ifa->addr, prefix_len);
if (ret)
break;
}
- read_unlock_bh(&idev->lock);
}
rcu_read_unlock();
--
2.14.2.920.gcf0c67979c-goog
^ permalink raw reply related
* [PATCH net-next 4/6] ipv6: ipv6_chk_prefix() rcu conversion
From: Eric Dumazet @ 2017-10-08 2:30 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet, Hideaki YOSHIFUJI
In-Reply-To: <20171008023028.32071-1-edumazet@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
net/ipv6/addrconf.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 33ee84c2512b50e316a0a6ed38a604a382ce5319..ea63442209bf268f1a19b5e014cb8c7e34fd40b4 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1880,22 +1880,20 @@ EXPORT_SYMBOL(ipv6_chk_custom_prefix);
int ipv6_chk_prefix(const struct in6_addr *addr, struct net_device *dev)
{
- struct inet6_dev *idev;
- struct inet6_ifaddr *ifa;
+ const struct inet6_ifaddr *ifa;
+ const struct inet6_dev *idev;
int onlink;
onlink = 0;
rcu_read_lock();
idev = __in6_dev_get(dev);
if (idev) {
- read_lock_bh(&idev->lock);
- list_for_each_entry(ifa, &idev->addr_list, if_list) {
+ list_for_each_entry_rcu(ifa, &idev->addr_list, if_list) {
onlink = ipv6_prefix_equal(addr, &ifa->addr,
ifa->prefix_len);
if (onlink)
break;
}
- read_unlock_bh(&idev->lock);
}
rcu_read_unlock();
return onlink;
--
2.14.2.920.gcf0c67979c-goog
^ permalink raw reply related
* [PATCH net-next 5/6] ipv6: __ipv6_dev_get_saddr() rcu conversion
From: Eric Dumazet @ 2017-10-08 2:30 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet, Hideaki YOSHIFUJI
In-Reply-To: <20171008023028.32071-1-edumazet@google.com>
Callers hold rcu_read_lock(), so we do not need
the rcu_read_lock()/rcu_read_unlock() pair.
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
net/ipv6/addrconf.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index ea63442209bf268f1a19b5e014cb8c7e34fd40b4..20c3ca777529fc49ebf749ca6f7d8c2451258d55 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1558,8 +1558,7 @@ static int __ipv6_dev_get_saddr(struct net *net,
{
struct ipv6_saddr_score *score = &scores[1 - hiscore_idx], *hiscore = &scores[hiscore_idx];
- read_lock_bh(&idev->lock);
- list_for_each_entry(score->ifa, &idev->addr_list, if_list) {
+ list_for_each_entry_rcu(score->ifa, &idev->addr_list, if_list) {
int i;
/*
@@ -1625,7 +1624,6 @@ static int __ipv6_dev_get_saddr(struct net *net,
}
}
out:
- read_unlock_bh(&idev->lock);
return hiscore_idx;
}
--
2.14.2.920.gcf0c67979c-goog
^ permalink raw reply related
* [PATCH net-next 6/6] ipv6: avoid cache line dirtying in ipv6_dev_get_saddr()
From: Eric Dumazet @ 2017-10-08 2:30 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet, Hideaki YOSHIFUJI
In-Reply-To: <20171008023028.32071-1-edumazet@google.com>
By extending the rcu section a bit, we can avoid these
very expensive in6_ifa_put()/in6_ifa_hold() calls
done in __ipv6_dev_get_saddr() and ipv6_dev_get_saddr()
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
net/ipv6/addrconf.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 20c3ca777529fc49ebf749ca6f7d8c2451258d55..cab3faad2bf1354c1241a11ac27178ea675aed55 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1608,11 +1608,6 @@ static int __ipv6_dev_get_saddr(struct net *net,
}
break;
} else if (minihiscore < miniscore) {
- if (hiscore->ifa)
- in6_ifa_put(hiscore->ifa);
-
- in6_ifa_hold(score->ifa);
-
swap(hiscore, score);
hiscore_idx = 1 - hiscore_idx;
@@ -1660,6 +1655,7 @@ int ipv6_dev_get_saddr(struct net *net, const struct net_device *dst_dev,
int dst_type;
bool use_oif_addr = false;
int hiscore_idx = 0;
+ int ret = 0;
dst_type = __ipv6_addr_type(daddr);
dst.addr = daddr;
@@ -1735,15 +1731,14 @@ int ipv6_dev_get_saddr(struct net *net, const struct net_device *dst_dev,
}
out:
- rcu_read_unlock();
-
hiscore = &scores[hiscore_idx];
if (!hiscore->ifa)
- return -EADDRNOTAVAIL;
+ ret = -EADDRNOTAVAIL;
+ else
+ *saddr = hiscore->ifa->addr;
- *saddr = hiscore->ifa->addr;
- in6_ifa_put(hiscore->ifa);
- return 0;
+ rcu_read_unlock();
+ return ret;
}
EXPORT_SYMBOL(ipv6_dev_get_saddr);
--
2.14.2.920.gcf0c67979c-goog
^ permalink raw reply related
* Re: [patch net-next 1/6] net: bridge: Use the MDB_RTR_TYPE_TEMP on bridge device too
From: Yotam Gigi @ 2017-10-08 5:23 UTC (permalink / raw)
To: Nikolay Aleksandrov, Jiri Pirko, netdev
Cc: davem, idosch, nogahf, mlxsw, ivecera, andrew, stephen, nbd,
roopa
In-Reply-To: <b9cfcf9f-bb3a-6649-5b6a-39be0a957550@cumulusnetworks.com>
On 10/05/2017 03:09 PM, Nikolay Aleksandrov wrote:
> On 05/10/17 13:36, Jiri Pirko wrote:
>> From: Yotam Gigi <yotamg@mellanox.com>
>>
>> Every bridge port is in one of four mcast router port states:
>> - MDB_RTR_TYPE_PERM - the port is set by the user to be an mrouter port
>> regardless of IGMP queries.
>> - MDB_RTR_TYPE_DISABLED - the port is set by the user to not be an mrouter
>> port regardless of IGMP queries.
>> - MDB_RTR_TYPE_TEMP - the port is set by the user to be in mcast router
>> learning state, but currently it is not an mrouter port as no IGMP query
>> has been received by it for the last multicast_querier_interval.
>> - MDB_RTR_TYPE_TEMP_QUERY - the port is set by the user to be in mcast
>> router learning state, and currently it is an mrouter port due to an
>> IGMP query that has been received by it during the passed
>> multicast_querier_interval.
> I think you got the last two partially mixed up, MDB_RTR_TYPE_TEMP marks the port as a router
> regardless if there were any igmp queries, while TYPE_TEMP_QUERY means it's in learning
> state. It is the timer (armed vs not) that defines if currently the port is a router
> when one of the TEMP/TEMP_QUERY are set. In the _TEMP case it is always armed as it
> is refreshed by user or igmp queries which was the point of that mode.
> So this means in br_multicast_router() just check for the timer_pending or perm mode.
As much as I tried to make this clear, it seems like I failed :)
The 4 states I described are currently the "bridged port" states, not the
"bridge device" state. A bridged port has these 4 states, all can be set by the
user, while the bridge device only uses 3 of these states. This patch makes the
bridge device use the 4 states too. I thought it makes sense.
The first paragraph describes the current states of a bridged port, and the
second one explains the difference between bridged port and bridge device. I
will (try to) make it clearer if we agree on resending this patch.
Is it clearer now?
>
> In the port code you have the following transitions:
> _TEMP -> TEMP_QUERY (on timer fire or user-set val, port becomes learning only)
> _TEMP -> _TEMP (noop on user refresh or igmp query, timer refreshes)
> _TEMP_QUERY -> _TEMP_QUERY (on igmp query the timer is armed, port becomes router)
>
> you never have _TEMP_QUERY -> _TEMP, which you're using here to denote the timer
> getting armed and the bridge becoming a router.
I am not sure I got this one. I do address that: when an IGMP query is recieved
and the current state is _TEMP_QUERY, I arm the timer and set the state to
_TEMP. I marked that place on the patch, so you can see below.
>
>> The bridge device (brX) itself can also be configured by the user to be
>> either fixed, disabled or learning mrouter port states, but currently there
>> is no distinction between the MDB_RTR_TYPE_TEMP_QUERY and MDB_RTR_TYPE_TEMP
>> in the bridge internal state. Due to that, when an IGMP query is received,
>> it is not straightforward to tell whether it changes the bridge device
>> mrouter port status or not.
> But before this patch the bridge device could not get that set.
>
>> Further patches in this patch-set will introduce notifications upon the
>> bridge device mrouter port state. In order to prevent resending bridge
>> mrouter notification when it is not needed, such distinction is necessary.
>>
> Granted the bridge device hasn't got a way to clearly distinguish the transitions
> without the chance for a race and if using the timer one could get an unnecessary
Is there a race condition?
> notification but that seems like a corner case when the timer fires exactly at the
> same time as the igmp query is received. Can't it be handled by just checking if
> the new state is different in the notification receiver ?
> If it can't and is a problem then I'd prefer to add a new boolean to denote that
> router on/off transition rather than doing this.
>
>> Hence, add the distinction between MDB_RTR_TYPE_TEMP and
>> MDB_RTR_TYPE_TEMP_QUERY states for the bridge device, similarly to any
>> other bridge port.
>>
> This does not add proper MDB_RTR_TYPE_TEMP support for the bridge device
> but seems to abuse it to distinguish the timer state, and changes
> the meaning of MDB_RTR_TYPE_TEMP. Can't you just use the timer instead ?
> I think it will simplify the set and avoid all of this.
>
>> In order to not break the current kernel-user API, don't propagate the new
>> state to the user and use it only in the bridge internal state. Thus, if
>> the user reads (either via sysfs or netlink) the bridge device mrouter
>> state, he will get the MDB_RTR_TYPE_TEMP_QUERY state even if the current
>> bridge state is MDB_RTR_TYPE_TEMP.
>>
>> Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
>> Reviewed-by: Nogah Frankel <nogahf@mellanox.com>
>> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
>> ---
>> net/bridge/br_multicast.c | 25 +++++++++++++++++++++----
>> net/bridge/br_netlink.c | 3 ++-
>> net/bridge/br_private.h | 13 ++++++++++---
>> net/bridge/br_sysfs_br.c | 3 ++-
>> 4 files changed, 35 insertions(+), 9 deletions(-)
>>
>> diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
>> index 8dc5c8d..b86307b 100644
>> --- a/net/bridge/br_multicast.c
>> +++ b/net/bridge/br_multicast.c
>> @@ -861,6 +861,17 @@ static void br_multicast_router_expired(unsigned long data)
>>
>> static void br_multicast_local_router_expired(unsigned long data)
>> {
>> + struct net_bridge *br = (struct net_bridge *) data;
>> +
>> + spin_lock(&br->multicast_lock);
>> + if (br->multicast_router == MDB_RTR_TYPE_DISABLED ||
>> + br->multicast_router == MDB_RTR_TYPE_PERM ||
>> + timer_pending(&br->multicast_router_timer))
>> + goto out;
>> +
>> + br->multicast_router = MDB_RTR_TYPE_TEMP_QUERY;
>> +out:
>> + spin_unlock(&br->multicast_lock);
>> }
>>
>> static void br_multicast_querier_expired(struct net_bridge *br,
>> @@ -1364,9 +1375,12 @@ static void br_multicast_mark_router(struct net_bridge *br,
>> unsigned long now = jiffies;
>>
>> if (!port) {
>> - if (br->multicast_router == MDB_RTR_TYPE_TEMP_QUERY)
>> + if (br->multicast_router == MDB_RTR_TYPE_TEMP_QUERY ||
>> + br->multicast_router == MDB_RTR_TYPE_TEMP) {
>> mod_timer(&br->multicast_router_timer,
>> now + br->multicast_querier_interval);
>> + br->multicast_router = MDB_RTR_TYPE_TEMP;
>> + }
These are the transitions:
_TEMP -> _TEMP_QUERY
_TEMP_QUERY -> _TEMP_QUERY
In both transitions the timer is armed.
>> return;
>> }
>>
>> @@ -1952,7 +1966,7 @@ void br_multicast_init(struct net_bridge *br)
>>
>> spin_lock_init(&br->multicast_lock);
>> setup_timer(&br->multicast_router_timer,
>> - br_multicast_local_router_expired, 0);
>> + br_multicast_local_router_expired, (unsigned long)br);
>> setup_timer(&br->ip4_other_query.timer,
>> br_ip4_multicast_querier_expired, (unsigned long)br);
>> setup_timer(&br->ip4_own_query.timer, br_ip4_multicast_query_expired,
>> @@ -2043,11 +2057,14 @@ int br_multicast_set_router(struct net_bridge *br, unsigned long val)
>> case MDB_RTR_TYPE_DISABLED:
>> case MDB_RTR_TYPE_PERM:
>> del_timer(&br->multicast_router_timer);
>> - /* fall through */
>> - case MDB_RTR_TYPE_TEMP_QUERY:
>> br->multicast_router = val;
>> err = 0;
>> break;
>> + case MDB_RTR_TYPE_TEMP_QUERY:
>> + if (br->multicast_router != MDB_RTR_TYPE_TEMP)
>> + br->multicast_router = val;
>> + err = 0;
>> + break;
>> }
>>
>> spin_unlock_bh(&br->multicast_lock);
>> diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
>> index dea88a2..cee5016 100644
>> --- a/net/bridge/br_netlink.c
>> +++ b/net/bridge/br_netlink.c
>> @@ -1357,7 +1357,8 @@ static int br_fill_info(struct sk_buff *skb, const struct net_device *brdev)
>> return -EMSGSIZE;
>> #endif
>> #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
>> - if (nla_put_u8(skb, IFLA_BR_MCAST_ROUTER, br->multicast_router) ||
>> + if (nla_put_u8(skb, IFLA_BR_MCAST_ROUTER,
>> + br_multicast_router_translate(br->multicast_router)) ||
>> nla_put_u8(skb, IFLA_BR_MCAST_SNOOPING, !br->multicast_disabled) ||
>> nla_put_u8(skb, IFLA_BR_MCAST_QUERY_USE_IFADDR,
>> br->multicast_query_use_ifaddr) ||
>> diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
>> index ab4df24..e6e3fec 100644
>> --- a/net/bridge/br_private.h
>> +++ b/net/bridge/br_private.h
>> @@ -649,9 +649,8 @@ void br_multicast_get_stats(const struct net_bridge *br,
>>
>> static inline bool br_multicast_is_router(struct net_bridge *br)
>> {
>> - return br->multicast_router == 2 ||
>> - (br->multicast_router == 1 &&
>> - timer_pending(&br->multicast_router_timer));
>> + return br->multicast_router == MDB_RTR_TYPE_PERM ||
>> + br->multicast_router == MDB_RTR_TYPE_TEMP;
>> }
>>
>> static inline bool
>> @@ -790,6 +789,14 @@ static inline int br_multicast_igmp_type(const struct sk_buff *skb)
>> }
>> #endif
>>
>> +static inline unsigned char
> u8
>
>> +br_multicast_router_translate(unsigned char multicast_router)
> u8, if need be change the type of the struct member
Sorry, didn't quite get that. Currently, both the bridge_port and bridge have
the multicast_router field, and in both cases it is of type unsigned char. Do
you suggest to change both to be "u8"?
>
>> +{
>> + if (multicast_router == MDB_RTR_TYPE_TEMP)
>> + return MDB_RTR_TYPE_TEMP_QUERY;
>> + return multicast_router;
>> +}
>> +
>> /* br_vlan.c */
>> #ifdef CONFIG_BRIDGE_VLAN_FILTERING
>> bool br_allowed_ingress(const struct net_bridge *br,
>> diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
>> index 723f25e..9b9c597 100644
>> --- a/net/bridge/br_sysfs_br.c
>> +++ b/net/bridge/br_sysfs_br.c
>> @@ -340,7 +340,8 @@ static ssize_t multicast_router_show(struct device *d,
>> struct device_attribute *attr, char *buf)
>> {
>> struct net_bridge *br = to_bridge(d);
>> - return sprintf(buf, "%d\n", br->multicast_router);
>> + return sprintf(buf, "%d\n",
>> + br_multicast_router_translate(br->multicast_router));
>> }
>>
>> static ssize_t multicast_router_store(struct device *d,
>>
^ 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