Re: [PATCH net 1/5] tcp_bbr: cut pacing rate only if filled pipe

2017-07-15 Thread Neal Cardwell
On Sat, Jul 15, 2017 at 5:44 PM, David Miller  wrote:
>
> Series applied and queued up for -stable.
>
> Please provide a proper "[PATCH net 0/N] " header posting next time.
> All patch series should have one.

Sorry about that. Will do!

Thanks,
neal


Re: [PATCH net 0/2] Fragmented SKB corrections

2017-07-15 Thread David Miller
From: Doug Berger 
Date: Fri, 14 Jul 2017 16:12:08 -0700

> Two issues were observed in a review of the bcmgenet driver support for
> fragmented SKBs which are addressed by this patch set.
> 
> The first addresses a problem that could occur if the driver is not able
> to DMA map a fragment of the SKB.  This would be a highly unusual event
> but it would leave the hardware descriptors in an invalid state which
> should be prevented.
> 
> The second is a hazard that could occur if the driver is able to reclaim
> the first control block of a fragmented SKB before all of its fragments
> have completed processing by the hardware.  In this case the SKB could
> be freed leading to reuse of memory that is still in use by hardware.

Series applied, thanks.


Re: [PATCH] dt-bindings: net: Remove duplicate NSP Ethernet MAC binding document

2017-07-15 Thread David Miller
From: Florian Fainelli 
Date: Sat, 15 Jul 2017 10:24:47 -0700

> Commit 07d4510f5251 ("dt-bindings: net: bgmac: add bindings documentation for
> bgmac") added both brcm,amac-nsp.txt and brcm,bgmac-nsp.txt. The former is
> actually the one that got updated and is in use by the bgmac driver while the
> latter is duplicating the former and is not used nor updated.
> 
> Fixes: 07d4510f5251 ("dt-bindings: net: bgmac: add bindings documentation for 
> bgmac")
> Signed-off-by: Florian Fainelli 

Applied.


Re: [PATCH 00/10] Constify isdn pci_device_id's.

2017-07-15 Thread David Miller
From: Arvind Yadav 
Date: Sat, 15 Jul 2017 09:55:41 +0530

> pci_device_id are not supposed to change at runtime. All functions
> working with pci_device_id provided by  work with
> const pci_device_id. So mark the non-const structs as const.

Series applied, thanks.


Re: [PATCH] Broadcom Sysport: Support 64bit net status report on 32bit Platform

2017-07-15 Thread kiki good
Hi Florian:

Thanks for the comment.

The reason to use kzalloc() for bsysport_netstats instead of extending
bcm_sysport_priv to have the network
stats included in bcm_sysport_priv is to minimise the impact of
increasing stack size if there are more 64bit stats
to be added in the future.

What about your thoughts ?

I will do the changes as you suggested for the rest parts.

Thanks
Jmqiao

On Sat, Jul 15, 2017 at 5:11 PM, kiki good  wrote:
> Signed-off-by: Jianming Qiao 
> ---
>  drivers/net/ethernet/broadcom/bcmsysport.c | 81
> -
>  drivers/net/ethernet/broadcom/bcmsysport.h |  8 
>  2 files changed, 68 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c
> b/drivers/net/ethernet/broadcom/bcmsysport.c
> index 5274501..263512f 100644
> --- a/drivers/net/ethernet/broadcom/bcmsysport.c
> +++ b/drivers/net/ethernet/broadcom/bcmsysport.c
> @@ -663,6 +663,7 @@ static unsigned int bcm_sysport_desc_rx(struct
> bcm_sysport_priv *priv,
>  unsigned int budget)
>  {
>  struct net_device *ndev = priv->netdev;
> +   struct bcmsysport_netstats *bsysport_netstats = 
> priv->bsysport_netstats;
>  unsigned int processed = 0, to_process;
>  struct bcm_sysport_cb *cb;
>  struct sk_buff *skb;
> @@ -763,8 +764,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(_netstats->syncp);
> +   bsysport_netstats->rx_packets++;
> +   bsysport_netstats->rx_bytes += len;
> +   u64_stats_update_end(_netstats->syncp);
>
>  napi_gro_receive(>napi, skb);
>  next:
> @@ -785,19 +788,26 @@ static void bcm_sysport_tx_reclaim_one(struct
> bcm_sysport_tx_ring *ring,
>  {
>  struct bcm_sysport_priv *priv = ring->priv;
>  struct device *kdev = >pdev->dev;
> +   struct bcmsysport_netstats *bsysport_netstats = 
> priv->bsysport_netstats;
>
>  if (cb->skb) {
> +   u64_stats_update_begin(_netstats->syncp);
>  ring->bytes += cb->skb->len;
> +   u64_stats_update_end(_netstats->syncp);
>  *bytes_compl += cb->skb->len;
>  dma_unmap_single(kdev, dma_unmap_addr(cb, dma_addr),
>   dma_unmap_len(cb, dma_len),
>   DMA_TO_DEVICE);
> +   u64_stats_update_begin(_netstats->syncp);
>  ring->packets++;
> +   u64_stats_update_end(_netstats->syncp);
>  (*pkts_compl)++;
>  bcm_sysport_free_cb(cb);
>  /* SKB fragment */
>  } else if (dma_unmap_addr(cb, dma_addr)) {
> +   u64_stats_update_begin(_netstats->syncp);
>  ring->bytes += dma_unmap_len(cb, dma_len);
> +   u64_stats_update_end(_netstats->syncp);
>  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);
> @@ -1671,23 +1681,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 = >tx_rings[q];
> -   tx_bytes += ring->bytes;
> -   tx_packets += ring->packets;
> -   }
> -
> -   dev->stats.tx_bytes = tx_bytes;
> -   dev->stats.tx_packets = tx_packets;
> -   return >stats;
> -}
>
>  static void bcm_sysport_netif_start(struct net_device *dev)
>  {
> @@ -1923,6 +1916,49 @@ static int bcm_sysport_stop(struct net_device *dev)
>  return 0;
>  }
>
> +static int bcm_sysport_init(struct net_device *dev)
> +{
> +   struct bcm_sysport_priv *priv = netdev_priv(dev);
> +
> +   priv->bsysport_netstats = kzalloc(sizeof(*priv->bsysport_netstats),
> + GFP_KERNEL);
> +   if (!priv->bsysport_netstats)
> +   return -ENOMEM;
> +
> +   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 bcmsysport_netstats *bsysport_netstats = 
> priv->bsysport_netstats;
> +   struct bcm_sysport_tx_ring 

Re: [PATCH net 1/5] tcp_bbr: cut pacing rate only if filled pipe

2017-07-15 Thread David Miller

Series applied and queued up for -stable.

Please provide a proper "[PATCH net 0/N] " header posting next time.
All patch series should have one.


Re: [PATCH V3 net] openvswitch: Fix for force/commit action failures

2017-07-15 Thread David Miller
From: Greg Rose 
Date: Fri, 14 Jul 2017 12:42:49 -0700

> When there is an established connection in direction A->B, it is
> possible to receive a packet on port B which then executes
> ct(commit,force) without first performing ct() - ie, a lookup.
> In this case, we would expect that this packet can delete the existing
> entry so that we can commit a connection with direction B->A. However,
> currently we only perform a check in skb_nfct_cached() for whether
> OVS_CS_F_TRACKED is set and OVS_CS_F_INVALID is not set, ie that a
> lookup previously occurred. In the above scenario, a lookup has not
> occurred but we should still be able to statelessly look up the
> existing entry and potentially delete the entry if it is in the
> opposite direction.
> 
> This patch extends the check to also hint that if the action has the
> force flag set, then we will lookup the existing entry so that the
> force check at the end of skb_nfct_cached has the ability to delete
> the connection.
> 
> Fixes: dd41d330b03 ("openvswitch: Add force commit.")
> CC: Pravin Shelar 
> CC: d...@openvswitch.org
> Signed-off-by: Joe Stringer 
> Signed-off-by: Greg Rose 

Applied, thanks.


Re: [PATCH] ipv4: ip_do_fragment: fix headroom tests

2017-07-15 Thread David Miller
From: Vasily Averin 
Date: Fri, 14 Jul 2017 12:04:16 +0300

> Some time ago David Woodhouse reported skb_under_panic
> when we try to push ethernet header to fragmented ipv6 skbs.
> It was fixed for ipv6 by Florian Westphal in
> commit 1d325d217c7f ("ipv6: ip6_fragment: fix headroom tests and skb leak")
> 
> However similar problem still exist in ipv4.
> 
> It does not trigger skb_under_panic due paranoid check
> in ip_finish_output2, however according to Alexey Kuznetsov
> current state is abnormal and ip_fragment should be fixed too.
> 
> Signed-off-by: Vasily Averin 

Applied, thank you.


Re: [PATCHv2 1/1] mlx4_en: remove unnecessary returned value check

2017-07-15 Thread David Miller
From: Zhu Yanjun 
Date: Thu, 13 Jul 2017 23:01:27 -0400

> The function __mlx4_zone_remove_one_entry always returns zero. So
> it is not necessary to check it.
> 
> Cc: Joe Jin 
> Cc: Junxiao Bi 
> Signed-off-by: Zhu Yanjun 
> Reviewed-by: Yuval Shaia 
> ---
> Change from v1 to v2:
>  Initialization is moved to variable declaration.

Applied.


Re: [PATCH 0/3] Extend BGMAC driver for Stingray SoC

2017-07-15 Thread David Miller
From: Abhishek Shah 
Date: Fri, 14 Jul 2017 00:34:06 +0530

> The patchset extends Broadcom BGMAC driver for Broadcom Stingray SoC.
> 
> This patchset is based on Linux-4.12 and tested on NS2 and Stingray.

Series applied.


Re: [PATCH] ioc3-eth: store pointer to net_device for priviate area

2017-07-15 Thread David Miller
From: "Jason A. Donenfeld" 
Date: Mon, 10 Jul 2017 14:00:32 +0200

> Computing the alignment manually for going from priv to pub is probably
> not such a good idea, and in general the assumption that going from priv
> to pub is possible trivially could change, so rather than relying on
> that, we change things to just store a pointer to pub. This was sugested
> by DaveM in [1].
> 
> [1] http://www.spinics.net/lists/netdev/msg443992.html
> 
> Signed-off-by: Jason A. Donenfeld 

Applied.


Re: [PATCH v2 1/2] dt-bindings: net: Add bindings for National Instruments XGE netdev

2017-07-15 Thread Andrew Lunn
> > > + ethernet_phy1: ethernet-phy@4 {
> > > + compatible = "ethernet-phy-ieee802.3-c45";
> > > + reg = <4>;
> > > + devices = <0xa>;
> > > + };
> > 
> > Since you don't fully implement c45, does this example actually work?
> 
> Yeah, I've tested this continuously. But for v3 I anyways implmented c45
> writes.

Hi Moritz

Just out of interest, what PHY are you using?

Andrew


Re: [PATCH v2 1/2] dt-bindings: net: Add bindings for National Instruments XGE netdev

2017-07-15 Thread Moritz Fischer
Hi Andrew,

On Sat, Jul 15, 2017 at 08:37:45PM +0200, Andrew Lunn wrote:
> On Fri, Jul 14, 2017 at 01:48:45PM -0700, Moritz Fischer wrote:
> > This adds bindings for the NI XGE 1G/10G network device.
> > 
> > Signed-off-by: Moritz Fischer 
> > ---
> >  Documentation/devicetree/bindings/net/nixge.txt | 32 
> > +
> >  1 file changed, 32 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/net/nixge.txt
> > 
> > diff --git a/Documentation/devicetree/bindings/net/nixge.txt 
> > b/Documentation/devicetree/bindings/net/nixge.txt
> > new file mode 100644
> > index 000..9fff5a7
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/net/nixge.txt
> > @@ -0,0 +1,32 @@
> > +* NI XGE Ethernet controller
> > +
> > +Required properties:
> > +- compatible: Should be "ni,xge-enet-2.00"
> > +- reg: Address and length of the register set for the device
> > +- interrupts: Should contain tx and rx interrupt
> > +- interrupt-names: Should be "rx-irq" and "tx-irq"
> > +- phy-mode: See ethernet.txt file in the same directory.
> 
> Hi Moritz
> 
> phy-handle is now required.

Good catch, thanks.
> 
> > +Examples (10G generic PHY):
> > +   nixge0: ethernet@4000 {
> > +   compatible = "ni,xge-enet-2.00";
> > +   reg = <0x4000 0x6000>;
> > +
> > +   nvmem-cells = <_addr>;
> > +   nvmem-cell-names = "address";
> > +
> > +   interrupts = <0 29 4>, <0 30 4>;
> 
> IRQ_TYPE_LEVEL_HIGH

Sure, will do.
> 
> > +   interrupt-names = "rx-irq", "tx-irq";
> > +   interrupt-parent = <>;
> > +
> > +   phy-mode = "xgmii";
> > +   phy-handle = <_phy1>;
> > +
> > +   ethernet_phy1: ethernet-phy@4 {
> > +   compatible = "ethernet-phy-ieee802.3-c45";
> > +   reg = <4>;
> > +   devices = <0xa>;
> > +   };
> 
> Since you don't fully implement c45, does this example actually work?

Yeah, I've tested this continuously. But for v3 I anyways implmented c45
writes.

> And devices is not a standard phy property.
> 

Will fix.
> Andrew

Cheers,

Moritz


Re: [PATCH v2 1/2] dt-bindings: net: Add bindings for National Instruments XGE netdev

2017-07-15 Thread Andrew Lunn
On Fri, Jul 14, 2017 at 01:48:45PM -0700, Moritz Fischer wrote:
> This adds bindings for the NI XGE 1G/10G network device.
> 
> Signed-off-by: Moritz Fischer 
> ---
>  Documentation/devicetree/bindings/net/nixge.txt | 32 
> +
>  1 file changed, 32 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/net/nixge.txt
> 
> diff --git a/Documentation/devicetree/bindings/net/nixge.txt 
> b/Documentation/devicetree/bindings/net/nixge.txt
> new file mode 100644
> index 000..9fff5a7
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/nixge.txt
> @@ -0,0 +1,32 @@
> +* NI XGE Ethernet controller
> +
> +Required properties:
> +- compatible: Should be "ni,xge-enet-2.00"
> +- reg: Address and length of the register set for the device
> +- interrupts: Should contain tx and rx interrupt
> +- interrupt-names: Should be "rx-irq" and "tx-irq"
> +- phy-mode: See ethernet.txt file in the same directory.

Hi Moritz

phy-handle is now required.

> +Examples (10G generic PHY):
> + nixge0: ethernet@4000 {
> + compatible = "ni,xge-enet-2.00";
> + reg = <0x4000 0x6000>;
> +
> + nvmem-cells = <_addr>;
> + nvmem-cell-names = "address";
> +
> + interrupts = <0 29 4>, <0 30 4>;

IRQ_TYPE_LEVEL_HIGH

> + interrupt-names = "rx-irq", "tx-irq";
> + interrupt-parent = <>;
> +
> + phy-mode = "xgmii";
> + phy-handle = <_phy1>;
> +
> + ethernet_phy1: ethernet-phy@4 {
> + compatible = "ethernet-phy-ieee802.3-c45";
> + reg = <4>;
> + devices = <0xa>;
> + };

Since you don't fully implement c45, does this example actually work?
And devices is not a standard phy property.

Andrew


[PATCH net-next v1] ip6: fix PMTU discovery when using /127 subnets

2017-07-15 Thread Vincent Bernat
The definition of an "anycast destination address" has been tweaked as a
side-effect of commit 2647a9b07032 ("ipv6: Remove external dependency on
rt6i_gateway and RTF_ANYCAST"). The first address of a point-to-point
/127 subnet is now considered as an anycast address. This prevents
ICMPv6 errors to be returned to a sender of such a subnet and breaks
PMTU discovery.

This can be reproduced with:

ip link add name out6 type veth peer name in6
ip link add name out7 type veth peer name in7
ip link set mtu 1400 dev out7
ip link set mtu 1400 dev in7
ip netns add next-hop
ip netns add next-next-hop
ip link set netns next-hop dev in6
ip link set netns next-hop dev out7
ip link set netns next-next-hop dev in7
ip link set up dev out6
ip addr add 2001:db8:1::12/127 dev out6
ip netns exec next-hop ip link set up dev in6
ip netns exec next-hop ip link set up dev out7
ip netns exec next-hop ip addr add 2001:db8:1::13/127 dev in6
ip netns exec next-hop ip addr add 2001:db8:1::14/127 dev out7
ip netns exec next-hop ip route add default via 2001:db8:1::15
ip netns exec next-hop sysctl -qw net.ipv6.conf.all.forwarding=1
ip netns exec next-next-hop ip link set up dev in7
ip netns exec next-next-hop ip addr add 2001:db8:1::15/127 dev in7
ip netns exec next-next-hop ip addr add 2001:db8:1::50/128 dev in7
ip netns exec next-next-hop ip route add default via 2001:db8:1::14
ip netns exec next-next-hop sysctl -qw net.ipv6.conf.all.forwarding=1
ip route add 2001:db8:1::48/123 via 2001:db8:1::13
sleep 4
ping -M do -s 1452 -c 3 2001:db8:1::50 || true
ip route get 2001:db8:1::50

Before the patch, we get:

2001:db8:1::50 from :: via 2001:db8:1::13 dev out6 src 2001:db8:1::12 
metric 1024  pref medium

After the patch, we get:

2001:db8:1::50 via 2001:db8:1::13 dev out6 src 2001:db8:1::12 metric 0
cache  expires 578sec mtu 1400 pref medium

Fixes: 2647a9b07032 ("ipv6: Remove external dependency on rt6i_gateway and 
RTF_ANYCAST")
Signed-off-by: Vincent Bernat 
---
 include/net/ip6_route.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 199056933dcb..907d39a42f6b 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -194,7 +194,7 @@ static inline bool ipv6_anycast_destination(const struct 
dst_entry *dst,
struct rt6_info *rt = (struct rt6_info *)dst;
 
return rt->rt6i_flags & RTF_ANYCAST ||
-   (rt->rt6i_dst.plen != 128 &&
+   (rt->rt6i_dst.plen < 127 &&
 ipv6_addr_equal(>rt6i_dst.addr, daddr));
 }
 
-- 
2.13.2



[PATCH] dt-bindings: net: Remove duplicate NSP Ethernet MAC binding document

2017-07-15 Thread Florian Fainelli
Commit 07d4510f5251 ("dt-bindings: net: bgmac: add bindings documentation for
bgmac") added both brcm,amac-nsp.txt and brcm,bgmac-nsp.txt. The former is
actually the one that got updated and is in use by the bgmac driver while the
latter is duplicating the former and is not used nor updated.

Fixes: 07d4510f5251 ("dt-bindings: net: bgmac: add bindings documentation for 
bgmac")
Signed-off-by: Florian Fainelli 
---
 .../devicetree/bindings/net/brcm,bgmac-nsp.txt | 24 --
 1 file changed, 24 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/net/brcm,bgmac-nsp.txt

diff --git a/Documentation/devicetree/bindings/net/brcm,bgmac-nsp.txt 
b/Documentation/devicetree/bindings/net/brcm,bgmac-nsp.txt
deleted file mode 100644
index 022946caa7e2..
--- a/Documentation/devicetree/bindings/net/brcm,bgmac-nsp.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-Broadcom GMAC Ethernet Controller Device Tree Bindings
--
-
-Required properties:
- - compatible: "brcm,bgmac-nsp"
- - reg:Address and length of the GMAC registers,
-   Address and length of the GMAC IDM registers
- - reg-names:  Names of the registers.  Must have both "gmac_base" and
-   "idm_base"
- - interrupts: Interrupt number
-
-Optional properties:
-- mac-address: See ethernet.txt file in the same directory
-
-Examples:
-
-gmac0: ethernet@18022000 {
-   compatible = "brcm,bgmac-nsp";
-   reg = <0x18022000 0x1000>,
- <0x1811 0x1000>;
-   reg-names = "gmac_base", "idm_base";
-   interrupts = ;
-   status = "disabled";
-};
-- 
2.11.0



Re: [PATCH] Broadcom Sysport: Support 64bit net status report on 32bit Platform

2017-07-15 Thread Florian Fainelli
On 07/15/2017 08:20 AM, ?? ? wrote:
> When using Broadcom Sysport 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. 

The subject of this patch should be:

net: systemport: Support 64bit statistics

to be consistent with past submissions done to that driver and it should
be Broadcom SYSTEMPORT, Sysport is just the abbreviated name for the driver.

> 
> Signed-off-by: Jianming Qiao 
> ---
>  drivers/net/ethernet/broadcom/bcmsysport.c | 81 
> -
>  drivers/net/ethernet/broadcom/bcmsysport.h |  8 
>  2 files changed, 68 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c 
> b/drivers/net/ethernet/broadcom/bcmsysport.c
> index 5274501..263512f 100644
> --- a/drivers/net/ethernet/broadcom/bcmsysport.c
> +++ b/drivers/net/ethernet/broadcom/bcmsysport.c
> @@ -663,6 +663,7 @@ static unsigned int bcm_sysport_desc_rx(struct 
> bcm_sysport_priv *priv,
>   unsigned int budget)
>  {
>   struct net_device *ndev = priv->netdev;
> + struct bcmsysport_netstats *bsysport_netstats = priv->bsysport_netstats;

Please keep the reverse christmas tree declarations order, from longest
to shortest and I am not a fan of the name "bsysort_netstats" it's
already in the driver private structure, so just name the new member
"stats64" for instance, see at the very bottom for a complete suggestion.

>   unsigned int processed = 0, to_process;
>   struct bcm_sysport_cb *cb;
>   struct sk_buff *skb;
> @@ -763,8 +764,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(_netstats->syncp);
> + bsysport_netstats->rx_packets++;
> + bsysport_netstats->rx_bytes += len;
> + u64_stats_update_end(_netstats->syncp);
>  
>   napi_gro_receive(>napi, skb);
>  next:
> @@ -785,19 +788,26 @@ static void bcm_sysport_tx_reclaim_one(struct 
> bcm_sysport_tx_ring *ring,
>  {
>   struct bcm_sysport_priv *priv = ring->priv;
>   struct device *kdev = >pdev->dev;
> + struct bcmsysport_netstats *bsysport_netstats = priv->bsysport_netstats;
>  
>   if (cb->skb) {
> + u64_stats_update_begin(_netstats->syncp);
>   ring->bytes += cb->skb->len;
> + u64_stats_update_end(_netstats->syncp);
>   *bytes_compl += cb->skb->len;
>   dma_unmap_single(kdev, dma_unmap_addr(cb, dma_addr),
>dma_unmap_len(cb, dma_len),
>DMA_TO_DEVICE);
> + u64_stats_update_begin(_netstats->syncp);
>   ring->packets++;
> + u64_stats_update_end(_netstats->syncp);
>   (*pkts_compl)++;
>   bcm_sysport_free_cb(cb);
>   /* SKB fragment */
>   } else if (dma_unmap_addr(cb, dma_addr)) {
> + u64_stats_update_begin(_netstats->syncp);
>   ring->bytes += dma_unmap_len(cb, dma_len);
> + u64_stats_update_end(_netstats->syncp);
>   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);

Can you find a way to avoid putting 3 different
u64_stats_update_begin()/end() sections and instead just one, that would
be clearer.

> @@ -1671,23 +1681,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 = >tx_rings[q];
> - tx_bytes += ring->bytes;
> - tx_packets += ring->packets;
> - }
> -
> - dev->stats.tx_bytes = tx_bytes;
> - dev->stats.tx_packets = tx_packets;
> - return >stats;
> -}

Is there a problem if we keep both get_nstats and get_nstats64?

>  
>  static void bcm_sysport_netif_start(struct net_device *dev)
>  {
> @@ -1923,6 +1916,49 @@ static int bcm_sysport_stop(struct net_device *dev)
>   return 0;
>  }
>  
> +static int bcm_sysport_init(struct net_device *dev)
> +{
> + struct bcm_sysport_priv *priv = netdev_priv(dev);
> +
> + priv->bsysport_netstats = kzalloc(sizeof(*priv->bsysport_netstats),
> +   GFP_KERNEL);
> + if (!priv->bsysport_netstats)
> + return 

Re: [PATCH v2 2/2] net: ethernet: nixge: Add support for National Instruments XGE netdev

2017-07-15 Thread Andrew Lunn
> +++ b/drivers/net/ethernet/ni/Kconfig
> @@ -0,0 +1,27 @@
> +#
> +# National Instuments network device configuration
> +#
> +
> +config NET_VENDOR_NI
> + bool "National Instruments Devices"
> + default y
> + ---help---
> +   If you have a network (Ethernet) device belonging to this class, say 
> Y.
> +
> +   Note that the answer to this question doesn't directly affect the
> +   kernel: saying N will just cause the configurator to skip all
> +   the questions about National Instrument devices.
> +   If you say Y, you will be asked for your specific device in the
> +   following questions.
> +
> +if NET_VENDOR_NI
> +
> +config NI_XGE_MANAGEMENT_ENET
> + tristate "National Instruments XGE management enet support"
> + depends on ARCH_ZYNQ

Consider also adding COMPILE_TEST, if possible.

> +#define nixge_ctrl_poll_timeout(priv, addr, val, cond, sleep_us, timeout_us) 
> \
> + readl_poll_timeout((priv)->ctrl_regs + (addr), (val), cond, \
> +(sleep_us), (timeout_us))

Seems odd not having cond inside (), especially since cond could be a
complex expression.

> +static void nixge_handle_link_change(struct net_device *ndev)
> +{
> + struct nixge_priv *priv = netdev_priv(ndev);
> + struct phy_device *phydev = ndev->phydev;
> + unsigned long flags;
> + int status_change = 0;
> +
> + spin_lock_irqsave(>lock, flags);
> +
> + if (phydev->link != priv->link || phydev->speed != priv->speed ||
> + phydev->duplex != priv->duplex) {
> + priv->link = phydev->link;
> + priv->speed = phydev->speed;
> + priv->duplex = phydev->duplex;
> + status_change = 1;
> + }
> +
> + spin_unlock_irqrestore(>lock, flags);
> +
> + if (status_change)
> + phy_print_status(phydev);
> +}

As Florian pointed out, you don't make use of any of this
information. So maybe don't bother, just have a return statement.

> +static int nixge_stop(struct net_device *ndev)
> +{
> + u32 cr;
> + struct nixge_priv *priv = netdev_priv(ndev);
> +
> + cr = nixge_dma_read_reg(priv, XAXIDMA_RX_CR_OFFSET);
> + nixge_dma_write_reg(priv, XAXIDMA_RX_CR_OFFSET,
> + cr & (~XAXIDMA_CR_RUNSTOP_MASK));
> + cr = nixge_dma_read_reg(priv, XAXIDMA_TX_CR_OFFSET);
> + nixge_dma_write_reg(priv, XAXIDMA_TX_CR_OFFSET,
> + cr & (~XAXIDMA_CR_RUNSTOP_MASK));
> +
> + tasklet_kill(>dma_err_tasklet);
> +
> + free_irq(priv->tx_irq, ndev);
> + free_irq(priv->rx_irq, ndev);
> +
> + nixge_dma_bd_release(ndev);
> +
> + if (ndev->phydev) {

Do you need this condition? You bail out with ENODEV if of_phy_connect fails?

> + phy_stop(ndev->phydev);
> + phy_disconnect(ndev->phydev);
> + }
> +
> + return 0;
> +}
> +
> +static int nixge_change_mtu(struct net_device *ndev, int new_mtu)
> +{
> + struct nixge_priv *priv = netdev_priv(ndev);
> +
> + if (netif_running(ndev))
> + return -EBUSY;
> +
> + if ((new_mtu + VLAN_ETH_HLEN +
> + NIXGE_TRL_SIZE) > priv->rxmem)
> + return -EINVAL;
> +
> + ndev->mtu = new_mtu;
> +
> + return 0;
> +}
> +
> +static s32 __nixge_hw_set_mac_address(struct net_device *ndev)
> +{
> + struct nixge_priv *priv = netdev_priv(ndev);
> +
> + nixge_ctrl_write_reg(priv, NIXGE_REG_MAC_LSB,
> +  (ndev->dev_addr[2]) << 24 |
> +  (ndev->dev_addr[3] << 16) |
> +  (ndev->dev_addr[4] << 8) |
> +  (ndev->dev_addr[5] << 0));
> +
> + nixge_ctrl_write_reg(priv, NIXGE_REG_MAC_MSB,
> +  (ndev->dev_addr[1] | (ndev->dev_addr[0] << 8)));
> +
> + return 0;
> +}
> +
> +static int nixge_net_set_mac_address(struct net_device *ndev, void *p)
> +{
> + int err;
> +
> + err = eth_mac_addr(ndev, p);
> + if (!err)
> + __nixge_hw_set_mac_address(ndev);
> +
> + return err;
> +}

Much better, thanks.

> +
> +static int nixge_mdio_write(struct mii_bus *bus, int phy_id, int reg, u16 
> val)
> +{
> + struct nixge_priv *priv = bus->priv;
> + u32 status, tmp;
> + int err;
> + u16 device;
> +
> + /* FIXME: Currently don't do writes */
> + if (reg & MII_ADDR_C45)
> + return -EOPNOTSUPP;
> +
> + device = reg & 0x1f;
> +
> + tmp = NIXGE_MDIO_CLAUSE22 | NIXGE_MDIO_OP(MDIO_C22_WRITE) |
> + NIXGE_MDIO_ADDR(phy_id) | NIXGE_MDIO_MMD(device);
> +
> + nixge_ctrl_write_reg(priv, NIXGE_REG_MDIO_DATA, val);
> + nixge_ctrl_write_reg(priv, NIXGE_REG_MDIO_OP, tmp);
> + nixge_ctrl_write_reg(priv, NIXGE_REG_MDIO_CTRL, 1);
> +
> + err = nixge_ctrl_poll_timeout(priv, NIXGE_REG_MDIO_CTRL, status,
> +   !status, 10, 1000);
> + if (err) {
> + dev_err(priv->dev, "timeout setting write command");
> + 

Re: [PATCH] Broadcom Sysport: Support 64bit net status report on 32bit Platform

2017-07-15 Thread kiki good
When using Broadcom Sysport 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.

The patch is used to add 64bit support for Broadcom Sysport device in
32bit Platform.

On Sat, Jul 15, 2017 at 5:11 PM, kiki good  wrote:
> Signed-off-by: Jianming Qiao 
> ---
>  drivers/net/ethernet/broadcom/bcmsysport.c | 81
> -
>  drivers/net/ethernet/broadcom/bcmsysport.h |  8 
>  2 files changed, 68 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c
> b/drivers/net/ethernet/broadcom/bcmsysport.c
> index 5274501..263512f 100644
> --- a/drivers/net/ethernet/broadcom/bcmsysport.c
> +++ b/drivers/net/ethernet/broadcom/bcmsysport.c
> @@ -663,6 +663,7 @@ static unsigned int bcm_sysport_desc_rx(struct
> bcm_sysport_priv *priv,
>  unsigned int budget)
>  {
>  struct net_device *ndev = priv->netdev;
> +   struct bcmsysport_netstats *bsysport_netstats = 
> priv->bsysport_netstats;
>  unsigned int processed = 0, to_process;
>  struct bcm_sysport_cb *cb;
>  struct sk_buff *skb;
> @@ -763,8 +764,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(_netstats->syncp);
> +   bsysport_netstats->rx_packets++;
> +   bsysport_netstats->rx_bytes += len;
> +   u64_stats_update_end(_netstats->syncp);
>
>  napi_gro_receive(>napi, skb);
>  next:
> @@ -785,19 +788,26 @@ static void bcm_sysport_tx_reclaim_one(struct
> bcm_sysport_tx_ring *ring,
>  {
>  struct bcm_sysport_priv *priv = ring->priv;
>  struct device *kdev = >pdev->dev;
> +   struct bcmsysport_netstats *bsysport_netstats = 
> priv->bsysport_netstats;
>
>  if (cb->skb) {
> +   u64_stats_update_begin(_netstats->syncp);
>  ring->bytes += cb->skb->len;
> +   u64_stats_update_end(_netstats->syncp);
>  *bytes_compl += cb->skb->len;
>  dma_unmap_single(kdev, dma_unmap_addr(cb, dma_addr),
>   dma_unmap_len(cb, dma_len),
>   DMA_TO_DEVICE);
> +   u64_stats_update_begin(_netstats->syncp);
>  ring->packets++;
> +   u64_stats_update_end(_netstats->syncp);
>  (*pkts_compl)++;
>  bcm_sysport_free_cb(cb);
>  /* SKB fragment */
>  } else if (dma_unmap_addr(cb, dma_addr)) {
> +   u64_stats_update_begin(_netstats->syncp);
>  ring->bytes += dma_unmap_len(cb, dma_len);
> +   u64_stats_update_end(_netstats->syncp);
>  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);
> @@ -1671,23 +1681,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 = >tx_rings[q];
> -   tx_bytes += ring->bytes;
> -   tx_packets += ring->packets;
> -   }
> -
> -   dev->stats.tx_bytes = tx_bytes;
> -   dev->stats.tx_packets = tx_packets;
> -   return >stats;
> -}
>
>  static void bcm_sysport_netif_start(struct net_device *dev)
>  {
> @@ -1923,6 +1916,49 @@ static int bcm_sysport_stop(struct net_device *dev)
>  return 0;
>  }
>
> +static int bcm_sysport_init(struct net_device *dev)
> +{
> +   struct bcm_sysport_priv *priv = netdev_priv(dev);
> +
> +   priv->bsysport_netstats = kzalloc(sizeof(*priv->bsysport_netstats),
> + GFP_KERNEL);
> +   if (!priv->bsysport_netstats)
> +   return -ENOMEM;
> +
> +   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 bcmsysport_netstats *bsysport_netstats = 
> priv->bsysport_netstats;
> +   struct bcm_sysport_tx_ring *ring;
> +   unsigned int q;
> +   u64 tx_packets = 0, tx_bytes = 0;
> +   unsigned int start;
> +
> +   

[PATCH] Broadcom Sysport: Support 64bit net status report on 32bit Platform

2017-07-15 Thread kiki good
Signed-off-by: Jianming Qiao 
---
 drivers/net/ethernet/broadcom/bcmsysport.c | 81
-
 drivers/net/ethernet/broadcom/bcmsysport.h |  8 
 2 files changed, 68 insertions(+), 21 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c
b/drivers/net/ethernet/broadcom/bcmsysport.c
index 5274501..263512f 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -663,6 +663,7 @@ static unsigned int bcm_sysport_desc_rx(struct
bcm_sysport_priv *priv,
 unsigned int budget)
 {
 struct net_device *ndev = priv->netdev;
+   struct bcmsysport_netstats *bsysport_netstats = priv->bsysport_netstats;
 unsigned int processed = 0, to_process;
 struct bcm_sysport_cb *cb;
 struct sk_buff *skb;
@@ -763,8 +764,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(_netstats->syncp);
+   bsysport_netstats->rx_packets++;
+   bsysport_netstats->rx_bytes += len;
+   u64_stats_update_end(_netstats->syncp);

 napi_gro_receive(>napi, skb);
 next:
@@ -785,19 +788,26 @@ static void bcm_sysport_tx_reclaim_one(struct
bcm_sysport_tx_ring *ring,
 {
 struct bcm_sysport_priv *priv = ring->priv;
 struct device *kdev = >pdev->dev;
+   struct bcmsysport_netstats *bsysport_netstats = priv->bsysport_netstats;

 if (cb->skb) {
+   u64_stats_update_begin(_netstats->syncp);
 ring->bytes += cb->skb->len;
+   u64_stats_update_end(_netstats->syncp);
 *bytes_compl += cb->skb->len;
 dma_unmap_single(kdev, dma_unmap_addr(cb, dma_addr),
  dma_unmap_len(cb, dma_len),
  DMA_TO_DEVICE);
+   u64_stats_update_begin(_netstats->syncp);
 ring->packets++;
+   u64_stats_update_end(_netstats->syncp);
 (*pkts_compl)++;
 bcm_sysport_free_cb(cb);
 /* SKB fragment */
 } else if (dma_unmap_addr(cb, dma_addr)) {
+   u64_stats_update_begin(_netstats->syncp);
 ring->bytes += dma_unmap_len(cb, dma_len);
+   u64_stats_update_end(_netstats->syncp);
 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);
@@ -1671,23 +1681,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 = >tx_rings[q];
-   tx_bytes += ring->bytes;
-   tx_packets += ring->packets;
-   }
-
-   dev->stats.tx_bytes = tx_bytes;
-   dev->stats.tx_packets = tx_packets;
-   return >stats;
-}

 static void bcm_sysport_netif_start(struct net_device *dev)
 {
@@ -1923,6 +1916,49 @@ static int bcm_sysport_stop(struct net_device *dev)
 return 0;
 }

+static int bcm_sysport_init(struct net_device *dev)
+{
+   struct bcm_sysport_priv *priv = netdev_priv(dev);
+
+   priv->bsysport_netstats = kzalloc(sizeof(*priv->bsysport_netstats),
+ GFP_KERNEL);
+   if (!priv->bsysport_netstats)
+   return -ENOMEM;
+
+   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 bcmsysport_netstats *bsysport_netstats = priv->bsysport_netstats;
+   struct bcm_sysport_tx_ring *ring;
+   unsigned int q;
+   u64 tx_packets = 0, tx_bytes = 0;
+   unsigned int start;
+
+   netdev_stats_to_stats64(stats, >stats);
+
+   for (q = 0; q < dev->num_tx_queues; q++) {
+   ring = >tx_rings[q];
+   do {
+   start =
u64_stats_fetch_begin_irq(_netstats->syncp);
+   tx_bytes += ring->bytes;
+   tx_packets += ring->packets;
+   } while
(u64_stats_fetch_retry_irq(_netstats->syncp, start));
+   }
+
+   stats->tx_packets = tx_packets;
+   stats->tx_bytes = tx_bytes;
+
+   do {
+   start = u64_stats_fetch_begin_irq(_netstats->syncp);
+  

Re: [PATCH 2/2] net: ethernet: nixge: Add support for National Instruments XGE netdev

2017-07-15 Thread kbuild test robot
Hi Moritz,

[auto build test ERROR on net-next/master]
[also build test ERROR on v4.12 next-20170714]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Moritz-Fischer/dt-bindings-net-Add-bindings-for-National-Instruments-XGE-netdev/20170714-125718
config: um-allyesconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=um 

All errors (new ones prefixed by >>):

   arch/um/drivers/built-in.o: In function `vde_open_real':
   (.text+0xc9f1): warning: Using 'getgrnam' in statically linked applications 
requires at runtime the shared libraries from the glibc version used for linking
   arch/um/drivers/built-in.o: In function `vde_open_real':
   (.text+0xc83c): warning: Using 'getpwuid' in statically linked applications 
requires at runtime the shared libraries from the glibc version used for linking
   arch/um/drivers/built-in.o: In function `vde_open_real':
   (.text+0xcb55): warning: Using 'getaddrinfo' in statically linked 
applications requires at runtime the shared libraries from the glibc version 
used for linking
   arch/um/drivers/built-in.o: In function `pcap_nametoaddr':
   (.text+0x1d5e5): warning: Using 'gethostbyname' in statically linked 
applications requires at runtime the shared libraries from the glibc version 
used for linking
   arch/um/drivers/built-in.o: In function `pcap_nametonetaddr':
   (.text+0x1d685): warning: Using 'getnetbyname' in statically linked 
applications requires at runtime the shared libraries from the glibc version 
used for linking
   arch/um/drivers/built-in.o: In function `pcap_nametoproto':
   (.text+0x1d8a5): warning: Using 'getprotobyname' in statically linked 
applications requires at runtime the shared libraries from the glibc version 
used for linking
   arch/um/drivers/built-in.o: In function `pcap_nametoport':
   (.text+0x1d6d7): warning: Using 'getservbyname' in statically linked 
applications requires at runtime the shared libraries from the glibc version 
used for linking
   drivers/built-in.o: In function `nixge_start_xmit':
>> include/linux/dma-mapping.h:210: undefined reference to `bad_dma_ops'
   drivers/built-in.o: In function `nixge_dma_bd_release':
>> drivers/net/ethernet/ni/nixge.c:234: undefined reference to `bad_dma_ops'
   drivers/built-in.o: In function `nixge_dma_bd_release':
   include/linux/dma-mapping.h:504: undefined reference to `bad_dma_ops'
   include/linux/dma-mapping.h:510: undefined reference to `bad_dma_ops'
   include/linux/dma-mapping.h:504: undefined reference to `bad_dma_ops'
   drivers/built-in.o:drivers/net/ethernet/ni/nixge.c:252: more undefined 
references to `bad_dma_ops' follow
   drivers/built-in.o: In function `nixge_mdio_setup':
>> drivers/net/ethernet/ni/nixge.c:1039: undefined reference to 
>> `of_address_to_resource'
   drivers/built-in.o: In function `nixge_probe':
>> drivers/net/ethernet/ni/nixge.c:1120: undefined reference to 
>> `devm_ioremap_resource'
   drivers/built-in.o: In function `img_ascii_lcd_probe':
   drivers/auxdisplay/img-ascii-lcd.c:386: undefined reference to 
`devm_ioremap_resource'
   collect2: error: ld returned 1 exit status

vim +234 drivers/net/ethernet/ni/nixge.c

   228  
   229  #define nixge_ctrl_poll_timeout(priv, addr, val, cond, sleep_us, 
timeout_us) \
   230  readl_poll_timeout((priv)->ctrl_regs + (addr), (val), cond, \
   231 (sleep_us), (timeout_us))
   232  
   233  static void nixge_dma_bd_release(struct net_device *ndev)
 > 234  {
   235  int i;
   236  struct nixge_priv *priv = netdev_priv(ndev);
   237  
   238  for (i = 0; i < RX_BD_NUM; i++) {
   239  dma_unmap_single(ndev->dev.parent, 
priv->rx_bd_v[i].phys,
   240   priv->max_frm_size, DMA_FROM_DEVICE);
   241  dev_kfree_skb((struct sk_buff *)
   242(priv->rx_bd_v[i].sw_id_offset));
   243  }
   244  
   245  if (priv->rx_bd_v) {
   246  dma_free_coherent(ndev->dev.parent,
   247sizeof(*priv->rx_bd_v) * RX_BD_NUM,
   248priv->rx_bd_v,
   249priv->rx_bd_p);
   250  }
   251  if (priv->tx_bd_v) {
   252  dma_free_coherent(ndev->dev.parent,
   253sizeof(*priv->tx_bd_v) * TX_BD_NUM,
   254priv->tx_bd_v,
   255priv->tx_bd_p);
   256  }
   257  }
   258  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: Lots of new warnings with gcc-7.1.1

2017-07-15 Thread Tejun Heo
Hello,

On Wed, Jul 12, 2017 at 03:31:02PM +0200, Arnd Bergmann wrote:
> > We also have about a bazillion
> >
> > warning: ‘*’ in boolean context, suggest ‘&&’ instead
> >
> > warnings in drivers/ata/libata-core.c, all due to a single macro that
> > uses a pattern that gcc-7.1.1 doesn't like. The warning looks a bit
> > debatable, but I suspect the macro could easily be changed too.
> >
> > Tejun, would you hate just moving the "multiply by 1000" part _into_
> > that EZ() macro? Something like the attached (UNTESTED!) patch?
> 
> Tejun applied an almost identical patch of mine a while ago, but it seems to
> have gotten lost in the meantime in some rebase:

Yeah, I was scratching my head remembering your patch.  Sorry about
that.  It should have been routed through for-4.12-fixes.

> https://patchwork.kernel.org/patch/9721397/
> https://patchwork.kernel.org/patch/9721399/
> 
> I guess I should have resubmitted the second patch with the suggested
> improvement.

The new one looks good to me.

Thanks.

-- 
tejun


Re: [PATCH v2] net: davicom: dm9000: Avoid spinlock recursion during dm9000_timeout routine

2017-07-15 Thread xiang fei
Hi,
  In this patch, I don't change the routine of dm9000_phy_write().
  I just abstract the real phy operation from dm9000_phy_write()
  to make a new function dm9000_phy_write_reg(),
  which contains no lock.

  It is called in dm9000_phy_write() or dm9000_init_dm9000().
  Since dm9000_timeout() holds the main spinlock through the
  entire routine, dm9000_phy_write_reg() called in this routine is
  protected from another thread. I think there is no need to
  acquire any locks.

  The only problem is dm9000_init_dm9000() may be called
  in dm9000_open(). If another thread calls dm9000_open()
  in timeout may cause race condition.

  dm9000_init_dm9000() needs lock to avoid race condition,
  did you mean that?
  Thanks!


[PATCH net] jhash: fix -Wimplicit-fallthrough warnings

2017-07-15 Thread Jakub Kicinski
GCC 7 added a new -Wimplicit-fallthrough warning.  It's only enabled
with W=1, but since linux/jhash.h is included in over hundred places
(including other global headers) it seems worthwhile fixing this
warning.

Signed-off-by: Jakub Kicinski 
---
If it looks good, would it be OK to take it via the net tree?

 include/linux/jhash.h | 29 ++---
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/include/linux/jhash.h b/include/linux/jhash.h
index 348c6f47e4cc..8037850f3104 100644
--- a/include/linux/jhash.h
+++ b/include/linux/jhash.h
@@ -85,19 +85,18 @@ static inline u32 jhash(const void *key, u32 length, u32 
initval)
k += 12;
}
/* Last block: affect all 32 bits of (c) */
-   /* All the case statements fall through */
switch (length) {
-   case 12: c += (u32)k[11]<<24;
-   case 11: c += (u32)k[10]<<16;
-   case 10: c += (u32)k[9]<<8;
-   case 9:  c += k[8];
-   case 8:  b += (u32)k[7]<<24;
-   case 7:  b += (u32)k[6]<<16;
-   case 6:  b += (u32)k[5]<<8;
-   case 5:  b += k[4];
-   case 4:  a += (u32)k[3]<<24;
-   case 3:  a += (u32)k[2]<<16;
-   case 2:  a += (u32)k[1]<<8;
+   case 12: c += (u32)k[11]<<24;   /* fall through */
+   case 11: c += (u32)k[10]<<16;   /* fall through */
+   case 10: c += (u32)k[9]<<8; /* fall through */
+   case 9:  c += k[8]; /* fall through */
+   case 8:  b += (u32)k[7]<<24;/* fall through */
+   case 7:  b += (u32)k[6]<<16;/* fall through */
+   case 6:  b += (u32)k[5]<<8; /* fall through */
+   case 5:  b += k[4]; /* fall through */
+   case 4:  a += (u32)k[3]<<24;/* fall through */
+   case 3:  a += (u32)k[2]<<16;/* fall through */
+   case 2:  a += (u32)k[1]<<8; /* fall through */
case 1:  a += k[0];
 __jhash_final(a, b, c);
case 0: /* Nothing left to add */
@@ -131,10 +130,10 @@ static inline u32 jhash2(const u32 *k, u32 length, u32 
initval)
k += 3;
}
 
-   /* Handle the last 3 u32's: all the case statements fall through */
+   /* Handle the last 3 u32's */
switch (length) {
-   case 3: c += k[2];
-   case 2: b += k[1];
+   case 3: c += k[2];  /* fall through */
+   case 2: b += k[1];  /* fall through */
case 1: a += k[0];
__jhash_final(a, b, c);
case 0: /* Nothing left to add */
-- 
2.11.0