* Re: Containers and checkpoint/restart micro-conference at LPC2018
From: Amir Goldstein @ 2018-09-08 7:41 UTC (permalink / raw)
To: Stephane Graber
Cc: lxc-devel, lxc-users, containers, LSM List, linux-fsdevel, Netdev,
overlayfs, Miklos Szeredi, Vivek Goyal
In-Reply-To: <20180908045935.GA9201@castiana>
On Sat, Sep 8, 2018 at 8:00 AM Stéphane Graber <stgraber@ubuntu.com> wrote:
>
> On Mon, Aug 13, 2018 at 12:10:15PM -0400, Stéphane Graber wrote:
> > Hello,
> >
> > This year's edition of the Linux Plumbers Conference will once again
> > have a containers micro-conference but this time around we'll have twice
> > the usual amount of time and will include the content that would
> > traditionally go into the checkpoint/restore micro-conference.
> >
> > LPC2018 will be held in Vancouver, Canada from the 13th to the 15th of
> > November, co-located with the Linux Kernel Summit.
> >
> >
> > We're looking for discussion topics around kernel work related to
> > containers and namespacing, resource control, access control,
> > checkpoint/restore of kernel structures, filesystem/mount handling for
> > containers and any related userspace work.
> >
> >
> > The format of the event will mostly be discussions where someone
> > introduces a given topic/problem and it then gets discussed for 20-30min
> > before moving on to something else. There will also be limited room for
> > short demos of recent work with shorter 15min slots.
> >
> >
> > Details can be found here:
> >
> > https://discuss.linuxcontainers.org/t/containers-micro-conference-at-linux-plumbers-2018/2417
> >
> >
> > Looking forward to seeing you in Vancouver!
>
> Hello,
>
> We've added an extra week to the CFP, new deadline is Friday 14th of September.
>
> If you were thinking about sending something bug then forgot or just
> missed the deadline, now is your chance to send it!
>
[cc: overlayfs developers]
Hi Stéphane!
I am not planing to travel to LPC this year, so this is more of an FYI than
a CFP, but maybe another overlayfs developer can pick up this glove??
For the past two years I have participated in the effort to fix overlayfs
"non-standard" behavior:
https://github.com/amir73il/overlayfs/wiki/Overlayfs-non-standard-behavior
Allegedly, this effort went underway to improve the experience of overlayfs
users, who are mostly applications running inside containers. For backward
compatibility reasons, container runtimes will need to opt-in for fixing some
of the legacy behavior.
In reality, I have seen very little cross list interaction between linux-unionfs
and containers mailing lists. The only interaction I recall in the
past two years
ended up in a fix in overlayfs to require opt-in for fixing yet another backward
compatible bad behavior, although docker did follow up shortly after to fix
bad practice in container runtime:
https://github.com/moby/moby/issues/34672
So the questions I would like to relay to the micro-conf participants w.r.t the
new opt-in overlayfs behavior:
1. Did you know?
2. Do you care?
Cheers,
Amir.
^ permalink raw reply
* [PATCH net-next] net: dsa: b53: Uninitialized variable in b53_adjust_link()
From: Dan Carpenter @ 2018-09-08 8:39 UTC (permalink / raw)
To: Florian Fainelli
Cc: Andrew Lunn, Vivien Didelot, David S. Miller, netdev,
kernel-janitors
The "pause" variable is only initialized on BCM5301x.
Fixes: 5e004460f874 ("net: dsa: b53: Add helper to set link parameters")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index ea4256cd628b..dbf5b86a07fe 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -1025,7 +1025,7 @@ static void b53_adjust_link(struct dsa_switch *ds, int port,
struct b53_device *dev = ds->priv;
struct ethtool_eee *p = &dev->ports[port].eee;
u8 rgmii_ctrl = 0, reg = 0, off;
- int pause;
+ int pause = 0;
if (!phy_is_pseudo_fixed_link(phydev))
return;
^ permalink raw reply related
* [PATCH] ieee802154: remove unecessary condition check before debugfs_remove_recursive
From: zhong jiang @ 2018-09-08 13:44 UTC (permalink / raw)
To: davem, alex.aring, michael.hennerich, stefan
Cc: linux-wpan, netdev, linux-kernel
debugfs_remove_recursive has taken IS_ERR_OR_NULL into account. So just
remove the condition check before debugfs_remove_recursive.
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
drivers/net/ieee802154/adf7242.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ieee802154/adf7242.c b/drivers/net/ieee802154/adf7242.c
index 23a52b9..cd1d8fa 100644
--- a/drivers/net/ieee802154/adf7242.c
+++ b/drivers/net/ieee802154/adf7242.c
@@ -1308,8 +1308,7 @@ static int adf7242_remove(struct spi_device *spi)
{
struct adf7242_local *lp = spi_get_drvdata(spi);
- if (!IS_ERR_OR_NULL(lp->debugfs_root))
- debugfs_remove_recursive(lp->debugfs_root);
+ debugfs_remove_recursive(lp->debugfs_root);
cancel_delayed_work_sync(&lp->work);
destroy_workqueue(lp->wqueue);
--
1.7.12.4
^ permalink raw reply related
* [PATCH] xen-netback: remove unecessary condition check before debugfs_remove_recursive
From: zhong jiang @ 2018-09-08 13:53 UTC (permalink / raw)
To: davem, paul.durrant, wei.liu2; +Cc: xen-devel, netdev, linux-kernel
debugfs_remove_recursive has taken IS_ERR_OR_NULL into account. So just
remove the condition check before debugfs_remove_recursive.
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
drivers/net/xen-netback/netback.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index 3621e05..80aae3a 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -1660,8 +1660,7 @@ static int __init netback_init(void)
static void __exit netback_fini(void)
{
#ifdef CONFIG_DEBUG_FS
- if (!IS_ERR_OR_NULL(xen_netback_dbg_root))
- debugfs_remove_recursive(xen_netback_dbg_root);
+ debugfs_remove_recursive(xen_netback_dbg_root);
#endif /* CONFIG_DEBUG_FS */
xenvif_xenbus_fini();
}
--
1.7.12.4
^ permalink raw reply related
* [PATCH net] ipv6: use rt6_info members when dst is set in rt6_fill_node
From: Xin Long @ 2018-09-08 9:24 UTC (permalink / raw)
To: network dev; +Cc: davem, David Ahern, Roopa Prabhu
In inet6_rtm_getroute, since Commit 93531c674315 ("net/ipv6: separate
handling of FIB entries from dst based routes"), it has used rt->from
to dump route info instead of rt.
However for some route like cache, its information is not the same as
that of the 'from' one. It caused 'ip -6 route get' to dump the wrong
route information.
In Jianlin's testing, the output information even lost the expiration
time for a pmtu route cache due to the wrong fib6_flags.
So change to use rt6_info members when it tries to dump a route entry
without fibmatch set.
Note that we will fix the gw/nh dump in another patch.
Fixes: 93531c674315 ("net/ipv6: separate handling of FIB entries from dst based routes")
Reported-by: Jianlin Shi <jishi@redhat.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
net/ipv6/route.c | 39 ++++++++++++++++++++++++++-------------
1 file changed, 26 insertions(+), 13 deletions(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 18e00ce..e554922 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -4670,20 +4670,33 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb,
int iif, int type, u32 portid, u32 seq,
unsigned int flags)
{
- struct rtmsg *rtm;
+ struct rt6key *fib6_prefsrc, *fib6_dst, *fib6_src;
+ struct rt6_info *rt6 = (struct rt6_info *)dst;
+ u32 *pmetrics, table, fib6_flags;
struct nlmsghdr *nlh;
+ struct rtmsg *rtm;
long expires = 0;
- u32 *pmetrics;
- u32 table;
nlh = nlmsg_put(skb, portid, seq, type, sizeof(*rtm), flags);
if (!nlh)
return -EMSGSIZE;
+ if (rt6) {
+ fib6_dst = &rt6->rt6i_dst;
+ fib6_src = &rt6->rt6i_src;
+ fib6_flags = rt6->rt6i_flags;
+ fib6_prefsrc = &rt6->rt6i_prefsrc;
+ } else {
+ fib6_dst = &rt->fib6_dst;
+ fib6_src = &rt->fib6_src;
+ fib6_flags = rt->fib6_flags;
+ fib6_prefsrc = &rt->fib6_prefsrc;
+ }
+
rtm = nlmsg_data(nlh);
rtm->rtm_family = AF_INET6;
- rtm->rtm_dst_len = rt->fib6_dst.plen;
- rtm->rtm_src_len = rt->fib6_src.plen;
+ rtm->rtm_dst_len = fib6_dst->plen;
+ rtm->rtm_src_len = fib6_src->plen;
rtm->rtm_tos = 0;
if (rt->fib6_table)
table = rt->fib6_table->tb6_id;
@@ -4698,7 +4711,7 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb,
rtm->rtm_scope = RT_SCOPE_UNIVERSE;
rtm->rtm_protocol = rt->fib6_protocol;
- if (rt->fib6_flags & RTF_CACHE)
+ if (fib6_flags & RTF_CACHE)
rtm->rtm_flags |= RTM_F_CLONED;
if (dest) {
@@ -4706,7 +4719,7 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb,
goto nla_put_failure;
rtm->rtm_dst_len = 128;
} else if (rtm->rtm_dst_len)
- if (nla_put_in6_addr(skb, RTA_DST, &rt->fib6_dst.addr))
+ if (nla_put_in6_addr(skb, RTA_DST, &fib6_dst->addr))
goto nla_put_failure;
#ifdef CONFIG_IPV6_SUBTREES
if (src) {
@@ -4714,12 +4727,12 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb,
goto nla_put_failure;
rtm->rtm_src_len = 128;
} else if (rtm->rtm_src_len &&
- nla_put_in6_addr(skb, RTA_SRC, &rt->fib6_src.addr))
+ nla_put_in6_addr(skb, RTA_SRC, &fib6_src->addr))
goto nla_put_failure;
#endif
if (iif) {
#ifdef CONFIG_IPV6_MROUTE
- if (ipv6_addr_is_multicast(&rt->fib6_dst.addr)) {
+ if (ipv6_addr_is_multicast(&fib6_dst->addr)) {
int err = ip6mr_get_route(net, skb, rtm, portid);
if (err == 0)
@@ -4737,9 +4750,9 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb,
goto nla_put_failure;
}
- if (rt->fib6_prefsrc.plen) {
+ if (fib6_prefsrc->plen) {
struct in6_addr saddr_buf;
- saddr_buf = rt->fib6_prefsrc.addr;
+ saddr_buf = fib6_prefsrc->addr;
if (nla_put_in6_addr(skb, RTA_PREFSRC, &saddr_buf))
goto nla_put_failure;
}
@@ -4777,7 +4790,7 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb,
goto nla_put_failure;
}
- if (rt->fib6_flags & RTF_EXPIRES) {
+ if (fib6_flags & RTF_EXPIRES) {
expires = dst ? dst->expires : rt->expires;
expires -= jiffies;
}
@@ -4785,7 +4798,7 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb,
if (rtnl_put_cacheinfo(skb, dst, 0, expires, dst ? dst->error : 0) < 0)
goto nla_put_failure;
- if (nla_put_u8(skb, RTA_PREF, IPV6_EXTRACT_PREF(rt->fib6_flags)))
+ if (nla_put_u8(skb, RTA_PREF, IPV6_EXTRACT_PREF(fib6_flags)))
goto nla_put_failure;
--
2.1.0
^ permalink raw reply related
* [PATCH] wireless: remove unnecessary condition check before kfree
From: zhong jiang @ 2018-09-08 14:12 UTC (permalink / raw)
To: davem, johannes; +Cc: linux-wireless, netdev, linux-kernel
kfree has taken the null pointer into account. Just remove the
redundant condition check before kfree.
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
net/wireless/reg.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 5ad5b9f..dc87e3d 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1086,7 +1086,7 @@ int reg_reload_regdb(void)
}
rtnl_lock();
- if (!IS_ERR_OR_NULL(regdb))
+ if (!IS_ERR(regdb))
kfree(regdb);
regdb = db;
rtnl_unlock();
@@ -3920,7 +3920,7 @@ void regulatory_exit(void)
kfree(reg_request);
}
- if (!IS_ERR_OR_NULL(regdb))
+ if (!IS_ERR(regdb))
kfree(regdb);
free_regdb_keyring();
--
1.7.12.4
^ permalink raw reply related
* [PATCH 04/11] compat_ioctl: remove isdn ioctl translation
From: Arnd Bergmann @ 2018-09-08 14:28 UTC (permalink / raw)
To: viro
Cc: Arnd Bergmann, Karsten Keil, Paul Bolle, netdev, linux-kernel,
gigaset307x-common, linux-fsdevel
In-Reply-To: <20180908142837.2819693-1-arnd@arndb.de>
Neither the old isdn4linux interface nor the newer mISDN stack
ever had working 32-bit compat mode as far as I can tell.
However, the CAPI stack and the Gigaset ISDN driver (implemented
on top of either CAPI or i4l) have some ioctl commands that are
correctly listed in fs/compat_ioctl.c.
We can trivially move all of those into the two corresponding
files that implement the native handlers by adding a compat_ioctl
redirect to that.
I did notice that treating CAPI_MANUFACTURER_CMD() as compatible
is broken, so I'm also adding a handler for that, realizing that
in all likelyhood, nobody is ever going to call it.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/isdn/capi/capi.c | 31 +++++++++++++++++++++++++++++++
drivers/isdn/gigaset/interface.c | 10 ++++++++++
fs/compat_ioctl.c | 22 ----------------------
3 files changed, 41 insertions(+), 22 deletions(-)
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
index ef5560b848ab..4851dc3941eb 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -942,6 +942,34 @@ capi_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
return ret;
}
+#ifdef CONFIG_COMPAT
+static long
+capi_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+{
+ int ret;
+
+ if (cmd == CAPI_MANUFACTURER_CMD) {
+ struct {
+ unsigned long cmd;
+ compat_uptr_t data;
+ } mcmd32;
+
+ if (!capable(CAP_SYS_ADMIN))
+ return -EPERM;
+ if (copy_from_user(&mcmd32, compat_ptr(arg), sizeof(mcmd32)))
+ return -EFAULT;
+
+ mutex_lock(&capi_mutex);
+ ret = capi20_manufacturer(mcmd32.cmd, compat_ptr(mcmd32.data));
+ mutex_unlock(&capi_mutex);
+
+ return ret;
+ }
+
+ return capi_unlocked_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
+}
+#endif
+
static int capi_open(struct inode *inode, struct file *file)
{
struct capidev *cdev;
@@ -988,6 +1016,9 @@ static const struct file_operations capi_fops =
.write = capi_write,
.poll = capi_poll,
.unlocked_ioctl = capi_unlocked_ioctl,
+#ifdef CONFIG_COMPAT
+ .compat_ioctl = capi_compat_ioctl,
+#endif
.open = capi_open,
.release = capi_release,
};
diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c
index 600c79b030cd..faae8ae54802 100644
--- a/drivers/isdn/gigaset/interface.c
+++ b/drivers/isdn/gigaset/interface.c
@@ -233,6 +233,13 @@ static int if_ioctl(struct tty_struct *tty,
return retval;
}
+#ifdef CONFIG_COMPAT
+static long if_compat_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
+{
+ return if_ioctl(tty, cmd, (unsigned long)compat_ptr(arg));
+}
+#endif
+
static int if_tiocmget(struct tty_struct *tty)
{
struct cardstate *cs = tty->driver_data;
@@ -472,6 +479,9 @@ static const struct tty_operations if_ops = {
.open = if_open,
.close = if_close,
.ioctl = if_ioctl,
+#ifdef CONFIG_COMPAT
+ .compat_ioctl = if_compat_ioctl,
+#endif
.write = if_write,
.write_room = if_write_room,
.chars_in_buffer = if_chars_in_buffer,
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 875516658c39..7d8c5722fd0a 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -61,9 +61,6 @@
#include <net/bluetooth/hci_sock.h>
#include <net/bluetooth/rfcomm.h>
-#include <linux/capi.h>
-#include <linux/gigaset_dev.h>
-
#ifdef CONFIG_BLOCK
#include <linux/cdrom.h>
#include <linux/fd.h>
@@ -670,25 +667,6 @@ COMPATIBLE_IOCTL(HIDPCONNADD)
COMPATIBLE_IOCTL(HIDPCONNDEL)
COMPATIBLE_IOCTL(HIDPGETCONNLIST)
COMPATIBLE_IOCTL(HIDPGETCONNINFO)
-/* CAPI */
-COMPATIBLE_IOCTL(CAPI_REGISTER)
-COMPATIBLE_IOCTL(CAPI_GET_MANUFACTURER)
-COMPATIBLE_IOCTL(CAPI_GET_VERSION)
-COMPATIBLE_IOCTL(CAPI_GET_SERIAL)
-COMPATIBLE_IOCTL(CAPI_GET_PROFILE)
-COMPATIBLE_IOCTL(CAPI_MANUFACTURER_CMD)
-COMPATIBLE_IOCTL(CAPI_GET_ERRCODE)
-COMPATIBLE_IOCTL(CAPI_INSTALLED)
-COMPATIBLE_IOCTL(CAPI_GET_FLAGS)
-COMPATIBLE_IOCTL(CAPI_SET_FLAGS)
-COMPATIBLE_IOCTL(CAPI_CLR_FLAGS)
-COMPATIBLE_IOCTL(CAPI_NCCI_OPENCOUNT)
-COMPATIBLE_IOCTL(CAPI_NCCI_GETUNIT)
-/* Siemens Gigaset */
-COMPATIBLE_IOCTL(GIGASET_REDIR)
-COMPATIBLE_IOCTL(GIGASET_CONFIG)
-COMPATIBLE_IOCTL(GIGASET_BRKCHARS)
-COMPATIBLE_IOCTL(GIGASET_VERSION)
/* Misc. */
COMPATIBLE_IOCTL(0x41545900) /* ATYIO_CLKR */
COMPATIBLE_IOCTL(0x41545901) /* ATYIO_CLKW */
--
2.18.0
^ permalink raw reply related
* Re: [PATCH] ethernet: hnae: add unlikely() to assert()
From: Igor Stoppa @ 2018-09-08 15:00 UTC (permalink / raw)
To: David Miller
Cc: huangdaode, igor.stoppa, yisen.zhuang, salil.mehta, netdev,
linux-kernel
In-Reply-To: <20180907.144659.284526279757617907.davem@davemloft.net>
On 08/09/18 00:46, David Miller wrote:
> From: Igor Stoppa <igor.stoppa@gmail.com>
> Date: Fri, 7 Sep 2018 20:26:50 +0300
>
>> The assert() condition is likely to be true.
>
> Worse than that is that drivers should not be definiting their own
> private "assert()" macro.
>
> I'd rather have that fixed instead. We have tons of standard kernel
> facilities that do what they are trying to do here, without overloading
> the standard C namespace in this way.
I've converted into WARN() what passed the compile test.
In one case it didn't even compile :-(
I could only compile-test.
--
igor
^ permalink raw reply
* [PATCH net] powerpc: use big endian to hash len and proto in csum_ipv6_magic
From: Xin Long @ 2018-09-08 10:15 UTC (permalink / raw)
To: network dev, linuxppc-dev
Cc: Christophe Leroy, Michael Ellerman, Roopa Prabhu
The function csum_ipv6_magic doesn't convert len and proto to big
endian before doing ipv6 csum hash, which is not consistent with
RFC and other arches.
Jianlin found it when ICMPv6 packets from other hosts were dropped
in the powerpc64 system.
This patch is to fix it by using instruction 'lwbrx' to do this
conversion in powerpc32/64 csum_ipv6_magic.
Fixes: e9c4943a107b ("powerpc: Implement csum_ipv6_magic in assembly")
Reported-by: Jianlin Shi <jishi@redhat.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
arch/powerpc/lib/checksum_32.S | 4 ++++
arch/powerpc/lib/checksum_64.S | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/arch/powerpc/lib/checksum_32.S b/arch/powerpc/lib/checksum_32.S
index aa22406..7d3446e 100644
--- a/arch/powerpc/lib/checksum_32.S
+++ b/arch/powerpc/lib/checksum_32.S
@@ -325,6 +325,10 @@ _GLOBAL(csum_ipv6_magic)
adde r0, r0, r9
lwz r11, 12(r4)
adde r0, r0, r10
+ STWX_BE r5, 0, r1
+ lwz r5, 0(r1)
+ STWX_BE r6, 0, r1
+ lwz r6, 0(r1)
add r5, r5, r6 /* assumption: len + proto doesn't carry */
adde r0, r0, r11
adde r0, r0, r5
diff --git a/arch/powerpc/lib/checksum_64.S b/arch/powerpc/lib/checksum_64.S
index 886ed94..302e732 100644
--- a/arch/powerpc/lib/checksum_64.S
+++ b/arch/powerpc/lib/checksum_64.S
@@ -439,6 +439,10 @@ EXPORT_SYMBOL(csum_partial_copy_generic)
_GLOBAL(csum_ipv6_magic)
ld r8, 0(r3)
ld r9, 8(r3)
+ STWX_BE r5, 0, r1
+ lwz r5, 0(r1)
+ STWX_BE r6, 0, r1
+ lwz r6, 0(r1)
add r5, r5, r6
addc r0, r8, r9
ld r10, 0(r4)
--
2.1.0
^ permalink raw reply related
* [PATCH v2] ethernet: hnae: drop adhoc assert() macros
From: Igor Stoppa @ 2018-09-08 15:01 UTC (permalink / raw)
To: David S . Miller
Cc: igor.stoppa, Igor Stoppa, huangdaode, Yisen Zhuang, Salil Mehta,
netdev, linux-kernel
Replace assert() with a less misleading test_condition() using WARN()
Drop one check which had bitrotted and didn't compile anymore.
Signed-off-by: Igor Stoppa <igor.stoppa@huawei.com>
Cc: huangdaode <huangdaode@hisilicon.com>
Cc: Yisen Zhuang <yisen.zhuang@huawei.com>
Cc: Salil Mehta <salil.mehta@huawei.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
drivers/net/ethernet/hisilicon/hns/hnae.c | 7 ++--
drivers/net/ethernet/hisilicon/hns/hnae.h | 34 +++++--------------
.../net/ethernet/hisilicon/hns/hns_ae_adapt.c | 16 ++++-----
drivers/net/ethernet/hisilicon/hns/hns_enet.c | 12 +++----
4 files changed, 25 insertions(+), 44 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.c b/drivers/net/ethernet/hisilicon/hns/hnae.c
index a051e582d541..bd64e6092e4b 100644
--- a/drivers/net/ethernet/hisilicon/hns/hnae.c
+++ b/drivers/net/ethernet/hisilicon/hns/hnae.c
@@ -203,11 +203,12 @@ hnae_init_ring(struct hnae_queue *q, struct hnae_ring *ring, int flags)
ring->flags = flags;
spin_lock_init(&ring->lock);
ring->coal_param = q->handle->coal_param;
- assert(!ring->desc && !ring->desc_cb && !ring->desc_dma_addr);
+ test_condition(!ring->desc && !ring->desc_cb &&
+ !ring->desc_dma_addr);
/* not matter for tx or rx ring, the ntc and ntc start from 0 */
- assert(ring->next_to_use == 0);
- assert(ring->next_to_clean == 0);
+ test_condition(ring->next_to_use == 0);
+ test_condition(ring->next_to_clean == 0);
ring->desc_cb = kcalloc(ring->desc_num, sizeof(ring->desc_cb[0]),
GFP_KERNEL);
diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.h b/drivers/net/ethernet/hisilicon/hns/hnae.h
index 08a750fb60c4..47dec7590079 100644
--- a/drivers/net/ethernet/hisilicon/hns/hnae.h
+++ b/drivers/net/ethernet/hisilicon/hns/hnae.h
@@ -43,23 +43,9 @@
#define HNAE_DEFAULT_DEVICE_DESCR "Hisilicon Network Subsystem"
#ifdef DEBUG
-
-#ifndef assert
-#define assert(expr) \
-do { \
- if (!(expr)) { \
- pr_err("Assertion failed! %s, %s, %s, line %d\n", \
- #expr, __FILE__, __func__, __LINE__); \
- } \
-} while (0)
-#endif
-
+#define test_condition(expr) WARN_ON_ONCE(!(expr))
#else
-
-#ifndef assert
-#define assert(expr)
-#endif
-
+#define test_condition(expr)
#endif
#define AE_VERSION_1 ('6' << 16 | '6' << 8 | '0')
@@ -314,16 +300,16 @@ enum hns_desc_type {
DESC_TYPE_PAGE,
};
-#define assert_is_ring_idx(ring, idx) \
- assert((idx) >= 0 && (idx) < (ring)->desc_num)
+#define is_ring_idx(ring, idx) \
+ test_condition((idx) >= 0 && (idx) < (ring)->desc_num)
/* the distance between [begin, end) in a ring buffer
* note: there is a unuse slot between the begin and the end
*/
static inline int ring_dist(struct hnae_ring *ring, int begin, int end)
{
- assert_is_ring_idx(ring, begin);
- assert_is_ring_idx(ring, end);
+ is_ring_idx(ring, begin);
+ is_ring_idx(ring, end);
return (end - begin + ring->desc_num) % ring->desc_num;
}
@@ -336,8 +322,8 @@ static inline int ring_space(struct hnae_ring *ring)
static inline int is_ring_empty(struct hnae_ring *ring)
{
- assert_is_ring_idx(ring, ring->next_to_use);
- assert_is_ring_idx(ring, ring->next_to_clean);
+ is_ring_idx(ring, ring->next_to_use);
+ is_ring_idx(ring, ring->next_to_clean);
return ring->next_to_use == ring->next_to_clean;
}
@@ -592,10 +578,6 @@ int hnae_reinit_handle(struct hnae_handle *handle);
#define hnae_queue_xmit(q, buf_num) writel_relaxed(buf_num, \
(q)->tx_ring.io_base + RCB_REG_TAIL)
-#ifndef assert
-#define assert(cond)
-#endif
-
static inline int hnae_reserve_buffer_map(struct hnae_ring *ring,
struct hnae_desc_cb *cb)
{
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c b/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
index b52029e26d15..6ff391ccdd7a 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
@@ -264,7 +264,7 @@ static int hns_ae_set_multicast_one(struct hnae_handle *handle, void *addr)
struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle);
u8 port_num;
- assert(mac_cb);
+ test_condition(mac_cb);
if (mac_cb->mac_type != HNAE_PORT_SERVICE)
return 0;
@@ -494,7 +494,7 @@ static void hns_ae_get_pauseparam(struct hnae_handle *handle,
static int hns_ae_set_autoneg(struct hnae_handle *handle, u8 enable)
{
- assert(handle);
+ test_condition(handle);
return hns_mac_set_autoneg(hns_get_mac_cb(handle), enable);
}
@@ -511,7 +511,7 @@ static int hns_ae_get_autoneg(struct hnae_handle *handle)
{
u32 auto_neg;
- assert(handle);
+ test_condition(handle);
hns_mac_get_autoneg(hns_get_mac_cb(handle), &auto_neg);
@@ -618,7 +618,7 @@ static void hns_ae_get_coalesce_range(struct hnae_handle *handle,
{
struct dsaf_device *dsaf_dev;
- assert(handle);
+ test_condition(handle);
dsaf_dev = hns_ae_get_dsaf_dev(handle->dev);
@@ -767,7 +767,7 @@ static void hns_ae_get_strings(struct hnae_handle *handle,
u8 *p = data;
struct hnae_vf_cb *vf_cb;
- assert(handle);
+ test_condition(handle);
vf_cb = hns_ae_get_vf_cb(handle);
port = vf_cb->port_index;
@@ -795,7 +795,7 @@ static int hns_ae_get_sset_count(struct hnae_handle *handle, int stringset)
struct hns_mac_cb *mac_cb;
struct dsaf_device *dsaf_dev = hns_ae_get_dsaf_dev(handle->dev);
- assert(handle);
+ test_condition(handle);
mac_cb = hns_get_mac_cb(handle);
@@ -839,7 +839,7 @@ static void hns_ae_update_led_status(struct hnae_handle *handle)
{
struct hns_mac_cb *mac_cb;
- assert(handle);
+ test_condition(handle);
mac_cb = hns_get_mac_cb(handle);
if (mac_cb->media_type != HNAE_MEDIA_TYPE_FIBER)
return;
@@ -852,7 +852,7 @@ static int hns_ae_cpld_set_led_id(struct hnae_handle *handle,
{
struct hns_mac_cb *mac_cb;
- assert(handle);
+ test_condition(handle);
mac_cb = hns_get_mac_cb(handle);
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
index f56855e63c96..8ba0d44742d1 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
@@ -366,7 +366,7 @@ netdev_tx_t hns_nic_net_xmit_hw(struct net_device *ndev,
ndev->stats.tx_packets++;
wmb(); /* commit all data before submit */
- assert(skb->queue_mapping < priv->ae_handle->q_num);
+ test_condition(skb->queue_mapping < priv->ae_handle->q_num);
hnae_queue_xmit(priv->ae_handle->qs[skb->queue_mapping], buf_num);
ring->stats.tx_pkts++;
ring->stats.tx_bytes += skb->len;
@@ -937,9 +937,9 @@ static int is_valid_clean_head(struct hnae_ring *ring, int h)
if (unlikely(h > ring->desc_num))
return 0;
- assert(u > 0 && u < ring->desc_num);
- assert(c > 0 && c < ring->desc_num);
- assert(u != c && h != c); /* must be checked before call this func */
+ test_condition(u > 0 && u < ring->desc_num);
+ test_condition(c > 0 && c < ring->desc_num);
+ test_condition(u != c && h != c); /* must be checked before call this func */
return u > c ? (h > c && h <= u) : (h > c || h <= u);
}
@@ -1515,8 +1515,6 @@ static netdev_tx_t hns_nic_net_xmit(struct sk_buff *skb,
{
struct hns_nic_priv *priv = netdev_priv(ndev);
- assert(skb->queue_mapping < ndev->ae_handle->q_num);
-
return hns_nic_net_xmit_hw(ndev, skb,
&tx_ring_data(priv, skb->queue_mapping));
}
@@ -2249,7 +2247,7 @@ static int hns_nic_notifier_action(struct notifier_block *nb,
struct hns_nic_priv *priv =
container_of(nb, struct hns_nic_priv, notifier_block);
- assert(action == HNAE_AE_REGISTER);
+ test_condition(action == HNAE_AE_REGISTER);
if (!hns_nic_try_get_ae(priv->netdev)) {
hnae_unregister_notifier(&priv->notifier_block);
--
2.17.1
^ permalink raw reply related
* [PATCH] cfg80211: remove unnecessary null pointer check in cfg80211_netdev_notifier_call
From: zhong jiang @ 2018-09-08 11:21 UTC (permalink / raw)
To: johannes, davem; +Cc: linux-wireless, netdev, linux-kernel
The iterator in list_for_each_entry_safe is never null, therefore, remove
the redundant null pointer check.
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
net/wireless/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/wireless/core.c b/net/wireless/core.c
index a88551f..4d5215e 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -1238,7 +1238,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
list_for_each_entry_safe(pos, tmp,
&rdev->sched_scan_req_list, list) {
- if (WARN_ON(pos && pos->dev == wdev->netdev))
+ if (WARN_ON(pos->dev == wdev->netdev))
cfg80211_stop_sched_scan_req(rdev, pos, false);
}
--
1.7.12.4
^ permalink raw reply related
* [PATCH net] qmi_wwan: Support dynamic config on Quectel EP06
From: Kristian Evensen @ 2018-09-08 11:50 UTC (permalink / raw)
To: netdev, bjorn; +Cc: Kristian Evensen
Quectel EP06 (and EM06/EG06) supports dynamic configuration of USB
interfaces, without the device changing VID/PID or configuration number.
When the configuration is updated and interfaces are added/removed, the
interface numbers change. This means that the current code for matching
EP06 does not work.
This patch removes the current EP06 interface number match, and replaces
it with a match on class, subclass and protocol. Unfortunately, matching
on those three alone is not enough, as the diag interface exports the
same values as QMI. The other serial interfaces + adb export different
values and do not match.
The diag interface only has two endpoints, while the QMI interface has
three. I have therefore added a check for number of interfaces, and we
ignore the interface if the number of endpoints equals two.
Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
---
drivers/net/usb/qmi_wwan.c | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 31684f338..e4bb6083f 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -967,6 +967,13 @@ static const struct usb_device_id products[] = {
USB_DEVICE_AND_INTERFACE_INFO(0x03f0, 0x581d, USB_CLASS_VENDOR_SPEC, 1, 7),
.driver_info = (unsigned long)&qmi_wwan_info,
},
+ { /* Quectel EP06/EG06/EM06 */
+ USB_DEVICE_AND_INTERFACE_INFO(0x2c7c, 0x0306,
+ USB_CLASS_VENDOR_SPEC,
+ USB_SUBCLASS_VENDOR_SPEC,
+ 0xff),
+ .driver_info = (unsigned long)&qmi_wwan_info_quirk_dtr,
+ },
/* 3. Combined interface devices matching on interface number */
{QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */
@@ -1254,7 +1261,6 @@ static const struct usb_device_id products[] = {
{QMI_QUIRK_SET_DTR(0x2c7c, 0x0121, 4)}, /* Quectel EC21 Mini PCIe */
{QMI_QUIRK_SET_DTR(0x2c7c, 0x0191, 4)}, /* Quectel EG91 */
{QMI_FIXED_INTF(0x2c7c, 0x0296, 4)}, /* Quectel BG96 */
- {QMI_QUIRK_SET_DTR(0x2c7c, 0x0306, 4)}, /* Quectel EP06 Mini PCIe */
/* 4. Gobi 1000 devices */
{QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
@@ -1330,6 +1336,19 @@ static bool quectel_ec20_detected(struct usb_interface *intf)
return false;
}
+static bool quectel_ep06_diag_detected(struct usb_interface *intf)
+{
+ struct usb_device *dev = interface_to_usbdev(intf);
+ struct usb_interface_descriptor intf_desc = intf->cur_altsetting->desc;
+
+ if (le16_to_cpu(dev->descriptor.idVendor) == 0x2c7c &&
+ le16_to_cpu(dev->descriptor.idProduct) == 0x0306 &&
+ intf_desc.bNumEndpoints == 2)
+ return true;
+
+ return false;
+}
+
static int qmi_wwan_probe(struct usb_interface *intf,
const struct usb_device_id *prod)
{
@@ -1364,6 +1383,15 @@ static int qmi_wwan_probe(struct usb_interface *intf,
return -ENODEV;
}
+ /* Quectel EP06/EM06/EG06 supports dynamic interface configuration, so
+ * we need to match on class/subclass/protocol. These values are
+ * identical for the diagnostic- and QMI-interface, but bNumEndpoints is
+ * different. Ignore the current interface if the number of endpoints
+ * the number for the diag interface (two).
+ */
+ if (quectel_ep06_diag_detected(intf))
+ return -ENODEV;
+
return usbnet_probe(intf, id);
}
--
2.14.1
^ permalink raw reply related
* Re: [PATCH net-next] failover: Fix error return code in net_failover_create
From: David Miller @ 2018-09-08 17:31 UTC (permalink / raw)
To: yuehaibing
Cc: alexander.h.duyck, jeffrey.t.kirsher, liran.alon,
sridhar.samudrala, stephen, dan.carpenter, linux-kernel, netdev
In-Reply-To: <20180906130412.21964-1-yuehaibing@huawei.com>
From: YueHaibing <yuehaibing@huawei.com>
Date: Thu, 6 Sep 2018 21:04:12 +0800
> if failover_register failed, 'err' code should be set correctly
>
> Fixes: cfc80d9a1163 ("net: Introduce net_failover driver")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Applied, thanks.
^ permalink raw reply
* [PATCH] net: xenbus: remove redundant condition check before debugfs_remove_recursive
From: zhong jiang @ 2018-09-08 13:35 UTC (permalink / raw)
To: davem, paul.durrant, wei.liu2; +Cc: xen-devel, netdev
debugfs_remove_recursive has taken the IS_ERR_OR_NULL into account. Just
remove the unnecessary condition check.
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
drivers/net/xen-netback/xenbus.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
index cd51492..fe1d522 100644
--- a/drivers/net/xen-netback/xenbus.c
+++ b/drivers/net/xen-netback/xenbus.c
@@ -254,8 +254,7 @@ static void xenvif_debugfs_delif(struct xenvif *vif)
if (IS_ERR_OR_NULL(xen_netback_dbg_root))
return;
- if (!IS_ERR_OR_NULL(vif->xenvif_dbg_root))
- debugfs_remove_recursive(vif->xenvif_dbg_root);
+ debugfs_remove_recursive(vif->xenvif_dbg_root);
vif->xenvif_dbg_root = NULL;
}
#endif /* CONFIG_DEBUG_FS */
--
1.7.12.4
^ permalink raw reply related
* [PATCH] brcm80211: remove redundant condition check before debugfs_remove_recursive
From: zhong jiang @ 2018-09-08 13:40 UTC (permalink / raw)
To: davem, arend.vanspriel, franky.lin, hante.meuleman, kvalo
Cc: chi-hsien.lin, wright.feng, linux-wireless,
brcm80211-dev-list.pdl, netdev
debugfs_remove_recursive has taken IS_ERR_OR_NULL into account. So just
remove the condition check before debugfs_remove_recursive.
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
drivers/net/wireless/broadcom/brcm80211/brcmsmac/debug.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/debug.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/debug.c
index 2fe1f68..3bd54f1 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/debug.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/debug.c
@@ -62,8 +62,7 @@ int brcms_debugfs_attach(struct brcms_pub *drvr)
void brcms_debugfs_detach(struct brcms_pub *drvr)
{
- if (!IS_ERR_OR_NULL(drvr->dbgfs_dir))
- debugfs_remove_recursive(drvr->dbgfs_dir);
+ debugfs_remove_recursive(drvr->dbgfs_dir);
}
struct dentry *brcms_debugfs_get_devdir(struct brcms_pub *drvr)
--
1.7.12.4
^ permalink raw reply related
* Fixed PHYs and link up/down from user space ?
From: Joakim Tjernlund @ 2018-09-08 13:59 UTC (permalink / raw)
To: netdev@vger.kernel.org
I am looking for a way to set physical link state from user space for a Fixed PHY.
Found the /sys/class/net/eth1/carrier I/F but that didn't work and I cannot find something else.
I want to make ifplugd/dhcp function as if there were a real cable there(or not)
Jocke
^ permalink raw reply
* Re: [PATCH net] qmi_wwan: Support dynamic config on Quectel EP06
From: Bjørn Mork @ 2018-09-08 14:12 UTC (permalink / raw)
To: Kristian Evensen; +Cc: netdev
In-Reply-To: <20180908115048.12667-1-kristian.evensen@gmail.com>
Kristian Evensen <kristian.evensen@gmail.com> writes:
> Quectel EP06 (and EM06/EG06) supports dynamic configuration of USB
> interfaces, without the device changing VID/PID or configuration number.
> When the configuration is updated and interfaces are added/removed, the
> interface numbers change. This means that the current code for matching
> EP06 does not work.
That's annoying, but hardly surprising. They obviously try to make life
as hard as possible for the drivers. I wonder what the Windows drivers
do here, if there are any? Or are these modules only used in embedded
Linux devices?
> This patch removes the current EP06 interface number match, and replaces
> it with a match on class, subclass and protocol. Unfortunately, matching
> on those three alone is not enough, as the diag interface exports the
> same values as QMI. The other serial interfaces + adb export different
> values and do not match.
>
> The diag interface only has two endpoints, while the QMI interface has
> three. I have therefore added a check for number of interfaces, and we
> ignore the interface if the number of endpoints equals two.
Could this break if more/other functions are enabled? Are you sure
there can't be any other type of serial function with 3 endpoints and
ff/ff/ff? Well, I guess no one knows for sure... And this is more than
good enough until it breaks. Thanks for solving the puzzle. Looks good
to me.
Acked-by: Bjørn Mork <bjorn@mork.no>
^ permalink raw reply
* [PATCH] netlink: fix hash::nelems check
From: Li RongQing @ 2018-09-08 14:33 UTC (permalink / raw)
To: netdev
The type of hash::nelems has been changed from size_t to atom_t
which is int in fact, and impossible to be bigger than UINT_MAX
Fixes: 97defe1ecf86 ("rhashtable: Per bucket locks & deferred expansion/shrinking")
Signed-off-by: Zhang Yu <zhangyu31@baidu.com>
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
net/netlink/af_netlink.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index b4a29bcc33b9..412437baee63 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -575,8 +575,7 @@ static int netlink_insert(struct sock *sk, u32 portid)
goto err;
err = -ENOMEM;
- if (BITS_PER_LONG > 32 &&
- unlikely(atomic_read(&table->hash.nelems) >= UINT_MAX))
+ if (unlikely(atomic_read(&table->hash.nelems) == INT_MAX))
goto err;
nlk_sk(sk)->portid = portid;
--
2.16.2
^ permalink raw reply related
* Re: [PATCH 1/7] fix hnode refcounting
From: Al Viro @ 2018-09-08 15:03 UTC (permalink / raw)
To: Jamal Hadi Salim; +Cc: netdev, Cong Wang, Jiri Pirko, stable
In-Reply-To: <612ba054-370d-d118-b439-c68ea466eec9@mojatatu.com>
On Fri, Sep 07, 2018 at 08:13:56AM -0400, Jamal Hadi Salim wrote:
> > } else {
> > bool last;
> >
> > err = tfilter_del_notify(net, skb, n, tp, block,
> > q, parent, fh, false, &last,
> > extack);
> > How can we ever get there with NULL fh?
> >
>
> Try:
> tc filter delete dev $P parent ffff: protocol ip prio 10 u32
> tcm handle is 0, so will hit that code path.
Huh? It will hit tcf_proto_destroy() (and thus u32_destroy()), but where will
it hit u32_delete()? Sure, we have fh == NULL there; what happens next is
if (t->tcm_handle == 0) {
tcf_chain_tp_remove(chain, &chain_info, tp);
tfilter_notify(net, skb, n, tp, block, q, parent, fh,
RTM_DELTFILTER, false);
tcf_proto_destroy(tp, extack);
and that's it. IDGI... Direct experiment shows that on e.g.
tc qdisc add dev eth0 ingress
tc filter add dev eth0 parent ffff: protocol ip prio 10 u32 match ip protocol 1 0xff
tc filter delete dev eth0 parent ffff: protocol ip prio 10 u32
we get u32_destroy() called, with u32_destroy_hnode() called by it,
but no u32_delete() is called at all, let alone with ht == NULL...
^ permalink raw reply
* Re: Why not use all the syn queues? in the function "tcp_conn_request", I have some questions.
From: Ttttabcd @ 2018-09-08 15:23 UTC (permalink / raw)
To: Neal Cardwell; +Cc: Netdev
In-Reply-To: <vN3mecCgCus4YcjtQ_kmAF54GhPE5BuQBEmDmPauw6J-FAWXZfzrXiw15lD6p2TmQtEH_ZORkfbA7BYgu7XeBIAXVzto628SNysPZz2Ia9s=@protonmail.com>
Thank you very much for your previous answer, sorry for the inconvenience.
But now I want to ask you one more question.
The question is why we need two variables to control the syn queue?
The first is the "backlog" parameter of the "listen" system call that controls the maximum length limit of the syn queue, it also controls the accept queue.
The second is /proc/sys/net/ipv4/tcp_max_syn_backlog, which also controls the maximum length limit of the syn queue.
So simply changing one of them and wanting to increase the syn queue is not working.
In our last discussion, I understood tcp_max_syn_backlog will retain the last quarter to the IP that has been proven to be alive
But if tcp_max_syn_backlog is very large, the syn queue will be filled as well.
So I don't understand why not just use a variable to control the syn queue.
For example, just use tcp_max_syn_backlog, which is the maximum length limit for the syn queue, and it can also be retained to prove that the IP remains the last quarter.
The backlog parameter of the listen system call only controls the accpet queue.
I feel this is more reasonable. If I don't look at the source code, I really can't guess the backlog parameter actually controls the syn queue.
I always thought that it only controlled the accept queue before I looked at the source code, because the man page is written like this.
Here is the man page's original words.
The behavior of the backlog argument on TCP sockets changed with Linux 2.2. Now it specifies the queue length for completely established sockets waiting to be accepted, instead of the number of incomplete connection requests. The maximum length of the queue for incomplete sockets can be set using /proc/sys/net/ipv4/tcp_max_syn_backlog. When syncookies are enabled there is no logical maximum length and this setting is ignored. See tcp(7) for more information.
^ permalink raw reply
* Re: [PATCH net] powerpc: use big endian to hash len and proto in csum_ipv6_magic
From: LEROY Christophe @ 2018-09-08 16:33 UTC (permalink / raw)
To: Xin Long; +Cc: Roopa Prabhu, Michael Ellerman, linuxppc-dev, network dev
In-Reply-To: <9183876a4a8ff0099686521d60f395a5230b67ed.1536401712.git.lucien.xin@gmail.com>
Xin Long <lucien.xin@gmail.com> a écrit :
> The function csum_ipv6_magic doesn't convert len and proto to big
> endian before doing ipv6 csum hash, which is not consistent with
> RFC and other arches.
>
> Jianlin found it when ICMPv6 packets from other hosts were dropped
> in the powerpc64 system.
>
> This patch is to fix it by using instruction 'lwbrx' to do this
> conversion in powerpc32/64 csum_ipv6_magic.
>
> Fixes: e9c4943a107b ("powerpc: Implement csum_ipv6_magic in assembly")
> Reported-by: Jianlin Shi <jishi@redhat.com>
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
> ---
> arch/powerpc/lib/checksum_32.S | 4 ++++
> arch/powerpc/lib/checksum_64.S | 4 ++++
> 2 files changed, 8 insertions(+)
>
> diff --git a/arch/powerpc/lib/checksum_32.S b/arch/powerpc/lib/checksum_32.S
> index aa22406..7d3446e 100644
> --- a/arch/powerpc/lib/checksum_32.S
> +++ b/arch/powerpc/lib/checksum_32.S
> @@ -325,6 +325,10 @@ _GLOBAL(csum_ipv6_magic)
> adde r0, r0, r9
> lwz r11, 12(r4)
> adde r0, r0, r10
> + STWX_BE r5, 0, r1
> + lwz r5, 0(r1)
> + STWX_BE r6, 0, r1
> + lwz r6, 0(r1)
PPC32 doesn't support little endian, so nothing to do here.
> add r5, r5, r6 /* assumption: len + proto doesn't carry */
> adde r0, r0, r11
> adde r0, r0, r5
> diff --git a/arch/powerpc/lib/checksum_64.S b/arch/powerpc/lib/checksum_64.S
> index 886ed94..302e732 100644
> --- a/arch/powerpc/lib/checksum_64.S
> +++ b/arch/powerpc/lib/checksum_64.S
> @@ -439,6 +439,10 @@ EXPORT_SYMBOL(csum_partial_copy_generic)
> _GLOBAL(csum_ipv6_magic)
> ld r8, 0(r3)
> ld r9, 8(r3)
> + STWX_BE r5, 0, r1
> + lwz r5, 0(r1)
> + STWX_BE r6, 0, r1
> + lwz r6, 0(r1)
> add r5, r5, r6
This is overkill. For LE it should be enough to rotate r5 by 8 bits
after the sum. Best place to do it would be after ld r11 I think.
Christophe
> addc r0, r8, r9
> ld r10, 0(r4)
> --
> 2.1.0
^ permalink raw reply
* [PATCH net-next] tcp: show number of network segments in some SNMP counters
From: Yafang Shao @ 2018-09-08 16:58 UTC (permalink / raw)
To: edumazet, davem; +Cc: netdev, linux-kernel, Yafang Shao
It is better to show the number of network segments in bellow SNMP
counters, because that could be more useful for the user.
For example, the user could easily figure out how mant packets are
dropped and how many packets are queued in the out-of-oder queue.
- LINUX_MIB_TCPRCVQDROP
- LINUX_MIB_TCPZEROWINDOWDROP
- LINUX_MIB_TCPBACKLOGDROP
- LINUX_MIB_TCPMINTTLDROP
- LINUX_MIB_TCPOFODROP
- LINUX_MIB_TCPOFOQUEUE
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
net/ipv4/tcp_input.c | 18 ++++++++++++------
net/ipv4/tcp_ipv4.c | 9 ++++++---
net/ipv6/tcp_ipv6.c | 6 ++++--
3 files changed, 22 insertions(+), 11 deletions(-)
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 62508a2..90f449b 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4496,7 +4496,8 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)
tcp_ecn_check_ce(sk, skb);
if (unlikely(tcp_try_rmem_schedule(sk, skb, skb->truesize))) {
- NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFODROP);
+ NET_ADD_STATS(sock_net(sk), LINUX_MIB_TCPOFODROP,
+ tcp_skb_pcount(skb));
tcp_drop(sk, skb);
return;
}
@@ -4505,7 +4506,8 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)
tp->pred_flags = 0;
inet_csk_schedule_ack(sk);
- NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFOQUEUE);
+ NET_ADD_STATS(sock_net(sk), LINUX_MIB_TCPOFOQUEUE,
+ tcp_skb_pcount(skb));
seq = TCP_SKB_CB(skb)->seq;
end_seq = TCP_SKB_CB(skb)->end_seq;
SOCK_DEBUG(sk, "out of order segment: rcv_next %X seq %X - %X\n",
@@ -4666,7 +4668,8 @@ int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size)
skb->len = size;
if (tcp_try_rmem_schedule(sk, skb, skb->truesize)) {
- NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPRCVQDROP);
+ NET_ADD_STATS(sock_net(sk), LINUX_MIB_TCPRCVQDROP,
+ tcp_skb_pcount(skb));
goto err_free;
}
@@ -4725,7 +4728,8 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
*/
if (TCP_SKB_CB(skb)->seq == tp->rcv_nxt) {
if (tcp_receive_window(tp) == 0) {
- NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPZEROWINDOWDROP);
+ NET_ADD_STATS(sock_net(sk), LINUX_MIB_TCPZEROWINDOWDROP,
+ tcp_skb_pcount(skb));
goto out_of_window;
}
@@ -4734,7 +4738,8 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
if (skb_queue_len(&sk->sk_receive_queue) == 0)
sk_forced_mem_schedule(sk, skb->truesize);
else if (tcp_try_rmem_schedule(sk, skb, skb->truesize)) {
- NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPRCVQDROP);
+ NET_ADD_STATS(sock_net(sk), LINUX_MIB_TCPRCVQDROP,
+ tcp_skb_pcount(skb));
goto drop;
}
@@ -4796,7 +4801,8 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
* remembering D-SACK for its head made in previous line.
*/
if (!tcp_receive_window(tp)) {
- NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPZEROWINDOWDROP);
+ NET_ADD_STATS(sock_net(sk), LINUX_MIB_TCPZEROWINDOWDROP,
+ tcp_skb_pcount(skb));
goto out_of_window;
}
goto queue_and_out;
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 09547ef..f2fe14b 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -475,7 +475,8 @@ void tcp_v4_err(struct sk_buff *icmp_skb, u32 info)
goto out;
if (unlikely(iph->ttl < inet_sk(sk)->min_ttl)) {
- __NET_INC_STATS(net, LINUX_MIB_TCPMINTTLDROP);
+ __NET_ADD_STATS(net, LINUX_MIB_TCPMINTTLDROP,
+ tcp_skb_pcount(skb));
goto out;
}
@@ -1633,7 +1634,8 @@ bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb)
if (unlikely(sk_add_backlog(sk, skb, limit))) {
bh_unlock_sock(sk);
- __NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPBACKLOGDROP);
+ __NET_ADD_STATS(sock_net(sk), LINUX_MIB_TCPBACKLOGDROP,
+ tcp_skb_pcount(skb));
return true;
}
return false;
@@ -1790,7 +1792,8 @@ int tcp_v4_rcv(struct sk_buff *skb)
}
}
if (unlikely(iph->ttl < inet_sk(sk)->min_ttl)) {
- __NET_INC_STATS(net, LINUX_MIB_TCPMINTTLDROP);
+ __NET_ADD_STATS(net, LINUX_MIB_TCPMINTTLDROP,
+ tcp_skb_pcount(skb));
goto discard_and_relse;
}
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 03e6b7a..97dfc16 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -391,7 +391,8 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
goto out;
if (ipv6_hdr(skb)->hop_limit < inet6_sk(sk)->min_hopcount) {
- __NET_INC_STATS(net, LINUX_MIB_TCPMINTTLDROP);
+ __NET_ADD_STATS(net, LINUX_MIB_TCPMINTTLDROP,
+ tcp_skb_pcount(skb));
goto out;
}
@@ -1523,7 +1524,8 @@ static int tcp_v6_rcv(struct sk_buff *skb)
}
}
if (hdr->hop_limit < inet6_sk(sk)->min_hopcount) {
- __NET_INC_STATS(net, LINUX_MIB_TCPMINTTLDROP);
+ __NET_ADD_STATS(net, LINUX_MIB_TCPMINTTLDROP,
+ tcp_skb_pcount(skb));
goto discard_and_relse;
}
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH] net/sock: move memory_allocated over to percpu_counter variables
From: Olof Johansson @ 2018-09-08 17:02 UTC (permalink / raw)
To: Eric Dumazet
Cc: Herbert Xu, David Miller, Neil Horman, Marcelo Ricardo Leitner,
Vladislav Yasevich, Alexey Kuznetsov, Hideaki YOSHIFUJI,
linux-crypto, LKML, linux-sctp, netdev, linux-decnet-user,
kernel-team, Yuchung Cheng, Neal Cardwell
In-Reply-To: <CANn89iKgZkfwQ8nAGEfOzubOh69y285TNKB5Q518Wf_phbq2Yg@mail.gmail.com>
Hi,
On Fri, Sep 7, 2018 at 12:21 AM, Eric Dumazet <edumazet@google.com> wrote:
> On Fri, Sep 7, 2018 at 12:03 AM Eric Dumazet <edumazet@google.com> wrote:
>
>> Problem is : we have platforms with more than 100 cpus, and
>> sk_memory_allocated() cost will be too expensive,
>> especially if the host is under memory pressure, since all cpus will
>> touch their private counter.
>>
>> per cpu variables do not really scale, they were ok 10 years ago when
>> no more than 16 cpus were the norm.
>>
>> I would prefer change TCP to not aggressively call
>> __sk_mem_reduce_allocated() from tcp_write_timer()
>>
>> Ideally only tcp_retransmit_timer() should attempt to reduce forward
>> allocations, after recurring timeout.
>>
>> Note that after 20c64d5cd5a2bdcdc8982a06cb05e5e1bd851a3d ("net: avoid
>> sk_forward_alloc overflows")
>> we have better control over sockets having huge forward allocations.
>>
>> Something like :
>
> Or something less risky :
I gave both of these patches a run, and neither do as well on the
system that has slower atomics. :(
The percpu version:
8.05% workload [kernel.vmlinux]
[k] __do_softirq
7.04% swapper [kernel.vmlinux]
[k] cpuidle_enter_state
5.54% workload [kernel.vmlinux]
[k] _raw_spin_unlock_irqrestore
1.66% swapper [kernel.vmlinux]
[k] __do_softirq
1.55% workload [kernel.vmlinux]
[k] finish_task_switch
1.24% swapper [kernel.vmlinux]
[k] finish_task_switch
1.07% workload [kernel.vmlinux]
[k] net_rx_action
The first patch from you still has significant amount of time spent in
the atomics paths (non-inlined versions used):
7.87% workload [kernel.vmlinux]
[k] __ll_sc_atomic64_sub
7.48% workload [kernel.vmlinux]
[k] __do_softirq
5.05% workload [kernel.vmlinux]
[k] _raw_spin_unlock_irqrestore
2.42% workload [kernel.vmlinux]
[k] __ll_sc_atomic64_add_return
1.49% swapper [kernel.vmlinux]
[k] cpuidle_enter_state
1.31% workload [kernel.vmlinux]
[k] finish_task_switch
1.09% workload [kernel.vmlinux]
[k] tcp_sendmsg_locked
1.08% workload [kernel.vmlinux]
[k] __arch_copy_from_user
1.02% workload [kernel.vmlinux]
[k] net_rx_action
I think a lot of the overhead from percpu approach can be alleviated
if we can use percpu_counter_read() instead of _sum() (i.e. no need to
iterate through the local per-cpu recent delta). I don't know the TCP
stack well enough to tell where it's OK to use a bit of slack in the
numbers though -- by default count will at most be off by 32*online
cpus. Might not be a significant number in reality.
-Olof
^ permalink raw reply
* Re: [PATCH net-next] net: sched: act_skbedit: remove dependency on rtnl lock
From: David Miller @ 2018-09-08 17:18 UTC (permalink / raw)
To: vladbu; +Cc: netdev, jhs, xiyou.wangcong, jiri
In-Reply-To: <1535958435-6861-1-git-send-email-vladbu@mellanox.com>
From: Vlad Buslov <vladbu@mellanox.com>
Date: Mon, 3 Sep 2018 10:07:15 +0300
> According to the new locking rule, we have to take tcf_lock for both
> ->init() and ->dump(), as RTNL will be removed.
>
> Use tcf lock to protect skbedit action struct private data from concurrent
> modification in init and dump. Use rcu swap operation to reassign params
> pointer under protection of tcf lock. (old params value is not used by
> init, so there is no need of standalone rcu dereference step)
>
> Remove rtnl lock assertion that is no longer required.
>
> Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next] net: sched: act_nat: remove dependency on rtnl lock
From: David Miller @ 2018-09-08 17:18 UTC (permalink / raw)
To: vladbu; +Cc: netdev, jhs, xiyou.wangcong, jiri
In-Reply-To: <1535958560-6967-1-git-send-email-vladbu@mellanox.com>
From: Vlad Buslov <vladbu@mellanox.com>
Date: Mon, 3 Sep 2018 10:09:20 +0300
> According to the new locking rule, we have to take tcf_lock for both
> ->init() and ->dump(), as RTNL will be removed.
>
> Use tcf spinlock to protect private nat action data from concurrent
> modification during dump. (nat init already uses tcf spinlock when changing
> action state)
>
> Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Also applied, thanks.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox