Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH 2/3] vringh: kill off ACCESS_ONCE()
From: Cornelia Huck @ 2016-11-24 11:35 UTC (permalink / raw)
  To: Mark Rutland
  Cc: dave, kvm, dbueso, netdev, mst, linux-kernel, virtualization,
	paulmck, dvyukov
In-Reply-To: <1479983114-17190-3-git-send-email-mark.rutland@arm.com>

On Thu, 24 Nov 2016 10:25:13 +0000
Mark Rutland <mark.rutland@arm.com> wrote:

> Despite living under drivers/ vringh.c is also used as part of the userspace
> virtio tools. Before we can kill off the ACCESS_ONCE()definition in the tools,
> we must convert vringh.c to use {READ,WRITE}_ONCE().
> 
> This patch does so, along with the required include of <linux/compiler.h> for
> the relevant definitions. The userspace tools provide their own definitions in
> their own <linux/compiler.h>.
> 
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: kvm@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: netdev@vger.kernel.org
> Cc: virtualization@lists.linux-foundation.org
> ---
>  drivers/vhost/vringh.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>

^ permalink raw reply

* Re: [PATCH 3/3] tools/virtio: use {READ,WRITE}_ONCE() in uaccess.h
From: Cornelia Huck @ 2016-11-24 11:37 UTC (permalink / raw)
  To: Mark Rutland
  Cc: dave, kvm, dbueso, netdev, mst, linux-kernel, virtualization,
	paulmck, dvyukov
In-Reply-To: <1479983114-17190-4-git-send-email-mark.rutland@arm.com>

On Thu, 24 Nov 2016 10:25:14 +0000
Mark Rutland <mark.rutland@arm.com> wrote:

> As a step towards killing off ACCESS_ONCE, use {READ,WRITE}_ONCE() for the
> virtio tools uaccess primitives, pulling these in from <linux/compiler.h>.
> 
> With this done, we can kill off the now-unused ACCESS_ONCE() definition.
> 
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: linux-kernel@vger.kernel.org
> Cc: virtualization@lists.linux-foundation.org
> ---
>  tools/virtio/linux/uaccess.h | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)

Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>

^ permalink raw reply

* Re: [PATCH net-next v2] ethtool: Protect {get,set}_phy_tunable with PHY device mutex
From: Allan W. Nielsen @ 2016-11-24 11:48 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: netdev, davem, bcm-kernel-feedback-list, andrew, raju.lakkaraju,
	vivien.didelot
In-Reply-To: <20161122215531.18212-1-f.fainelli@gmail.com>

On 22/11/16 13:55, Florian Fainelli wrote:
> EXTERNAL EMAIL
> 
> 
> PHY drivers should be able to rely on the caller of {get,set}_tunable to
> have acquired the PHY device mutex, in order to both serialize against
> concurrent calls of these functions, but also against PHY state machine
> changes. All ethtool PHY-level functions do this, except
> {get,set}_tunable, so we make them consistent here as well.
> 
> We need to update the Microsemi PHY driver in the same commit to avoid
> introducing either deadlocks, or lack of proper locking.
> 
> Fixes: 968ad9da7e0e ("ethtool: Implements ETHTOOL_PHY_GTUNABLE/ETHTOOL_PHY_STUNABLE")
> Fixes: 310d9ad57ae0 ("net: phy: Add downshift get/set support in Microsemi PHYs driver")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Allan W. Nielsen <allan.nielsen@microsemi.com>

^ permalink raw reply

* Re: [patch net-next] sfc: remove unneeded variable
From: Bert Kenward @ 2016-11-24 12:03 UTC (permalink / raw)
  To: Dan Carpenter, Solarflare linux maintainers, Edward Cree
  Cc: netdev, kernel-janitors
In-Reply-To: <20161124111651.GJ17225@mwanda>

On 24/11/16 11:16, Dan Carpenter wrote:
> We don't use ->heap_buf after commit 46d1efd852cc ("sfc: remove Software
> TSO") so let's remove the last traces.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Bert Kenward <bkenward@solarflare.com>

^ permalink raw reply

* RE: [patch] fsl/fman: fix a leak in tgec_free()
From: Madalin-Cristian Bucur @ 2016-11-24 12:01 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
In-Reply-To: <20161124111931.GK17225@mwanda>

> -----Original Message-----
> From: Dan Carpenter [mailto:dan.carpenter@oracle.com]
> Sent: Thursday, November 24, 2016 1:21 PM
> To: Madalin-Cristian Bucur <madalin.bucur@nxp.com>; Igal Liberman
> <igal.liberman@freescale.com>
> Cc: netdev@vger.kernel.org; kernel-janitors@vger.kernel.org
> Subject: [patch] fsl/fman: fix a leak in tgec_free()
> 
> We set "tgec->cfg" to NULL before passing it to kfree().  There is no
> need to set it to NULL at all.  Let's just delete it.

Agree, thanks.

 
> Fixes: 57ba4c9b56d8 ("fsl/fman: Add FMan MAC support")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> I haven't tested this.  It occurs to me that this code might be
> something to paper over a use after free bug by changing it to a leak
> instead.
> 
> It applies to net-master.
> 
> diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c
> b/drivers/net/ethernet/freescale/fman/fman_tgec.c
> index efabb04..4b0f3a5 100644
> --- a/drivers/net/ethernet/freescale/fman/fman_tgec.c
> +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c
> @@ -722,9 +722,6 @@ int tgec_free(struct fman_mac *tgec)
>  {
>  	free_init_resources(tgec);
> 
> -	if (tgec->cfg)
> -		tgec->cfg = NULL;
> -
>  	kfree(tgec->cfg);
>  	kfree(tgec);
> 

^ permalink raw reply

* Re: net/arp: ARP cache aging failed.
From: Hannes Frederic Sowa @ 2016-11-24 12:28 UTC (permalink / raw)
  To: YueHaibing, Julian Anastasov, Eric Dumazet; +Cc: davem, netdev
In-Reply-To: <c82b7b44-c0ad-9ee7-1114-3eae3b5cf75a@huawei.com>

On 24.11.2016 10:06, YueHaibing wrote:
> On 2016/11/24 15:51, Julian Anastasov wrote:
>>
>> 	Hello,
>>
>> On Wed, 23 Nov 2016, Eric Dumazet wrote:
>>
>>> On Wed, 2016-11-23 at 15:37 +0100, Hannes Frederic Sowa wrote:
>>>
>>>> Irregardless about the question if bonding should keep the MAC address
>>>> alive, a MAC address can certainly change below a TCP connection.
>>>
>>> Of course ;)
>>>
> 
> I configured bonding fail_over_mac=1 ,so the bonding MAC always be the MAC
> address of the currently active slave.
> 
>>>>
>>>> dst_entry is 1:n to neigh_entry and as such we can end up confirming an
>>>> aging neighbor while sending a reply with dst->pending_confirm set while
>>>> the confirming packet actually came from a different neighbor.
>>>>
>>>> I agree with Julian, pending_confirm became useless in this way.
>>>
>>> Let's kill it then ;)
>>
>> 	It works for traffic via gateway. I now see that
>> we can even avoid write in dst_confirm:
>>
>> 	if (!dst->pending_confirm)
>> 		dst->pending_confirm = 1;
>>
>> 	because it is called by non-dup TCP ACKs.
>>
>> 	But for traffic to hosts on LAN we need different solution,
>> i.e. for cached dsts with rt_gateway = 0 (last entry below).
>>
>> rt_uses_gateway rt_gateway DST_NOCACHE Description
>> ====================================================================
>> 1               nh_gw      ANY         Traffic via gateway
>> 0               LAN_host   1           FLOWI_FLAG_KNOWN_NH (nexthop
>>                                        set by IPVS, hdrincl, xt_TEE)
>> 0               0          0           1 dst for many subnet hosts
>>
>> Regards
>>
>> --
>> Julian Anastasov <ja@ssi.bg>
>>
>> .
>>
> 
> As above,Is there a plan to fix the problem ? Should we just not call dst_confirm
> when in the case rt->rt_uses_gateway/DST_NOCACHE?

I think some people are thinking about it already (me also ;) ).

But it is not easy to come up with a solution. First of all, we need to
look up the L2 address again in the neighbor cache and confirm the
appropriate neighbor. Secondly we should only do that for packets which
we can actually confirm (that means passing the TCP recv tests or some
other kind of confirmation besides simply spamming the box etc). Also it
needs to be fast.

Bye,
Hannes

^ permalink raw reply

* Aw: Re: [net-next 1/2] net: ethernet: slicoss: add slicoss gigabit ethernet driver
From: Lino Sanfilippo @ 2016-11-24 12:30 UTC (permalink / raw)
  To: f.fainelli, andrew
  Cc: davem, charrer, liodot, gregkh, devel, linux-kernel, netdev,
	LinoSanfilippo
In-Reply-To: <86165d2b-f9d5-a380-9bb0-f77c12691eb6@gmx.de>

Hi Andrew, Hi Florian

> Gesendet: Dienstag, 15. November 2016 um 23:34 Uhr
> Von: "Lino Sanfilippo" <LinoSanfilippo@gmx.de>
> An: "Andrew Lunn" <andrew@lunn.ch>
> Cc: "Florian Fainelli" <f.fainelli@gmail.com>, davem@davemloft.net, charrer@alacritech.com, liodot@gmail.com, gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org
> Betreff: Re: [net-next 1/2] net: ethernet: slicoss: add slicoss gigabit ethernet driver
>
> On 15.11.2016 22:59, Andrew Lunn wrote:
> >> The link state is retrieved by a command to the application processor that is running 
> >> on the network card. Also the register to set the phy configuration is write-only, so
> >> it is not even possible to do the usual mdio bit-banging in the Phy read() and write()
> >> functions (however there seems to be another application processor command reserved 
> >> for retrieving the PHY settings, but I have not tried it yet). 
> > 
> >>> +  			val = MII_BMCR << 16 | SLIC_PCR_AUTONEG |
> >>> +		     	         SLIC_PCR_AUTONEG_RST;
> >>> +			slic_write(sdev, SLIC_REG_WPHY, val);
> > 
> > This actually looks a lot like an MDIO write operation. The upper 16
> > bits are the register, and the lower 16 bits are the data. What you
> > don't have is the address. But maybe it is limited to one address.
> > 
> > If the processor command reserved for read works in a similar way, you
> > have enough to do an MDIO bus.
> > 
> 
> Ok, I will give it a try. Reading values via the application processor
> is a bit awkward though, since it requires an address to a dma area as part of
> the command and then the AP informs the driver via irq that the dma memory has 
> been written. So probably the irq handler will have to set some flag and
> the mdio_read() function will have to poll for that flag in place of doing 
> bit-banging a register. 
> 
> > If you can get the read working look at registers 2 and 3. Compare
> > what you get with the values at the end of marvell.c.
> > 
> 
> Will do, thank you!
> 

unfortunately I was not able to figure out how to read the phy. My hope was to find
a hidden register that I can use to request the phy status from the cards utility processor.
I actually found two more registers that seem to be reserved for the communication
with the UP. At least they cause the UPR irq to be fired but there is no data written to
the provided dma address. I assume that they are not meant to be used for the this purpose.
So I am afraid I am not able to use the phy API in this driver for now. 
However I will send a v2 of the driver shortly that will include the other
changes suggested by Andrew along with some further small improvements.
Thanks for your help so far!

Regards,
Lino

^ permalink raw reply

* Re: [PATCH net 1/2] r8152: fix the sw rx checksum is unavailable
From: Mark Lord @ 2016-11-24 12:31 UTC (permalink / raw)
  To: Hayes Wang, netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
  Cc: nic_swsd, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
In-Reply-To: <95fa9f67-3af6-6749-0e2b-c95406486f7d-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>

On 16-11-23 02:29 PM, Mark Lord wrote:
> On 16-11-23 10:12 AM, Hayes Wang wrote:
>> Mark Lord [mlord-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org]
>> [...]
>>> What does this code do:
>>
>>>> static void r8153_set_rx_early_size(struct r8152 *tp)
>>>> {
>>>>        u32 mtu = tp->netdev->mtu;
>>>>        u32 ocp_data = (agg_buf_sz - mtu - VLAN_ETH_HLEN - VLAN_HLEN) / 4;
>>>>
>>>>        ocp_write_word(tp, MCU_TYPE_USB, USB_RX_EARLY_SIZE, ocp_data);
>>>> }
>>
>> This only works for RTL8153. However, what you use is RTL8152.
>> It is like delay completion. It is used to reduce the loading of CPU
>> by letting a transfer contain more data to reduce the number of
>> transfers.
>>
>>> How is ocp_data used by the hardware?
>>> Shouldn't the calculation also include sizeof(rx_desc) in there somewhere?
>>
>> The algorithm is from our hw engineers, and it should be
>>
>>    (agg_buf_sz - packet size) / 8
>>
>> You could refer to commit a59e6d815226 ("r8152: correct the rx early size").
>
> Thanks.
>
> Right now I am working quite hard trying to narrow things down exactly.
> You are correct that the driver does appear to be careful about accesses
> beyond the filled portion of a URB buffer -- for some reason I thought
> the original driver had issues there, but looking again it does not seem to.
>
> One idea that is now looking more likely:
> Things could be suffering from speculative CPU accesses to RAM
> (the system here has non-coherent d-cache/RAM).
> This could incorrectly pre-load data from adjacent URB buffers
> into the d-cache, creating coherency issues.  I am testing now
> with cacheline-sized guard zones between the buffers to see if
> that is the issue or not.

Nope.  Guard zones did not fix it, so it's probably not a prefetch issue.
Oddly, adding a couple of memory barriers to specific places in the driver
does help, A LOT.  Still not 100%, but it did pass 1800 reboot tests over night
with only three bad rx_desc's reported.

That's a new record here for the driver using kmalloc'd buffers,
and put reliability on par with using non-cacheable buffers.

Any way we look at it though, the chip/driver are simply unreliable,
and relying upon hardware checksums (which fail due to the driver
looking at garbage rather than the checksum bits) leads to data corruption.

Cheers



--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [patch net-next v2 09/11] ipv4: fib: Add an API to request a FIB dump
From: Hannes Frederic Sowa @ 2016-11-24 12:34 UTC (permalink / raw)
  To: Ido Schimmel
  Cc: Jiri Pirko, netdev, davem, idosch, eladr, yotamg, nogahf, arkadis,
	ogerlitz, roopa, dsa, nikolay, andy, vivien.didelot, andrew,
	f.fainelli, alexander.h.duyck, kaber
In-Reply-To: <20161124084758.q5uh7lr55pwwhxoh@splinter>

On 24.11.2016 09:47, Ido Schimmel wrote:
> On Thu, Nov 24, 2016 at 12:04:57AM +0100, Hannes Frederic Sowa wrote:
>> On 23.11.2016 20:53, Ido Schimmel wrote:
>>> On Wed, Nov 23, 2016 at 06:47:03PM +0100, Hannes Frederic Sowa wrote:
>>>> Hmm, I think you need to read the sequence counter under rtnl_lock to
>>>> have an ordering with the rest of the updates to the RCU trie. Otherwise
>>>> you don't know if the fib trie has the correct view regarding to the
>>>> incoming notifications as a whole. This is also necessary during restarts.
>>>
>>> I spent quite a lot of time thinking about this specific issue, but I
>>> couldn't convince myself that the read should be done under RTNL and I'm
>>> not sure I understand your reasoning. Can you please elaborate?
>>>
>>> If, before each notification sent, we call atomic_inc() and then call
>>> atomic_read() at the end, then how can we be tricked?
>>
>> The race I am suspecting to happen is:
>>
>> <CPU0> fib_register()
>>
>> <CPU1> delete route by notifier
>> <CPU1> enqueue delete cmd into ordered queue
>>
>> <CPU0> starts dump
>> <CPU0> sees deleted route by CPU1 because route not yet removed from RCU
>> <CPU0> enqueues route for addition
> 
> Yea, I missed this trivial case... My mind was fixed on problems that
> could happen after the dump already started. :(
> 
> Regarding your suggestion, I think the API will be more useful if we
> don't bundle fib_register() and fib_dump() together. We can do the
> following instead:
> 
> 1) Sum 'fib_seq' (doesn't need to be atomic_t anymore) from all net
> namespaces under RTNL

You anyway only support init_net, no?

I didn't fully understood what you mean by sum? Using one for the whole
system?

We already have net->ipv4.rt_genid as a per-namespace routing change
counter, have you looked at that?

> 2) Dump FIB tables under RCU
> 3) Do 1) again
> 4) Compare results from 1) and 3) and retry (according to sysctl limit)
> if results differ. Before each retry the module's callback (if passed)
> will be invoked.
> 
> Sounds OK?

Ah, you want to sum up all the fib_seq from all namespaces. Now I got it.

Not sure if that is such a good idea actually. It might make problems
later on if offloading will maybe one day become a per-netns knob for
the respective admins.

But semantically it should work.

If it turns out to be much easier than doing it per-netns, I think this
approach should work.

Bye,
Hannes

^ permalink raw reply

* Re: [Patch net-next] net_sched: move the empty tp check from ->destroy() to ->delete()
From: Roi Dayan @ 2016-11-24 11:01 UTC (permalink / raw)
  To: Daniel Borkmann, Cong Wang, netdev; +Cc: roid, jiri, John Fastabend
In-Reply-To: <5836BD82.6080407@iogearbox.net>


On 24/11/2016 12:14, Daniel Borkmann wrote:
> On 11/24/2016 09:29 AM, Roi Dayan wrote:
>> Hi,
>>
>> I'm testing this patch with KASAN enabled and got into a new kernel 
>> crash I didn't hit before.
>>
>> [ 1860.725065] 
>> ==================================================================
>> [ 1860.733893] BUG: KASAN: use-after-free in 
>> __netif_receive_skb_core+0x1ebe/0x29a0 at addr ffff880a68b04028
>> [ 1860.745415] Read of size 8 by task CPU 0/KVM/5334
>> [ 1860.751368] CPU: 8 PID: 5334 Comm: CPU 0/KVM Tainted: G O 
>> 4.9.0-rc3+ #18
>> [ 1860.760547] Hardware name: HP ProLiant DL380p Gen8, BIOS P70 
>> 07/01/2015
>> [ 1860.768036] Call Trace:
>> [ 1860.771307]  [<ffffffffa9b6dc42>] dump_stack+0x63/0x81
>> [ 1860.777167]  [<ffffffffa95fb751>] kasan_object_err+0x21/0x70
>> [ 1860.783826]  [<ffffffffa95fb9dd>] kasan_report_error+0x1ed/0x4e0
>> [ 1860.790640]  [<ffffffffa9b9b841>] ? csum_partial+0x11/0x20
>> [ 1860.796871]  [<ffffffffaa44a6b9>] ? csum_partial_ext+0x9/0x10
>> [ 1860.803571]  [<ffffffffaa453155>] ? __skb_checksum+0x115/0x8d0
>> [ 1860.810370]  [<ffffffffa95fbe81>] 
>> __asan_report_load8_noabort+0x61/0x70
>> [ 1860.818263]  [<ffffffffaa49c3fe>] ? 
>> __netif_receive_skb_core+0x1ebe/0x29a0
>> [ 1860.826215]  [<ffffffffaa49c3fe>] 
>> __netif_receive_skb_core+0x1ebe/0x29a0
>> [ 1860.833991]  [<ffffffffaa49a540>] ? netdev_info+0x100/0x100
>> [ 1860.840529]  [<ffffffffaa671792>] ? udp4_gro_receive+0x802/0x1090
>> [ 1860.847783]  [<ffffffffa9bb9a08>] ? find_next_bit+0x18/0x20
>> [ 1860.854126]  [<ffffffffaa49cf04>] __netif_receive_skb+0x24/0x150
>> [ 1860.861695]  [<ffffffffaa49d0d1>] 
>> netif_receive_skb_internal+0xa1/0x1d0
>> [ 1860.869366]  [<ffffffffaa49d030>] ? __netif_receive_skb+0x150/0x150
>> [ 1860.876464]  [<ffffffffaa49f7e9>] ? dev_gro_receive+0x969/0x1660
>> [ 1860.883924]  [<ffffffffaa4a0e1f>] napi_gro_receive+0x1df/0x300
>> [ 1860.890744]  [<ffffffffc02e885d>] 
>> mlx5e_handle_rx_cqe_rep+0x83d/0xd30 [mlx5_core]
>>
>> checking with gdb
>>
>> (gdb) l *(__netif_receive_skb_core+0x1ebe)
>> 0xffffffff8249c3fe is in __netif_receive_skb_core (net/core/dev.c:3937).
>> 3932                    *pt_prev = NULL;
>> 3933            }
>> 3934
>> 3935            qdisc_skb_cb(skb)->pkt_len = skb->len;
>> 3936            skb->tc_verd = SET_TC_AT(skb->tc_verd, AT_INGRESS);
>> 3937            qdisc_bstats_cpu_update(cl->q, skb);
>> 3938
>> 3939            switch (tc_classify(skb, cl, &cl_res, false)) {
>> 3940            case TC_ACT_OK:
>> 3941            case TC_ACT_RECLASSIFY:
>
> Can you elaborate some more on your test-case? Adding/dropping ingress 
> qdisc with
> some classifier on it in a loop while traffic goes through?

I first delete the qdisc ingress from the relevant interface
I start traffic on it then I add the qdisc ingress to the relevant 
interface and start adding tc flower rules to match the traffic.


>
> Thanks,
> Daniel

^ permalink raw reply

* Re: [PATCH net-next] mlx4: reorganize struct mlx4_en_tx_ring
From: Tariq Toukan @ 2016-11-24 12:36 UTC (permalink / raw)
  To: Eric Dumazet, David Miller; +Cc: netdev, Tariq Toukan
In-Reply-To: <1479858970.8455.461.camel@edumazet-glaptop3.roam.corp.google.com>

Hi Eric,
Thanks for your patch.

On 23/11/2016 1:56 AM, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> Goal is to reorganize this critical structure to increase performance.
>
> ndo_start_xmit() should only dirty one cache line, and access as few
> cache lines as possible.
>
> Add sp_ (Slow Path) prefix to fields that are not used in fast path,
> to make clear what is going on.
>
> After this patch pahole reports something much better, as all
> ndo_start_xmit() needed fields are packed into two cache lines instead
> of seven or eight
>
> struct mlx4_en_tx_ring {
> 	u32                        last_nr_txbb;         /*     0   0x4 */
> 	u32                        cons;                 /*   0x4   0x4 */
> 	long unsigned int          wake_queue;           /*   0x8   0x8 */
> 	struct netdev_queue *      tx_queue;             /*  0x10   0x8 */
> 	u32                        (*free_tx_desc)(struct mlx4_en_priv *, struct mlx4_en_tx_ring *, int, u8, u64, int); /*  0x18   0x8 */
> 	struct mlx4_en_rx_ring *   recycle_ring;         /*  0x20   0x8 */
>
> 	/* XXX 24 bytes hole, try to pack */
>
> 	/* --- cacheline 1 boundary (64 bytes) --- */
> 	u32                        prod;                 /*  0x40   0x4 */
> 	unsigned int               tx_dropped;           /*  0x44   0x4 */
> 	long unsigned int          bytes;                /*  0x48   0x8 */
> 	long unsigned int          packets;              /*  0x50   0x8 */
> 	long unsigned int          tx_csum;              /*  0x58   0x8 */
> 	long unsigned int          tso_packets;          /*  0x60   0x8 */
> 	long unsigned int          xmit_more;            /*  0x68   0x8 */
> 	struct mlx4_bf             bf;                   /*  0x70  0x18 */
> 	/* --- cacheline 2 boundary (128 bytes) was 8 bytes ago --- */
> 	__be32                     doorbell_qpn;         /*  0x88   0x4 */
> 	__be32                     mr_key;               /*  0x8c   0x4 */
> 	u32                        size;                 /*  0x90   0x4 */
> 	u32                        size_mask;            /*  0x94   0x4 */
> 	u32                        full_size;            /*  0x98   0x4 */
> 	u32                        buf_size;             /*  0x9c   0x4 */
> 	void *                     buf;                  /*  0xa0   0x8 */
> 	struct mlx4_en_tx_info *   tx_info;              /*  0xa8   0x8 */
> 	int                        qpn;                  /*  0xb0   0x4 */
> 	u8                         queue_index;          /*  0xb4   0x1 */
> 	bool                       bf_enabled;           /*  0xb5   0x1 */
> 	bool                       bf_alloced;           /*  0xb6   0x1 */
> 	u8                         hwtstamp_tx_type;     /*  0xb7   0x1 */
> 	u8 *                       bounce_buf;           /*  0xb8   0x8 */
> 	/* --- cacheline 3 boundary (192 bytes) --- */
> 	long unsigned int          queue_stopped;        /*  0xc0   0x8 */
> 	struct mlx4_hwq_resources  sp_wqres;             /*  0xc8  0x58 */
> 	/* --- cacheline 4 boundary (256 bytes) was 32 bytes ago --- */
> 	struct mlx4_qp             sp_qp;                /* 0x120  0x30 */
> 	/* --- cacheline 5 boundary (320 bytes) was 16 bytes ago --- */
> 	struct mlx4_qp_context     sp_context;           /* 0x150  0xf8 */
> 	/* --- cacheline 9 boundary (576 bytes) was 8 bytes ago --- */
> 	cpumask_t                  sp_affinity_mask;     /* 0x248  0x20 */
> 	enum mlx4_qp_state         sp_qp_state;          /* 0x268   0x4 */
> 	u16                        sp_stride;            /* 0x26c   0x2 */
> 	u16                        sp_cqn;               /* 0x26e   0x2 */
>
> 	/* size: 640, cachelines: 10, members: 36 */
> 	/* sum members: 600, holes: 1, sum holes: 24 */
> 	/* padding: 16 */
> };
>
> Instead of this silly placement :
>
> struct mlx4_en_tx_ring {
> 	u32                        last_nr_txbb;         /*     0   0x4 */
> 	u32                        cons;                 /*   0x4   0x4 */
> 	long unsigned int          wake_queue;           /*   0x8   0x8 */
>
> 	/* XXX 48 bytes hole, try to pack */
>
> 	/* --- cacheline 1 boundary (64 bytes) --- */
> 	u32                        prod;                 /*  0x40   0x4 */
>
> 	/* XXX 4 bytes hole, try to pack */
>
> 	long unsigned int          bytes;                /*  0x48   0x8 */
> 	long unsigned int          packets;              /*  0x50   0x8 */
> 	long unsigned int          tx_csum;              /*  0x58   0x8 */
> 	long unsigned int          tso_packets;          /*  0x60   0x8 */
> 	long unsigned int          xmit_more;            /*  0x68   0x8 */
> 	unsigned int               tx_dropped;           /*  0x70   0x4 */
>
> 	/* XXX 4 bytes hole, try to pack */
>
> 	struct mlx4_bf             bf;                   /*  0x78  0x18 */
> 	/* --- cacheline 2 boundary (128 bytes) was 16 bytes ago --- */
> 	long unsigned int          queue_stopped;        /*  0x90   0x8 */
> 	cpumask_t                  affinity_mask;        /*  0x98  0x10 */
> 	struct mlx4_qp             qp;                   /*  0xa8  0x30 */
> 	/* --- cacheline 3 boundary (192 bytes) was 24 bytes ago --- */
> 	struct mlx4_hwq_resources  wqres;                /*  0xd8  0x58 */
> 	/* --- cacheline 4 boundary (256 bytes) was 48 bytes ago --- */
> 	u32                        size;                 /* 0x130   0x4 */
> 	u32                        size_mask;            /* 0x134   0x4 */
> 	u16                        stride;               /* 0x138   0x2 */
>
> 	/* XXX 2 bytes hole, try to pack */
>
> 	u32                        full_size;            /* 0x13c   0x4 */
> 	/* --- cacheline 5 boundary (320 bytes) --- */
> 	u16                        cqn;                  /* 0x140   0x2 */
>
> 	/* XXX 2 bytes hole, try to pack */
>
> 	u32                        buf_size;             /* 0x144   0x4 */
> 	__be32                     doorbell_qpn;         /* 0x148   0x4 */
> 	__be32                     mr_key;               /* 0x14c   0x4 */
> 	void *                     buf;                  /* 0x150   0x8 */
> 	struct mlx4_en_tx_info *   tx_info;              /* 0x158   0x8 */
> 	struct mlx4_en_rx_ring *   recycle_ring;         /* 0x160   0x8 */
> 	u32                        (*free_tx_desc)(struct mlx4_en_priv *, struct mlx4_en_tx_ring *, int, u8, u64, int); /* 0x168   0x8 */
> 	u8 *                       bounce_buf;           /* 0x170   0x8 */
> 	struct mlx4_qp_context     context;              /* 0x178  0xf8 */
> 	/* --- cacheline 9 boundary (576 bytes) was 48 bytes ago --- */
> 	int                        qpn;                  /* 0x270   0x4 */
> 	enum mlx4_qp_state         qp_state;             /* 0x274   0x4 */
> 	u8                         queue_index;          /* 0x278   0x1 */
> 	bool                       bf_enabled;           /* 0x279   0x1 */
> 	bool                       bf_alloced;           /* 0x27a   0x1 */
>
> 	/* XXX 5 bytes hole, try to pack */
>
> 	/* --- cacheline 10 boundary (640 bytes) --- */
> 	struct netdev_queue *      tx_queue;             /* 0x280   0x8 */
> 	int                        hwtstamp_tx_type;     /* 0x288   0x4 */
>
> 	/* size: 704, cachelines: 11, members: 36 */
> 	/* sum members: 587, holes: 6, sum holes: 65 */
> 	/* padding: 52 */
> };
>
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---
>   drivers/net/ethernet/mellanox/mlx4/en_netdev.c |    2
>   drivers/net/ethernet/mellanox/mlx4/en_tx.c     |   48 +++++++--------
>   drivers/net/ethernet/mellanox/mlx4/mlx4_en.h   |   42 +++++++------
>   3 files changed, 48 insertions(+), 44 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> index 9a807e93c9fdd81e61e561208aa1480a244d0bdb..9018bb1b2e12142e048281a9d28ddf95e0023a61 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
> @@ -1305,7 +1305,7 @@ static void mlx4_en_tx_timeout(struct net_device *dev)
>   		if (!netif_tx_queue_stopped(netdev_get_tx_queue(dev, i)))
>   			continue;
>   		en_warn(priv, "TX timeout on queue: %d, QP: 0x%x, CQ: 0x%x, Cons: 0x%x, Prod: 0x%x\n",
> -			i, tx_ring->qpn, tx_ring->cqn,
> +			i, tx_ring->qpn, tx_ring->sp_cqn,
>   			tx_ring->cons, tx_ring->prod);
>   	}
>   
> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
> index 5de3cbe24f2bf467f9a8f7d499e131b6d2a1844c..4b597dca5c52d114344d638895275ed0d378bd96 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
> @@ -66,7 +66,7 @@ int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv,
>   
>   	ring->size = size;
>   	ring->size_mask = size - 1;
> -	ring->stride = stride;
> +	ring->sp_stride = stride;
>   	ring->full_size = ring->size - HEADROOM - MAX_DESC_TXBBS;
>   
>   	tmp = size * sizeof(struct mlx4_en_tx_info);
> @@ -90,22 +90,22 @@ int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv,
>   			goto err_info;
>   		}
>   	}
> -	ring->buf_size = ALIGN(size * ring->stride, MLX4_EN_PAGE_SIZE);
> +	ring->buf_size = ALIGN(size * ring->sp_stride, MLX4_EN_PAGE_SIZE);
>   
>   	/* Allocate HW buffers on provided NUMA node */
>   	set_dev_node(&mdev->dev->persist->pdev->dev, node);
> -	err = mlx4_alloc_hwq_res(mdev->dev, &ring->wqres, ring->buf_size);
> +	err = mlx4_alloc_hwq_res(mdev->dev, &ring->sp_wqres, ring->buf_size);
>   	set_dev_node(&mdev->dev->persist->pdev->dev, mdev->dev->numa_node);
>   	if (err) {
>   		en_err(priv, "Failed allocating hwq resources\n");
>   		goto err_bounce;
>   	}
>   
> -	ring->buf = ring->wqres.buf.direct.buf;
> +	ring->buf = ring->sp_wqres.buf.direct.buf;
>   
>   	en_dbg(DRV, priv, "Allocated TX ring (addr:%p) - buf:%p size:%d buf_size:%d dma:%llx\n",
>   	       ring, ring->buf, ring->size, ring->buf_size,
> -	       (unsigned long long) ring->wqres.buf.direct.map);
> +	       (unsigned long long) ring->sp_wqres.buf.direct.map);
>   
>   	err = mlx4_qp_reserve_range(mdev->dev, 1, 1, &ring->qpn,
>   				    MLX4_RESERVE_ETH_BF_QP);
> @@ -114,12 +114,12 @@ int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv,
>   		goto err_hwq_res;
>   	}
>   
> -	err = mlx4_qp_alloc(mdev->dev, ring->qpn, &ring->qp, GFP_KERNEL);
> +	err = mlx4_qp_alloc(mdev->dev, ring->qpn, &ring->sp_qp, GFP_KERNEL);
>   	if (err) {
>   		en_err(priv, "Failed allocating qp %d\n", ring->qpn);
>   		goto err_reserve;
>   	}
> -	ring->qp.event = mlx4_en_sqp_event;
> +	ring->sp_qp.event = mlx4_en_sqp_event;
>   
>   	err = mlx4_bf_alloc(mdev->dev, &ring->bf, node);
>   	if (err) {
> @@ -141,7 +141,7 @@ int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv,
>   	if (queue_index < priv->num_tx_rings_p_up)
>   		cpumask_set_cpu(cpumask_local_spread(queue_index,
>   						     priv->mdev->dev->numa_node),
> -				&ring->affinity_mask);
> +				&ring->sp_affinity_mask);
>   
>   	*pring = ring;
>   	return 0;
> @@ -149,7 +149,7 @@ int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv,
>   err_reserve:
>   	mlx4_qp_release_range(mdev->dev, ring->qpn, 1);
>   err_hwq_res:
> -	mlx4_free_hwq_res(mdev->dev, &ring->wqres, ring->buf_size);
> +	mlx4_free_hwq_res(mdev->dev, &ring->sp_wqres, ring->buf_size);
>   err_bounce:
>   	kfree(ring->bounce_buf);
>   	ring->bounce_buf = NULL;
> @@ -171,10 +171,10 @@ void mlx4_en_destroy_tx_ring(struct mlx4_en_priv *priv,
>   
>   	if (ring->bf_alloced)
>   		mlx4_bf_free(mdev->dev, &ring->bf);
> -	mlx4_qp_remove(mdev->dev, &ring->qp);
> -	mlx4_qp_free(mdev->dev, &ring->qp);
> +	mlx4_qp_remove(mdev->dev, &ring->sp_qp);
> +	mlx4_qp_free(mdev->dev, &ring->sp_qp);
>   	mlx4_qp_release_range(priv->mdev->dev, ring->qpn, 1);
> -	mlx4_free_hwq_res(mdev->dev, &ring->wqres, ring->buf_size);
> +	mlx4_free_hwq_res(mdev->dev, &ring->sp_wqres, ring->buf_size);
>   	kfree(ring->bounce_buf);
>   	ring->bounce_buf = NULL;
>   	kvfree(ring->tx_info);
> @@ -190,7 +190,7 @@ int mlx4_en_activate_tx_ring(struct mlx4_en_priv *priv,
>   	struct mlx4_en_dev *mdev = priv->mdev;
>   	int err;
>   
> -	ring->cqn = cq;
> +	ring->sp_cqn = cq;
>   	ring->prod = 0;
>   	ring->cons = 0xffffffff;
>   	ring->last_nr_txbb = 1;
> @@ -198,21 +198,21 @@ int mlx4_en_activate_tx_ring(struct mlx4_en_priv *priv,
>   	memset(ring->buf, 0, ring->buf_size);
>   	ring->free_tx_desc = mlx4_en_free_tx_desc;
>   
> -	ring->qp_state = MLX4_QP_STATE_RST;
> -	ring->doorbell_qpn = cpu_to_be32(ring->qp.qpn << 8);
> +	ring->sp_qp_state = MLX4_QP_STATE_RST;
> +	ring->doorbell_qpn = cpu_to_be32(ring->sp_qp.qpn << 8);
>   	ring->mr_key = cpu_to_be32(mdev->mr.key);
>   
> -	mlx4_en_fill_qp_context(priv, ring->size, ring->stride, 1, 0, ring->qpn,
> -				ring->cqn, user_prio, &ring->context);
> +	mlx4_en_fill_qp_context(priv, ring->size, ring->sp_stride, 1, 0, ring->qpn,
> +				ring->sp_cqn, user_prio, &ring->sp_context);
>   	if (ring->bf_alloced)
> -		ring->context.usr_page =
> +		ring->sp_context.usr_page =
>   			cpu_to_be32(mlx4_to_hw_uar_index(mdev->dev,
>   							 ring->bf.uar->index));
>   
> -	err = mlx4_qp_to_ready(mdev->dev, &ring->wqres.mtt, &ring->context,
> -			       &ring->qp, &ring->qp_state);
> -	if (!cpumask_empty(&ring->affinity_mask))
> -		netif_set_xps_queue(priv->dev, &ring->affinity_mask,
> +	err = mlx4_qp_to_ready(mdev->dev, &ring->sp_wqres.mtt, &ring->sp_context,
> +			       &ring->sp_qp, &ring->sp_qp_state);
> +	if (!cpumask_empty(&ring->sp_affinity_mask))
> +		netif_set_xps_queue(priv->dev, &ring->sp_affinity_mask,
>   				    ring->queue_index);
>   
>   	return err;
> @@ -223,8 +223,8 @@ void mlx4_en_deactivate_tx_ring(struct mlx4_en_priv *priv,
>   {
>   	struct mlx4_en_dev *mdev = priv->mdev;
>   
> -	mlx4_qp_modify(mdev->dev, NULL, ring->qp_state,
> -		       MLX4_QP_STATE_RST, NULL, 0, 0, &ring->qp);
> +	mlx4_qp_modify(mdev->dev, NULL, ring->sp_qp_state,
> +		       MLX4_QP_STATE_RST, NULL, 0, 0, &ring->sp_qp);
>   }
>   
>   static inline bool mlx4_en_is_tx_ring_full(struct mlx4_en_tx_ring *ring)
> diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
> index eff21651b67308a17fe3d60d236cd0b6800a3fd2..574bcbb1b38fc4758511d8f7bd17a87b0a507a73 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
> +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
> @@ -281,46 +281,50 @@ struct mlx4_en_tx_ring {
>   	u32			last_nr_txbb;
>   	u32			cons;
>   	unsigned long		wake_queue;
> +	struct netdev_queue	*tx_queue;
> +	u32			(*free_tx_desc)(struct mlx4_en_priv *priv,
> +						struct mlx4_en_tx_ring *ring,
> +						int index, u8 owner,
> +						u64 timestamp, int napi_mode);
> +	struct mlx4_en_rx_ring	*recycle_ring;
>   
>   	/* cache line used and dirtied in mlx4_en_xmit() */
>   	u32			prod ____cacheline_aligned_in_smp;
> +	unsigned int		tx_dropped;
>   	unsigned long		bytes;
>   	unsigned long		packets;
>   	unsigned long		tx_csum;
>   	unsigned long		tso_packets;
>   	unsigned long		xmit_more;
> -	unsigned int		tx_dropped;
>   	struct mlx4_bf		bf;
> -	unsigned long		queue_stopped;
>   
>   	/* Following part should be mostly read */
> -	cpumask_t		affinity_mask;
> -	struct mlx4_qp		qp;
> -	struct mlx4_hwq_resources wqres;
> +	__be32			doorbell_qpn;
> +	__be32			mr_key;
>   	u32			size; /* number of TXBBs */
>   	u32			size_mask;
> -	u16			stride;
>   	u32			full_size;
> -	u16			cqn;	/* index of port CQ associated with this ring */
>   	u32			buf_size;
> -	__be32			doorbell_qpn;
> -	__be32			mr_key;
>   	void			*buf;
>   	struct mlx4_en_tx_info	*tx_info;
> -	struct mlx4_en_rx_ring	*recycle_ring;
> -	u32			(*free_tx_desc)(struct mlx4_en_priv *priv,
> -						struct mlx4_en_tx_ring *ring,
> -						int index, u8 owner,
> -						u64 timestamp, int napi_mode);
> -	u8			*bounce_buf;
> -	struct mlx4_qp_context	context;
>   	int			qpn;
> -	enum mlx4_qp_state	qp_state;
>   	u8			queue_index;
>   	bool			bf_enabled;
>   	bool			bf_alloced;
> -	struct netdev_queue	*tx_queue;
> -	int			hwtstamp_tx_type;
> +	u8			hwtstamp_tx_type;
> +	u8			*bounce_buf;
> +
> +	/* Not used in fast path
> +	 * Only queue_stopped might be used if BQL is not properly working.
> +	 */
> +	unsigned long		queue_stopped;
> +	struct mlx4_hwq_resources sp_wqres;
> +	struct mlx4_qp		sp_qp;
> +	struct mlx4_qp_context	sp_context;
> +	cpumask_t		sp_affinity_mask;
> +	enum mlx4_qp_state	sp_qp_state;
> +	u16			sp_stride;
> +	u16			sp_cqn;	/* index of port CQ associated with this ring */
>   } ____cacheline_aligned_in_smp;
>   
>   struct mlx4_en_rx_desc {
>
>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>

Regards,
Tariq

^ permalink raw reply

* RE: [PATCH net 1/2] r8152: fix the sw rx checksum is unavailable
From: Hayes Wang @ 2016-11-24 12:37 UTC (permalink / raw)
  To: Mark Lord, netdev@vger.kernel.org
  Cc: nic_swsd, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org
In-Reply-To: <b61a0e10-c737-8912-3e4e-393f4eb32077@pobox.com>

Mark Lord [mailto:mlord@pobox.com]
> Sent: Wednesday, November 23, 2016 9:41 PM
[...] 
> >static void r8153_set_rx_early_size(struct r8152 *tp)
> >{
> >        u32 mtu = tp->netdev->mtu;
> >        u32 ocp_data = (agg_buf_sz - mtu - VLAN_ETH_HLEN - VLAN_HLEN) / 4;
> >
> >        ocp_write_word(tp, MCU_TYPE_USB, USB_RX_EARLY_SIZE, ocp_data);
> >}
> 
> How is ocp_data used by the hardware?
> Shouldn't the calculation also include sizeof(rx_desc) in there somewhere?

I check your question with our hw engineers, and you are right.
The size of rx descriptor should be calculated, too.

Best Regards,
Hayes



^ permalink raw reply

* RE: [patch added to 3.12-stable] net: sctp, forbid negative length
From: David Laight @ 2016-11-24 12:51 UTC (permalink / raw)
  To: 'Jiri Slaby', stable@vger.kernel.org
  Cc: Vlad Yasevich, Neil Horman, David S. Miller,
	linux-sctp@vger.kernel.org, netdev@vger.kernel.org
In-Reply-To: <20161124091800.14160-11-jslaby@suse.cz>

From: Jiri Slaby
> Sent: 24 November 2016 09:18
> This patch has been added to the 3.12 stable tree. If you have any
> objections, please let us know.
> 
> ===============
> 
> [ Upstream commit a4b8e71b05c27bae6bad3bdecddbc6b68a3ad8cf ]
> 
> Most of getsockopt handlers in net/sctp/socket.c check len against
> sizeof some structure like:
>         if (len < sizeof(int))
>                 return -EINVAL;
> 
> On the first look, the check seems to be correct. But since len is int
> and sizeof returns size_t, int gets promoted to unsigned size_t too. So
> the test returns false for negative lengths. Yes, (-1 < sizeof(long)) is
> false.

Would it be worth adding the check in the generic setsockopt/getsockopt system
call code instead of in each and every protocol?
(Clearly for net-next, not stable.)

	David

^ permalink raw reply

* Re: [patch net-next] sfc: remove unneeded variable
From: Edward Cree @ 2016-11-24 13:22 UTC (permalink / raw)
  To: Dan Carpenter, Solarflare linux maintainers
  Cc: Bert Kenward, netdev, kernel-janitors
In-Reply-To: <20161124111651.GJ17225@mwanda>

On 24/11/16 11:16, Dan Carpenter wrote:
> We don't use ->heap_buf after commit 46d1efd852cc ("sfc: remove Software
> TSO") so let's remove the last traces.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
> index f97f828..fd17bda 100644
> --- a/drivers/net/ethernet/sfc/net_driver.h
> +++ b/drivers/net/ethernet/sfc/net_driver.h
> @@ -139,8 +139,6 @@ struct efx_special_buffer {
>   * struct efx_tx_buffer - buffer state for a TX descriptor
>   * @skb: When @flags & %EFX_TX_BUF_SKB, the associated socket buffer to be
>   *	freed when descriptor completes
> - * @heap_buf: When @flags & %EFX_TX_BUF_HEAP, the associated heap buffer to be
> - *	freed when descriptor completes.

Does that mean we can also remove EFX_TX_BUF_HEAP?
-Ed

^ permalink raw reply

* RE: [PATCH net 1/2] r8152: fix the sw rx checksum is unavailable
From: Hayes Wang @ 2016-11-24 13:26 UTC (permalink / raw)
  To: Mark Lord, netdev@vger.kernel.org
  Cc: nic_swsd, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org
In-Reply-To: <baf5246d-9d8a-4029-6823-350ed561fd33@pobox.com>

Mark Lord [mailto:mlord@pobox.com]
> Sent: Thursday, November 24, 2016 8:31 PM
[...]
> Nope.  Guard zones did not fix it, so it's probably not a prefetch issue.
> Oddly, adding a couple of memory barriers to specific places in the driver
> does help, A LOT.  Still not 100%, but it did pass 1800 reboot tests over night
> with only three bad rx_desc's reported.
> 
> That's a new record here for the driver using kmalloc'd buffers,
> and put reliability on par with using non-cacheable buffers.
> 
> Any way we look at it though, the chip/driver are simply unreliable,
> and relying upon hardware checksums (which fail due to the driver
> looking at garbage rather than the checksum bits) leads to data corruption.

I don't think the garbage results from our driver or device.
If it is the issue about memory, I think the host driver ought
to deal with it, because it handles the DMA.

Besides, it doesn't seem to occur for all platforms. I have
tested the iperf more than 26 hours, and it still works fine.
I think I would get the same result on x86 or x86_64 platform.

Best Regards,
Hayes

^ permalink raw reply

* Re: [PATCH iproute2 0/2] tc/cls_flower: Support for ip tunnel metadata set/release/classify
From: Jiri Benc @ 2016-11-24 13:38 UTC (permalink / raw)
  To: Amir Vadai
  Cc: Stephen Hemminger, David S. Miller, netdev, Or Gerlitz,
	Hadar Har-Zion, Roi Dayan
In-Reply-To: <20161121102056.13468-1-amir@vadai.me>

On Mon, 21 Nov 2016 12:20:54 +0200, Amir Vadai wrote:
> $ tc filter add dev vxlan0 protocol ip parent ffff: \
>     flower \
>       enc_src_ip 11.11.0.2 \
>       enc_dst_ip 11.11.0.1 \
>       enc_key_id 11 \
>       dst_ip 11.11.11.1 \
>     action tunnel_key release \
>     action mirred egress redirect dev vnet0

I really hate the "action tunnel_key release". This just exposes the
kernel internal implementation detail (dst_metadata) to the user. Why
should the user care about explicit releasing of the tunnel key? This
should happen automatically. Users do not care about our internal
implementation.

> $ tc filter add dev net0 protocol ip parent ffff: \
>     flower \
>       ip_proto 1 \
>       dst_ip 11.11.11.2 \
>     action tunnel_key set \
>       src_ip 11.11.0.1 \
>       dst_ip 11.11.0.2 \
>       id 11 \
>     action mirred egress redirect dev vxlan0

Do you see the asymmetry? This is not called "alloc tunnel_key", and
rightly so. It's very reasonable to call this "set", as it is what the
action looks like to the user.

The only argument for the existence of an explicit "release" (we should
rather call it "unset" in such case, though) is forwarding between two
tunnels, where metadata from the first tunnel will be used for
encapsulation done by the second tunnel. Or a similar case when there's
classification based on the tunnel metadata done on the mirred
interface. Somewhat corner cases, though. If we want to support them,
then let's call the action "unset" and not "release". And in any case,
it should not be mandatory to specify it, which should be made clear
in the documentation (including examples where it is needed - basically
only when forwarding between tunnels).

 Jiri

^ permalink raw reply

* Re: [patch net-next] sfc: remove unneeded variable
From: Dan Carpenter @ 2016-11-24 13:49 UTC (permalink / raw)
  To: Edward Cree
  Cc: Solarflare linux maintainers, Bert Kenward, netdev,
	kernel-janitors
In-Reply-To: <698affdd-d4e0-53c0-fff0-9b66252504a0@solarflare.com>

On Thu, Nov 24, 2016 at 01:22:24PM +0000, Edward Cree wrote:
> On 24/11/16 11:16, Dan Carpenter wrote:
> > We don't use ->heap_buf after commit 46d1efd852cc ("sfc: remove Software
> > TSO") so let's remove the last traces.
> >
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> >
> > diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
> > index f97f828..fd17bda 100644
> > --- a/drivers/net/ethernet/sfc/net_driver.h
> > +++ b/drivers/net/ethernet/sfc/net_driver.h
> > @@ -139,8 +139,6 @@ struct efx_special_buffer {
> >   * struct efx_tx_buffer - buffer state for a TX descriptor
> >   * @skb: When @flags & %EFX_TX_BUF_SKB, the associated socket buffer to be
> >   *   freed when descriptor completes
> > - * @heap_buf: When @flags & %EFX_TX_BUF_HEAP, the associated heap buffer to be
> > - *   freed when descriptor completes.
> 
> Does that mean we can also remove EFX_TX_BUF_HEAP?

Good point.  I will resend.

regards,
dan carpenter

^ permalink raw reply

* [PATCH] ath5k: drop duplicate header vmalloc.h
From: Geliang Tang @ 2016-11-24 13:58 UTC (permalink / raw)
  To: Jiri Slaby, Nick Kossifidis, Luis R. Rodriguez, Kalle Valo
  Cc: Geliang Tang, linux-wireless, netdev, linux-kernel

Drop duplicate header vmalloc.h from ath5k/debug.c.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
 drivers/net/wireless/ath/ath5k/debug.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath5k/debug.c b/drivers/net/wireless/ath/ath5k/debug.c
index 4f8d9ed..d068df5 100644
--- a/drivers/net/wireless/ath/ath5k/debug.c
+++ b/drivers/net/wireless/ath/ath5k/debug.c
@@ -66,7 +66,6 @@
 
 #include <linux/seq_file.h>
 #include <linux/list.h>
-#include <linux/vmalloc.h>
 #include "debug.h"
 #include "ath5k.h"
 #include "reg.h"
-- 
2.9.3

^ permalink raw reply related

* [PATCH] ibmvnic: drop duplicate header seq_file.h
From: Geliang Tang @ 2016-11-24 13:58 UTC (permalink / raw)
  To: Thomas Falcon, John Allen, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman
  Cc: Geliang Tang, netdev, linuxppc-dev, linux-kernel
In-Reply-To: <15299de49216a2360976ca37ff774cae9d27d88b.1479991297.git.geliangtang@gmail.com>

Drop duplicate header seq_file.h from ibmvnic.c.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
 drivers/net/ethernet/ibm/ibmvnic.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 1e486d1..c125966 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -74,7 +74,6 @@
 #include <asm/iommu.h>
 #include <linux/uaccess.h>
 #include <asm/firmware.h>
-#include <linux/seq_file.h>
 #include <linux/workqueue.h>
 
 #include "ibmvnic.h"
-- 
2.9.3

^ permalink raw reply related

* [PATCH] net: ieee802154: drop duplicate header delay.h
From: Geliang Tang @ 2016-11-24 13:58 UTC (permalink / raw)
  To: Michael Hennerich, Alexander Aring
  Cc: Geliang Tang, linux-wpan, netdev, linux-kernel
In-Reply-To: <15299de49216a2360976ca37ff774cae9d27d88b.1479991297.git.geliangtang@gmail.com>

Drop duplicate header delay.h from adf7242.c.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
 drivers/net/ieee802154/adf7242.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/ieee802154/adf7242.c b/drivers/net/ieee802154/adf7242.c
index 4ff4c7d..3e4c8b2 100644
--- a/drivers/net/ieee802154/adf7242.c
+++ b/drivers/net/ieee802154/adf7242.c
@@ -20,7 +20,6 @@
 #include <linux/skbuff.h>
 #include <linux/of.h>
 #include <linux/irq.h>
-#include <linux/delay.h>
 #include <linux/debugfs.h>
 #include <linux/bitops.h>
 #include <linux/ieee802154.h>
-- 
2.9.3

^ permalink raw reply related

* [PATCH] net/mlx5: drop duplicate header delay.h
From: Geliang Tang @ 2016-11-24 13:58 UTC (permalink / raw)
  To: Saeed Mahameed, Matan Barak, Leon Romanovsky
  Cc: Geliang Tang, netdev, linux-rdma, linux-kernel
In-Reply-To: <15299de49216a2360976ca37ff774cae9d27d88b.1479991297.git.geliangtang@gmail.com>

Drop duplicate header delay.h from mlx5/core/main.c.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/main.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index f28df33..d7a55eb 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -46,7 +46,6 @@
 #include <linux/mlx5/srq.h>
 #include <linux/debugfs.h>
 #include <linux/kmod.h>
-#include <linux/delay.h>
 #include <linux/mlx5/mlx5_ifc.h>
 #ifdef CONFIG_RFS_ACCEL
 #include <linux/cpu_rmap.h>
-- 
2.9.3

^ permalink raw reply related

* [PATCH iproute2 3/3] ifstat: Add "sw only" extended statistics to ifstat
From: Nogah Frankel @ 2016-11-24 14:12 UTC (permalink / raw)
  To: netdev; +Cc: eladr, yotamg, jiri, idosch, ogerlitz, Nogah Frankel
In-Reply-To: <1479996760-61271-1-git-send-email-nogahf@mellanox.com>

Add support for extended statistics of SW only type, for counting only the
packets that went via the cpu. (useful for systems with forward
offloading). It reads it from filter type IFLA_STATS_LINK_OFFLOAD_XSTATS
and sub type IFLA_OFFLOAD_XSTATS_CPU_HIT.

It is under the name 'software'
(or any shorten of it as 'soft' or simply 's').

For example:
ifstat -x s

Signed-off-by: Nogah Frankel <nogahf@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
---
 misc/ifstat.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/misc/ifstat.c b/misc/ifstat.c
index 90aeeaa..7825a3a 100644
--- a/misc/ifstat.c
+++ b/misc/ifstat.c
@@ -675,7 +675,8 @@ static int verify_forging(int fd)
 static void xstat_usage(void)
 {
 	fprintf(stderr,
-"Usage: ifstat supported xstats:\n");
+"Usage: ifstat supported xstats:\n"
+"	software	SW stats. Counts only packets that went via the CPU\n");
 
 }
 
@@ -691,6 +692,7 @@ struct extended_stats_options_t {
  */
 static const struct extended_stats_options_t extended_stats_options[] = {
 	{"", IFLA_STATS_LINK_64, NO_SUB_TYPE},
+	{"software",  IFLA_STATS_LINK_OFFLOAD_XSTATS, IFLA_OFFLOAD_XSTATS_CPU_HIT},
 };
 
 static bool get_filter_type(char *name)
-- 
2.4.3

^ permalink raw reply related

* [PATCH iproute2 2/3] ifstat: Add extended statistics to ifstat
From: Nogah Frankel @ 2016-11-24 14:12 UTC (permalink / raw)
  To: netdev; +Cc: eladr, yotamg, jiri, idosch, ogerlitz, Nogah Frankel
In-Reply-To: <1479996760-61271-1-git-send-email-nogahf@mellanox.com>

Add extended stats option for ifstat. It supports stats that are in the
nesting level as the "normal" stats or one lower, as long as they are in
the same struct type as the "normal" stats.
Every extension is unaware of data from other extension and is being
presented by itself.
The extension can be called by its name or any shorten of it. If there is
more then one matched, the first one will be picked.

To get the extended stats the flag -x <stats type> is used.

Signed-off-by: Nogah Frankel <nogahf@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
---
 misc/ifstat.c | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 81 insertions(+), 7 deletions(-)

diff --git a/misc/ifstat.c b/misc/ifstat.c
index 25a8fc1..90aeeaa 100644
--- a/misc/ifstat.c
+++ b/misc/ifstat.c
@@ -49,11 +49,14 @@ int pretty;
 double W;
 char **patterns;
 int npatterns;
+int filter_type;
+int sub_type;
 
 char info_source[128];
 int source_mismatch;
 
 #define MAXS (sizeof(struct rtnl_link_stats64)/sizeof(__u64))
+#define NO_SUB_TYPE 0xffff
 
 struct ifstat_ent {
 	struct ifstat_ent	*next;
@@ -124,7 +127,7 @@ static int get_nlmsg(const struct sockaddr_nl *who,
 		return -1;
 
 	parse_rtattr(tb, IFLA_STATS_MAX, IFLA_STATS_RTA(ifsm), len);
-	if (tb[IFLA_STATS_LINK_64] == NULL)
+	if (tb[filter_type] == NULL)
 		return 0;
 
 	n = malloc(sizeof(*n));
@@ -133,7 +136,17 @@ static int get_nlmsg(const struct sockaddr_nl *who,
 
 	n->ifindex = ifsm->ifindex;
 	n->name = strdup(ll_index_to_name(ifsm->ifindex));
-	memcpy(&n->ival, RTA_DATA(tb[IFLA_STATS_LINK_64]), sizeof(n->ival));
+
+	if (sub_type == NO_SUB_TYPE) {
+		memcpy(&n->ival, RTA_DATA(tb[filter_type]), sizeof(n->ival));
+	} else {
+		struct rtattr *attr;
+
+		attr = parse_rtattr_one_nested(sub_type, tb[filter_type]);
+		if (attr == NULL)
+			return 0;
+		memcpy(&n->ival, RTA_DATA(attr), sizeof(n->ival));
+	}
 	memset(&n->rate, 0, sizeof(n->rate));
 	for (i = 0; i < MAXS; i++)
 		n->val[i] = n->ival[i];
@@ -152,7 +165,7 @@ static void load_info(void)
 		exit(1);
 
 	ll_init_map(&rth);
-	filt_mask = IFLA_STATS_FILTER_BIT(IFLA_STATS_LINK_64);
+	filt_mask = IFLA_STATS_FILTER_BIT(filter_type);
 	if (rtnl_wilddump_stats_req_filter(&rth, AF_UNSPEC, RTM_GETSTATS,
 					   filt_mask) < 0) {
 		perror("Cannot send dump request");
@@ -659,6 +672,50 @@ static int verify_forging(int fd)
 	return -1;
 }
 
+static void xstat_usage(void)
+{
+	fprintf(stderr,
+"Usage: ifstat supported xstats:\n");
+
+}
+
+struct extended_stats_options_t {
+	char *name;
+	int id;
+	int sub_type;
+};
+
+/* Note: if one xstat name in subset of another, it should be before it in this
+ * list. Therefore the default "" option must always be first.
+ * Name length must be under 64 chars.
+ */
+static const struct extended_stats_options_t extended_stats_options[] = {
+	{"", IFLA_STATS_LINK_64, NO_SUB_TYPE},
+};
+
+static bool get_filter_type(char *name)
+{
+	int name_len;
+	int i;
+
+	name_len = strlen(name);
+	for (i = 0; i < ARRAY_SIZE(extended_stats_options); i++) {
+		const struct extended_stats_options_t *xstat;
+
+		xstat = &extended_stats_options[i];
+		if (strncmp(name, xstat->name, name_len) == 0) {
+			filter_type = xstat->id;
+			sub_type = xstat->sub_type;
+			strcpy(name, xstat->name);
+			return true;
+		}
+	}
+
+	printf("invalid ifstat extension %s\n", name);
+	xstat_usage();
+	return false;
+}
+
 static void usage(void) __attribute__((noreturn));
 
 static void usage(void)
@@ -676,7 +733,8 @@ static void usage(void)
 "   -s, --noupdate	don\'t update history\n"
 "   -t, --interval=SECS	report average over the last SECS\n"
 "   -V, --version	output version information\n"
-"   -z, --zeros		show entries with zero activity\n");
+"   -z, --zeros		show entries with zero activity\n"
+"   -x, --extended=TYPE	show extended stats of TYPE\n");
 
 	exit(-1);
 }
@@ -694,18 +752,22 @@ static const struct option longopts[] = {
 	{ "interval", 1, 0, 't' },
 	{ "version", 0, 0, 'V' },
 	{ "zeros", 0, 0, 'z' },
+	{ "extended", 1, 0, 'x'},
 	{ 0 }
 };
 
+
 int main(int argc, char *argv[])
 {
 	char hist_name[128];
 	struct sockaddr_un sun;
 	FILE *hist_fp = NULL;
+	char stats_type[64];
 	int ch;
 	int fd;
 
-	while ((ch = getopt_long(argc, argv, "hjpvVzrnasd:t:e",
+	memset(stats_type, 0, 128);
+	while ((ch = getopt_long(argc, argv, "hjpvVzrnasd:t:ex:",
 			longopts, NULL)) != EOF) {
 		switch (ch) {
 		case 'z':
@@ -746,6 +808,9 @@ int main(int argc, char *argv[])
 				exit(-1);
 			}
 			break;
+		case 'x':
+			strncpy(stats_type, optarg, 63);
+			break;
 		case 'v':
 		case 'V':
 			printf("ifstat utility, iproute2-ss%s\n", SNAPSHOT);
@@ -760,6 +825,9 @@ int main(int argc, char *argv[])
 	argc -= optind;
 	argv += optind;
 
+	if (!get_filter_type(stats_type))
+		exit(-1);
+
 	sun.sun_family = AF_UNIX;
 	sun.sun_path[0] = 0;
 	sprintf(sun.sun_path+1, "ifstat%d", getuid());
@@ -798,8 +866,14 @@ int main(int argc, char *argv[])
 		snprintf(hist_name, sizeof(hist_name),
 			 "%s", getenv("IFSTAT_HISTORY"));
 	else
-		snprintf(hist_name, sizeof(hist_name),
-			 "%s/.ifstat.u%d", P_tmpdir, getuid());
+
+		if (strlen(stats_type) == 0)
+			snprintf(hist_name, sizeof(hist_name),
+				 "%s/.ifstat.u%d", P_tmpdir, getuid());
+		else
+			snprintf(hist_name, sizeof(hist_name),
+				 "%s/.%s_ifstat.u%d", P_tmpdir, stats_type,
+				 getuid());
 
 	if (reset_history)
 		unlink(hist_name);
-- 
2.4.3

^ permalink raw reply related

* [PATCH iproute2 1/3] ifstat: Change interface to get stats
From: Nogah Frankel @ 2016-11-24 14:12 UTC (permalink / raw)
  To: netdev; +Cc: eladr, yotamg, jiri, idosch, ogerlitz, Nogah Frankel
In-Reply-To: <1479996760-61271-1-git-send-email-nogahf@mellanox.com>

ifstat used to get it data from the kernel with RTM_GETLINK.
Change the interface to get this data to RTM_GETSTATS that supports more
stats type beside the default one. It also change the default stats to be
64 bits based.

Signed-off-by: Nogah Frankel <nogahf@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
---
 misc/ifstat.c | 41 ++++++++++++++++++++++-------------------
 1 file changed, 22 insertions(+), 19 deletions(-)

diff --git a/misc/ifstat.c b/misc/ifstat.c
index d551973..25a8fc1 100644
--- a/misc/ifstat.c
+++ b/misc/ifstat.c
@@ -35,6 +35,7 @@
 
 #include <SNAPSHOT.h>
 
+#include "utils.h"
 int dump_zeros;
 int reset_history;
 int ignore_history;
@@ -52,15 +53,15 @@ int npatterns;
 char info_source[128];
 int source_mismatch;
 
-#define MAXS (sizeof(struct rtnl_link_stats)/sizeof(__u32))
+#define MAXS (sizeof(struct rtnl_link_stats64)/sizeof(__u64))
 
 struct ifstat_ent {
 	struct ifstat_ent	*next;
 	char			*name;
 	int			ifindex;
-	unsigned long long	val[MAXS];
+	__u64			val[MAXS];
 	double			rate[MAXS];
-	__u32			ival[MAXS];
+	__u64			ival[MAXS];
 };
 
 static const char *stats[MAXS] = {
@@ -109,32 +110,30 @@ static int match(const char *id)
 static int get_nlmsg(const struct sockaddr_nl *who,
 		     struct nlmsghdr *m, void *arg)
 {
-	struct ifinfomsg *ifi = NLMSG_DATA(m);
-	struct rtattr *tb[IFLA_MAX+1];
+	struct if_stats_msg *ifsm = NLMSG_DATA(m);
+	struct rtattr *tb[IFLA_STATS_MAX+1];
 	int len = m->nlmsg_len;
 	struct ifstat_ent *n;
 	int i;
 
-	if (m->nlmsg_type != RTM_NEWLINK)
+	if (m->nlmsg_type != RTM_NEWSTATS)
 		return 0;
 
-	len -= NLMSG_LENGTH(sizeof(*ifi));
+	len -= NLMSG_LENGTH(sizeof(*ifsm));
 	if (len < 0)
 		return -1;
 
-	if (!(ifi->ifi_flags&IFF_UP))
-		return 0;
-
-	parse_rtattr(tb, IFLA_MAX, IFLA_RTA(ifi), len);
-	if (tb[IFLA_IFNAME] == NULL || tb[IFLA_STATS] == NULL)
+	parse_rtattr(tb, IFLA_STATS_MAX, IFLA_STATS_RTA(ifsm), len);
+	if (tb[IFLA_STATS_LINK_64] == NULL)
 		return 0;
 
 	n = malloc(sizeof(*n));
 	if (!n)
 		abort();
-	n->ifindex = ifi->ifi_index;
-	n->name = strdup(RTA_DATA(tb[IFLA_IFNAME]));
-	memcpy(&n->ival, RTA_DATA(tb[IFLA_STATS]), sizeof(n->ival));
+
+	n->ifindex = ifsm->ifindex;
+	n->name = strdup(ll_index_to_name(ifsm->ifindex));
+	memcpy(&n->ival, RTA_DATA(tb[IFLA_STATS_LINK_64]), sizeof(n->ival));
 	memset(&n->rate, 0, sizeof(n->rate));
 	for (i = 0; i < MAXS; i++)
 		n->val[i] = n->ival[i];
@@ -147,11 +146,15 @@ static void load_info(void)
 {
 	struct ifstat_ent *db, *n;
 	struct rtnl_handle rth;
+	__u32 filt_mask;
 
 	if (rtnl_open(&rth, 0) < 0)
 		exit(1);
 
-	if (rtnl_wilddump_request(&rth, AF_INET, RTM_GETLINK) < 0) {
+	ll_init_map(&rth);
+	filt_mask = IFLA_STATS_FILTER_BIT(IFLA_STATS_LINK_64);
+	if (rtnl_wilddump_stats_req_filter(&rth, AF_UNSPEC, RTM_GETSTATS,
+					   filt_mask) < 0) {
 		perror("Cannot send dump request");
 		exit(1);
 	}
@@ -216,7 +219,7 @@ static void load_raw_table(FILE *fp)
 			*next++ = 0;
 			if (sscanf(p, "%llu", n->val+i) != 1)
 				abort();
-			n->ival[i] = (__u32)n->val[i];
+			n->ival[i] = (__u64)n->val[i];
 			p = next;
 			if (!(next = strchr(p, ' ')))
 				abort();
@@ -546,14 +549,14 @@ static void update_db(int interval)
 				int i;
 
 				for (i = 0; i < MAXS; i++) {
-					if ((long)(h1->ival[i] - n->ival[i]) < 0) {
+					if ((long long)(h1->ival[i] - n->ival[i]) < 0) {
 						memset(n->ival, 0, sizeof(n->ival));
 						break;
 					}
 				}
 				for (i = 0; i < MAXS; i++) {
 					double sample;
-					unsigned long incr = h1->ival[i] - n->ival[i];
+					unsigned long long incr = h1->ival[i] - n->ival[i];
 
 					n->val[i] += incr;
 					n->ival[i] = h1->ival[i];
-- 
2.4.3

^ permalink raw reply related

* [PATCH iproute2 0/3] update ifstat for new stats
From: Nogah Frankel @ 2016-11-24 14:12 UTC (permalink / raw)
  To: netdev; +Cc: eladr, yotamg, jiri, idosch, ogerlitz, Nogah Frankel

Previously stats were gotten by RTM_GETLINK which return 32 bits based
statistics. It support only one type of stats.
Lately, a new method to get stats was added - RTM_GETSTATS. It supports
ability to choose stats type. The basic stats were changed from 32 bits
based to 64 bits based.

This patchset change ifstat to the new method, add it the ability to
choose an extended type of statistic, and add the extended type of SW
stats for packets that hit cpu.

Nogah Frankel (3):
  ifstat: Change interface to get stats
  ifstat: Add extended statistics to ifstat
  ifstat: Add "sw only" extended statistics to ifstat

 misc/ifstat.c | 125 +++++++++++++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 102 insertions(+), 23 deletions(-)

-- 
2.4.3

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox