Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH net-next] tuntap: calculate rps hash only when needed
From: kbuild test robot @ 2016-04-26  2:30 UTC (permalink / raw)
  To: Jason Wang
  Cc: kbuild-all, davem, netdev, linux-kernel, Jason Wang,
	Michael S. Tsirkin
In-Reply-To: <1461635741-18857-1-git-send-email-jasowang@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1464 bytes --]

Hi,

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Jason-Wang/tuntap-calculate-rps-hash-only-when-needed/20160426-095825
config: xtensa-allyesconfig (attached as .config)
compiler: 
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=xtensa 

All errors (new ones prefixed by >>):

   drivers/net/tun.c: In function 'tun_net_xmit':
>> drivers/net/tun.c:836:42: error: 'rps_needed' undeclared (first use in this function)
     if (numqueues == 1 && static_key_false(&rps_needed)) {
                                             ^
   drivers/net/tun.c:836:42: note: each undeclared identifier is reported only once for each function it appears in

vim +/rps_needed +836 drivers/net/tun.c

   830		numqueues = ACCESS_ONCE(tun->numqueues);
   831	
   832		/* Drop packet if interface is not attached */
   833		if (txq >= numqueues)
   834			goto drop;
   835	
 > 836		if (numqueues == 1 && static_key_false(&rps_needed)) {
   837			/* Select queue was not called for the skbuff, so we extract the
   838			 * RPS hash and save it into the flow_table here.
   839			 */

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

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 44887 bytes --]

^ permalink raw reply

* [PATCH] ps3_gelic: fix memcpy parameter
From: Christophe JAILLET @ 2016-04-26  2:33 UTC (permalink / raw)
  To: netdev; +Cc: linux-kernel, kernel-janitors, Christophe JAILLET

The size allocated for target->hwinfo and the number of bytes copied in it
should be consistent.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Untested

 drivers/net/ethernet/toshiba/ps3_gelic_wireless.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c b/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c
index 13214a6..743b182 100644
--- a/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c
+++ b/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c
@@ -1622,7 +1622,7 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl)
 			continue;
 
 		/* copy hw scan info */
-		memcpy(target->hwinfo, scan_info, scan_info->size);
+		memcpy(target->hwinfo, scan_info, be16_to_cpu(scan_info->size));
 		target->essid_len = strnlen(scan_info->essid,
 					    sizeof(scan_info->essid));
 		target->rate_len = 0;
-- 
2.7.4

^ permalink raw reply related

* Re: myri10ge: fix sleeping with bh disabled
From: Hyong-Youb Kim @ 2016-04-26  2:22 UTC (permalink / raw)
  To: Stanislaw Gruszka; +Cc: netdev
In-Reply-To: <20160425085918.GB2608@redhat.com>

On Mon, Apr 25, 2016 at 10:59:19AM +0200, Stanislaw Gruszka wrote:
> napi_disable() can not be called with bh disabled, move locking just
> around myri10ge_ss_lock_napi() .

Acked-by: Hyong-Youb Kim <hykim@myri.com>

Thanks.

> 
> Patches fixes following bug:
> 
> [  114.278378] BUG: sleeping function called from invalid context at net/core/dev.c:4383 
> <snip>
> [  114.313712] Call Trace: 
> [  114.314943]  [<ffffffff817010ce>] dump_stack+0x19/0x1b 
> [  114.317673]  [<ffffffff810ce7f3>] __might_sleep+0x173/0x230 
> [  114.320566]  [<ffffffff815b3117>] napi_disable+0x27/0x90 
> [  114.323254]  [<ffffffffa01e437f>] myri10ge_close+0xbf/0x3f0 [myri10ge] 
> 
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> ---
> diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
> index 270c9ee..6d1a956 100644
> --- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
> +++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
> @@ -2668,9 +2668,9 @@ static int myri10ge_close(struct net_device *dev)
>  
>  	del_timer_sync(&mgp->watchdog_timer);
>  	mgp->running = MYRI10GE_ETH_STOPPING;
> -	local_bh_disable(); /* myri10ge_ss_lock_napi needs bh disabled */
>  	for (i = 0; i < mgp->num_slices; i++) {
>  		napi_disable(&mgp->ss[i].napi);
> +		local_bh_disable(); /* myri10ge_ss_lock_napi needs this */
>  		/* Lock the slice to prevent the busy_poll handler from
>  		 * accessing it.  Later when we bring the NIC up, myri10ge_open
>  		 * resets the slice including this lock.
> @@ -2679,8 +2679,8 @@ static int myri10ge_close(struct net_device *dev)
>  			pr_info("Slice %d locked\n", i);
>  			mdelay(1);
>  		}
> +		local_bh_enable();
>  	}
> -	local_bh_enable();
>  	netif_carrier_off(dev);
>  
>  	netif_tx_stop_all_queues(dev);

^ permalink raw reply

* RE: [v8, 1/7] Documentation: DT: update Freescale DCFG compatible
From: Yangbo Lu @ 2016-04-26  2:43 UTC (permalink / raw)
  To: Mark Rutland
  Cc: ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, Zhao Qiang,
	Xiaobo Xie, linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-clk-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Russell King,
	Bhupesh Sharma, Jochen Friedrich, Scott Wood, Claudiu Manoil,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Rob Herring,
	Santosh Shilimkar,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Yang-Leo Li,
	"iommu-cunTk1MwBs9QetFLy7KEmw@public.gmane.org
In-Reply-To: <20160422131151.GJ10606@leverpostej>

Hi Mark,


> -----Original Message-----
> From: Mark Rutland [mailto:mark.rutland-5wv7dgnIgG8@public.gmane.org]
> Sent: Friday, April 22, 2016 9:12 PM
> To: Yangbo Lu
> Cc: linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org;
> devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org; linux-
> kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-clk-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-
> i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org;
> netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org; Scott Wood; Rob Herring;
> Russell King; Jochen Friedrich; Joerg Roedel; Claudiu Manoil; Bhupesh
> Sharma; Zhao Qiang; Kumar Gala; Santosh Shilimkar; Yang-Leo Li; Xiaobo
> Xie
> Subject: Re: [v8, 1/7] Documentation: DT: update Freescale DCFG
> compatible
> 
> On Fri, Apr 22, 2016 at 02:27:38PM +0800, Yangbo Lu wrote:
> > Update Freescale DCFG compatible with 'fsl,<chip>-dcfg' instead of
> > 'fsl,ls1021a-dcfg' to include more chips.
> >
> > Signed-off-by: Yangbo Lu <yangbo.lu-3arQi8VN3Tc@public.gmane.org>
> > ---
> > Changes for v8:
> > 	- Added this patch
> > ---
> >  Documentation/devicetree/bindings/arm/fsl.txt | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/Documentation/devicetree/bindings/arm/fsl.txt
> > b/Documentation/devicetree/bindings/arm/fsl.txt
> > index 752a685..1d5f512 100644
> > --- a/Documentation/devicetree/bindings/arm/fsl.txt
> > +++ b/Documentation/devicetree/bindings/arm/fsl.txt
> > @@ -119,7 +119,7 @@ Freescale DCFG
> >  configuration and status for the device. Such as setting the
> > secondary  core start address and release the secondary core from
> holdoff and startup.
> >    Required properties:
> > -  - compatible: should be "fsl,ls1021a-dcfg"
> > +  - compatible: should be "fsl,<chip>-dcfg"
> 
> Please list specific values expected for <chip>, while jusy saying <chip>
> may be more generic, it makes it practically impossible to search for the
> correct binding given a compatible string, and it's vague as to exaclty
> what <chip> should be.

[Lu Yangbo-B47093] Thanks for your comment. I will list the possible chips.

> 
> Thanks,
> Mark.
> 
> 
> 
> >    - reg : should contain base address and length of DCFG
> > memory-mapped registers
> >
> >  Example:
> > --
> > 2.1.0.27.g96db324
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe devicetree"
> > 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: ipv6: Delete host routes on an ifdown
From: David Miller @ 2016-04-26  2:50 UTC (permalink / raw)
  To: dsa; +Cc: netdev, mmanning
In-Reply-To: <571E943C.9010504@cumulusnetworks.com>

From: David Ahern <dsa@cumulusnetworks.com>
Date: Mon, 25 Apr 2016 16:03:40 -0600

> Rather than focusing on my mistakes, why not see the commitment on
> following through with this change?

I do not question the amount of time and effort invested.

I question whether the change was truly ready yet, and my
conclusion right now is that it is not ready for 4.6.0-final

So I reverted instead of waiting for the other shoe to drop.

Thanks.

^ permalink raw reply

* Re: [PATCH] net: ipv6: Delete host routes on an ifdown
From: David Miller @ 2016-04-26  2:53 UTC (permalink / raw)
  To: mmanning; +Cc: dsa, netdev
In-Reply-To: <571EBCF0.8030609@brocade.com>

From: Mike Manning <mmanning@brocade.com>
Date: Tue, 26 Apr 2016 01:57:20 +0100

> It would be great if this could be reconsidered

If you guys start ganging up on me, I will set you all to ignore.
This is my last warning.

Please respect my decision and try to shore up this change properly
for 4.7.0

Thank you.

^ permalink raw reply

* Re: [PATCH net-next] tuntap: calculate rps hash only when needed
From: Jason Wang @ 2016-04-26  3:12 UTC (permalink / raw)
  To: davem, netdev, linux-kernel; +Cc: Michael S. Tsirkin
In-Reply-To: <1461635741-18857-1-git-send-email-jasowang@redhat.com>



On 04/26/2016 09:55 AM, Jason Wang wrote:
> There's no need to calculate rps hash if it was not enabled. So this
> patch export rps_needed and check it before trying to get rps
> hash. Tests (using pktgen to inject packets to guest) shows this can
> improve pps about 13% (when rps is disabled).
>
> Before:
> ~1150000 pps
> After:
> ~1300000 pps
>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
>  drivers/net/tun.c | 2 +-
>  net/core/dev.c    | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index afdf950..746877f 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -819,7 +819,7 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
>  	if (txq >= numqueues)
>  		goto drop;
>  
> -	if (numqueues == 1) {
> +	if (numqueues == 1 && static_key_false(&rps_needed)) {
>  		/* Select queue was not called for the skbuff, so we extract the
>  		 * RPS hash and save it into the flow_table here.
>  		 */
> diff --git a/net/core/dev.c b/net/core/dev.c
> index b9bcbe7..d4ba936 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -3428,6 +3428,7 @@ u32 rps_cpu_mask __read_mostly;
>  EXPORT_SYMBOL(rps_cpu_mask);
>  
>  struct static_key rps_needed __read_mostly;
> +EXPORT_SYMBOL(rps_needed);
>  
>  static struct rps_dev_flow *
>  set_rps_cpu(struct net_device *dev, struct sk_buff *skb,

Kbuild bot reports an error when !CONFIG_RPS. Will send V2 to fix this.

^ permalink raw reply

* [PATCH net-next V2] tuntap: calculate rps hash only when needed
From: Jason Wang @ 2016-04-26  3:13 UTC (permalink / raw)
  To: davem, netdev, linux-kernel; +Cc: Jason Wang, Michael S. Tsirkin

There's no need to calculate rps hash if it was not enabled. So this
patch export rps_needed and check it before trying to get rps
hash. Tests (using pktgen to inject packets to guest) shows this can
improve pps about 13% (when rps is disabled).

Before:
~1150000 pps
After:
~1300000 pps

Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
----
Changes from V1:
- Fix build when CONFIG_RPS is not set
---
 drivers/net/tun.c | 4 +++-
 net/core/dev.c    | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index afdf950..8df9e23 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -819,7 +819,8 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
 	if (txq >= numqueues)
 		goto drop;
 
-	if (numqueues == 1) {
+#ifdef CONFIG_RPS
+	if (numqueues == 1 && static_key_false(&rps_needed)) {
 		/* Select queue was not called for the skbuff, so we extract the
 		 * RPS hash and save it into the flow_table here.
 		 */
@@ -834,6 +835,7 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
 				tun_flow_save_rps_rxhash(e, rxhash);
 		}
 	}
+#endif
 
 	tun_debug(KERN_INFO, tun, "tun_net_xmit %d\n", skb->len);
 
diff --git a/net/core/dev.c b/net/core/dev.c
index b9bcbe7..d4ba936 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3428,6 +3428,7 @@ u32 rps_cpu_mask __read_mostly;
 EXPORT_SYMBOL(rps_cpu_mask);
 
 struct static_key rps_needed __read_mostly;
+EXPORT_SYMBOL(rps_needed);
 
 static struct rps_dev_flow *
 set_rps_cpu(struct net_device *dev, struct sk_buff *skb,
-- 
1.8.3.1

^ permalink raw reply related

* pull request [net]: batman-adv-0160426
From: Antonio Quartulli @ 2016-04-26  3:27 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n

Hi David,

this is a batch intended for net. Changes are quite small, therefore I
hope it is not a big deal to include them at this point of the release cycle.

In this patchset you can find the following fixes:

1) check skb size to avoid reading beyond its border when delivering
   payloads, by Sven Eckelmann
2) initialize last_seen time in neigh_node object to prevent cleanup
   routine from accidentally purge it, by Marek Lindner
3) release "recently added" slave interfaces upon virtual/batman
   interface shutdown, by Sven Eckelmann
4) properly decrease router object reference counter upon routing table
   update, by Sven Eckelmann
5) release queue slots when purging OGM packets of deactivating slave
   interface, by Linus Lüssing

Patch 2 and 3 have no "Fixes:" tag because the offending commits date
back to when batman-adv was not yet officially in the net tree.

Note that all these changes are fixing very old commits and therefore
it would be nice if you could queue them for *stable*.

Please pull or let me know of any issue!

Thanks a lot,
	Antonio




The following changes since commit 5f44abd041c5f3be76d57579ab254d78e601315b:

  Merge tag 'rtc-4.6-3' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux (2016-04-21 15:41:13 -0700)

are available in the git repository at:

  git://git.open-mesh.org/linux-merge.git tags/batman-adv-fix-for-davem

for you to fetch changes up to c4fdb6cff2aa0ae740c5f19b6f745cbbe786d42f:

  batman-adv: Fix broadcast/ogm queue limit on a removed interface (2016-04-24 15:41:56 +0800)

----------------------------------------------------------------
In this patchset you can find the following fixes:

1) check skb size to avoid reading beyond its border when delivering
   payloads, by Sven Eckelmann
2) initialize last_seen time in neigh_node object to prevent cleanup
   routine from accidentally purge it, by Marek Lindner
3) release "recently added" slave interfaces upon virtual/batman
   interface shutdown, by Sven Eckelmann
4) properly decrease router object reference counter upon routing table
   update, by Sven Eckelmann
5) release queue slots when purging OGM packets of deactivating slave
   interface, by Linus Lüssing

Patch 2 and 3 have no "Fixes:" tag because the offending commits date
back to when batman-adv was not yet officially in the net tree.

----------------------------------------------------------------
Linus Lüssing (1):
      batman-adv: Fix broadcast/ogm queue limit on a removed interface

Marek Lindner (1):
      batman-adv: init neigh node last seen field

Sven Eckelmann (3):
      batman-adv: Check skb size before using encapsulated ETH+VLAN header
      batman-adv: Deactivate TO_BE_ACTIVATED hardif on shutdown
      batman-adv: Reduce refcnt of removed router when updating route

 net/batman-adv/hard-interface.c | 3 +--
 net/batman-adv/originator.c     | 1 +
 net/batman-adv/routing.c        | 9 +++++++++
 net/batman-adv/send.c           | 6 ++++++
 net/batman-adv/soft-interface.c | 8 ++++++--
 5 files changed, 23 insertions(+), 4 deletions(-)

^ permalink raw reply

* [PATCH 1/5] batman-adv: Check skb size before using encapsulated ETH+VLAN header
From: Antonio Quartulli @ 2016-04-26  3:27 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Sven Eckelmann, Marek Lindner,
	Antonio Quartulli
In-Reply-To: <1461641239-7097-1-git-send-email-a@unstable.cc>

From: Sven Eckelmann <sven@narfation.org>

The encapsulated ethernet and VLAN header may be outside the received
ethernet frame. Thus the skb buffer size has to be checked before it can be
parsed to find out if it encapsulates another batman-adv packet.

Fixes: 420193573f11 ("batman-adv: softif bridge loop avoidance")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
---
 net/batman-adv/soft-interface.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index 0710379491bf..8a136b6a1ff0 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -408,11 +408,17 @@ void batadv_interface_rx(struct net_device *soft_iface,
 	 */
 	nf_reset(skb);
 
+	if (unlikely(!pskb_may_pull(skb, ETH_HLEN)))
+		goto dropped;
+
 	vid = batadv_get_vid(skb, 0);
 	ethhdr = eth_hdr(skb);
 
 	switch (ntohs(ethhdr->h_proto)) {
 	case ETH_P_8021Q:
+		if (!pskb_may_pull(skb, VLAN_ETH_HLEN))
+			goto dropped;
+
 		vhdr = (struct vlan_ethhdr *)skb->data;
 
 		if (vhdr->h_vlan_encapsulated_proto != ethertype)
@@ -424,8 +430,6 @@ void batadv_interface_rx(struct net_device *soft_iface,
 	}
 
 	/* skb->dev & skb->pkt_type are set here */
-	if (unlikely(!pskb_may_pull(skb, ETH_HLEN)))
-		goto dropped;
 	skb->protocol = eth_type_trans(skb, soft_iface);
 
 	/* should not be necessary anymore as we use skb_pull_rcsum()
-- 
2.8.1

^ permalink raw reply related

* [PATCH 2/5] batman-adv: init neigh node last seen field
From: Antonio Quartulli @ 2016-04-26  3:27 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Marek Lindner, Sven Eckelmann,
	Antonio Quartulli
In-Reply-To: <1461641239-7097-1-git-send-email-a@unstable.cc>

From: Marek Lindner <mareklindner@neomailbox.ch>

Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
[sven@narfation.org: fix conflicts with current version]
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
---
 net/batman-adv/originator.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index e4cbb0753e37..d52f67a0c057 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -663,6 +663,7 @@ batadv_neigh_node_new(struct batadv_orig_node *orig_node,
 	ether_addr_copy(neigh_node->addr, neigh_addr);
 	neigh_node->if_incoming = hard_iface;
 	neigh_node->orig_node = orig_node;
+	neigh_node->last_seen = jiffies;
 
 	/* extra reference for return */
 	kref_init(&neigh_node->refcount);
-- 
2.8.1

^ permalink raw reply related

* [PATCH 3/5] batman-adv: Deactivate TO_BE_ACTIVATED hardif on shutdown
From: Antonio Quartulli @ 2016-04-26  3:27 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Sven Eckelmann, Marek Lindner,
	Antonio Quartulli
In-Reply-To: <1461641239-7097-1-git-send-email-a@unstable.cc>

From: Sven Eckelmann <sven@narfation.org>

The shutdown of an batman-adv interface can happen with one of its slave
interfaces still being in the BATADV_IF_TO_BE_ACTIVATED state. A possible
reason for it is that the routing algorithm BATMAN_V was selected and
batadv_schedule_bat_ogm was not yet called for this interface. This slave
interface still has to be set to BATADV_IF_INACTIVE or the batman-adv
interface will never reduce its usage counter and thus never gets shutdown.

This problem can be simulated via:

    $ modprobe dummy
    $ modprobe batman-adv routing_algo=BATMAN_V
    $ ip link add bat0 type batadv
    $ ip link set dummy0 master bat0
    $ ip link set dummy0 up
    $ ip link del bat0
    unregister_netdevice: waiting for bat0 to become free. Usage count = 3

Reported-by: Matthias Schiffer <mschiffer@universe-factory.net>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
---
 net/batman-adv/hard-interface.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index b22b2775a0a5..c61d5b0b24d2 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -572,8 +572,7 @@ void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface,
 	struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
 	struct batadv_hard_iface *primary_if = NULL;
 
-	if (hard_iface->if_status == BATADV_IF_ACTIVE)
-		batadv_hardif_deactivate_interface(hard_iface);
+	batadv_hardif_deactivate_interface(hard_iface);
 
 	if (hard_iface->if_status != BATADV_IF_INACTIVE)
 		goto out;
-- 
2.8.1

^ permalink raw reply related

* [PATCH 4/5] batman-adv: Reduce refcnt of removed router when updating route
From: Antonio Quartulli @ 2016-04-26  3:27 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Sven Eckelmann, Marek Lindner,
	Antonio Quartulli
In-Reply-To: <1461641239-7097-1-git-send-email-a@unstable.cc>

From: Sven Eckelmann <sven@narfation.org>

_batadv_update_route rcu_derefences orig_ifinfo->router outside of a
spinlock protected region to print some information messages to the debug
log. But this pointer is not checked again when the new pointer is assigned
in the spinlock protected region. Thus is can happen that the value of
orig_ifinfo->router changed in the meantime and thus the reference counter
of the wrong router gets reduced after the spinlock protected region.

Just rcu_dereferencing the value of orig_ifinfo->router inside the spinlock
protected region (which also set the new pointer) is enough to get the
correct old router object.

Fixes: e1a5382f978b ("batman-adv: Make orig_node->router an rcu protected pointer")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
---
 net/batman-adv/routing.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 4dd646a52f1a..b781bf753250 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -105,6 +105,15 @@ static void _batadv_update_route(struct batadv_priv *bat_priv,
 		neigh_node = NULL;
 
 	spin_lock_bh(&orig_node->neigh_list_lock);
+	/* curr_router used earlier may not be the current orig_ifinfo->router
+	 * anymore because it was dereferenced outside of the neigh_list_lock
+	 * protected region. After the new best neighbor has replace the current
+	 * best neighbor the reference counter needs to decrease. Consequently,
+	 * the code needs to ensure the curr_router variable contains a pointer
+	 * to the replaced best neighbor.
+	 */
+	curr_router = rcu_dereference_protected(orig_ifinfo->router, true);
+
 	rcu_assign_pointer(orig_ifinfo->router, neigh_node);
 	spin_unlock_bh(&orig_node->neigh_list_lock);
 	batadv_orig_ifinfo_put(orig_ifinfo);
-- 
2.8.1

^ permalink raw reply related

* [PATCH 5/5] batman-adv: Fix broadcast/ogm queue limit on a removed interface
From: Antonio Quartulli @ 2016-04-26  3:27 UTC (permalink / raw)
  To: davem
  Cc: netdev, b.a.t.m.a.n, Linus Lüssing, Sven Eckelmann,
	Marek Lindner, Antonio Quartulli
In-Reply-To: <1461641239-7097-1-git-send-email-a@unstable.cc>

From: Linus Lüssing <linus.luessing@c0d3.blue>

When removing a single interface while a broadcast or ogm packet is
still pending then we will free the forward packet without releasing the
queue slots again.

This patch is supposed to fix this issue.

Fixes: 6d5808d4ae1b ("batman-adv: Add missing hardif_free_ref in forw_packet_free")
Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
[sven@narfation.org: fix conflicts with current version]
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
---
 net/batman-adv/send.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c
index 3ce06e0a91b1..76417850d3fc 100644
--- a/net/batman-adv/send.c
+++ b/net/batman-adv/send.c
@@ -675,6 +675,9 @@ batadv_purge_outstanding_packets(struct batadv_priv *bat_priv,
 
 		if (pending) {
 			hlist_del(&forw_packet->list);
+			if (!forw_packet->own)
+				atomic_inc(&bat_priv->bcast_queue_left);
+
 			batadv_forw_packet_free(forw_packet);
 		}
 	}
@@ -702,6 +705,9 @@ batadv_purge_outstanding_packets(struct batadv_priv *bat_priv,
 
 		if (pending) {
 			hlist_del(&forw_packet->list);
+			if (!forw_packet->own)
+				atomic_inc(&bat_priv->batman_queue_left);
+
 			batadv_forw_packet_free(forw_packet);
 		}
 	}
-- 
2.8.1

^ permalink raw reply related

* Re: [PATCH v2 net-next 00/13] net: hns: add support of debug dsaf device
From: David Miller @ 2016-04-26  5:11 UTC (permalink / raw)
  To: Yisen.Zhuang
  Cc: devicetree, netdev, linux-arm-kernel, robh+dt, pawel.moll,
	mark.rutland, ijc+devicetree, galak, will.deacon, catalin.marinas,
	yankejian, huangdaode, salil.mehta, lipeng321, liguozhu,
	xieqianqian, xuwei5, linuxarm
In-Reply-To: <1461402317-136499-1-git-send-email-Yisen.Zhuang@huawei.com>

From: Yisen Zhuang <Yisen.Zhuang@huawei.com>
Date: Sat, 23 Apr 2016 17:05:04 +0800

> There are two kinds of dsaf device in hns, one is for service ports,
> contains crossbar in it, can work under different mode. Another is for
> debug port, only can work under single port mode. The current code only
> declares a dsaf device for both service ports and debug ports.It is not so
> readability. This patch separates it to three platform devices to make the
> code more simple and readability.
 ...
> We take the compatibility into consideration, and it works well by using the
> old dts file(tested on d02 board).
> 
> For more details, please see individual patches.

Series applied, thanks.

^ permalink raw reply

* Re: [PATCH] net: tsi108: use NULL for pointer-typed argument
From: David Miller @ 2016-04-26  5:11 UTC (permalink / raw)
  To: Julia.Lawall; +Cc: netdev, kernel-janitors, linux-kernel
In-Reply-To: <1461402422-10879-1-git-send-email-Julia.Lawall@lip6.fr>

From: Julia Lawall <Julia.Lawall@lip6.fr>
Date: Sat, 23 Apr 2016 11:07:02 +0200

> The first argument of pci_free_consistent has type struct pci_dev *, so use
> NULL instead of 0.
> 
> The semantic patch that performs this transformation is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> @@
> pci_free_consistent(
> - 0
> + NULL
>   , ...)
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Applied.

^ permalink raw reply

* Re: [PATCH] net: dummy: remove note about being Y by default
From: David Miller @ 2016-04-26  5:12 UTC (permalink / raw)
  To: ivan; +Cc: netdev, trivial, dsa, linville
In-Reply-To: <20160423125803.GA6583@cf>

From: Ivan Babrou <ivan@cloudflare.com>
Date: Sat, 23 Apr 2016 12:58:03 +0000

> Signed-off-by: Ivan Babrou <ivan@cloudflare.com>

Applied.

^ permalink raw reply

* Re: [PATCH net] net/mlx4_en: fix spurious timestamping callbacks
From: David Miller @ 2016-04-26  5:14 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, eugenia
In-Reply-To: <1461436546.7627.45.camel@edumazet-glaptop3.roam.corp.google.com>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Sat, 23 Apr 2016 11:35:46 -0700

> From: Eric Dumazet <edumazet@google.com>
> 
> When multiple skb are TX-completed in a row, we might incorrectly keep
> a timestamp of a prior skb and cause extra work.
> 
> Fixes: ec693d47010e8 ("net/mlx4_en: Add HW timestamping (TS) support")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Willem de Bruijn <willemb@google.com>

Applied and queued up for -stable.

^ permalink raw reply

* Re: [PATCH net-next 0/3] ila: Support for checksum neutral translations
From: David Miller @ 2016-04-26  5:41 UTC (permalink / raw)
  To: tom; +Cc: netdev, kernel-team
In-Reply-To: <1461437217-1568717-1-git-send-email-tom@herbertland.com>

From: Tom Herbert <tom@herbertland.com>
Date: Sat, 23 Apr 2016 11:46:54 -0700

> This patch set updates ILA to support draft-herbert-nvo3-ila-02. The
> primary addition is support checksum neutral ILA translation.
> This allows address to be performed and still keep any transport
> layer checksums that include the addresses in their pseudo header to
> still be correct without the translator needing to parse L4.
> 
> Other items are:
>    - Structures for ILA addresses, identifiers, locators
>    - Disallow translation on non-ILA addresses (check by
>      type in identifier).
>    - Change xlat (nf_input) to translates solely based
>      on matching locators not identifiers (since identifiers
>      are not obfuscated by checksum neutral).
>    - Side effect if above is that multiple ILA domains are
>      supported. Each local locator can map to a different
>      SIR address (ILA domain), and each domain defines its
>      own identifier space.
> 
> Tested: Ran TCP_RR with 200 cnxs. ILA performance is slightly better
> than previously since we are not longer parsing L4 for checksum
> handling. I amd seeing about 1% performance overhead. Also ran
> TCP_STREAM and tested non-ILA address (type=0) are not translated.
> 
> v2: Fix complilation errors

Series applied.

There were some conflicts I had to resolve due to the recent 64-bit
padding fixes, but those weren't too difficult to deal with.

Thanks.

^ permalink raw reply

* Re: [PATCH] net: ethernet: davinci_emac: Fix devioctl while in fixed link
From: Mugunthan V N @ 2016-04-26  6:07 UTC (permalink / raw)
  To: Neil Armstrong, David S. Miller, Andrew Lunn, Tom Lendacky,
	netdev, linux-kernel
  Cc: Brian Hutchinson
In-Reply-To: <1461606098-20057-1-git-send-email-narmstrong@baylibre.com>

On Monday 25 April 2016 11:11 PM, Neil Armstrong wrote:
> When configured in fixed link, the DaVinci emac driver sets the
> priv->phydev to NULL and further ioctl calls to the phy_mii_ioctl()
> causes the kernel to crash.
> 
> Cc: Brian Hutchinson <b.hutchman@gmail.com>
> Fixes: 1bb6aa56bb38 ("net: davinci_emac: Add support for fixed-link PHY")
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>

Reviewed-by: Mugunthan V N <mugunthanvnm@ti.com>

Regards
Mugunthan V N

^ permalink raw reply

* Re: codel: split into multiple files
From: Sedat Dilek @ 2016-04-26  6:09 UTC (permalink / raw)
  To: Michal Kazior; +Cc: David S. Miller, netdev@vger.kernel.org

Hi,

I had a very quick view on net-next.git#master (up to commit
fab7b629a82da1b59620470d13152aff975239f6).

Commit in [1] aka "codel: split into multiple files" removed codel.h
but [2] and [3] have relicts to it.
Forgot to remove?
(Not sure if there exist more relicts.)

Regards,
- Sedat -


[1] http://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/commit/?id=d068ca2ae2e614b9a418fb3b5f1fd4cf996ff032
[2] http://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/tree/net/sched/sch_codel.c#n51
[3] http://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/tree/net/sched/sch_fq_codel.c#n26

^ permalink raw reply

* Re: [PATCH 2/2] vhost: lockless enqueuing
From: Pankaj Gupta @ 2016-04-26  6:24 UTC (permalink / raw)
  To: Jason Wang; +Cc: mst, kvm, virtualization, netdev, linux-kernel
In-Reply-To: <1461636873-45335-2-git-send-email-jasowang@redhat.com>

Hi Jason,

Overall patches look good. Just one doubt I have is below:
> 
> We use spinlock to synchronize the work list now which may cause
> unnecessary contentions. So this patch switch to use llist to remove
> this contention. Pktgen tests shows about 5% improvement:
> 
> Before:
> ~1300000 pps
> After:
> ~1370000 pps
> 
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
>  drivers/vhost/vhost.c | 52
>  +++++++++++++++++++++++++--------------------------
>  drivers/vhost/vhost.h |  7 ++++---
>  2 files changed, 29 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index 73dd16d..0061a7b 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -168,7 +168,7 @@ static int vhost_poll_wakeup(wait_queue_t *wait, unsigned
> mode, int sync,
>  
>  void vhost_work_init(struct vhost_work *work, vhost_work_fn_t fn)
>  {
> -	INIT_LIST_HEAD(&work->node);
> +	clear_bit(VHOST_WORK_QUEUED, &work->flags);
>  	work->fn = fn;
>  	init_waitqueue_head(&work->done);
>  }
> @@ -246,15 +246,16 @@ EXPORT_SYMBOL_GPL(vhost_poll_flush);
>  
>  void vhost_work_queue(struct vhost_dev *dev, struct vhost_work *work)
>  {
> -	unsigned long flags;
> +	if (!dev->worker)
> +		return;
>  
> -	spin_lock_irqsave(&dev->work_lock, flags);
> -	if (list_empty(&work->node)) {
> -		list_add_tail(&work->node, &dev->work_list);
> -		spin_unlock_irqrestore(&dev->work_lock, flags);
> +	if (!test_and_set_bit(VHOST_WORK_QUEUED, &work->flags)) {
> +		/* We can only add the work to the list after we're
> +		 * sure it was not in the list.
> +		 */
> +		smp_mb();
> +		llist_add(&work->node, &dev->work_list);
>  		wake_up_process(dev->worker);
> -	} else {
> -		spin_unlock_irqrestore(&dev->work_lock, flags);
>  	}
>  }
>  EXPORT_SYMBOL_GPL(vhost_work_queue);
> @@ -262,7 +263,7 @@ EXPORT_SYMBOL_GPL(vhost_work_queue);
>  /* A lockless hint for busy polling code to exit the loop */
>  bool vhost_has_work(struct vhost_dev *dev)
>  {
> -	return !list_empty(&dev->work_list);
> +	return !llist_empty(&dev->work_list);
>  }
>  EXPORT_SYMBOL_GPL(vhost_has_work);
>  
> @@ -305,7 +306,8 @@ static void vhost_vq_reset(struct vhost_dev *dev,
>  static int vhost_worker(void *data)
>  {
>  	struct vhost_dev *dev = data;
> -	struct vhost_work *work = NULL;
> +	struct vhost_work *work, *work_next;
> +	struct llist_node *node;
>  	mm_segment_t oldfs = get_fs();
>  
>  	set_fs(USER_DS);
> @@ -315,29 +317,25 @@ static int vhost_worker(void *data)
>  		/* mb paired w/ kthread_stop */
>  		set_current_state(TASK_INTERRUPTIBLE);
>  
> -		spin_lock_irq(&dev->work_lock);
> -
>  		if (kthread_should_stop()) {
> -			spin_unlock_irq(&dev->work_lock);
>  			__set_current_state(TASK_RUNNING);
>  			break;
>  		}
> -		if (!list_empty(&dev->work_list)) {
> -			work = list_first_entry(&dev->work_list,
> -						struct vhost_work, node);
> -			list_del_init(&work->node);
> -		} else
> -			work = NULL;
> -		spin_unlock_irq(&dev->work_lock);
>  
> -		if (work) {
> +		node = llist_del_all(&dev->work_list);
> +		if (!node)
> +			schedule();
> +
> +		node = llist_reverse_order(node);

Can we avoid llist reverse here?

> +		/* make sure flag is seen after deletion */
> +		smp_wmb();
> +		llist_for_each_entry_safe(work, work_next, node, node) {
> +			clear_bit(VHOST_WORK_QUEUED, &work->flags);
>  			__set_current_state(TASK_RUNNING);
>  			work->fn(work);
>  			if (need_resched())
>  				schedule();
> -		} else
> -			schedule();
> -
> +		}
>  	}
>  	unuse_mm(dev->mm);
>  	set_fs(oldfs);
> @@ -398,9 +396,9 @@ void vhost_dev_init(struct vhost_dev *dev,
>  	dev->log_file = NULL;
>  	dev->memory = NULL;
>  	dev->mm = NULL;
> -	spin_lock_init(&dev->work_lock);
> -	INIT_LIST_HEAD(&dev->work_list);
>  	dev->worker = NULL;
> +	init_llist_head(&dev->work_list);
> +
>  
>  	for (i = 0; i < dev->nvqs; ++i) {
>  		vq = dev->vqs[i];
> @@ -566,7 +564,7 @@ void vhost_dev_cleanup(struct vhost_dev *dev, bool
> locked)
>  	/* No one will access memory at this point */
>  	kvfree(dev->memory);
>  	dev->memory = NULL;
> -	WARN_ON(!list_empty(&dev->work_list));
> +	WARN_ON(!llist_empty(&dev->work_list));
>  	if (dev->worker) {
>  		kthread_stop(dev->worker);
>  		dev->worker = NULL;
> diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
> index d36d8be..6690e64 100644
> --- a/drivers/vhost/vhost.h
> +++ b/drivers/vhost/vhost.h
> @@ -15,13 +15,15 @@
>  struct vhost_work;
>  typedef void (*vhost_work_fn_t)(struct vhost_work *work);
>  
> +#define VHOST_WORK_QUEUED 1
>  struct vhost_work {
> -	struct list_head	  node;
> +	struct llist_node	  node;
>  	vhost_work_fn_t		  fn;
>  	wait_queue_head_t	  done;
>  	int			  flushing;
>  	unsigned		  queue_seq;
>  	unsigned		  done_seq;
> +	unsigned long		  flags;
>  };
>  
>  /* Poll a file (eventfd or socket) */
> @@ -126,8 +128,7 @@ struct vhost_dev {
>  	int nvqs;
>  	struct file *log_file;
>  	struct eventfd_ctx *log_ctx;
> -	spinlock_t work_lock;
> -	struct list_head work_list;
> +	struct llist_head work_list;
>  	struct task_struct *worker;
>  };
>  
> --
> 1.8.3.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply

* Re: codel: split into multiple files
From: Michal Kazior @ 2016-04-26  6:30 UTC (permalink / raw)
  To: sedat.dilek; +Cc: David S. Miller, netdev@vger.kernel.org
In-Reply-To: <CA+icZUWrRbBJM3q7SzRSc2znAXZHr1JdXHD2j2POKvDin4=CZg@mail.gmail.com>

On 26 April 2016 at 08:09, Sedat Dilek <sedat.dilek@gmail.com> wrote:
> Hi,
>
> I had a very quick view on net-next.git#master (up to commit
> fab7b629a82da1b59620470d13152aff975239f6).
>
> Commit in [1] aka "codel: split into multiple files" removed codel.h
> but [2] and [3] have relicts to it.
> Forgot to remove?

codel.h was not removed. diffstat for codel.h is all red which I
presume is why you thought of it as removed, see:

http://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/tree/include/net/codel.h?id=d068ca2ae2e614b9a418fb3b5f1fd4cf996ff032


Michał

^ permalink raw reply

* Re: [PATCH v5 09/21] IB/hns: Add hca support
From: oulijun @ 2016-04-26  6:34 UTC (permalink / raw)
  To: leon-DgEjT+Ai2ygdnm+yROfE0A
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
	sean.hefty-ral2JQCrhuEAvxtiuMwx3w,
	hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q,
	jeffrey.t.kirsher-ral2JQCrhuEAvxtiuMwx3w,
	jiri-VPRAkNaXOzVWk0Htik3J/w, ogerlitz-VPRAkNaXOzVWk0Htik3J/w,
	linuxarm-hv44wF8Li93QT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	gongyangming-hv44wF8Li93QT0dZR+AlfA,
	xiaokun-hv44wF8Li93QT0dZR+AlfA,
	tangchaofei-hv44wF8Li93QT0dZR+AlfA,
	haifeng.wei-hv44wF8Li93QT0dZR+AlfA,
	yisen.zhuang-hv44wF8Li93QT0dZR+AlfA,
	yankejian-hv44wF8Li93QT0dZR+AlfA,
	lisheng011-hv44wF8Li93QT0dZR+AlfA,
	charles.chenxin-hv44wF8Li93QT0dZR+AlfA
In-Reply-To: <20160424075424.GE7974-2ukJVAZIZ/Y@public.gmane.org>

On 2016/4/24 15:54, Leon Romanovsky wrote:
> On Sat, Apr 23, 2016 at 06:26:47PM +0800, Lijun Ou wrote:
>> This patch mainly setup hca for RoCE. it will do a series of
>> initial works as follows:
>>       1. init uar table, allocate uar resource
>>       2. init pd table
>>       3. init cq table
>>       4. init mr table
>>       5. init qp table
>>
>> Signed-off-by: Lijun Ou <oulijun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
>> Signed-off-by: Wei Hu(Xavier) <xavier.huwei-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
>> ---
>>  drivers/infiniband/hw/hns/hns_roce_alloc.c  | 104 ++++++++++++++++
>>  drivers/infiniband/hw/hns/hns_roce_cq.c     |  25 ++++
>>  drivers/infiniband/hw/hns/hns_roce_device.h |  69 ++++++++++
>>  drivers/infiniband/hw/hns/hns_roce_eq.c     |   1 -
>>  drivers/infiniband/hw/hns/hns_roce_icm.c    |  88 +++++++++++++
>>  drivers/infiniband/hw/hns/hns_roce_icm.h    |   9 ++
>>  drivers/infiniband/hw/hns/hns_roce_main.c   |  79 ++++++++++++
>>  drivers/infiniband/hw/hns/hns_roce_mr.c     | 187 ++++++++++++++++++++++++++++
>>  drivers/infiniband/hw/hns/hns_roce_pd.c     |  65 ++++++++++
>>  drivers/infiniband/hw/hns/hns_roce_qp.c     |  30 +++++
>>  10 files changed, 656 insertions(+), 1 deletion(-)
>>  create mode 100644 drivers/infiniband/hw/hns/hns_roce_alloc.c
>>  create mode 100644 drivers/infiniband/hw/hns/hns_roce_mr.c
>>  create mode 100644 drivers/infiniband/hw/hns/hns_roce_pd.c
>>
>> diff --git a/drivers/infiniband/hw/hns/hns_roce_alloc.c b/drivers/infiniband/hw/hns/hns_roce_alloc.c
>> new file mode 100644
>> index 0000000..0c76f1b
>> --- /dev/null
>> +++ b/drivers/infiniband/hw/hns/hns_roce_alloc.c
>> @@ -0,0 +1,104 @@
>> +/*
>> + * Copyright (c) 2016 Hisilicon Limited.
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License as published by
>> + * the Free Software Foundation; either version 2 of the License, or
>> + * (at your option) any later version.
>> + */
>> +
>> +#include <linux/bitmap.h>
>> +#include <linux/dma-mapping.h>
>> +#include <linux/errno.h>
>> +#include <linux/mm.h>
>> +#include <linux/slab.h>
>> +#include <linux/vmalloc.h>
>> +#include "hns_roce_device.h"
>> +
>> +int hns_roce_bitmap_alloc(struct hns_roce_bitmap *bitmap, u32 *obj)
>> +{
>> +	int ret = 0;
>> +
>> +	spin_lock(&bitmap->lock);
>> +	*obj = find_next_zero_bit(bitmap->table, bitmap->max, bitmap->last);
>> +	if (*obj >= bitmap->max) {
>> +		bitmap->top = (bitmap->top + bitmap->max + bitmap->reserved_top)
>> +			       & bitmap->mask;
>> +		*obj = find_first_zero_bit(bitmap->table, bitmap->max);
> 
> find_first_zero_bit function returns "unsigned long" which may or may
> not be equal to u32 on some architectures.
> 
Hi Leon,
    I appreciate your keen eye. this code is meant for ARM64bit therefore should run corretly for 64-bit AARCH64.
I will consider changing it as part of good partice and better portability "
I will give a primary plan to modified it.
for example:
    *obj = (u32)find_next_zero_bit(bitmap->table, bitmap->max, bitmap->last);
Beause the max size of bitmap->table is u32 in current version.

int hns_roce_bitmap_init(struct hns_roce_bitmap *bitmap, u32 num, u32 mask,
			 u32 reserved_bot, u32 reserved_top)
{
	u32 i;

	if (num != roundup_pow_of_two(num))
		return -EINVAL;

	bitmap->last = 0;
	bitmap->top = 0;
	bitmap->max = num - reserved_top;
	bitmap->mask = mask;
	bitmap->reserved_top = reserved_top;
	spin_lock_init(&bitmap->lock);
	bitmap->table = kcalloc(BITS_TO_LONGS(bitmap->max), sizeof(long),
				GFP_KERNEL);

Is this plan ok?

Thanks
Lijun Ou

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" 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: codel: split into multiple files
From: Sedat Dilek @ 2016-04-26  6:43 UTC (permalink / raw)
  To: Michal Kazior; +Cc: David S. Miller, netdev@vger.kernel.org, Jens Axboe
In-Reply-To: <CA+BoTQn2h8XQ5PwTm4Zy2-6JZs-muW2FmA0kVWf9OYCYgQ3T2g@mail.gmail.com>

On 4/26/16, Michal Kazior <michal.kazior@tieto.com> wrote:
> On 26 April 2016 at 08:09, Sedat Dilek <sedat.dilek@gmail.com> wrote:
>> Hi,
>>
>> I had a very quick view on net-next.git#master (up to commit
>> fab7b629a82da1b59620470d13152aff975239f6).
>>
>> Commit in [1] aka "codel: split into multiple files" removed codel.h
>> but [2] and [3] have relicts to it.
>> Forgot to remove?
>
> codel.h was not removed. diffstat for codel.h is all red which I
> presume is why you thought of it as removed, see:
>
> http://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/tree/include/net/codel.h?id=d068ca2ae2e614b9a418fb3b5f1fd4cf996ff032
>

[ CC Jens ]

OK.
So what are the plans in the future?
Keep a "generic" codel.h (compatibility reasons?) for net or is it your split?

AFAICS I have seen a codel-implementation in block.git#wb-buf-throttle.
Does it make sense to have a more "super-generic" codel.h for re-use
(not only for net and block)?
Just a thought.

- Sedat -

[1] http://git.kernel.org/cgit/linux/kernel/git/axboe/linux-block.git/log/?h=wb-buf-throttle
[2] http://git.kernel.org/cgit/linux/kernel/git/axboe/linux-block.git/commit/?h=wb-buf-throttle&id=b8bc0478ddd6f32a09a2b1ff30f7c75605448638
[3] http://git.kernel.org/cgit/linux/kernel/git/axboe/linux-block.git/commit/?h=wb-buf-throttle&id=e26e88f9c125a9cd6d3df0087386992183c1f47e

^ 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