Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH net-next 0/3] mlx4_en: Adding BQL support
From: David Miller @ 2012-04-24  2:34 UTC (permalink / raw)
  To: yevgenyp; +Cc: netdev
In-Reply-To: <4F954893.3040401@mellanox.co.il>

From: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Date: Mon, 23 Apr 2012 15:18:27 +0300

> This patchset adds Byte Queue Limit support to the mlx4_en driver.
> As a precondition to this I had to change the mode of TX completion handling
> Till now we have handled completions by polling from the xmit context,
> once in every 16 packets.
> Now moving to interrupts, and also added the set/get coalescing option for TX interrupts.

All applied to net-next, thanks.

^ permalink raw reply

* Re: [PATCH net-next 0/3] bnx2x: use FW 7.2.51 and add afex support
From: David Miller @ 2012-04-24  2:34 UTC (permalink / raw)
  To: barak; +Cc: netdev, eilong
In-Reply-To: <1335186273.14229.25.camel@lb-tlvb-barak.il.broadcom.com>

From: "Barak Witkowski" <barak@broadcom.com>
Date: Mon, 23 Apr 2012 16:04:33 +0300

> This patch utilize FW 7.2.51 that was recently added to the linux-firmware tree.
> 
> The main feature of this new FW is support of the AFEX multi-function protocol.
> Supporting the afex protocol requires many changes in the driver, but all of
> them are required together in order to compile and make the feature operational.
> Breaking the afex patch into smaller chunks did not seem to increase readability
> to me.

All applied, thanks.

^ permalink raw reply

* Re: [PATCH net-next] tcp: introduce tcp_try_coalesce
From: Neal Cardwell @ 2012-04-24  2:39 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David Miller, netdev, Tom Herbert, Maciej Żenczykowski,
	Ilpo Järvinen
In-Reply-To: <1335201102.5205.28.camel@edumazet-glaptop>

On Mon, Apr 23, 2012 at 1:11 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> commit c8628155ece3 (tcp: reduce out_of_order memory use) took care of
> coalescing tcp segments provided by legacy devices (linear skbs)
>
> We extend this idea to fragged skbs, as their truesize can be heavy.
>
> ixgbe for example uses 256+1024+PAGE_SIZE/2 = 3328 bytes per segment.
>
> Use this coalescing strategy for receive queue too.
>
> This contributes to reduce number of tcp collapses, at minimal cost, and
> reduces memory overhead and packets drops.

Acked-by: Neal Cardwell <ncardwell@google.com>

Thanks for the background info, Eric.

neal

^ permalink raw reply

* Re: [PATCH v2 5/5] decrement static keys on real destroy time
From: KAMEZAWA Hiroyuki @ 2012-04-24  2:40 UTC (permalink / raw)
  To: Glauber Costa
  Cc: Tejun Heo, netdev-u79uwXL29TY76Z2rM5mHXA,
	cgroups-u79uwXL29TY76Z2rM5mHXA, Li Zefan, David Miller,
	devel-GEFAQzZX7r8dnm+yROfE0A
In-Reply-To: <1335209867-1831-6-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>

(2012/04/24 4:37), Glauber Costa wrote:

> We call the destroy function when a cgroup starts to be removed,
> such as by a rmdir event.
> 
> However, because of our reference counters, some objects are still
> inflight. Right now, we are decrementing the static_keys at destroy()
> time, meaning that if we get rid of the last static_key reference,
> some objects will still have charges, but the code to properly
> uncharge them won't be run.
> 
> This becomes a problem specially if it is ever enabled again, because
> now new charges will be added to the staled charges making keeping
> it pretty much impossible.
> 
> We just need to be careful with the static branch activation:
> since there is no particular preferred order of their activation,
> we need to make sure that we only start using it after all
> call sites are active. This is achieved by having a per-memcg
> flag that is only updated after static_key_slow_inc() returns.
> At this time, we are sure all sites are active.
> 
> This is made per-memcg, not global, for a reason:
> it also has the effect of making socket accounting more
> consistent. The first memcg to be limited will trigger static_key()
> activation, therefore, accounting. But all the others will then be
> accounted no matter what. After this patch, only limited memcgs
> will have its sockets accounted.
> 
> [v2: changed a tcp limited flag for a generic proto limited flag ]
> [v3: update the current active flag only after the static_key update ]
> 
> Signed-off-by: Glauber Costa <glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>


Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>

A small request below.

<snip>


> +		 * ->activated needs to be written after the static_key update.
> +		 *  This is what guarantees that the socket activation function
> +		 *  is the last one to run. See sock_update_memcg() for details,
> +		 *  and note that we don't mark any socket as belonging to this
> +		 *  memcg until that flag is up.
> +		 *
> +		 *  We need to do this, because static_keys will span multiple
> +		 *  sites, but we can't control their order. If we mark a socket
> +		 *  as accounted, but the accounting functions are not patched in
> +		 *  yet, we'll lose accounting.
> +		 *
> +		 *  We never race with the readers in sock_update_memcg(), because
> +		 *  when this value change, the code to process it is not patched in
> +		 *  yet.
> +		 */
> +		mutex_lock(&tcp_set_limit_mutex);


Could you explain for what this mutex is in above comment ?

Thanks,
-Kame

> +		if (!cg_proto->activated) {
> +			static_key_slow_inc(&memcg_socket_limit_enabled);
> +			cg_proto->activated = true;
> +		}
> +		mutex_unlock(&tcp_set_limit_mutex);
> +		cg_proto->active = true;
> +	}
>  
>  	return 0;
>  }

^ permalink raw reply

* Re: [PATCH net-next] tcp: introduce tcp_try_coalesce
From: David Miller @ 2012-04-24  2:46 UTC (permalink / raw)
  To: ncardwell; +Cc: eric.dumazet, netdev, therbert, maze, ilpo.jarvinen
In-Reply-To: <CADVnQy=igJdbcG4J2HU7nEJUNM84qVcLa08h6g6MQQ8-fvgxHg@mail.gmail.com>

From: Neal Cardwell <ncardwell@google.com>
Date: Mon, 23 Apr 2012 22:39:10 -0400

> On Mon, Apr 23, 2012 at 1:11 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>> From: Eric Dumazet <edumazet@google.com>
>>
>> commit c8628155ece3 (tcp: reduce out_of_order memory use) took care of
>> coalescing tcp segments provided by legacy devices (linear skbs)
>>
>> We extend this idea to fragged skbs, as their truesize can be heavy.
>>
>> ixgbe for example uses 256+1024+PAGE_SIZE/2 = 3328 bytes per segment.
>>
>> Use this coalescing strategy for receive queue too.
>>
>> This contributes to reduce number of tcp collapses, at minimal cost, and
>> reduces memory overhead and packets drops.
> 
> Acked-by: Neal Cardwell <ncardwell@google.com>
> 
> Thanks for the background info, Eric.

Applied, thanks Eric.

Although I'd like to ask you to clean up tcp_try_coalesce() a bit.

It effectively returns a boolean, but you've clouded this up by
returning an int and defining it in the comment to return "> 0" or
not.

Just make it return a real bool.

I know why you did this, it makes the "eaten" code somewhat simpler in
tcp_data_queue(), but overall it's more confusing how it is now.

People look at how the tcp_try_coalesce() return value is interpreted
and say "in what cases can it return a negative value?"  We both know
it can't, but you have to read the entire function to figure that out.

And that's by definition not intuitive.

Thanks.

^ permalink raw reply

* [PATCH] b44: properly use pr_fmt()
From: Luis R. Rodriguez @ 2012-04-24  2:46 UTC (permalink / raw)
  To: zambrano; +Cc: netdev, Luis R. Rodriguez

From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>

pr_fmt() is either defined or we redefine it. Typically
drivers define it prior to including printk.h but this
is done under the assumption that no other subsystem
it uses has already defined pr_fmt(). In such cases
pr_fmt() should be undefined and redefined.

Doing this properly shaves down compilation time quite
considerably.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 drivers/net/ethernet/broadcom/b44.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
index 46b8b7d..656f323 100644
--- a/drivers/net/ethernet/broadcom/b44.c
+++ b/drivers/net/ethernet/broadcom/b44.c
@@ -10,9 +10,11 @@
  * Distribute under GPL.
  */
 
+#undef pr_fmt
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/kernel.h>
+#include <linux/printk.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/types.h>
-- 
1.7.10.rc1.22.gf5241

^ permalink raw reply related

* linux-next: manual merge of the wireless-next tree with the net-next tree
From: Stephen Rothwell @ 2012-04-24  2:48 UTC (permalink / raw)
  To: John W. Linville
  Cc: linux-next, linux-kernel, Emmanuel Grumbach, Wey-Yi Guy,
	David Miller, netdev

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

Hi John,

Today's linux-next merge of the wireless-next tree got a conflict in
drivers/net/wireless/iwlwifi/iwl-testmode.c between commit d33e152e1edd
("iwlwifi: Stop using NLA_PUT*()") from the net-next tree and commit
2152268ff911 ("iwlwifi: op_mode holds its pointer to the config") from
the wireless-next tree.

I was hoping that we were done with these ... :-(

I fixed it up (see below) and can carry the fix as necessary.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc drivers/net/wireless/iwlwifi/iwl-testmode.c
index bb27509,a6b16aa..0000000
--- a/drivers/net/wireless/iwlwifi/iwl-testmode.c
+++ b/drivers/net/wireless/iwlwifi/iwl-testmode.c
@@@ -543,12 -539,11 +543,12 @@@ static int iwl_testmode_driver(struct i
  				IWL_ERR(priv, "Memory allocation fail\n");
  				return -ENOMEM;
  			}
 -			NLA_PUT_U32(skb, IWL_TM_ATTR_COMMAND,
 -				IWL_TM_CMD_DEV2APP_EEPROM_RSP);
 -			NLA_PUT(skb, IWL_TM_ATTR_EEPROM,
 -				priv->cfg->base_params->eeprom_size,
 -				priv->eeprom);
 +			if (nla_put_u32(skb, IWL_TM_ATTR_COMMAND,
 +					IWL_TM_CMD_DEV2APP_EEPROM_RSP) ||
 +			    nla_put(skb, IWL_TM_ATTR_EEPROM,
- 				    cfg(priv)->base_params->eeprom_size,
++				    priv->cfg->base_params->eeprom_size,
 +				    priv->eeprom))
 +				goto nla_put_failure;
  			status = cfg80211_testmode_reply(skb);
  			if (status < 0)
  				IWL_ERR(priv, "Error sending msg : %d\n",

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply

* Re: [PATCH net-next] tcp: introduce tcp_try_coalesce
From: Eric Dumazet @ 2012-04-24  2:59 UTC (permalink / raw)
  To: David Miller; +Cc: ncardwell, netdev, therbert, maze, ilpo.jarvinen
In-Reply-To: <20120423.224602.594997774992725103.davem@davemloft.net>

On Mon, 2012-04-23 at 22:46 -0400, David Miller wrote:

> Applied, thanks Eric.
> 
> Although I'd like to ask you to clean up tcp_try_coalesce() a bit.
> 
> It effectively returns a boolean, but you've clouded this up by
> returning an int and defining it in the comment to return "> 0" or
> not.
> 
> Just make it return a real bool.
> 
> I know why you did this, it makes the "eaten" code somewhat simpler in
> tcp_data_queue(), but overall it's more confusing how it is now.
> 
> People look at how the tcp_try_coalesce() return value is interpreted
> and say "in what cases can it return a negative value?"  We both know
> it can't, but you have to read the entire function to figure that out.
> 
> And that's by definition not intuitive.
> 
> Thanks.

Sure I'll do the cleanup. You guessed correctly why I did that ;)

In the beginning I did a "return len;" instead of "return 1;" and felt a
bit uncomfortable in case we merged a zero length message.

Then I added the !th->fin test inside tcp_try_coalesce()

(my initial patch allowed the fin being set for the tcp_data_queue()
case since tcp_fin() was called anyway)

Thanks

^ permalink raw reply

* Re: [PATCH net-next] net: speedup skb_splice_bits()
From: David Miller @ 2012-04-24  3:02 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, therbert, axboe
In-Reply-To: <1335133576.2395.409.camel@edumazet-glaptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 23 Apr 2012 00:26:16 +0200

> From: Eric Dumazet <edumazet@google.com>
> 
> Commit 35f3d14db (pipe: add support for shrinking and growing pipes)
> added a slowdown for splice(socket -> pipe), as we might grow the spd
> used in skb_splice_bits() for each skb we process in splice() syscall.
> 
> Its not needed since skb lengths are capped. The default on-stack arrays
> are more than enough.
> 
> Use MAX_SKB_FRAGS instead of PIPE_DEF_BUFFERS to describe the reasonable
> limit per skb.
> 
> Add coalescing support to help splicing of GRO skbs built from linear
> skbs (linked into frag_list)
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Jens Axboe <axboe@kernel.dk>
> Cc: Tom Herbert <therbert@google.com>

Applied thanks.

I'm going to cleanup spd_fill_page() to return a bool.

^ permalink raw reply

* Re: [PATCH net-next] net: speedup skb_splice_bits()
From: David Miller @ 2012-04-24  3:06 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, therbert, axboe
In-Reply-To: <20120423.230205.418261556142199877.davem@davemloft.net>

From: David Miller <davem@davemloft.net>
Date: Mon, 23 Apr 2012 23:02:05 -0400 (EDT)

> I'm going to cleanup spd_fill_page() to return a bool.

Done, thusly:

--------------------
net: Use bool and remove inline in skb_splice_bits() code.

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 net/core/skbuff.c |   58 ++++++++++++++++++++++++++---------------------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index dfb3040..aaf4abc 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1547,9 +1547,9 @@ static void sock_spd_release(struct splice_pipe_desc *spd, unsigned int i)
 	put_page(spd->pages[i]);
 }
 
-static inline struct page *linear_to_page(struct page *page, unsigned int *len,
-					  unsigned int *offset,
-					  struct sk_buff *skb, struct sock *sk)
+static struct page *linear_to_page(struct page *page, unsigned int *len,
+				   unsigned int *offset,
+				   struct sk_buff *skb, struct sock *sk)
 {
 	struct page *p = sk->sk_sndmsg_page;
 	unsigned int off;
@@ -1598,23 +1598,23 @@ static bool spd_can_coalesce(const struct splice_pipe_desc *spd,
 /*
  * Fill page/offset/length into spd, if it can hold more pages.
  */
-static inline int spd_fill_page(struct splice_pipe_desc *spd,
-				struct pipe_inode_info *pipe, struct page *page,
-				unsigned int *len, unsigned int offset,
-				struct sk_buff *skb, int linear,
-				struct sock *sk)
+static bool spd_fill_page(struct splice_pipe_desc *spd,
+			  struct pipe_inode_info *pipe, struct page *page,
+			  unsigned int *len, unsigned int offset,
+			  struct sk_buff *skb, int linear,
+			  struct sock *sk)
 {
 	if (unlikely(spd->nr_pages == MAX_SKB_FRAGS))
-		return 1;
+		return true;
 
 	if (linear) {
 		page = linear_to_page(page, len, &offset, skb, sk);
 		if (!page)
-			return 1;
+			return true;
 	}
 	if (spd_can_coalesce(spd, page, offset)) {
 		spd->partial[spd->nr_pages - 1].len += *len;
-		return 0;
+		return false;
 	}
 	get_page(page);
 	spd->pages[spd->nr_pages] = page;
@@ -1622,7 +1622,7 @@ static inline int spd_fill_page(struct splice_pipe_desc *spd,
 	spd->partial[spd->nr_pages].offset = offset;
 	spd->nr_pages++;
 
-	return 0;
+	return false;
 }
 
 static inline void __segment_seek(struct page **page, unsigned int *poff,
@@ -1639,20 +1639,20 @@ static inline void __segment_seek(struct page **page, unsigned int *poff,
 	*plen -= off;
 }
 
-static inline int __splice_segment(struct page *page, unsigned int poff,
-				   unsigned int plen, unsigned int *off,
-				   unsigned int *len, struct sk_buff *skb,
-				   struct splice_pipe_desc *spd, int linear,
-				   struct sock *sk,
-				   struct pipe_inode_info *pipe)
+static bool __splice_segment(struct page *page, unsigned int poff,
+			     unsigned int plen, unsigned int *off,
+			     unsigned int *len, struct sk_buff *skb,
+			     struct splice_pipe_desc *spd, int linear,
+			     struct sock *sk,
+			     struct pipe_inode_info *pipe)
 {
 	if (!*len)
-		return 1;
+		return true;
 
 	/* skip this segment if already processed */
 	if (*off >= plen) {
 		*off -= plen;
-		return 0;
+		return false;
 	}
 
 	/* ignore any bits we already processed */
@@ -1668,23 +1668,23 @@ static inline int __splice_segment(struct page *page, unsigned int poff,
 		flen = min_t(unsigned int, flen, PAGE_SIZE - poff);
 
 		if (spd_fill_page(spd, pipe, page, &flen, poff, skb, linear, sk))
-			return 1;
+			return true;
 
 		__segment_seek(&page, &poff, &plen, flen);
 		*len -= flen;
 
 	} while (*len && plen);
 
-	return 0;
+	return false;
 }
 
 /*
- * Map linear and fragment data from the skb to spd. It reports failure if the
+ * Map linear and fragment data from the skb to spd. It reports true if the
  * pipe is full or if we already spliced the requested length.
  */
-static int __skb_splice_bits(struct sk_buff *skb, struct pipe_inode_info *pipe,
-			     unsigned int *offset, unsigned int *len,
-			     struct splice_pipe_desc *spd, struct sock *sk)
+static bool __skb_splice_bits(struct sk_buff *skb, struct pipe_inode_info *pipe,
+			      unsigned int *offset, unsigned int *len,
+			      struct splice_pipe_desc *spd, struct sock *sk)
 {
 	int seg;
 
@@ -1695,7 +1695,7 @@ static int __skb_splice_bits(struct sk_buff *skb, struct pipe_inode_info *pipe,
 			     (unsigned long) skb->data & (PAGE_SIZE - 1),
 			     skb_headlen(skb),
 			     offset, len, skb, spd, 1, sk, pipe))
-		return 1;
+		return true;
 
 	/*
 	 * then map the fragments
@@ -1706,10 +1706,10 @@ static int __skb_splice_bits(struct sk_buff *skb, struct pipe_inode_info *pipe,
 		if (__splice_segment(skb_frag_page(f),
 				     f->page_offset, skb_frag_size(f),
 				     offset, len, skb, spd, 0, sk, pipe))
-			return 1;
+			return true;
 	}
 
-	return 0;
+	return false;
 }
 
 /*
-- 
1.7.10

^ permalink raw reply related

* Re: [PATCH v1 6/8] dmaengine: enhance network subsystem to support DMA device hotplug
From: Dan Williams @ 2012-04-24  3:09 UTC (permalink / raw)
  To: Jiang Liu
  Cc: Jiang Liu, Vinod Koul, Keping Chen, David S. Miller,
	Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI,
	Patrick McHardy, netdev, linux-pci, linux-kernel
In-Reply-To: <4F961041.7010106@huawei.com>

On Mon, Apr 23, 2012 at 7:30 PM, Jiang Liu <jiang.liu@huawei.com> wrote:
>> If you are going to hotplug the entire IOH, then you are probably ok
>> with network links going down, so could you just down the links and
>> remove the driver with the existing code?
>
> I feel it's a little risky to shut down/restart all network interfaces
> for hot-removal of IOH, that may disturb the applications.

I guess I'm confused... wouldn't the removal of an entire domain of
pci devices disturb userspace applications?

> And there
> are also other kinds of clients, such as ASYNC_TX, seems we can't
> adopt this method to reclaim DMA channels from ASYNC_TX subsystem.

I say handle this like block device hotplug.  I.e. the driver stays
loaded but the channel is put into an 'offline' state.  So the driver
hides the fact that the hardware went away.  Similar to how you can
remove a disk but /dev/sda sticks around until the last reference is
gone (and the driver 'sd' sticks around until all block devices are
gone).

I expect the work will be in making sure existing clients are prepared
to handle NULL returns from ->device_prep_dma_*.  In some cases the
channel is treated more like a cpu, so a NULL return from
->device_prep_dma_memcpy() has been interpreted as "device is
temporarily busy, it is safe to try again".  We would need to change
that to a permanent indication that the device is gone and not attempt
retry.

--
Dan

^ permalink raw reply

* Re: [PATCH net-next] net: speedup skb_splice_bits()
From: Eric Dumazet @ 2012-04-24  3:18 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, therbert, axboe
In-Reply-To: <20120423.230641.256329442020745539.davem@davemloft.net>

On Mon, 2012-04-23 at 23:06 -0400, David Miller wrote:
> From: David Miller <davem@davemloft.net>
> Date: Mon, 23 Apr 2012 23:02:05 -0400 (EDT)
> 
> > I'm going to cleanup spd_fill_page() to return a bool.
> 
> Done, thusly:
> 
> --------------------
> net: Use bool and remove inline in skb_splice_bits() code.
> 
> Signed-off-by: David S. Miller <davem@davemloft.net>
> ---
>  net/core/skbuff.c |   58 ++++++++++++++++++++++++++---------------------------
>  1 file changed, 29 insertions(+), 29 deletions(-)
> 
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index dfb3040..aaf4abc 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -1547,9 +1547,9 @@ static void sock_spd_release(struct splice_pipe_desc *spd, unsigned int i)
>  	put_page(spd->pages[i]);
>  }
>  
> -static inline struct page *linear_to_page(struct page *page, unsigned int *len,
> -					  unsigned int *offset,
> -					  struct sk_buff *skb, struct sock *sk)
> +static struct page *linear_to_page(struct page *page, unsigned int *len,
> +				   unsigned int *offset,
> +				   struct sk_buff *skb, struct sock *sk)
>  {
>  	struct page *p = sk->sk_sndmsg_page;
>  	unsigned int off;
> @@ -1598,23 +1598,23 @@ static bool spd_can_coalesce(const struct splice_pipe_desc *spd,
>  /*
>   * Fill page/offset/length into spd, if it can hold more pages.
>   */
> -static inline int spd_fill_page(struct splice_pipe_desc *spd,
> -				struct pipe_inode_info *pipe, struct page *page,
> -				unsigned int *len, unsigned int offset,
> -				struct sk_buff *skb, int linear,
> -				struct sock *sk)
> +static bool spd_fill_page(struct splice_pipe_desc *spd,
> +			  struct pipe_inode_info *pipe, struct page *page,
> +			  unsigned int *len, unsigned int offset,
> +			  struct sk_buff *skb, int linear,

linear could be a bool too 

[PATCH] net: make spd_fill_page() linear argument a bool

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/core/skbuff.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index aaf4abc..2342a72 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1601,7 +1601,7 @@ static bool spd_can_coalesce(const struct splice_pipe_desc *spd,
 static bool spd_fill_page(struct splice_pipe_desc *spd,
 			  struct pipe_inode_info *pipe, struct page *page,
 			  unsigned int *len, unsigned int offset,
-			  struct sk_buff *skb, int linear,
+			  struct sk_buff *skb, bool linear,
 			  struct sock *sk)
 {
 	if (unlikely(spd->nr_pages == MAX_SKB_FRAGS))
@@ -1642,7 +1642,7 @@ static inline void __segment_seek(struct page **page, unsigned int *poff,
 static bool __splice_segment(struct page *page, unsigned int poff,
 			     unsigned int plen, unsigned int *off,
 			     unsigned int *len, struct sk_buff *skb,
-			     struct splice_pipe_desc *spd, int linear,
+			     struct splice_pipe_desc *spd, bool linear,
 			     struct sock *sk,
 			     struct pipe_inode_info *pipe)
 {
@@ -1694,7 +1694,7 @@ static bool __skb_splice_bits(struct sk_buff *skb, struct pipe_inode_info *pipe,
 	if (__splice_segment(virt_to_page(skb->data),
 			     (unsigned long) skb->data & (PAGE_SIZE - 1),
 			     skb_headlen(skb),
-			     offset, len, skb, spd, 1, sk, pipe))
+			     offset, len, skb, spd, true, sk, pipe))
 		return true;
 
 	/*
@@ -1705,7 +1705,7 @@ static bool __skb_splice_bits(struct sk_buff *skb, struct pipe_inode_info *pipe,
 
 		if (__splice_segment(skb_frag_page(f),
 				     f->page_offset, skb_frag_size(f),
-				     offset, len, skb, spd, 0, sk, pipe))
+				     offset, len, skb, spd, false, sk, pipe))
 			return true;
 	}
 

^ permalink raw reply related

* [PATCH net-next] tcp: tcp_try_coalesce returns a boolean
From: Eric Dumazet @ 2012-04-24  3:34 UTC (permalink / raw)
  To: David Miller; +Cc: ncardwell, netdev, therbert, maze, ilpo.jarvinen
In-Reply-To: <20120423.224602.594997774992725103.davem@davemloft.net>

From: Eric Dumazet <edumazet@google.com>

This clarifies code intention, as suggested by David.

Suggested-by: David Miller <davem@davemloft.net>
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/ipv4/tcp_input.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index bd7aef5..67f352a 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4459,23 +4459,23 @@ static inline int tcp_try_rmem_schedule(struct sock *sk, unsigned int size)
  * to reduce overall memory use and queue lengths, if cost is small.
  * Packets in ofo or receive queues can stay a long time.
  * Better try to coalesce them right now to avoid future collapses.
- * Returns > 0 value if caller should free @from instead of queueing it
+ * Returns true if caller should free @from instead of queueing it
  */
-static int tcp_try_coalesce(struct sock *sk,
-			    struct sk_buff *to,
-			    struct sk_buff *from)
+static bool tcp_try_coalesce(struct sock *sk,
+			     struct sk_buff *to,
+			     struct sk_buff *from)
 {
 	int len = from->len;
 
 	if (tcp_hdr(from)->fin)
-		return 0;
+		return false;
 	if (len <= skb_tailroom(to)) {
 		BUG_ON(skb_copy_bits(from, 0, skb_put(to, len), len));
 merge:
 		NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPRCVCOALESCE);
 		TCP_SKB_CB(to)->end_seq = TCP_SKB_CB(from)->end_seq;
 		TCP_SKB_CB(to)->ack_seq = TCP_SKB_CB(from)->ack_seq;
-		return 1;
+		return true;
 	}
 	if (skb_headlen(from) == 0 &&
 	    !skb_has_frag_list(to) &&
@@ -4498,7 +4498,7 @@ merge:
 		to->data_len += len;
 		goto merge;
 	}
-	return 0;
+	return false;
 }
 
 static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)
@@ -4539,7 +4539,7 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)
 	end_seq = TCP_SKB_CB(skb)->end_seq;
 
 	if (seq == TCP_SKB_CB(skb1)->end_seq) {
-		if (tcp_try_coalesce(sk, skb1, skb) <= 0) {
+		if (!tcp_try_coalesce(sk, skb1, skb)) {
 			__skb_queue_after(&tp->out_of_order_queue, skb1, skb);
 		} else {
 			__kfree_skb(skb);
@@ -4671,7 +4671,7 @@ queue_and_out:
 				goto drop;
 
 			tail = skb_peek_tail(&sk->sk_receive_queue);
-			eaten = tail ? tcp_try_coalesce(sk, tail, skb) : -1;
+			eaten = (tail && tcp_try_coalesce(sk, tail, skb)) ? 1 : 0;
 			if (eaten <= 0) {
 				skb_set_owner_r(skb, sk);
 				__skb_queue_tail(&sk->sk_receive_queue, skb);

^ permalink raw reply related

* Re: [PATCH net-next] net: speedup skb_splice_bits()
From: David Miller @ 2012-04-24  3:35 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, therbert, axboe
In-Reply-To: <1335237503.5205.113.camel@edumazet-glaptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 24 Apr 2012 05:18:23 +0200

> linear could be a bool too 

Yep.

> [PATCH] net: make spd_fill_page() linear argument a bool
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied, thanks!

^ permalink raw reply

* Re: [PATCH net-next] tcp: tcp_try_coalesce returns a boolean
From: David Miller @ 2012-04-24  3:37 UTC (permalink / raw)
  To: eric.dumazet; +Cc: ncardwell, netdev, therbert, maze, ilpo.jarvinen
In-Reply-To: <1335238476.5205.122.camel@edumazet-glaptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 24 Apr 2012 05:34:36 +0200

> From: Eric Dumazet <edumazet@google.com>
> 
> This clarifies code intention, as suggested by David.
> 
> Suggested-by: David Miller <davem@davemloft.net>
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied, thanks.

^ permalink raw reply

* [PATCH net-next] net: skb_can_coalesce returns a boolean
From: Eric Dumazet @ 2012-04-24  3:48 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

From: Eric Dumazet <edumazet@google.com>

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 include/linux/skbuff.h |    6 +++---
 net/ipv4/tcp.c         |    3 ++-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index f25795c..4a656b5 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1963,8 +1963,8 @@ static inline int skb_add_data(struct sk_buff *skb,
 	return -EFAULT;
 }
 
-static inline int skb_can_coalesce(struct sk_buff *skb, int i,
-				   const struct page *page, int off)
+static inline bool skb_can_coalesce(struct sk_buff *skb, int i,
+				    const struct page *page, int off)
 {
 	if (i) {
 		const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i - 1];
@@ -1972,7 +1972,7 @@ static inline int skb_can_coalesce(struct sk_buff *skb, int i,
 		return page == skb_frag_page(frag) &&
 		       off == frag->page_offset + skb_frag_size(frag);
 	}
-	return 0;
+	return false;
 }
 
 static inline int __skb_linearize(struct sk_buff *skb)
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index bcc4eab..de6a238 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -848,9 +848,10 @@ static ssize_t do_tcp_sendpages(struct sock *sk, struct page **pages, int poffse
 	while (psize > 0) {
 		struct sk_buff *skb = tcp_write_queue_tail(sk);
 		struct page *page = pages[poffset / PAGE_SIZE];
-		int copy, i, can_coalesce;
+		int copy, i;
 		int offset = poffset % PAGE_SIZE;
 		int size = min_t(size_t, psize, PAGE_SIZE - offset);
+		bool can_coalesce;
 
 		if (!tcp_send_head(sk) || (copy = size_goal - skb->len) <= 0) {
 new_segment:

^ permalink raw reply related

* Re: [PATCH v1 6/8] dmaengine: enhance network subsystem to support DMA device hotplug
From: Jiang Liu @ 2012-04-24  3:56 UTC (permalink / raw)
  To: Dan Williams
  Cc: Jiang Liu, Vinod Koul, Keping Chen, David S. Miller,
	Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI,
	Patrick McHardy, netdev, linux-pci, linux-kernel
In-Reply-To: <CABE8wwvW9MUWaqSUCPMr7_yj7XGtSj+X9VE1-xWrEusZ3TMaqQ@mail.gmail.com>

On 2012-4-24 11:09, Dan Williams wrote:
> On Mon, Apr 23, 2012 at 7:30 PM, Jiang Liu<jiang.liu@huawei.com>  wrote:
>>> If you are going to hotplug the entire IOH, then you are probably ok
>>> with network links going down, so could you just down the links and
>>> remove the driver with the existing code?
>>
>> I feel it's a little risky to shut down/restart all network interfaces
>> for hot-removal of IOH, that may disturb the applications.
>
> I guess I'm confused... wouldn't the removal of an entire domain of
> pci devices disturb userspace applications?
Here I mean removing an IOH shouldn't affect devices under other IOHs
if possible.
With current dmaengine implementation, a DMA device/channel may be used
by clients in other PCI domains. So to safely remove a DMA device, we
need to return dmaengine_ref_count to zero by stopping all DMA clients.
For network, that means we need to stop all network interfaces, seems
a little heavy:)

>
>> And there
>> are also other kinds of clients, such as ASYNC_TX, seems we can't
>> adopt this method to reclaim DMA channels from ASYNC_TX subsystem.
>
> I say handle this like block device hotplug.  I.e. the driver stays
> loaded but the channel is put into an 'offline' state.  So the driver
> hides the fact that the hardware went away.  Similar to how you can
> remove a disk but /dev/sda sticks around until the last reference is
> gone (and the driver 'sd' sticks around until all block devices are
> gone).
Per my understanding, this mechanism could be used to stop driver from
accessing surprisingly removed devices, but it still needs a reference
count mechanism to finish the driver unbinding operation eventually.

For IOH hotplug, we need to wait for the completion of driver unbinding
operations before destroying the PCI device nodes of IOAT, so still need
reference count to track channel usage.

Another way is to notify all clients to release all channels when IOAT
device hotplug happens, but that may need heavy modification to the
DMA clients.

>
> I expect the work will be in making sure existing clients are prepared
> to handle NULL returns from ->device_prep_dma_*.  In some cases the
> channel is treated more like a cpu, so a NULL return from
> ->device_prep_dma_memcpy() has been interpreted as "device is
> temporarily busy, it is safe to try again".  We would need to change
> that to a permanent indication that the device is gone and not attempt
> retry.
Yes, some ASYNC_TX clients interpret NULL return as EBUSY and keep on
retry when doing context aware computations. Will try to investigate
on this direction.

>
> --
> Dan
>
> .
>

^ permalink raw reply

* Re: [PATCH v4] set fake_rtable's dst to NULL to avoid kernel Oops
From: David Miller @ 2012-04-24  4:17 UTC (permalink / raw)
  To: peter.huangpeng
  Cc: shemminger, netdev, eric.dumazet, peter.huangpeng, linux-kernel,
	harry.majun, ctrix+debianbugs
In-Reply-To: <4F90FE63.9060800@huawei.com>

From: "Peter Huang(Peng)" <peter.huangpeng@huawei.com>
Date: Fri, 20 Apr 2012 14:12:51 +0800

> bridge: set fake_rtable's dst to NULL to avoid kernel Oops
> 
> when bridge is deleted before tap/vif device's delete, kernel may
> encounter an oops because of NULL reference to fake_rtable's dst.
> Set fake_rtable's dst to NULL before sending packets out can solve
> this problem.
> 
> v4 reformat, change br_drop_fake_rtable(skb) to {}
> 
> v3 enrich commit header
> 
> v2 introducing new flag DST_FAKE_RTABLE to dst_entry struct.
> 
> Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
> Signed-off-by: Peter Huang <peter.huangpeng@huawei.com>

Applied, although I changed to nop br_drop_fake_rtable() implementation
to use "do { } while (0)" instead of just plain "{ }".

^ permalink raw reply

* Re: [PATCH net-next] net: skb_can_coalesce returns a boolean
From: David Miller @ 2012-04-24  4:19 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev
In-Reply-To: <1335239307.5205.125.camel@edumazet-glaptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 24 Apr 2012 05:48:27 +0200

> From: Eric Dumazet <edumazet@google.com>
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied, thanks Eric.

^ permalink raw reply

* Re: [PATCH] smsc95xx: mark link down on startup and let PHY interrupt deal with carrier changes
From: David Miller @ 2012-04-24  4:25 UTC (permalink / raw)
  To: paolo.pisati; +Cc: netdev, steve.glendinning
In-Reply-To: <1334914521-5990-1-git-send-email-paolo.pisati@canonical.com>

From: Paolo Pisati <paolo.pisati@canonical.com>
Date: Fri, 20 Apr 2012 11:35:21 +0200

> Without this patch sysfs reports the cable as present
> 
> flag@flag-desktop:~$ cat /sys/class/net/eth0/carrier
> 1
> 
> while it's not:
> 
> flag@flag-desktop:~$ sudo mii-tool eth0
> eth0: no link
> 
> Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>

I suspect Steve didn't set the FLAG_LINK_INTR bit intentionally, and
that the link status IRQ is not reliable on all smsc95xx chips.

Steve?

^ permalink raw reply

* Re: [PATCH] Fix tx transfer padding for full-speed USB
From: David Miller @ 2012-04-24  4:28 UTC (permalink / raw)
  To: inguin; +Cc: netdev
In-Reply-To: <1334916021-9124-1-git-send-email-inguin@gmx.de>

From: Ingo van Lil <inguin@gmx.de>
Date: Fri, 20 Apr 2012 12:00:21 +0200

> -	padlen = ((skb->len + 4) % 512) ? 0 : 4;
> +	padlen = ((skb->len + 4) % dev->maxpacket) ? 0 : 4;

This is now an expensive modulus operation, instead of
a cheap mask.

Since you know that dev->maxpacket is always a power of two, tell the
compiler this so it can still optimize the expression by changing this
to "& (dev->maxpacket - 1)" and we'll thus avoid the costly modulus.

^ permalink raw reply

* Re: [PATCH] net: usb: smsc95xx: fix mtu
From: David Miller @ 2012-04-24  4:29 UTC (permalink / raw)
  To: fillods; +Cc: netdev, steve.glendinning
In-Reply-To: <20120420193923.GQ5277@charybde.local>

From: Stephane Fillod <fillods@users.sf.net>
Date: Fri, 20 Apr 2012 21:39:23 +0200

> Make smsc95xx recalculate the hard_mtu after adjusting the
> hard_header_len.
> 
> Without this, usbnet adjusts the MTU down to 1488 bytes, and the host is
> unable to receive standard 1500-byte frames from the device.
> 
> Inspired by same fix on cdc_eem 78fb72f7936c01d5b426c03a691eca082b03f2b9.
> 
> Tested on ARM/Beagle.
> 
> Signed-off-by: Stephane Fillod <fillods@users.sf.net>

Applied, thanks.

Ok, now we've made this fix to 2 or 3 USB net drivers, can someone
audit to see if any more remain?

^ permalink raw reply

* Re: [patch 0/2] s390: qeth bug fixes for net
From: David Miller @ 2012-04-24  4:33 UTC (permalink / raw)
  To: frank.blaschka; +Cc: netdev, linux-s390
In-Reply-To: <20120423072140.297458261@de.ibm.com>

From: frank.blaschka@de.ibm.com
Date: Mon, 23 Apr 2012 09:21:40 +0200

> here are two small qeth bug fixes for net.
> 
> shortlog:
> 
> Ursula Braun (1)
> qeth: allow change of blkt default values
> 
> Stefan Raspl (1)
> qeth: Use blkt defaults for OSA Express 4

Both applied, thanks Frank.

^ permalink raw reply

* Re: [PATCH 1/2 net-next] af_netlink: cleanups
From: David Miller @ 2012-04-24  4:35 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev
In-Reply-To: <1335166221.3293.13.camel@edumazet-glaptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 23 Apr 2012 09:30:21 +0200

> From: Eric Dumazet <edumazet@google.com>
> 
> netlink_destroy_callback() move to avoid forward reference
> 
> CodingStyle cleanups
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied.

^ permalink raw reply

* Re: [PATCH 2/2 net-next] af_netlink: drop_monitor/dropwatch friendly
From: David Miller @ 2012-04-24  4:36 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev
In-Reply-To: <1335166229.3293.14.camel@edumazet-glaptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 23 Apr 2012 09:30:29 +0200

> From: Eric Dumazet <edumazet@google.com>
> 
> Need to consume_skb() instead of kfree_skb() in netlink_dump() and
> netlink_unicast_kernel() to avoid false dropwatch positives.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied.

^ 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