* 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
* Re: [PATCH] mac80211: aead api to reduce redundancy
From: Xiang Gao @ 2017-10-08 5:43 UTC (permalink / raw)
To: Johannes Berg; +Cc: David S. Miller, linux-kernel, linux-wireless, netdev
In-Reply-To: <1506945898.25586.3.camel@sipsolutions.net>
Hi Johannes,
Thanks for your time on reviewing this. I will make changes following
your review. See details below.
By the way, I'm still struggling on how to run unit tests. It might
take time for me to make it run on my machine.
2017-10-02 8:04 GMT-04:00 Johannes Berg <johannes@sipsolutions.net>:
> Please use "v2" tag or so in the subject line, having the same patch
> again is really not helpful.
>
> The next should be v3, obviously.
Thanks for your patience to point this out. I will follow your instruction.
>
>> +++ b/net/mac80211/aead_api.c
>> @@ -1,7 +1,4 @@
>> -/*
>> - * Copyright 2014-2015, Qualcomm Atheros, Inc.
>> - *
>> - * This program is free software; you can redistribute it and/or
>> modify
>> +/* This program is free software; you can redistribute it and/or
>> modify
>
> I see no reason to make this change, why remove copyright?
Hmm... good question. The reason is, aes_ccm.c and aes_gcm.c was
almost exact copy of each other. But they have different copyright
information.
The copyright of aes_ccm.c was:
Copyright 2006, Devicescape Software, Inc.
Copyright 2003-2004, Instant802 Networks, Inc.
and the copyright of aes_gcm.c was:
Copyright 2014-2015, Qualcomm Atheros, Inc.
I just don't know how to write the copyright for the new aead_api.c,
so I does not put anything there.
These copyright information are still at aes_ccm.h and aes_gcm.h
What's your opinion on writing these copyright information? Do I write
all of them? like:
Copyright 2014-2015, Qualcomm Atheros, Inc.
Copyright 2006, Devicescape Software, Inc.
Copyright 2003-2004, Instant802 Networks, Inc.
>
>> +++ b/net/mac80211/wpa.c
>> @@ -464,7 +464,8 @@ static int ccmp_encrypt_skb(struct
>> ieee80211_tx_data *tx, struct sk_buff *skb,
>> pos += IEEE80211_CCMP_HDR_LEN;
>> ccmp_special_blocks(skb, pn, b_0, aad);
>> return ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, b_0, aad,
>> pos, len,
>> - skb_put(skb, mic_len),
>> mic_len);
>> + skb_put(skb,
>> + key->u.ccmp.tfm-
>> >authsize));
>> }
>
> I see no reason for the change from mic_len to authsize here?
This was because I was planning to put it to crypto directory, then I
changed it to the same name as in other crypto api. Now that it will
goes to the mac80211, I think it is time to revert this change.
>
>> @@ -540,10 +541,11 @@ ieee80211_crypto_ccmp_decrypt(struct
>> ieee80211_rx_data *rx,
>> ccmp_special_blocks(skb, pn, b_0, aad);
>>
>> if (ieee80211_aes_ccm_decrypt(
>> - key->u.ccmp.tfm, b_0, aad,
>> - skb->data + hdrlen + IEEE80211_CCMP_HDR_LEN,
>> - data_len,
>> - skb->data + skb->len - mic_len, mic_len))
>> + key->u.ccmp.tfm, b_0, aad,
>> + skb->data + hdrlen + IEEE80211_CCMP_HDR_LEN,
>> + data_len,
>> + skb->data + skb->len - key->u.ccmp.tfm->authsize
>> + ))
>> return RX_DROP_UNUSABLE;
>
> That's a really really strange way of writing this ...
>
> Please reformat.
OK, I will reformat it.
>
> johannes
^ permalink raw reply
* Re: [PATCH iproute2] iproute: build more easily on Android
From: Leon Romanovsky @ 2017-10-08 6:47 UTC (permalink / raw)
To: Lorenzo Colitti; +Cc: netdev, stephen, enh
In-Reply-To: <20171002170337.42235-1-lorenzo@google.com>
[-- Attachment #1: Type: text/plain, Size: 1522 bytes --]
On Tue, Oct 03, 2017 at 02:03:37AM +0900, Lorenzo Colitti wrote:
> iproute2 contains a bunch of kernel headers, including uapi ones.
> Android's libc uses uapi headers almost directly, and uses a
> script to fix kernel types that don't match what userspace
> expects.
>
> For example: https://issuetracker.google.com/36987220 reports
> that our struct ip_mreq_source contains "__be32 imr_multiaddr"
> rather than "struct in_addr imr_multiaddr". The script addresses
> this by replacing the uapi struct definition with a #include
> <bits/ip_mreq.h> which contains the traditional userspace
> definition.
>
> Unfortunately, when we compile iproute2, this definition
> conflicts with the one in iproute2's linux/in.h.
>
> Historically we've just solved this problem by running "git rm"
> on all the iproute2 include/linux headers that break Android's
> libc. However, deleting the files in this way makes it harder to
> keep up with upstream, because every upstream change to
> an include file causes a merge conflict with the delete.
>
> This patch fixes the problem by moving the iproute2 linux headers
> from include/linux to include/uapi/linux.
>
> Tested: compiles on ubuntu trusty (glibc)
>
> Signed-off-by: Elliott Hughes <enh@google.com>
> Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
> ---
include/rdma/* files are coming from kernel's uapi too.
BTW, I know that the rdma folder is not relevant for android, but
anyway would like to see the same treatment for that folder as for the
include/linux.
Thanks
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply
* Re: [PATCH 3/3] batman-adv: Add missing kerneldoc for extack
From: Sven Eckelmann @ 2017-10-08 7:29 UTC (permalink / raw)
To: David Miller; +Cc: b.a.t.m.a.n, netdev, dsahern
In-Reply-To: <20171007.205952.775593212999479324.davem@davemloft.net>
[-- Attachment #1: Type: text/plain, Size: 2369 bytes --]
On Samstag, 7. Oktober 2017 20:59:52 CEST David Miller wrote:
> 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?
They are on the b.a.t.m.a.n@lists.open-mesh.org mailing list. And they deal
with the "extack" compat problems of the out-of-tree module build.
Why were you cc'ed for the patch 3:
==================================
David Ahern and David Miller were involved in adding following changes to
batman-adv:
* net: Add extack to ndo_add_slave
* net: Add extack to upper device linking
These were not posted to the batman-adv mailing list.
An automatic kernel-doc run on a build machine noticed a minor problem in the
first patch. Since I was not involved in the original change (and have not
checked what was discussed in the past about it), I could only guess how the
kernel-doc should have looked like. But you, David Ahern or anyone else from
netdev@... could have a different, more educated opinion about the correct
documentation - this is why you were Cc'ed.
Why are you not Cc'ed on the patch 1+2:
======================================
The changes are about code which is not present in the upstream kernel. It
only deals with changes required to build the extracted batman-adv module
against a different kernel. These changes were required to get the "extack"
stuff working on Linux 4.14 and below.
So, it is not really relevant for you but for some people on the
b.a.t.m.a.n@lists.open-mesh.org mailing list. This is why everything
(including the third patch) was send directly ("To:") to the mentioned mailing
list.
Are you expected to apply this change:
=====================================
I was hoping that Simon is picking the patch up and forwards it do you in a
proper pull request. But I would doubt that he has a big problem with you
applying this single line kernel-doc change. At least it is less work for him
and less extra noise on both mailing lists...
But feel free to tell us your preferred solution.
Kind regards,
Sven
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply
* Re: devlink dump of mlxsw_adj table triggers a panic
From: Arkadi Sharshevsky @ 2017-10-08 7:43 UTC (permalink / raw)
To: David Ahern, Jiri Pirko; +Cc: netdev@vger.kernel.org
In-Reply-To: <78e0bce8-e122-ab92-2f48-e9d278f4d2b4@cumulusnetworks.com>
On 10/05/2017 02:57 AM, David Ahern wrote:
> The following devlink command on a 2700 triggers a panic every time.
> Kernel is net-next at 26873308b21654b6e0785b9f9e2c5414d37a4c4c
>
> $ devlink dpipe table dump pci/0000:03:00.0 name mlxsw_adj
> devlink answers: No buffer space available
> <hang>
>
> I have seen several different stack traces and varying amounts of EMAD
> errors on console:
>
> [ 77.453364] mlxsw_spectrum 0000:03:00.0: EMAD reg access failed
> (tid=64c24a400003688,reg_id=200b(sfn),type=query,status=0(operation
> performed))
> [ 77.466568] mlxsw_spectrum 0000:03:00.0: Failed to get FDB notifications
>
> If it does not reproduce for you let me know and I'll grab a trace.
>
> David
>
Thanks, will check it out. How many nexthops groups & overall number of
nexthops you configured?
Thanks,
Arkadi
^ permalink raw reply
* [PATCH v2 1/7] crypto:chelsio: Remove unused parameter
From: Harsh Jain @ 2017-10-08 8:07 UTC (permalink / raw)
To: herbert, linux-crypto, netdev; +Cc: Yeshaswi M R Gowda, Harsh Jain
In-Reply-To: <cover.1507449374.git.harsh@chelsio.com>
From: Yeshaswi M R Gowda <yeshaswi@chelsio.com>
Remove unused parameter sent to latest fw.
Signed-off-by: Harsh Jain <harsh@chelsio.com>
---
drivers/crypto/chelsio/chcr_algo.c | 43 +++++++++++++++-----------------------
drivers/crypto/chelsio/chcr_algo.h | 12 +++++------
2 files changed, 23 insertions(+), 32 deletions(-)
diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c
index 0e81607..bdb1014 100644
--- a/drivers/crypto/chelsio/chcr_algo.c
+++ b/drivers/crypto/chelsio/chcr_algo.c
@@ -577,36 +577,27 @@ static int chcr_cipher_fallback(struct crypto_skcipher *cipher,
static inline void create_wreq(struct chcr_context *ctx,
struct chcr_wr *chcr_req,
void *req, struct sk_buff *skb,
- int kctx_len, int hash_sz,
- int is_iv,
+ int hash_sz,
unsigned int sc_len,
unsigned int lcb)
{
struct uld_ctx *u_ctx = ULD_CTX(ctx);
- int iv_loc = IV_DSGL;
int qid = u_ctx->lldi.rxq_ids[ctx->rx_qidx];
- unsigned int immdatalen = 0, nr_frags = 0;
+ unsigned int immdatalen = 0;
- if (is_ofld_imm(skb)) {
+ if (is_ofld_imm(skb))
immdatalen = skb->data_len;
- iv_loc = IV_IMMEDIATE;
- } else {
- nr_frags = skb_shinfo(skb)->nr_frags;
- }
- chcr_req->wreq.op_to_cctx_size = FILL_WR_OP_CCTX_SIZE(immdatalen,
- ((sizeof(chcr_req->key_ctx) + kctx_len) >> 4));
+ chcr_req->wreq.op_to_cctx_size = FILL_WR_OP_CCTX_SIZE;
chcr_req->wreq.pld_size_hash_size =
- htonl(FW_CRYPTO_LOOKASIDE_WR_PLD_SIZE_V(sgl_lengths[nr_frags]) |
- FW_CRYPTO_LOOKASIDE_WR_HASH_SIZE_V(hash_sz));
+ htonl(FW_CRYPTO_LOOKASIDE_WR_HASH_SIZE_V(hash_sz));
chcr_req->wreq.len16_pkd =
htonl(FW_CRYPTO_LOOKASIDE_WR_LEN16_V(DIV_ROUND_UP(
(calc_tx_flits_ofld(skb) * 8), 16)));
chcr_req->wreq.cookie = cpu_to_be64((uintptr_t)req);
chcr_req->wreq.rx_chid_to_rx_q_id =
FILL_WR_RX_Q_ID(ctx->dev->rx_channel_id, qid,
- is_iv ? iv_loc : IV_NOP, !!lcb,
- ctx->tx_qidx);
+ !!lcb, ctx->tx_qidx);
chcr_req->ulptx.cmd_dest = FILL_ULPTX_CMD_DEST(ctx->dev->tx_channel_id,
qid);
@@ -616,7 +607,7 @@ static inline void create_wreq(struct chcr_context *ctx,
chcr_req->sc_imm.cmd_more = FILL_CMD_MORE(immdatalen);
chcr_req->sc_imm.len = cpu_to_be32(sizeof(struct cpl_tx_sec_pdu) +
sizeof(chcr_req->key_ctx) +
- kctx_len + sc_len + immdatalen);
+ sc_len + immdatalen);
}
/**
@@ -706,8 +697,8 @@ static struct sk_buff *create_cipher_wr(struct cipher_wr_param *wrparam)
write_buffer_to_skb(skb, &frags, reqctx->iv, ivsize);
write_sg_to_skb(skb, &frags, wrparam->srcsg, wrparam->bytes);
atomic_inc(&adap->chcr_stats.cipher_rqst);
- create_wreq(ctx, chcr_req, &(wrparam->req->base), skb, kctx_len, 0, 1,
- sizeof(struct cpl_rx_phys_dsgl) + phys_dsgl,
+ create_wreq(ctx, chcr_req, &(wrparam->req->base), skb, 0,
+ sizeof(struct cpl_rx_phys_dsgl) + phys_dsgl + kctx_len,
ablkctx->ciph_mode == CHCR_SCMD_CIPHER_MODE_AES_CBC);
reqctx->skb = skb;
skb_get(skb);
@@ -1417,8 +1408,8 @@ static struct sk_buff *create_hash_wr(struct ahash_request *req,
if (param->sg_len != 0)
write_sg_to_skb(skb, &frags, req->src, param->sg_len);
atomic_inc(&adap->chcr_stats.digest_rqst);
- create_wreq(ctx, chcr_req, &req->base, skb, kctx_len,
- hash_size_in_response, 0, DUMMY_BYTES, 0);
+ create_wreq(ctx, chcr_req, &req->base, skb, hash_size_in_response,
+ DUMMY_BYTES + kctx_len, 0);
req_ctx->skb = skb;
skb_get(skb);
return skb;
@@ -2080,8 +2071,8 @@ static struct sk_buff *create_authenc_wr(struct aead_request *req,
write_buffer_to_skb(skb, &frags, req->iv, ivsize);
write_sg_to_skb(skb, &frags, src, req->cryptlen);
atomic_inc(&adap->chcr_stats.cipher_rqst);
- create_wreq(ctx, chcr_req, &req->base, skb, kctx_len, size, 1,
- sizeof(struct cpl_rx_phys_dsgl) + dst_size, 0);
+ create_wreq(ctx, chcr_req, &req->base, skb, size,
+ sizeof(struct cpl_rx_phys_dsgl) + dst_size + kctx_len, 0);
reqctx->skb = skb;
skb_get(skb);
@@ -2396,8 +2387,8 @@ static struct sk_buff *create_aead_ccm_wr(struct aead_request *req,
skb_set_transport_header(skb, transhdr_len);
frags = fill_aead_req_fields(skb, req, src, ivsize, aeadctx);
atomic_inc(&adap->chcr_stats.aead_rqst);
- create_wreq(ctx, chcr_req, &req->base, skb, kctx_len, 0, 1,
- sizeof(struct cpl_rx_phys_dsgl) + dst_size, 0);
+ create_wreq(ctx, chcr_req, &req->base, skb, 0,
+ sizeof(struct cpl_rx_phys_dsgl) + dst_size + kctx_len, 0);
reqctx->skb = skb;
skb_get(skb);
return skb;
@@ -2554,8 +2545,8 @@ static struct sk_buff *create_gcm_wr(struct aead_request *req,
write_buffer_to_skb(skb, &frags, reqctx->iv, ivsize);
write_sg_to_skb(skb, &frags, src, req->cryptlen);
atomic_inc(&adap->chcr_stats.aead_rqst);
- create_wreq(ctx, chcr_req, &req->base, skb, kctx_len, size, 1,
- sizeof(struct cpl_rx_phys_dsgl) + dst_size,
+ create_wreq(ctx, chcr_req, &req->base, skb, size,
+ sizeof(struct cpl_rx_phys_dsgl) + dst_size + kctx_len,
reqctx->verify);
reqctx->skb = skb;
skb_get(skb);
diff --git a/drivers/crypto/chelsio/chcr_algo.h b/drivers/crypto/chelsio/chcr_algo.h
index 583008d..54851ec 100644
--- a/drivers/crypto/chelsio/chcr_algo.h
+++ b/drivers/crypto/chelsio/chcr_algo.h
@@ -176,21 +176,21 @@
KEY_CONTEXT_SALT_PRESENT_V(1) | \
KEY_CONTEXT_CTX_LEN_V((ctx_len)))
-#define FILL_WR_OP_CCTX_SIZE(len, ctx_len) \
+#define FILL_WR_OP_CCTX_SIZE \
htonl( \
FW_CRYPTO_LOOKASIDE_WR_OPCODE_V( \
FW_CRYPTO_LOOKASIDE_WR) | \
FW_CRYPTO_LOOKASIDE_WR_COMPL_V(0) | \
- FW_CRYPTO_LOOKASIDE_WR_IMM_LEN_V((len)) | \
- FW_CRYPTO_LOOKASIDE_WR_CCTX_LOC_V(1) | \
- FW_CRYPTO_LOOKASIDE_WR_CCTX_SIZE_V((ctx_len)))
+ FW_CRYPTO_LOOKASIDE_WR_IMM_LEN_V((0)) | \
+ FW_CRYPTO_LOOKASIDE_WR_CCTX_LOC_V(0) | \
+ FW_CRYPTO_LOOKASIDE_WR_CCTX_SIZE_V(0))
-#define FILL_WR_RX_Q_ID(cid, qid, wr_iv, lcb, fid) \
+#define FILL_WR_RX_Q_ID(cid, qid, lcb, fid) \
htonl( \
FW_CRYPTO_LOOKASIDE_WR_RX_CHID_V((cid)) | \
FW_CRYPTO_LOOKASIDE_WR_RX_Q_ID_V((qid)) | \
FW_CRYPTO_LOOKASIDE_WR_LCB_V((lcb)) | \
- FW_CRYPTO_LOOKASIDE_WR_IV_V((wr_iv)) | \
+ FW_CRYPTO_LOOKASIDE_WR_IV_V((IV_NOP)) | \
FW_CRYPTO_LOOKASIDE_WR_FQIDX_V(fid))
#define FILL_ULPTX_CMD_DEST(cid, qid) \
--
2.1.4
^ permalink raw reply related
* [PATCH v2 2/7] crypto:chelsio: Check error code with IS_ERR macro
From: Harsh Jain @ 2017-10-08 8:07 UTC (permalink / raw)
To: herbert, linux-crypto, netdev
Cc: Yeshaswi M R Gowda, Jitendra Lulla, Harsh Jain
In-Reply-To: <cover.1507449374.git.harsh@chelsio.com>
From: Yeshaswi M R Gowda <yeshaswi@chelsio.com>
Check and return proper error code.
Signed-off-by: Jitendra Lulla <jlulla@chelsio.com>
Signed-off-by: Harsh Jain <harsh@chelsio.com>
---
drivers/crypto/chelsio/chcr_algo.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c
index bdb1014..e4bf32d 100644
--- a/drivers/crypto/chelsio/chcr_algo.c
+++ b/drivers/crypto/chelsio/chcr_algo.c
@@ -1455,8 +1455,8 @@ static int chcr_ahash_update(struct ahash_request *req)
req_ctx->result = 0;
req_ctx->data_len += params.sg_len + params.bfr_len;
skb = create_hash_wr(req, ¶ms);
- if (!skb)
- return -ENOMEM;
+ if (IS_ERR(skb))
+ return PTR_ERR(skb);
if (remainder) {
u8 *temp;
@@ -1519,8 +1519,8 @@ static int chcr_ahash_final(struct ahash_request *req)
params.more = 0;
}
skb = create_hash_wr(req, ¶ms);
- if (!skb)
- return -ENOMEM;
+ if (IS_ERR(skb))
+ return PTR_ERR(skb);
skb->dev = u_ctx->lldi.ports[0];
set_wr_txq(skb, CPL_PRIORITY_DATA, ctx->tx_qidx);
@@ -1570,8 +1570,8 @@ static int chcr_ahash_finup(struct ahash_request *req)
}
skb = create_hash_wr(req, ¶ms);
- if (!skb)
- return -ENOMEM;
+ if (IS_ERR(skb))
+ return PTR_ERR(skb);
skb->dev = u_ctx->lldi.ports[0];
set_wr_txq(skb, CPL_PRIORITY_DATA, ctx->tx_qidx);
@@ -1621,8 +1621,8 @@ static int chcr_ahash_digest(struct ahash_request *req)
}
skb = create_hash_wr(req, ¶ms);
- if (!skb)
- return -ENOMEM;
+ if (IS_ERR(skb))
+ return PTR_ERR(skb);
skb->dev = u_ctx->lldi.ports[0];
set_wr_txq(skb, CPL_PRIORITY_DATA, ctx->tx_qidx);
--
2.1.4
^ permalink raw reply related
* [PATCH v2 3/7] crypto:gf128mul: The x8_ble multiplication functions
From: Harsh Jain @ 2017-10-08 8:07 UTC (permalink / raw)
To: herbert, linux-crypto, netdev; +Cc: Harsh Jain
In-Reply-To: <cover.1507449374.git.harsh@chelsio.com>
It multiply GF(2^128) elements in the ble format.
It will be used by chelsio driver to speed up gf multiplication.
Signed-off-by: Harsh Jain <harsh@chelsio.com>
---
crypto/gf128mul.c | 13 +++++++++++++
include/crypto/gf128mul.h | 2 +-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/crypto/gf128mul.c b/crypto/gf128mul.c
index dc01212..24e6019 100644
--- a/crypto/gf128mul.c
+++ b/crypto/gf128mul.c
@@ -156,6 +156,19 @@ static void gf128mul_x8_bbe(be128 *x)
x->b = cpu_to_be64((b << 8) ^ _tt);
}
+void gf128mul_x8_ble(le128 *r, const le128 *x)
+{
+ u64 a = le64_to_cpu(x->a);
+ u64 b = le64_to_cpu(x->b);
+
+ /* equivalent to gf128mul_table_be[b >> 63] (see crypto/gf128mul.c): */
+ u64 _tt = gf128mul_table_be[a >> 56];
+
+ r->a = cpu_to_le64((a << 8) | (b >> 56));
+ r->b = cpu_to_le64((b << 8) ^ _tt);
+}
+EXPORT_SYMBOL(gf128mul_x8_ble);
+
void gf128mul_lle(be128 *r, const be128 *b)
{
be128 p[8];
diff --git a/include/crypto/gf128mul.h b/include/crypto/gf128mul.h
index 0977fb1..fa0a63d 100644
--- a/include/crypto/gf128mul.h
+++ b/include/crypto/gf128mul.h
@@ -227,7 +227,7 @@ struct gf128mul_4k *gf128mul_init_4k_lle(const be128 *g);
struct gf128mul_4k *gf128mul_init_4k_bbe(const be128 *g);
void gf128mul_4k_lle(be128 *a, const struct gf128mul_4k *t);
void gf128mul_4k_bbe(be128 *a, const struct gf128mul_4k *t);
-
+void gf128mul_x8_ble(le128 *r, const le128 *x);
static inline void gf128mul_free_4k(struct gf128mul_4k *t)
{
kzfree(t);
--
2.1.4
^ 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