* Re: [PATCH net-next 4/6] tcp: remove header prediction
From: Neal Cardwell @ 2017-08-01 17:23 UTC (permalink / raw)
To: Florian Westphal; +Cc: Netdev, David Miller, Eric Dumazet, Yuchung Cheng
In-Reply-To: <20170730015723.25587-5-fw@strlen.de>
On Sat, Jul 29, 2017 at 9:57 PM, Florian Westphal <fw@strlen.de> wrote:
> @@ -5519,11 +5347,10 @@ void tcp_finish_connect(struct sock *sk, struct sk_buff *skb)
> if (sock_flag(sk, SOCK_KEEPOPEN))
> inet_csk_reset_keepalive_timer(sk, keepalive_time_when(tp));
>
> - if (!tp->rx_opt.snd_wscale)
> - __tcp_fast_path_on(tp, tp->snd_wnd);
> - else
> - tp->pred_flags = 0;
> -
> + if (!sock_flag(sk, SOCK_DEAD)) {
> + sk->sk_state_change(sk);
> + sk_wake_async(sk, SOCK_WAKE_IO, POLL_OUT);
> + }
> }
>
This patch hunk seems like it introduces a minor bug. It seems like
after this change, the sk_state_change() and sk_wake_async() calls for
a completed active connection happen twice: once in this new spot
inside tcp_finish_connect() and once in the existing code in
tcp_rcv_synsent_state_process() immediately after it calls
tcp_finish_connect().
I would vote for removing this new code snippet and retaining the old
one, in case there are subtle interactions with
tcp_rcv_fastopen_synack(), which happens in between the new wake-up
location and the old wake-up location.
neal
^ permalink raw reply
* Re: [PATCH 0/2] Revert "ipv6: constify inet6_protocol structures"
From: David Miller @ 2017-08-01 17:04 UTC (permalink / raw)
To: Julia.Lawall; +Cc: kernel-janitors, bhumirks, netdev, linux-kernel
In-Reply-To: <1501604849-19443-1-git-send-email-Julia.Lawall@lip6.fr>
From: Julia Lawall <Julia.Lawall@lip6.fr>
Date: Tue, 1 Aug 2017 18:27:27 +0200
> inet6_add_protocol and inet6_del_protocol include casts that remove the
> effect of the const annotation on their parameter, leading to possible
> runtime crashes.
Series applied, thanks for following up on this.
^ permalink raw reply
* [PATCH v4] ss: Enclose IPv6 address in brackets
From: Florian Lehner @ 2017-08-01 16:54 UTC (permalink / raw)
To: netdev
In-Reply-To: <fc81757c-8dbb-dbed-7a24-7011cb8bb9e0@der-flo.net>
This updated patch adds support for RFC2732 IPv6 address format with
brackets for the tool ss.
Following the advice by David Laight I used strchr().
Also, IN6ADDR_ANY and INADDR_ANY will return "*".
Signed-off-by: Lehner Florian <dev@der-flo.net>
---
misc/ss.c | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/misc/ss.c b/misc/ss.c
index 12763c9..d40ad00 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -1046,25 +1046,31 @@ do_numeric:
static void inet_addr_print(const inet_prefix *a, int port, unsigned
int ifindex)
{
- char buf[1024];
+ char buf[1024], buf2[1024];
const char *ap = buf;
+ char *c = NULL;
int est_len = addr_width;
const char *ifname = NULL;
- if (a->family == AF_INET) {
- if (a->data[0] == 0) {
+ if (a->data[0] == 0) {
buf[0] = '*';
buf[1] = 0;
- } else {
+ } else {
+ if (a->family == AF_INET) {
ap = format_host(AF_INET, 4, a->data);
+ } else {
+ ap = format_host(a->family, 16, a->data);
+ c = strchr(ap, ':');
+ if (c != NULL && a->family == AF_INET6) {
+ sprintf(buf2, "[%s]", ap);
+ ap = buf2;
+ }
+ est_len = strlen(ap);
+ if (est_len <= addr_width)
+ est_len = addr_width;
+ else
+ est_len = addr_width + ((est_len-addr_width+3)/4)*4;
}
- } else {
- ap = format_host(a->family, 16, a->data);
- est_len = strlen(ap);
- if (est_len <= addr_width)
- est_len = addr_width;
- else
- est_len = addr_width + ((est_len-addr_width+3)/4)*4;
}
if (ifindex) {
--
2.9.4
^ permalink raw reply related
* Re: [PATCH v6 net-next] net: systemport: Support 64bit statistics
From: Florian Fainelli @ 2017-08-01 16:53 UTC (permalink / raw)
To: Jianming.qiao, davem, eric.dumazet, netdev
In-Reply-To: <1501550293-20443-1-git-send-email-jqiaoulk@gmail.com>
On 07/31/2017 06:18 PM, Jianming.qiao wrote:
> When using Broadcom Systemport device in 32bit Platform, ifconfig can
> only report up to 4G tx,rx status, which will be wrapped to 0 when the
> number of incoming or outgoing packets exceeds 4G, only taking
> around 2 hours in busy network environment (such as streaming).
> Therefore, it makes hard for network diagnostic tool to get reliable
> statistical result, so the patch is used to add 64bit support for
> Broadcom Systemport device in 32bit Platform.
Almost there, can you turn on lock debugging and try to e.g: modprobe
bcmsysport:
<4>[ 17.836361] CPU: 3 PID: 1328 Comm: modprobe Not tainted
4.13.0-rc1-00560-g67f9849fc4f9 #300
<4>[ 17.844760] Hardware name: Broadcom STB (Flattened Device Tree)
<4>[ 17.850744] [<c0211fe4>] (unwind_backtrace) from [<c020cc4c>]
(show_stack+0x10/0x14)
<4>[ 17.858555] [<c020cc4c>] (show_stack) from [<c0a3204c>]
(dump_stack+0xb0/0xdc)
<4>[ 17.865838] [<c0a3204c>] (dump_stack) from [<c0277564>]
(register_lock_class+0x200/0x5ec)
<4>[ 17.874075] [<c0277564>] (register_lock_class) from [<c027b7f0>]
(__lock_acquire+0x9c/0x19c4)
<4>[ 17.882664] [<c027b7f0>] (__lock_acquire) from [<c027dc24>]
(lock_acquire+0xd0/0x294)
<4>[ 17.890594] [<c027dc24>] (lock_acquire) from [<bf021ee8>]
(bcm_sysport_get_stats64+0xe0/0x1b4 [bcmsysport])
<4>[ 17.900440] [<bf021ee8>] (bcm_sysport_get_stats64 [bcmsysport])
from [<c08c492c>] (dev_get_stats+0x38/0xac)
<4>[ 17.910263] [<c08c492c>] (dev_get_stats) from [<c08e94cc>]
(rtnl_fill_stats+0x38/0x118)
<4>[ 17.918330] [<c08e94cc>] (rtnl_fill_stats) from [<c08e44ec>]
(rtnl_fill_ifinfo+0x4cc/0xdac)
<4>[ 17.926749] [<c08e44ec>] (rtnl_fill_ifinfo) from [<c08e8d5c>]
(rtmsg_ifinfo_build_skb+0x70/0xdc)
<4>[ 17.935591] [<c08e8d5c>] (rtmsg_ifinfo_build_skb) from
[<c08e8ddc>] (rtmsg_ifinfo_event.part.6+0x14/0x44)
<4>[ 17.945221] [<c08e8ddc>] (rtmsg_ifinfo_event.part.6) from
[<c08e8e2c>] (rtmsg_ifinfo+0x20/0x28)
<4>[ 17.953990] [<c08e8e2c>] (rtmsg_ifinfo) from [<c08d3b04>]
(register_netdevice+0x558/0x684)
<4>[ 17.962311] [<c08d3b04>] (register_netdevice) from [<c08d3c44>]
(register_netdev+0x14/0x24)
<4>[ 17.970739] [<c08d3c44>] (register_netdev) from [<bf02310c>]
(bcm_sysport_probe+0x2f0/0x42c [bcmsysport])
<4>[ 17.980384] [<bf02310c>] (bcm_sysport_probe [bcmsysport]) from
[<c0698680>] (platform_drv_probe+0x4c/0xac)
<4>[ 17.990100] [<c0698680>] (platform_drv_probe) from [<c06961b8>]
(driver_probe_device+0x2b8/0x468)
<4>[ 17.999030] [<c06961b8>] (driver_probe_device) from [<c0696454>]
(__driver_attach+0xec/0x128)
<4>[ 18.007613] [<c0696454>] (__driver_attach) from [<c069413c>]
(bus_for_each_dev+0x74/0xb8)
<4>[ 18.015844] [<c069413c>] (bus_for_each_dev) from [<c06954bc>]
(bus_add_driver+0x1bc/0x270)
<4>[ 18.024158] [<c06954bc>] (bus_add_driver) from [<c06974c0>]
(driver_register+0x78/0xf8)
<4>[ 18.032218] [<c06974c0>] (driver_register) from [<c0201908>]
(do_one_initcall+0x50/0x190)
<4>[ 18.040446] [<c0201908>] (do_one_initcall) from [<c02cd8f8>]
(do_init_module+0x64/0x1f8)
<4>[ 18.048584] [<c02cd8f8>] (do_init_module) from [<c02cc4ec>]
(load_module+0x1eb4/0x27f0)
<4>[ 18.056641] [<c02cc4ec>] (load_module) from [<c02ccf50>]
(SyS_init_module+0x128/0x19c)
<4>[ 18.064623] [<c02ccf50>] (SyS_init_module) from [<c02085a0>]
(ret_fast_syscall+0x0/0x1c)
<6>[ 18.072890] brcm-systemport f04a0000.ethernet: Broadcom
SYSTEMPORTv 1.00 at 0xf0ca8000 (irqs: 64, 65, TXQs: 32, RXQs: 1)
You might also want to check the output of ethtool -S because now
tx_bytes and tx_packets is all zeroes.
I know we are not supposed to include netdev stats within ethtool, but
since it was done that way and ethtool is an user-facing/ABI, this needs
to keep working.
Thanks!
>
> Signed-off-by: Jianming.qiao <kiki-good@hotmail.com>
> ---
> drivers/net/ethernet/broadcom/bcmsysport.c | 68 ++++++++++++++++++++----------
> drivers/net/ethernet/broadcom/bcmsysport.h | 9 +++-
> 2 files changed, 52 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
> index 5333601..bb3cc7a 100644
> --- a/drivers/net/ethernet/broadcom/bcmsysport.c
> +++ b/drivers/net/ethernet/broadcom/bcmsysport.c
> @@ -662,6 +662,7 @@ static int bcm_sysport_alloc_rx_bufs(struct bcm_sysport_priv *priv)
> static unsigned int bcm_sysport_desc_rx(struct bcm_sysport_priv *priv,
> unsigned int budget)
> {
> + struct bcm_sysport_stats *stats64 = &priv->stats64;
> struct net_device *ndev = priv->netdev;
> unsigned int processed = 0, to_process;
> struct bcm_sysport_cb *cb;
> @@ -765,6 +766,10 @@ static unsigned int bcm_sysport_desc_rx(struct bcm_sysport_priv *priv,
> skb->protocol = eth_type_trans(skb, ndev);
> ndev->stats.rx_packets++;
> ndev->stats.rx_bytes += len;
> + u64_stats_update_begin(&stats64->syncp);
> + stats64->rx_packets++;
> + stats64->rx_bytes += len;
> + u64_stats_update_end(&stats64->syncp);
>
> napi_gro_receive(&priv->napi, skb);
> next:
> @@ -787,17 +792,15 @@ static void bcm_sysport_tx_reclaim_one(struct bcm_sysport_tx_ring *ring,
> struct device *kdev = &priv->pdev->dev;
>
> if (cb->skb) {
> - ring->bytes += cb->skb->len;
> *bytes_compl += cb->skb->len;
> dma_unmap_single(kdev, dma_unmap_addr(cb, dma_addr),
> dma_unmap_len(cb, dma_len),
> DMA_TO_DEVICE);
> - ring->packets++;
> (*pkts_compl)++;
> bcm_sysport_free_cb(cb);
> /* SKB fragment */
> } else if (dma_unmap_addr(cb, dma_addr)) {
> - ring->bytes += dma_unmap_len(cb, dma_len);
> + *bytes_compl += dma_unmap_len(cb, dma_len);
> dma_unmap_page(kdev, dma_unmap_addr(cb, dma_addr),
> dma_unmap_len(cb, dma_len), DMA_TO_DEVICE);
> dma_unmap_addr_set(cb, dma_addr, 0);
> @@ -808,9 +811,10 @@ static void bcm_sysport_tx_reclaim_one(struct bcm_sysport_tx_ring *ring,
> static unsigned int __bcm_sysport_tx_reclaim(struct bcm_sysport_priv *priv,
> struct bcm_sysport_tx_ring *ring)
> {
> - struct net_device *ndev = priv->netdev;
> unsigned int c_index, last_c_index, last_tx_cn, num_tx_cbs;
> + struct bcm_sysport_stats *stats64 = &priv->stats64;
> unsigned int pkts_compl = 0, bytes_compl = 0;
> + struct net_device *ndev = priv->netdev;
> struct bcm_sysport_cb *cb;
> u32 hw_ind;
>
> @@ -849,6 +853,11 @@ static unsigned int __bcm_sysport_tx_reclaim(struct bcm_sysport_priv *priv,
> last_c_index &= (num_tx_cbs - 1);
> }
>
> + u64_stats_update_begin(&stats64->syncp);
> + ring->packets += pkts_compl;
> + ring->bytes += bytes_compl;
> + u64_stats_update_end(&stats64->syncp);
> +
> ring->c_index = c_index;
>
> netif_dbg(priv, tx_done, ndev,
> @@ -1671,24 +1680,6 @@ static int bcm_sysport_change_mac(struct net_device *dev, void *p)
> return 0;
> }
>
> -static struct net_device_stats *bcm_sysport_get_nstats(struct net_device *dev)
> -{
> - struct bcm_sysport_priv *priv = netdev_priv(dev);
> - unsigned long tx_bytes = 0, tx_packets = 0;
> - struct bcm_sysport_tx_ring *ring;
> - unsigned int q;
> -
> - for (q = 0; q < dev->num_tx_queues; q++) {
> - ring = &priv->tx_rings[q];
> - tx_bytes += ring->bytes;
> - tx_packets += ring->packets;
> - }
> -
> - dev->stats.tx_bytes = tx_bytes;
> - dev->stats.tx_packets = tx_packets;
> - return &dev->stats;
> -}
> -
> static void bcm_sysport_netif_start(struct net_device *dev)
> {
> struct bcm_sysport_priv *priv = netdev_priv(dev);
> @@ -1923,6 +1914,37 @@ static int bcm_sysport_stop(struct net_device *dev)
> return 0;
> }
>
> +static void bcm_sysport_get_stats64(struct net_device *dev,
> + struct rtnl_link_stats64 *stats)
> +{
> + struct bcm_sysport_priv *priv = netdev_priv(dev);
> + struct bcm_sysport_stats *stats64 = &priv->stats64;
> + struct bcm_sysport_tx_ring *ring;
> + u64 tx_packets = 0, tx_bytes = 0;
> + unsigned int start;
> + unsigned int q;
> +
> + netdev_stats_to_stats64(stats, &dev->stats);
> +
> + for (q = 0; q < dev->num_tx_queues; q++) {
> + ring = &priv->tx_rings[q];
> + do {
> + start = u64_stats_fetch_begin_irq(&stats64->syncp);
> + tx_bytes = ring->bytes;
> + tx_packets = ring->packets;
> + } while (u64_stats_fetch_retry_irq(&stats64->syncp, start));
> +
> + stats->tx_bytes += tx_bytes;
> + stats->tx_packets += tx_packets;
> + }
> +
> + do {
> + start = u64_stats_fetch_begin_irq(&stats64->syncp);
> + stats->rx_packets = stats64->rx_packets;
> + stats->rx_bytes = stats64->rx_bytes;
> + } while (u64_stats_fetch_retry_irq(&stats64->syncp, start));
> +}
> +
> static const struct ethtool_ops bcm_sysport_ethtool_ops = {
> .get_drvinfo = bcm_sysport_get_drvinfo,
> .get_msglevel = bcm_sysport_get_msglvl,
> @@ -1950,7 +1972,7 @@ static int bcm_sysport_stop(struct net_device *dev)
> #ifdef CONFIG_NET_POLL_CONTROLLER
> .ndo_poll_controller = bcm_sysport_poll_controller,
> #endif
> - .ndo_get_stats = bcm_sysport_get_nstats,
> + .ndo_get_stats64 = bcm_sysport_get_stats64,
> };
>
> #define REV_FMT "v%2x.%02x"
> diff --git a/drivers/net/ethernet/broadcom/bcmsysport.h b/drivers/net/ethernet/broadcom/bcmsysport.h
> index 77a51c1..c03a176 100644
> --- a/drivers/net/ethernet/broadcom/bcmsysport.h
> +++ b/drivers/net/ethernet/broadcom/bcmsysport.h
> @@ -657,6 +657,9 @@ struct bcm_sysport_stats {
> enum bcm_sysport_stat_type type;
> /* reg offset from UMAC base for misc counters */
> u16 reg_offset;
> + u64 rx_packets;
> + u64 rx_bytes;
> + struct u64_stats_sync syncp;
> };
>
> /* Software house keeping helper structure */
> @@ -693,8 +696,8 @@ struct bcm_sysport_tx_ring {
> struct bcm_sysport_cb *cbs; /* Transmit control blocks */
> struct dma_desc *desc_cpu; /* CPU view of the descriptor */
> struct bcm_sysport_priv *priv; /* private context backpointer */
> - unsigned long packets; /* packets statistics */
> - unsigned long bytes; /* bytes statistics */
> + u64 packets; /* packets statistics */
> + u64 bytes; /* bytes statistics */
> };
>
> /* Driver private structure */
> @@ -743,5 +746,7 @@ struct bcm_sysport_priv {
>
> /* Ethtool */
> u32 msg_enable;
> + /* 64bit stats on 32bit/64bit Machine */
> + struct bcm_sysport_stats stats64;
> };
> #endif /* __BCM_SYSPORT_H */
>
--
Florian
^ permalink raw reply
* [RFC PATCH v2 2/2] net: ethernet: nb8800: Add suspend/resume support
From: Mason @ 2017-08-01 16:43 UTC (permalink / raw)
To: Florian Fainelli, David Miller, Mans Rullgard; +Cc: netdev, Linux ARM
In-Reply-To: <33d1ab47-6098-5e3f-8a3c-f72626d07113@free.fr>
Wrappers around nb8800_stop and nb8800_open.
---
drivers/net/ethernet/aurora/nb8800.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/aurora/nb8800.c b/drivers/net/ethernet/aurora/nb8800.c
index aa18ea25d91f..607064a6d7a1 100644
--- a/drivers/net/ethernet/aurora/nb8800.c
+++ b/drivers/net/ethernet/aurora/nb8800.c
@@ -1012,7 +1012,6 @@ static int nb8800_stop(struct net_device *dev)
netif_stop_queue(dev);
napi_disable(&priv->napi);
- nb8800_dma_stop(dev);
nb8800_mac_rx(dev, false);
nb8800_mac_tx(dev, false);
@@ -1526,6 +1525,26 @@ static int nb8800_remove(struct platform_device *pdev)
return 0;
}
+static int nb8800_suspend(struct platform_device *pdev, pm_message_t state)
+{
+ struct net_device *dev = platform_get_drvdata(pdev);
+
+ if (netif_running(dev))
+ nb8800_stop(dev);
+
+ return 0;
+}
+
+static int nb8800_resume(struct platform_device *pdev)
+{
+ struct net_device *dev = platform_get_drvdata(pdev);
+
+ if (netif_running(dev))
+ nb8800_open(dev);
+
+ return 0;
+}
+
static struct platform_driver nb8800_driver = {
.driver = {
.name = "nb8800",
@@ -1533,6 +1552,8 @@ static struct platform_driver nb8800_driver = {
},
.probe = nb8800_probe,
.remove = nb8800_remove,
+ .suspend = nb8800_suspend,
+ .resume = nb8800_resume,
};
module_platform_driver(nb8800_driver);
--
2.11.0
^ permalink raw reply related
* [RFC PATCH v2 1/2] net: ethernet: nb8800: Reset HW block in ndo_open
From: Mason @ 2017-08-01 16:37 UTC (permalink / raw)
To: Florian Fainelli, David Miller, Mans Rullgard; +Cc: netdev, Linux ARM
In-Reply-To: <33d1ab47-6098-5e3f-8a3c-f72626d07113@free.fr>
Move all HW initializations to nb8800_init.
This provides the basis for suspend/resume support.
---
drivers/net/ethernet/aurora/nb8800.c | 50 +++++++++++++++++-------------------
drivers/net/ethernet/aurora/nb8800.h | 1 +
2 files changed, 25 insertions(+), 26 deletions(-)
diff --git a/drivers/net/ethernet/aurora/nb8800.c b/drivers/net/ethernet/aurora/nb8800.c
index e94159507847..aa18ea25d91f 100644
--- a/drivers/net/ethernet/aurora/nb8800.c
+++ b/drivers/net/ethernet/aurora/nb8800.c
@@ -39,6 +39,7 @@
#include "nb8800.h"
+static void nb8800_init(struct net_device *dev);
static void nb8800_tx_done(struct net_device *dev);
static int nb8800_dma_stop(struct net_device *dev);
@@ -957,6 +958,8 @@ static int nb8800_open(struct net_device *dev)
struct phy_device *phydev;
int err;
+ nb8800_init(dev);
+
/* clear any pending interrupts */
nb8800_writel(priv, NB8800_RXC_SR, 0xf);
nb8800_writel(priv, NB8800_TXC_SR, 0xf);
@@ -1246,11 +1249,6 @@ static int nb8800_hw_init(struct net_device *dev)
nb8800_writeb(priv, NB8800_PQ1, val >> 8);
nb8800_writeb(priv, NB8800_PQ2, val & 0xff);
- /* Auto-negotiate by default */
- priv->pause_aneg = true;
- priv->pause_rx = true;
- priv->pause_tx = true;
-
nb8800_mc_init(dev, 0);
return 0;
@@ -1350,6 +1348,20 @@ static const struct of_device_id nb8800_dt_ids[] = {
};
MODULE_DEVICE_TABLE(of, nb8800_dt_ids);
+static void nb8800_init(struct net_device *dev)
+{
+ struct nb8800_priv *priv = netdev_priv(dev);
+ const struct nb8800_ops *ops = priv->ops;
+
+ if (ops && ops->reset)
+ ops->reset(dev);
+ nb8800_hw_init(dev);
+ if (ops && ops->init)
+ ops->init(dev);
+ nb8800_update_mac_addr(dev);
+ priv->speed = 0;
+}
+
static int nb8800_probe(struct platform_device *pdev)
{
const struct of_device_id *match;
@@ -1389,6 +1401,7 @@ static int nb8800_probe(struct platform_device *pdev)
priv = netdev_priv(dev);
priv->base = base;
+ priv->ops = ops;
priv->phy_mode = of_get_phy_mode(pdev->dev.of_node);
if (priv->phy_mode < 0)
@@ -1407,12 +1420,6 @@ static int nb8800_probe(struct platform_device *pdev)
spin_lock_init(&priv->tx_lock);
- if (ops && ops->reset) {
- ret = ops->reset(dev);
- if (ret)
- goto err_disable_clk;
- }
-
bus = devm_mdiobus_alloc(&pdev->dev);
if (!bus) {
ret = -ENOMEM;
@@ -1454,21 +1461,16 @@ static int nb8800_probe(struct platform_device *pdev)
priv->mii_bus = bus;
- ret = nb8800_hw_init(dev);
- if (ret)
- goto err_deregister_fixed_link;
-
- if (ops && ops->init) {
- ret = ops->init(dev);
- if (ret)
- goto err_deregister_fixed_link;
- }
-
dev->netdev_ops = &nb8800_netdev_ops;
dev->ethtool_ops = &nb8800_ethtool_ops;
dev->flags |= IFF_MULTICAST;
dev->irq = irq;
+ /* Auto-negotiate by default */
+ priv->pause_aneg = true;
+ priv->pause_rx = true;
+ priv->pause_tx = true;
+
mac = of_get_mac_address(pdev->dev.of_node);
if (mac)
ether_addr_copy(dev->dev_addr, mac);
@@ -1476,14 +1478,12 @@ static int nb8800_probe(struct platform_device *pdev)
if (!is_valid_ether_addr(dev->dev_addr))
eth_hw_addr_random(dev);
- nb8800_update_mac_addr(dev);
-
netif_carrier_off(dev);
ret = register_netdev(dev);
if (ret) {
netdev_err(dev, "failed to register netdev\n");
- goto err_free_dma;
+ goto err_deregister_fixed_link;
}
netif_napi_add(dev, &priv->napi, nb8800_poll, NAPI_POLL_WEIGHT);
@@ -1492,8 +1492,6 @@ static int nb8800_probe(struct platform_device *pdev)
return 0;
-err_free_dma:
- nb8800_dma_free(dev);
err_deregister_fixed_link:
if (of_phy_is_fixed_link(pdev->dev.of_node))
of_phy_deregister_fixed_link(pdev->dev.of_node);
diff --git a/drivers/net/ethernet/aurora/nb8800.h b/drivers/net/ethernet/aurora/nb8800.h
index 6ec4a956e1e5..d5f4481a2c7b 100644
--- a/drivers/net/ethernet/aurora/nb8800.h
+++ b/drivers/net/ethernet/aurora/nb8800.h
@@ -305,6 +305,7 @@ struct nb8800_priv {
dma_addr_t tx_desc_dma;
struct clk *clk;
+ const struct nb8800_ops *ops;
};
struct nb8800_ops {
--
2.11.0
^ permalink raw reply related
* [RFC PATCH v2 0/2] nb8800 suspend/resume support
From: Mason @ 2017-08-01 16:32 UTC (permalink / raw)
To: Florian Fainelli, David Miller, Mans Rullgard; +Cc: netdev, Linux ARM
Hello,
I need suspend/resume support in the nb8800 driver.
On tango platforms, suspend loses all context (MMIO registers).
To make the task easy, we just close the device on suspend,
and open it again on resume. This requires properly resetting
the HW on resume.
Patch 1 moves all the HW init to nb8800_init()
Patch 2 adds suspend/resume support
Regards.
^ permalink raw reply
* [iproute PATCH] Really fix get_addr() and get_prefix() error messages
From: Phil Sutter @ 2017-08-01 16:36 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
Both functions take the desired address family as a parameter. So using
that to notify the user what address family was expected is correct,
unlike using dst->family which will tell the user only what address
family was specified.
The situation which commit 334af76143368 tried to fix was when 'ip'
would accept addresses from multiple families. In that case, the family
parameter is set to AF_UNSPEC so that get_addr_1() may accept any valid
address.
This patch introduces a wrapper around family_name() which returns the
string "any valid" for AF_UNSPEC instead of the three question marks
unsuitable for use in error messages.
Tests for AF_UNSPEC:
| # ip a a 256.10.166.1/24 dev d0
| Error: any valid prefix is expected rather than "256.10.166.1/24".
| # ip neighbor add proxy 2001:db8::g dev d0
| Error: any valid address is expected rather than "2001:db8::g".
Tests for explicit address family:
| # ip -6 addrlabel add prefix 1.1.1.1/24 label 123
| Error: inet6 prefix is expected rather than "1.1.1.1/24".
| # ip -4 addrlabel add prefix dead:beef::1/24 label 123
| Error: inet prefix is expected rather than "dead:beef::1/24".
Reported-by: Jaroslav Aster <jaster@redhat.com>
Fixes: 334af76143368 ("fix get_addr() and get_prefix() error messages")
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
lib/utils.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/lib/utils.c b/lib/utils.c
index 9aa3219c5547d..9143ed2284870 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -616,12 +616,19 @@ done:
return err;
}
+static const char *family_name_verbose(int family)
+{
+ if (family == AF_UNSPEC)
+ return "any valid";
+ return family_name(family);
+}
+
int get_addr(inet_prefix *dst, const char *arg, int family)
{
if (get_addr_1(dst, arg, family)) {
fprintf(stderr,
"Error: %s address is expected rather than \"%s\".\n",
- family_name(dst->family), arg);
+ family_name_verbose(family), arg);
exit(1);
}
return 0;
@@ -639,7 +646,7 @@ int get_prefix(inet_prefix *dst, char *arg, int family)
if (get_prefix_1(dst, arg, family)) {
fprintf(stderr,
"Error: %s prefix is expected rather than \"%s\".\n",
- family_name(dst->family), arg);
+ family_name_verbose(family), arg);
exit(1);
}
return 0;
--
2.13.1
^ permalink raw reply related
* Re: [PATCH net-next 10/11] net: dsa: mv88e6xxx: remove EEE support
From: Vivien Didelot @ 2017-08-01 16:34 UTC (permalink / raw)
To: Andrew Lunn
Cc: netdev, linux-kernel, kernel, David S. Miller, Florian Fainelli
In-Reply-To: <20170801160628.GJ23157@lunn.ch>
Hi Andrew,
Andrew Lunn <andrew@lunn.ch> writes:
>> >> The PHY's EEE settings are already accessed by the DSA layer through the
>> >> Marvell PHY driver and there is nothing to be done for switch's MACs.
>> >
>> > I'm confused, or missing something. Does not patch #1 mean that if the
>> > DSA driver does not have a set_eee function, we always return -ENODEV
>> > in slave.c?
>>
>> If there is a PHY, phy_init_eee (if eee_enabled is true) and
>> phy_ethtool_set_eee is called. If there is a .set_eee op, it is
>> called. If both are absent, -ENODEV is returned.
>
> O.K, i don't think that is correct. EEE should only be enabled if both
> the MAC and the PHY supports it. We need some way for the MAC to
> indicate it does not support EEE.
>
> If set_eee is optional the meaning of a NULL pointer is that the MAC
> does support EEE. So for mv88e6060, lan9303, microchip and mt7530
> which currently don't support EEE, you need to add a set_eee which
> returns -ENODEV.
>
> Having to implement the op to say you don't implement the feature just
> seems wrong.
Agreed, above I simply described how this patchset currently behaves.
I suggested in the previous mail to define a DSA noop so that the driver
can indicate that its MACs supports EEE, even though there's nothing to
do (and the DSA layer can learn about that):
static inline int dsa_set_mac_eee_noop(struct dsa_switch *ds,
int port,
struct ethtool_eee *e)
{
dev_dbg(ds->dev, "nothing to do for port %d's MAC\n", port);
return 0;
}
(and the respective dsa_get_mac_eee_noop() for sure.)
Second option is: we keep it KISS and let the driver define its noop,
but as I explain, it is confusion, especially for the get operation.
Thanks,
Vivien
^ permalink raw reply
* Re: [PATCH net-next 10/11] net: dsa: mv88e6xxx: remove EEE support
From: Florian Fainelli @ 2017-08-01 16:33 UTC (permalink / raw)
To: Andrew Lunn, Vivien Didelot; +Cc: netdev, linux-kernel, kernel, David S. Miller
In-Reply-To: <20170801160628.GJ23157@lunn.ch>
On 08/01/2017 09:06 AM, Andrew Lunn wrote:
> On Tue, Aug 01, 2017 at 11:36:13AM -0400, Vivien Didelot wrote:
>> Hi Andrew,
>>
>> Andrew Lunn <andrew@lunn.ch> writes:
>>
>>> On Mon, Jul 31, 2017 at 06:17:18PM -0400, Vivien Didelot wrote:
>>>> The PHY's EEE settings are already accessed by the DSA layer through the
>>>> Marvell PHY driver and there is nothing to be done for switch's MACs.
>>>
>>> I'm confused, or missing something. Does not patch #1 mean that if the
>>> DSA driver does not have a set_eee function, we always return -ENODEV
>>> in slave.c?
>>
>> If there is a PHY, phy_init_eee (if eee_enabled is true) and
>> phy_ethtool_set_eee is called. If there is a .set_eee op, it is
>> called. If both are absent, -ENODEV is returned.
>
> O.K, i don't think that is correct. EEE should only be enabled if both
> the MAC and the PHY supports it. We need some way for the MAC to
> indicate it does not support EEE.
If the MAC does not support EEE but the PHY does I think you can still
allow EEE to be advertised and enabled, you just won't have the MAC be
able to leverage the power savings that EEE brings. AFAICT this is still
a valid mode whereby the PHY is put in a lower power mode, just not the
whole transmit path (MAC + PHY).
>
> If set_eee is optional the meaning of a NULL pointer is that the MAC
> does support EEE. So for mv88e6060, lan9303, microchip and mt7530
> which currently don't support EEE, you need to add a set_eee which
> returns -ENODEV.
>
> Having to implement the op to say you don't implement the feature just
> seems wrong.
If it is truly optional then we can either request drivers to implement
it and return something agreed upon, or just not implementing it means
we might be able to do EEE only at the PHY level.
--
Florian
^ permalink raw reply
* Re: [PATCH net-next] net: bcmgenet: drop COMPILE_TEST dependency
From: Florian Fainelli @ 2017-08-01 16:32 UTC (permalink / raw)
To: Arnd Bergmann, David S. Miller
Cc: Michael Chan, Sathya Perla, netdev, linux-kernel
In-Reply-To: <20170801115121.1246540-1-arnd@arndb.de>
On 08/01/2017 04:50 AM, Arnd Bergmann wrote:
> The last patch added the dependency on 'OF && HAS_IOMEM' but left
> COMPILE_TEST as an alternative, which kind of defeats the purpose
> of adding the dependency, we still get randconfig build warnings:
>
> warning: (NET_DSA_BCM_SF2 && BCMGENET) selects MDIO_BCM_UNIMAC which has unmet direct dependencies (NETDEVICES && MDIO_BUS && HAS_IOMEM && OF_MDIO)
>
> For compile-testing purposes, we don't really need this anyway,
> as CONFIG_OF can be enabled on all architectures, and HAS_IOMEM
> is present on all architectures we do meaningful compile-testing on
> (the exception being arch/um).
>
> This makes both OF and HAS_IOMEM hard dependencies.
>
> Fixes: 5af74bb4fcf8 ("net: bcmgenet: Add dependency on HAS_IOMEM && OF")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Thanks!
--
Florian
^ permalink raw reply
* [PATCH 2/2] Revert "l2tp: constify inet6_protocol structures"
From: Julia Lawall @ 2017-08-01 16:27 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, David Ahern
Cc: kernel-janitors, bhumirks, netdev, linux-kernel
In-Reply-To: <1501604849-19443-1-git-send-email-Julia.Lawall@lip6.fr>
This reverts commit d04916a48ad4a3db892b664fa9c3a2a693c378ad.
inet6_add_protocol and inet6_del_protocol include casts that remove the
effect of the const annotation on their parameter, leading to possible
runtime crashes.
Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
net/l2tp/l2tp_ip6.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c
index d2efcd9..88b397c 100644
--- a/net/l2tp/l2tp_ip6.c
+++ b/net/l2tp/l2tp_ip6.c
@@ -788,7 +788,7 @@ static int l2tp_ip6_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
.ops = &l2tp_ip6_ops,
};
-static const struct inet6_protocol l2tp_ip6_protocol = {
+static struct inet6_protocol l2tp_ip6_protocol __read_mostly = {
.handler = l2tp_ip6_recv,
};
^ permalink raw reply related
* [PATCH 1/2] Revert "ipv6: constify inet6_protocol structures"
From: Julia Lawall @ 2017-08-01 16:27 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, David Ahern
Cc: kernel-janitors, bhumirks, Alexey Kuznetsov, Hideaki YOSHIFUJI,
netdev, linux-kernel
In-Reply-To: <1501604849-19443-1-git-send-email-Julia.Lawall@lip6.fr>
This reverts commit 3a3a4e3054137c5ff5d4d306ec834f6d25d7f95b.
inet6_add_protocol and inet6_del_protocol include casts that remove the
effect of the const annotation on their parameter, leading to possible
runtime crashes.
Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
net/ipv6/ip6_gre.c | 2 +-
net/ipv6/tcp_ipv6.c | 2 +-
net/ipv6/udp.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 33865d6..67ff2aa 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -1080,7 +1080,7 @@ static void ip6gre_fb_tunnel_init(struct net_device *dev)
}
-static const struct inet6_protocol ip6gre_protocol = {
+static struct inet6_protocol ip6gre_protocol __read_mostly = {
.handler = gre_rcv,
.err_handler = ip6gre_err,
.flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL,
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 39ee8e7..ced5dcf 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1944,7 +1944,7 @@ struct proto tcpv6_prot = {
.diag_destroy = tcp_abort,
};
-static const struct inet6_protocol tcpv6_protocol = {
+static struct inet6_protocol tcpv6_protocol = {
.early_demux = tcp_v6_early_demux,
.early_demux_handler = tcp_v6_early_demux,
.handler = tcp_v6_rcv,
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 7e6d7f5..98fe456 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -1457,7 +1457,7 @@ int compat_udpv6_getsockopt(struct sock *sk, int level, int optname,
}
#endif
-static const struct inet6_protocol udpv6_protocol = {
+static struct inet6_protocol udpv6_protocol = {
.early_demux = udp_v6_early_demux,
.early_demux_handler = udp_v6_early_demux,
.handler = udpv6_rcv,
^ permalink raw reply related
* [PATCH 0/2] Revert "ipv6: constify inet6_protocol structures"
From: Julia Lawall @ 2017-08-01 16:27 UTC (permalink / raw)
To: David S. Miller; +Cc: kernel-janitors, bhumirks, netdev, linux-kernel
inet6_add_protocol and inet6_del_protocol include casts that remove the
effect of the const annotation on their parameter, leading to possible
runtime crashes.
^ permalink raw reply
* Re: [PATCH v3] ss: Enclose IPv6 address in brackets
From: Florian Lehner @ 2017-08-01 16:07 UTC (permalink / raw)
To: Phil Sutter, netdev
In-Reply-To: <20170801141112.GZ16375@orbyte.nwl.cc>
On 08/01/2017 04:11 PM, Phil Sutter wrote:
> On Tue, Aug 01, 2017 at 12:05:13PM +0200, Florian Lehner wrote:
> [...]
>> @@ -114,9 +114,13 @@ int addr64_n2a(__u64 addr, char *buff, size_t len);
>> int af_bit_len(int af);
>> int af_byte_len(int af);
>>
>> -const char *format_host_r(int af, int len, const void *addr,
>> - char *buf, int buflen);
>> -const char *format_host(int af, int lne, const void *addr);
>> +const char *format_host_rb(int af, int len, const void *addr,
>> + char *buf, int buflen, bool *resolved);
>> +#define format_host_r(af, len, addr, buf, buflen) \
>> + format_host_rb(af, len, addr, buf, buflen, NULL)
>> +const char *format_host_b(int af, int lne, const void *addr, bool
>> *resolved);
>> +#define format_host(af, lne, addr) \
>> + format_host_b(af, lne, addr, NULL)
>> #define format_host_rta(af, rta) \
>> format_host(af, RTA_PAYLOAD(rta), RTA_DATA(rta))
>> const char *rt_addr_n2a_r(int af, int len, const void *addr,
>> diff --git a/lib/utils.c b/lib/utils.c
>> index 9aa3219..42c3bf5 100644
>> --- a/lib/utils.c
>> +++ b/lib/utils.c
>> @@ -898,8 +898,8 @@ static const char *resolve_address(const void *addr,
>> int len, int af)
>> }
>> #endif
>>
>> -const char *format_host_r(int af, int len, const void *addr,
>> - char *buf, int buflen)
>> +const char *format_host_rb(int af, int len, const void *addr,
>> + char *buf, int buflen, bool *resolved)
>> {
>> #ifdef RESOLVE_HOSTNAMES
>> if (resolve_hosts) {
>> @@ -909,17 +909,20 @@ const char *format_host_r(int af, int len, const
>> void *addr,
>>
>> if (len > 0 &&
>> (n = resolve_address(addr, len, af)) != NULL)
>> + {
>> + *resolved = true;
>> return n;
>> + }
>> }
>> #endif
>> return rt_addr_n2a_r(af, len, addr, buf, buflen);
>> }
>
> Did you test that? I guess calling format_host() will lead to
> dereference of a NULL pointer.
Yes, I did. And it just worked.
David Laight suggested to use strchr(). Instead of changing stuff in
lib/* I will try this.
^ permalink raw reply
* Re: [PATCH 1/2] ipv6: constify inet6_protocol structures
From: Julia Lawall @ 2017-08-01 16:06 UTC (permalink / raw)
To: David Ahern; +Cc: Eric Dumazet, David S. Miller, bhumirks, netdev
In-Reply-To: <63118b71-c196-efcd-0700-7c7c0025c577@gmail.com>
On Tue, 1 Aug 2017, David Ahern wrote:
> On 7/31/17 11:59 PM, Julia Lawall wrote:
> >> This change breaks the kernel if one of these sysctls are changed:
> >> tcp_early_demux, udp_early_demux
> >
> > The other patch in the series has the same problem and should be dropped
> > too.
> >
> > julia
>
> Julia: are you going to send a revert patch? Right now I have to do that
> manually before launching test scripts.
Sorry, I didn't know it was applied. I can send it.
julia
^ permalink raw reply
* Re: [PATCH net-next 10/11] net: dsa: mv88e6xxx: remove EEE support
From: Andrew Lunn @ 2017-08-01 16:06 UTC (permalink / raw)
To: Vivien Didelot
Cc: netdev, linux-kernel, kernel, David S. Miller, Florian Fainelli
In-Reply-To: <87r2wv2tci.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me>
On Tue, Aug 01, 2017 at 11:36:13AM -0400, Vivien Didelot wrote:
> Hi Andrew,
>
> Andrew Lunn <andrew@lunn.ch> writes:
>
> > On Mon, Jul 31, 2017 at 06:17:18PM -0400, Vivien Didelot wrote:
> >> The PHY's EEE settings are already accessed by the DSA layer through the
> >> Marvell PHY driver and there is nothing to be done for switch's MACs.
> >
> > I'm confused, or missing something. Does not patch #1 mean that if the
> > DSA driver does not have a set_eee function, we always return -ENODEV
> > in slave.c?
>
> If there is a PHY, phy_init_eee (if eee_enabled is true) and
> phy_ethtool_set_eee is called. If there is a .set_eee op, it is
> called. If both are absent, -ENODEV is returned.
O.K, i don't think that is correct. EEE should only be enabled if both
the MAC and the PHY supports it. We need some way for the MAC to
indicate it does not support EEE.
If set_eee is optional the meaning of a NULL pointer is that the MAC
does support EEE. So for mv88e6060, lan9303, microchip and mt7530
which currently don't support EEE, you need to add a set_eee which
returns -ENODEV.
Having to implement the op to say you don't implement the feature just
seems wrong.
Andrew
^ permalink raw reply
* Re: [PATCH 1/2] ipv6: constify inet6_protocol structures
From: David Ahern @ 2017-08-01 16:03 UTC (permalink / raw)
To: Julia Lawall, Eric Dumazet; +Cc: David S. Miller, bhumirks, netdev
In-Reply-To: <alpine.DEB.2.20.1708010759050.2671@hadrien>
On 7/31/17 11:59 PM, Julia Lawall wrote:
>> This change breaks the kernel if one of these sysctls are changed:
>> tcp_early_demux, udp_early_demux
>
> The other patch in the series has the same problem and should be dropped
> too.
>
> julia
Julia: are you going to send a revert patch? Right now I have to do that
manually before launching test scripts.
^ permalink raw reply
* [PATCH iproute2] netns: make /var/run/netns bind-mount recursive
From: Casey Callendrello @ 2017-08-01 15:46 UTC (permalink / raw)
To: netdev, stephen
When ip netns {add|delete} is first run, it bind-mounts /var/run/netns
on top of itself, then marks it as shared. However, if there are already
bind-mounts in the directory from other tools, these would not be
propagated. Fix this by recursively bind-mounting.
Signed-off-by: Casey Callendrello <casey.callendrello@coreos.com>
---
ip/ipnetns.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ip/ipnetns.c b/ip/ipnetns.c
index 198e9de8..9ee1fe6a 100644
--- a/ip/ipnetns.c
+++ b/ip/ipnetns.c
@@ -636,7 +636,7 @@ static int netns_add(int argc, char **argv)
}
/* Upgrade NETNS_RUN_DIR to a mount point */
- if (mount(NETNS_RUN_DIR, NETNS_RUN_DIR, "none", MS_BIND, NULL)) {
+ if (mount(NETNS_RUN_DIR, NETNS_RUN_DIR, "none", MS_BIND | MS_REC, NULL)) {
fprintf(stderr, "mount --bind %s %s failed: %s\n",
NETNS_RUN_DIR, NETNS_RUN_DIR, strerror(errno));
return -1;
--
2.13.3
^ permalink raw reply related
* [PATCH 2/2] usb: qmi_wwan: add D-Link DWM-222 device ID
From: Hector Martin @ 2017-08-01 15:45 UTC (permalink / raw)
To: bjorn; +Cc: netdev, linux-usb, linux-kernel, Hector Martin, stable
Cc: stable@vger.kernel.org
Signed-off-by: Hector Martin <marcan@marcan.st>
---
drivers/net/usb/qmi_wwan.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 5894e3c9468f..ff6f39fe6c00 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -1175,6 +1175,7 @@ static const struct usb_device_id products[] = {
{QMI_FIXED_INTF(0x19d2, 0x1428, 2)}, /* Telewell TW-LTE 4G v2 */
{QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */
{QMI_FIXED_INTF(0x2001, 0x7e19, 4)}, /* D-Link DWM-221 B1 */
+ {QMI_FIXED_INTF(0x2001, 0x7e35, 4)}, /* D-Link DWM-222 */
{QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */
{QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */
{QMI_FIXED_INTF(0x1199, 0x68a2, 8)}, /* Sierra Wireless MC7710 in QMI mode */
--
2.13.3
^ permalink raw reply related
* [PATCH iproute2 v2] ip: change flag names to an array
From: Stephen Hemminger @ 2017-08-01 15:38 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger
For the most of the address flags, use a table of values rather
than open coding every value. This allows for easier inevitable
expansion of flags.
This also fixes the missing stable-privacy flag.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
v2 - use name/value table rather than assuming order
handle negative masks "-deprecated"
ip/ipaddress.c | 184 ++++++++++++++++++++++++++++-----------------------------
1 file changed, 89 insertions(+), 95 deletions(-)
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index cf8ef8186f52..4d37c5e04507 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -1012,14 +1012,95 @@ static unsigned int get_ifa_flags(struct ifaddrmsg *ifa,
ifa->ifa_flags;
}
+/* Mapping from argument to address flag mask */
+struct {
+ const char *name;
+ unsigned long value;
+} ifa_flag_names[] = {
+ { "secondary", IFA_F_SECONDARY },
+ { "temporary", IFA_F_SECONDARY },
+ { "nodad", IFA_F_NODAD },
+ { "optimistic", IFA_F_OPTIMISTIC },
+ { "dadfailed", IFA_F_DADFAILED },
+ { "home", IFA_F_HOMEADDRESS },
+ { "deprecated", IFA_F_DEPRECATED },
+ { "tentative", IFA_F_TENTATIVE },
+ { "permanent", IFA_F_PERMANENT },
+ { "mngtmpaddr", IFA_F_MANAGETEMPADDR },
+ { "noprefixroute", IFA_F_NOPREFIXROUTE },
+ { "autojoin", IFA_F_MCAUTOJOIN },
+ { "stable-privacy", IFA_F_STABLE_PRIVACY },
+};
+
+static void print_ifa_flags(FILE *fp, const struct ifaddrmsg *ifa,
+ unsigned int flags)
+{
+ unsigned int i;
+
+ for (i = 0; i < ARRAY_SIZE(ifa_flag_names); i++) {
+ unsigned long mask = ifa_flag_names[i].value;
+
+ if (mask == IFA_F_PERMANENT) {
+ if (!(flags & mask))
+ fprintf(fp, "dynamic ");
+ } else if (flags & mask) {
+ if (mask == IFA_F_SECONDARY &&
+ ifa->ifa_family == AF_INET6)
+ fprintf(fp, "temporary ");
+ else
+ fprintf(fp, "%s ", ifa_flag_names[i].name);
+ }
+
+ flags &= ~mask;
+ }
+
+ if (flags)
+ fprintf(fp, "flags %02x ", flags);
+
+}
+
+static int get_filter(const char *arg)
+{
+ unsigned int i;
+
+ /* Special cases */
+ if (strcmp(arg, "dynamic") == 0) {
+ filter.flags &= ~IFA_F_PERMANENT;
+ filter.flagmask |= IFA_F_PERMANENT;
+ } else if (strcmp(arg, "primary") == 0) {
+ filter.flags &= ~IFA_F_SECONDARY;
+ filter.flagmask |= IFA_F_SECONDARY;
+ } else if (*arg == '-') {
+ for (i = 0; i < ARRAY_SIZE(ifa_flag_names); i++) {
+ if (strcmp(arg + 1, ifa_flag_names[i].name))
+ continue;
+
+ filter.flags &= ifa_flag_names[i].value;
+ filter.flagmask |= ifa_flag_names[i].value;
+ return 0;
+ }
+
+ return -1;
+ } else {
+ for (i = 0; i < ARRAY_SIZE(ifa_flag_names); i++) {
+ if (strcmp(arg, ifa_flag_names[i].name))
+ continue;
+ filter.flags |= ifa_flag_names[i].value;
+ filter.flagmask |= ifa_flag_names[i].value;
+ return 0;
+ }
+ return -1;
+ }
+
+ return 0;
+}
+
int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
void *arg)
{
FILE *fp = arg;
struct ifaddrmsg *ifa = NLMSG_DATA(n);
int len = n->nlmsg_len;
- int deprecated = 0;
- /* Use local copy of ifa_flags to not interfere with filtering code */
unsigned int ifa_flags;
struct rtattr *rta_tb[IFA_MAX+1];
@@ -1144,52 +1225,9 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
rta_tb[IFA_ANYCAST]));
}
fprintf(fp, "scope %s ", rtnl_rtscope_n2a(ifa->ifa_scope, b1, sizeof(b1)));
- if (ifa_flags & IFA_F_SECONDARY) {
- ifa_flags &= ~IFA_F_SECONDARY;
- if (ifa->ifa_family == AF_INET6)
- fprintf(fp, "temporary ");
- else
- fprintf(fp, "secondary ");
- }
- if (ifa_flags & IFA_F_TENTATIVE) {
- ifa_flags &= ~IFA_F_TENTATIVE;
- fprintf(fp, "tentative ");
- }
- if (ifa_flags & IFA_F_DEPRECATED) {
- ifa_flags &= ~IFA_F_DEPRECATED;
- deprecated = 1;
- fprintf(fp, "deprecated ");
- }
- if (ifa_flags & IFA_F_HOMEADDRESS) {
- ifa_flags &= ~IFA_F_HOMEADDRESS;
- fprintf(fp, "home ");
- }
- if (ifa_flags & IFA_F_NODAD) {
- ifa_flags &= ~IFA_F_NODAD;
- fprintf(fp, "nodad ");
- }
- if (ifa_flags & IFA_F_MANAGETEMPADDR) {
- ifa_flags &= ~IFA_F_MANAGETEMPADDR;
- fprintf(fp, "mngtmpaddr ");
- }
- if (ifa_flags & IFA_F_NOPREFIXROUTE) {
- ifa_flags &= ~IFA_F_NOPREFIXROUTE;
- fprintf(fp, "noprefixroute ");
- }
- if (ifa_flags & IFA_F_MCAUTOJOIN) {
- ifa_flags &= ~IFA_F_MCAUTOJOIN;
- fprintf(fp, "autojoin ");
- }
- if (!(ifa_flags & IFA_F_PERMANENT))
- fprintf(fp, "dynamic ");
- else
- ifa_flags &= ~IFA_F_PERMANENT;
- if (ifa_flags & IFA_F_DADFAILED) {
- ifa_flags &= ~IFA_F_DADFAILED;
- fprintf(fp, "dadfailed ");
- }
- if (ifa_flags)
- fprintf(fp, "flags %02x ", ifa_flags);
+
+ print_ifa_flags(fp, ifa, ifa_flags);
+
if (rta_tb[IFA_LABEL])
fprintf(fp, "%s", rta_getattr_str(rta_tb[IFA_LABEL]));
if (rta_tb[IFA_CACHEINFO]) {
@@ -1205,7 +1243,7 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
if (ci->ifa_prefered == INFINITY_LIFE_TIME)
fprintf(fp, "forever");
else {
- if (deprecated)
+ if (ifa_flags & IFA_F_DEPRECATED)
fprintf(fp, "%dsec", ci->ifa_prefered);
else
fprintf(fp, "%usec", ci->ifa_prefered);
@@ -1608,52 +1646,8 @@ static int ipaddr_list_flush_or_save(int argc, char **argv, int action)
filter.scope = scope;
} else if (strcmp(*argv, "up") == 0) {
filter.up = 1;
- } else if (strcmp(*argv, "dynamic") == 0) {
- filter.flags &= ~IFA_F_PERMANENT;
- filter.flagmask |= IFA_F_PERMANENT;
- } else if (strcmp(*argv, "permanent") == 0) {
- filter.flags |= IFA_F_PERMANENT;
- filter.flagmask |= IFA_F_PERMANENT;
- } else if (strcmp(*argv, "secondary") == 0 ||
- strcmp(*argv, "temporary") == 0) {
- filter.flags |= IFA_F_SECONDARY;
- filter.flagmask |= IFA_F_SECONDARY;
- } else if (strcmp(*argv, "primary") == 0) {
- filter.flags &= ~IFA_F_SECONDARY;
- filter.flagmask |= IFA_F_SECONDARY;
- } else if (strcmp(*argv, "tentative") == 0) {
- filter.flags |= IFA_F_TENTATIVE;
- filter.flagmask |= IFA_F_TENTATIVE;
- } else if (strcmp(*argv, "-tentative") == 0) {
- filter.flags &= ~IFA_F_TENTATIVE;
- filter.flagmask |= IFA_F_TENTATIVE;
- } else if (strcmp(*argv, "deprecated") == 0) {
- filter.flags |= IFA_F_DEPRECATED;
- filter.flagmask |= IFA_F_DEPRECATED;
- } else if (strcmp(*argv, "-deprecated") == 0) {
- filter.flags &= ~IFA_F_DEPRECATED;
- filter.flagmask |= IFA_F_DEPRECATED;
- } else if (strcmp(*argv, "home") == 0) {
- filter.flags |= IFA_F_HOMEADDRESS;
- filter.flagmask |= IFA_F_HOMEADDRESS;
- } else if (strcmp(*argv, "nodad") == 0) {
- filter.flags |= IFA_F_NODAD;
- filter.flagmask |= IFA_F_NODAD;
- } else if (strcmp(*argv, "mngtmpaddr") == 0) {
- filter.flags |= IFA_F_MANAGETEMPADDR;
- filter.flagmask |= IFA_F_MANAGETEMPADDR;
- } else if (strcmp(*argv, "noprefixroute") == 0) {
- filter.flags |= IFA_F_NOPREFIXROUTE;
- filter.flagmask |= IFA_F_NOPREFIXROUTE;
- } else if (strcmp(*argv, "autojoin") == 0) {
- filter.flags |= IFA_F_MCAUTOJOIN;
- filter.flagmask |= IFA_F_MCAUTOJOIN;
- } else if (strcmp(*argv, "dadfailed") == 0) {
- filter.flags |= IFA_F_DADFAILED;
- filter.flagmask |= IFA_F_DADFAILED;
- } else if (strcmp(*argv, "-dadfailed") == 0) {
- filter.flags &= ~IFA_F_DADFAILED;
- filter.flagmask |= IFA_F_DADFAILED;
+ } else if (get_filter(*argv) == 0) {
+
} else if (strcmp(*argv, "label") == 0) {
NEXT_ARG();
filter.label = *argv;
--
2.11.0
^ permalink raw reply related
* Re: [PATCH net-next 10/11] net: dsa: mv88e6xxx: remove EEE support
From: Vivien Didelot @ 2017-08-01 15:36 UTC (permalink / raw)
To: Andrew Lunn
Cc: netdev, linux-kernel, kernel, David S. Miller, Florian Fainelli
In-Reply-To: <20170801142843.GE23157@lunn.ch>
Hi Andrew,
Andrew Lunn <andrew@lunn.ch> writes:
> On Mon, Jul 31, 2017 at 06:17:18PM -0400, Vivien Didelot wrote:
>> The PHY's EEE settings are already accessed by the DSA layer through the
>> Marvell PHY driver and there is nothing to be done for switch's MACs.
>
> I'm confused, or missing something. Does not patch #1 mean that if the
> DSA driver does not have a set_eee function, we always return -ENODEV
> in slave.c?
If there is a PHY, phy_init_eee (if eee_enabled is true) and
phy_ethtool_set_eee is called. If there is a .set_eee op, it is
called. If both are absent, -ENODEV is returned.
> There might be nothing to configure here, but some of the switches do
> support EEE. So we need at least a NOP set_eee. Better still it should
> return -ENODEV for those switches which don't actually support EEE,
> and 0 for those that do?
As I explain in a commit message, I didn't want to make the EEE ops
mandatory, because it makes it impossible for the DSA layer to
distinguish whether the driver did not update the ethtool_eee structure
because there is nothing to do on the port's MAC side (e.g. mv88e6xxx or
qca8k) or if it returned EEE disabled. To avoid confusion, I prefered to
make the ops optional, making the phy_* calls enough in the first case.
That being said, if you don't share this point of view and prefer to
define an inline dsa_set_eee_noop() function, I don't mind, since this
allows the DSA layer to make the distinction.
Thanks,
Vivien
^ permalink raw reply
* RE: [PATCH RFC, iproute2] tc/mirred: Extend the mirred/redirect action to accept additional traffic class parameter
From: David Laight @ 2017-08-01 15:12 UTC (permalink / raw)
To: 'Stephen Hemminger', Amritha Nambiar
Cc: netdev@vger.kernel.org, alexander.h.duyck@intel.com,
kiran.patil@intel.com, sridhar.samudrala@intel.com,
mitch.a.williams@intel.com, alexander.duyck@gmail.com,
neerav.parikh@intel.com, carolyn.wyborny@intel.com,
jeffrey.t.kirsher@intel.com
In-Reply-To: <20170731205133.5e58e47c@xeon-e3>
From: Stephen Hemminger
> Sent: 01 August 2017 04:52
> On Mon, 31 Jul 2017 17:40:50 -0700
> Amritha Nambiar <amritha.nambiar@intel.com> wrote:
> The concept is fine, bu t the code looks different than the rest which
> is never a good sign.
>
>
> > + if ((argc > 0) && (matches(*argv, "tc") == 0)) {
>
> Extra () are unnecessary in compound conditional.
>
> > + tc = atoi(*argv);
>
> Prefer using strtoul since it has better error handling than atoi()
>
> > + argc--;
> > + argv++;
> > + }
>
>
> Use NEXT_ARG() construct like rest of the code.
Why bother faffing about with argc at all?
The argument list terminates when *argv == NULL.
David
^ permalink raw reply
* Re: [PATCH] Adding Agile-SD TCP module and modifying Kconfig and Makefile to configure the kernel for this new module to configure the kernel for this new module.
From: Stephen Hemminger @ 2017-08-01 14:49 UTC (permalink / raw)
To: mohamedalrshah; +Cc: davem, netdev, torvalds, linux-kernel, mohamed.a.alrshah
In-Reply-To: <20170801095005.16025-1-mohamed.asnd@gmail.com>
On Tue, 1 Aug 2017 17:50:05 +0800
mohamedalrshah <mohamed.asnd@gmail.com> wrote:
> From: Mohamed Alrshah <mohamed.asnd@gmail.com>
>
Please add more background on Agile-SD in the email commit message.
> +static struct tcp_congestion_ops agilesdtcp __read_mostly = {
> + .init = agilesdtcp_init,
> + .ssthresh = agilesdtcp_recalc_ssthresh, //REQUIRED
> + .cong_avoid = agilesdtcp_cong_avoid, //REQUIRED
> + .set_state = agilesdtcp_state,
> + .undo_cwnd = agilesdtcp_undo_cwnd,
> + .pkts_acked = agilesdtcp_acked,
> + .owner = THIS_MODULE,
> + .name = "agilesd", //REQUIRED
> + //.min_cwnd = agilesdtcp_min_cwnd, //NOT REQUIRED
> +};
Your code must match kernel coding style. See Documentation for more
info and use the checkpatch.pl checking script.
^ permalink raw reply
* Re: [PATCH net-next 00/10] net: l3mdev: Support for sockets bound to enslaved device
From: David Ahern @ 2017-08-01 14:45 UTC (permalink / raw)
To: David Laight, netdev@vger.kernel.org
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6DD00482E4@AcuExch.aculab.com>
On 8/1/17 8:15 AM, David Laight wrote:
> From: David Ahern
>> Sent: 01 August 2017 04:13
> ...
>> Existing code for socket lookups already pass in 6+ arguments. Rather
>> than add another for the enslaved device index, the existing lookups
>> are converted to use a new sk_lookup struct. From there, the enslaved
>> device index becomes another element of the struct.
>>
>> Patch 1 introduces sk_lookup struct and helper.
>
> I guess that socket lookup happens quite often!
> Passing the lookup parameters in a structure might have a
> measurable negative effect on performance - especially if the
> structure isn't passed through to other functions.
>
> Have you made any performance mearurements?
Before patches:
IPv4
Test TCP_RR 23769.42 23862.59 23867.69 sum
71499.70 avg 23833
Test TCP_CRR 8649.29 8650.94 8661.24 sum
25961.47 avg 8653
Test UDP_RR 26935.38 26813.30 26747.88 sum
80496.56 avg 26832
IPv6
Test TCP_RR 24708.10 24629.43 24593.75 sum
73931.28 avg 24643
Test TCP_CRR 8432.82 8489.26 8474.82 sum
25396.90 avg 8465
Test UDP_RR 23607.57 23722.37 23713.80 sum
71043.74 avg 23681
#################################################################
After patches:
IPv4
Test TCP_RR 24204.41 23993.05 24129.18 sum
72326.64 avg 24108
Test TCP_CRR 8690.31 8630.12 8620.88 sum
25941.31 avg 8647
Test UDP_RR 26653.26 26725.76 26587.70 sum
79966.72 avg 26655
IPv6
Test TCP_RR 24807.54 24698.30 24849.84 sum
74355.68 avg 24785
Test TCP_CRR 8573.22 8640.02 8624.09 sum
25837.33 avg 8612
Test UDP_RR 23800.14 23747.01 23814.94 sum
71362.09 avg 23787
The middle columns are the results of each 30-second run and then the
average of the 3 is on the end.
^ 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