* [PATCH net-next] mlx4: fix mlx4_en_set_rxfh()
From: Eric Dumazet @ 2014-11-23 1:24 UTC (permalink / raw)
To: Ben Hutchings; +Cc: David S. Miller, netdev, Amir Vadai
In-Reply-To: <1416700690.20938.34.camel@edumazet-glaptop2.roam.corp.google.com>
From: Eric Dumazet <edumazet@google.com>
mlx4_en_set_rxfh() can crash if no RSS indir table is provided.
While we are at it, allow RSS key to be changed with ethtool -X
Tested:
myhost:~# cat /proc/sys/net/core/netdev_rss_key
b6:89:91:f3:b2:c3:c2:90:11:e8:ce:45:e8:a9:9d:1c:f2:f6:d4:53:61:8b:26:3a:b3:9a:57:97:c3:b6:79:4d:2e:d9:66:5c:72:ed:b6:8e:c5:5d:4d:8c:22:67:30:ab:8a:6e:c3:6a
myhost:~# ethtool -x eth0
RX flow hash indirection table for eth0 with 8 RX ring(s):
0: 0 1 2 3 4 5 6 7
RSS hash key:
b6:89:91:f3:b2:c3:c2:90:11:e8:ce:45:e8:a9:9d:1c:f2:f6:d4:53:61:8b:26:3a:b3:9a:57:97:c3:b6:79:4d:2e:d9:66:5c:72:ed:b6:8e
myhost:~# ethtool -X eth0 hkey \
03:0e:e2:43:fa:82:0e:73:14:2d:c0:68:21:9e:82:99:b9:84:d0:22:e2:b3:64:9f:4a:af:00:fa:cc:05:b4:4a:17:05:14:73:76:58:bd:2f
myhost:~# ethtool -x eth0
RX flow hash indirection table for eth0 with 8 RX ring(s):
0: 0 1 2 3 4 5 6 7
RSS hash key:
03:0e:e2:43:fa:82:0e:73:14:2d:c0:68:21:9e:82:99:b9:84:d0:22:e2:b3:64:9f:4a:af:00:fa:cc:05:b4:4a:17:05:14:73:76:58:bd:2f
Reported-by: Ben Hutchings <ben@decadent.org.uk>
Fixes: b9d1ab7eb42e ("mlx4: use netdev_rss_key_fill() helper")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Amir Vadai <amirv@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 10 +++++++---
drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 1 +
drivers/net/ethernet/mellanox/mlx4/en_rx.c | 3 +--
drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 1 +
4 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
index bdff834a2a7e..c45e06abc073 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
@@ -994,7 +994,7 @@ static int mlx4_en_get_rxfh(struct net_device *dev, u32 *ring_index, u8 *key)
rss_map->base_qpn;
}
if (key)
- netdev_rss_key_fill(key, MLX4_EN_RSS_KEY_SIZE);
+ memcpy(key, priv->rss_key, MLX4_EN_RSS_KEY_SIZE);
return err;
}
@@ -1012,6 +1012,8 @@ static int mlx4_en_set_rxfh(struct net_device *dev, const u32 *ring_index,
* between rings
*/
for (i = 0; i < priv->rx_ring_num; i++) {
+ if (!ring_index)
+ continue;
if (i > 0 && !ring_index[i] && !rss_rings)
rss_rings = i;
@@ -1032,8 +1034,10 @@ static int mlx4_en_set_rxfh(struct net_device *dev, const u32 *ring_index,
mlx4_en_stop_port(dev, 1);
}
- priv->prof->rss_rings = rss_rings;
-
+ if (ring_index)
+ priv->prof->rss_rings = rss_rings;
+ if (key)
+ memcpy(priv->rss_key, key, MLX4_EN_RSS_KEY_SIZE);
if (port_up) {
err = mlx4_en_start_port(dev);
if (err)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 89440cb25ad8..b7c99780aef3 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -2493,6 +2493,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
priv->num_tx_rings_p_up = mdev->profile.num_tx_rings_p_up;
priv->tx_ring_num = prof->tx_ring_num;
priv->tx_work_limit = MLX4_EN_DEFAULT_TX_WORK;
+ netdev_rss_key_fill(priv->rss_key, sizeof(priv->rss_key));
priv->tx_ring = kzalloc(sizeof(struct mlx4_en_tx_ring *) * MAX_TX_RINGS,
GFP_KERNEL);
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index b7bda8956011..946d35280abc 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -1223,8 +1223,7 @@ int mlx4_en_config_rss_steer(struct mlx4_en_priv *priv)
rss_context->flags = rss_mask;
rss_context->hash_fn = MLX4_RSS_HASH_TOP;
- netdev_rss_key_fill(rss_context->rss_key, MLX4_EN_RSS_KEY_SIZE);
-
+ memcpy(rss_context->rss_key, priv->rss_key, MLX4_EN_RSS_KEY_SIZE);
err = mlx4_qp_to_ready(mdev->dev, &priv->res.mtt, &context,
&rss_map->indir_qp, &rss_map->indir_state);
if (err)
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
index de456749ffae..aaa7efbb9664 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
@@ -618,6 +618,7 @@ struct mlx4_en_priv {
__be16 vxlan_port;
u32 pflags;
+ u8 rss_key[MLX4_EN_RSS_KEY_SIZE];
};
enum mlx4_en_wol {
^ permalink raw reply related
* Re: net: Hyper-V: Deletion of an unnecessary check before the function call "vfree"
From: SF Markus Elfring @ 2014-11-23 0:51 UTC (permalink / raw)
To: David Miller
Cc: netdev, Haiyang Zhang, kernel-janitors, linux-kernel,
Julia Lawall, devel
In-Reply-To: <20141121.172705.540279259389643572.davem@davemloft.net>
> This has nothing to do with me asking you to frame your patches
> against the correct tree.
I imagine than someone other can also pick up this update suggestion
(a simple change of two lines) quicker before I might try another
software build again from a different commit as a base.
Regards,
Markus
^ permalink raw reply
* Re: [PATCH net-next 12/14] mlx4: use netdev_rss_key_fill() helper
From: Eric Dumazet @ 2014-11-22 23:58 UTC (permalink / raw)
To: Ben Hutchings
Cc: Eric Dumazet, David S. Miller, netdev, Thomas Lendacky,
Ariel Elior, Michael Chan, Prashant Sreedharan, Rasesh Mody,
Sathya Perla, Subbu Seetharaman, Ajit Khaparde, Jesse Brandeburg,
Jeff Kirsher, Amir Vadai, Shradha Shah, Shreyas Bhatewara
In-Reply-To: <1416692961.7215.31.camel@decadent.org.uk>
On Sat, 2014-11-22 at 21:49 +0000, Ben Hutchings wrote:
> On Sun, 2014-11-16 at 06:23 -0800, Eric Dumazet wrote:
> > Use of well known RSS key increases attack surface.
> > Switch to a random one, using generic helper so that all
> > ports share a common key.
> >
> > Also provide ethtool -x support to fetch RSS key
> [...]
> > @@ -1799,6 +1805,7 @@ const struct ethtool_ops mlx4_en_ethtool_ops = {
> > .get_rxnfc = mlx4_en_get_rxnfc,
> > .set_rxnfc = mlx4_en_set_rxnfc,
> > .get_rxfh_indir_size = mlx4_en_get_rxfh_indir_size,
> > + .get_rxfh_key_size = mlx4_en_get_rxfh_key_size,
> > .get_rxfh = mlx4_en_get_rxfh,
> > .set_rxfh = mlx4_en_set_rxfh,
> [...]
>
> A driver that implements get_rxfh_key_size() and set_rxfh() is assumed
> to support setting the RSS key (and only the key). However,
> mlx4_en_set_rxfh() will currently crash if a new indirection table is
> not provided.
Hi Ben.
Is this a net-next only concern, or is it an existing problem in net
tree ?
Thanks !
^ permalink raw reply
* Re: [PATCH 5/6] net/core: support compiling out splice
From: Josh Triplett @ 2014-11-22 23:07 UTC (permalink / raw)
To: Pieter Smith
Cc: Willem de Bruijn, Alexander Duyck, Thomas Graf,
open list:NETWORKING [GENERAL], Miklos Szeredi,
Michael S. Tsirkin, Daniel Borkmann, Jan Beulich, open list,
Paul Durrant, Eric Dumazet, David S. Miller, Tom Herbert
In-Reply-To: <CAPho-_+GV+2sVVxGsPSjvE3heEoGa4chbqrmnxLAr_p7RU=TDQ@mail.gmail.com>
[Please don't top-post.]
On Sat, Nov 22, 2014 at 11:50:51PM +0100, Pieter Smith wrote:
> splice exports a structure that is used by skbuf. Mocking out a function is
> straightforward. To my knowledge there is no elegant way of mocking out a
> splice_operations struct. I directly modified the code to prevent linking
> against the struct. Do you know of a better technique to get the same
> result?
No, I don't. The approach you took seems fine; I'm just saying that you
need to explain the need for it in the commit message.
- JosH Triplett
^ permalink raw reply
* Re: [RFC PATCH 1/4] rtnetlink: new flag NLM_F_HW_OFFLOAD to indicate kernel object offload to hardware
From: Vincent JARDIN @ 2014-11-22 22:03 UTC (permalink / raw)
To: Roopa Prabhu
Cc: Thomas Graf, jiri, sfeldma, jhs, bcrl, john.fastabend, stephen,
linville, nhorman, nicolas.dichtel, vyasevic, f.fainelli, buytenh,
aviadr, netdev, davem, Shrijeet Mukherjee, gospo
In-Reply-To: <5470E5E0.9070005@cumulusnetworks.com>
On 22/11/2014 20:37, Roopa Prabhu wrote:
> struct ifinfomsg -> ifi_flags
> struct ndmsg ->ndm_flags
> struct rtmsg -> rtm_flags
>
> If this is preferred .., I can repost the series with these changes.
Yes, it would be my preferred too.
Thank you,
Vincent
^ permalink raw reply
* Re: [PATCH net-next 0/5] RDMA/cxgb4,cxgb4vf,csiostor: Cleanup macros
From: David Miller @ 2014-11-22 21:58 UTC (permalink / raw)
To: hariprasad-ut6Up61K2wZBDgjK7y7TUQ
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
linux-scsi-u79uwXL29TY76Z2rM5mHXA, roland-BHEL68pLQRGGvPXPguhicg,
JBottomley-bzQdu9zFT3WakBO8gow8eQ, hch-wEGCiKHe2LqWVfeAwA7xHQ,
swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW,
leedom-ut6Up61K2wZBDgjK7y7TUQ, anish-ut6Up61K2wZBDgjK7y7TUQ,
nirranjan-ut6Up61K2wZBDgjK7y7TUQ, kumaras-ut6Up61K2wZBDgjK7y7TUQ,
praveen-ut6Up61K2wZBDgjK7y7TUQ, varun-ut6Up61K2wZBDgjK7y7TUQ
In-Reply-To: <1416554525-11844-1-git-send-email-hariprasad-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
From: Hariprasad Shenai <hariprasad-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
Date: Fri, 21 Nov 2014 12:52:00 +0530
> This series continues to cleanup all the macros/register defines related to
> filter, port, VI, queue, RSS, LDST, firmware, etc that are defined in t4fw_api.h
> and the affected files.
>
> Will post few more series so that we can cover all the macros so that they all
> follow the same style to be consistent.
>
> The patches series is created against 'net-next' tree.
> And includes patches on cxgb4, cxgb4vf, iw_cxgb4 and csiostor driver.
>
> We have included all the maintainers of respective drivers. Kindly review the
> change and let us know in case of any review comments.
Series applied, thanks.
--
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: [net-next] i40e: enable fdb add code, remove unused code
From: David Miller @ 2014-11-22 21:56 UTC (permalink / raw)
To: jeffrey.t.kirsher; +Cc: jesse.brandeburg, netdev, nhorman, sassmann, jogreene
In-Reply-To: <1416529802-16055-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Thu, 20 Nov 2014 16:30:02 -0800
> From: Jesse Brandeburg <jesse.brandeburg@intel.com>
>
> The original FDB code submission wasn't correct and the code
> wasn't enabled. This removes some dead code (can use the common kernel
> code for fdb_del and fdb_dump) and correctly enables the fdb_add
> function pointer.
>
> The fdb_add functionality is important to i40e because it is needed
> for a workaround to allow bridges to work correctly on the i40e
> hardware.
>
> Reported-by: Jiri Pirko <jiri@resnulli.us>
> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
> Acked-by: Greg Rose <gregory.v.rose@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Applied, thanks Jeff.
^ permalink raw reply
* Re: [PATCH net-next V1 1/2] ethtool: Support for configurable RSS hash function
From: David Miller @ 2014-11-22 21:54 UTC (permalink / raw)
To: amirv
Cc: netdev, ben, ogerlitz, yevgenyp, eyalpe, thomas.lendacky,
ariel.elior, prashant, mchan, hariprasad, sathya.perla,
subbu.seetharaman, ajit.khaparde, jeffrey.t.kirsher,
jesse.brandeburg, bruce.w.allan, carolyn.wyborny,
donald.c.skidmore, gregory.v.rose, matthew.vick, john.ronciak,
mitch.a.williams, linux-net-drivers, sshah, sbhatewara,
pv-drivers
In-Reply-To: <1416493610-8966-2-git-send-email-amirv@mellanox.com>
From: Amir Vadai <amirv@mellanox.com>
Date: Thu, 20 Nov 2014 16:26:49 +0200
> + /* We require at least one supported parameter to be changed and no
> + * change in any of the unsupported parameters
> + */
> + if ((!indir && !key) || hfunc != ETH_RSS_HASH_NO_CHANGE)
> + return -EOPNOTSUPP;
> +
I know it will make more work for you, but all of these driver
implementations of this hook should:
1) Accept hfunc of whatever hash function the chip is using,
not just ETH_RSS_HASH_NO_CHANGE.
2) Provide an accurate hfunc value in the ->get() call.
^ permalink raw reply
* Re: [PATCH net-next 12/14] mlx4: use netdev_rss_key_fill() helper
From: Ben Hutchings @ 2014-11-22 21:49 UTC (permalink / raw)
To: Eric Dumazet
Cc: David S. Miller, netdev, Thomas Lendacky, Ariel Elior,
Michael Chan, Prashant Sreedharan, Rasesh Mody, Sathya Perla,
Subbu Seetharaman, Ajit Khaparde, Jesse Brandeburg, Jeff Kirsher,
Amir Vadai, Shradha Shah, Shreyas Bhatewara
In-Reply-To: <1416147798-16561-13-git-send-email-edumazet@google.com>
[-- Attachment #1: Type: text/plain, Size: 906 bytes --]
On Sun, 2014-11-16 at 06:23 -0800, Eric Dumazet wrote:
> Use of well known RSS key increases attack surface.
> Switch to a random one, using generic helper so that all
> ports share a common key.
>
> Also provide ethtool -x support to fetch RSS key
[...]
> @@ -1799,6 +1805,7 @@ const struct ethtool_ops mlx4_en_ethtool_ops = {
> .get_rxnfc = mlx4_en_get_rxnfc,
> .set_rxnfc = mlx4_en_set_rxnfc,
> .get_rxfh_indir_size = mlx4_en_get_rxfh_indir_size,
> + .get_rxfh_key_size = mlx4_en_get_rxfh_key_size,
> .get_rxfh = mlx4_en_get_rxfh,
> .set_rxfh = mlx4_en_set_rxfh,
[...]
A driver that implements get_rxfh_key_size() and set_rxfh() is assumed
to support setting the RSS key (and only the key). However,
mlx4_en_set_rxfh() will currently crash if a new indirection table is
not provided.
Ben.
--
Ben Hutchings
Logic doesn't apply to the real world. - Marvin Minsky
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]
^ permalink raw reply
* Re: [PATCH 5/6] net/core: support compiling out splice
From: Josh Triplett @ 2014-11-22 21:48 UTC (permalink / raw)
To: Pieter Smith
Cc: David S. Miller, Tom Herbert, Eric Dumazet, Daniel Borkmann,
Willem de Bruijn, Michael S. Tsirkin, Alexander Duyck,
Paul Durrant, Thomas Graf, Jan Beulich, Miklos Szeredi, open list,
open list:NETWORKING [GENERAL]
In-Reply-To: <1416690001-20817-6-git-send-email-pieter@boesman.nl>
On Sat, Nov 22, 2014 at 10:00:00PM +0100, Pieter Smith wrote:
> Compile out splice support from networking core when the splice-family of
> syscalls is not supported by the system (i.e. CONFIG_SYSCALL_SPLICE is
> undefined).
Please explain in the commit message why this particular bit of splice
support needs compiling out when most other bits do not.
Also, a couple of style comments below.
> Signed-off-by: Pieter Smith <pieter@boesman.nl>
> ---
> include/linux/skbuff.h | 9 +++++++++
> net/core/skbuff.c | 9 ++++++---
> 2 files changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index a59d934..8c28524 100644
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -2640,9 +2640,18 @@ int skb_copy_bits(const struct sk_buff *skb, int offset, void *to, int len);
> int skb_store_bits(struct sk_buff *skb, int offset, const void *from, int len);
> __wsum skb_copy_and_csum_bits(const struct sk_buff *skb, int offset, u8 *to,
> int len, __wsum csum);
> +#ifdef CONFIG_SYSCALL_SPLICE
> int skb_splice_bits(struct sk_buff *skb, unsigned int offset,
> struct pipe_inode_info *pipe, unsigned int len,
> unsigned int flags);
> +#else /* #ifdef CONFIG_SYSCALL_SPLICE */
> +static inline int skb_splice_bits(struct sk_buff *skb, unsigned int offset,
> + struct pipe_inode_info *pipe, unsigned int len,
> + unsigned int flags)
> +{
> + return -EPERM;
> +}
> +#endif /* #ifdef CONFIG_SYSCALL_SPLICE */
These comments, and the one added below in the corresponding .c file,
don't match the prevailing style. These are so short (fitting on one
screen) that they hardly seem worth the comments at all, but if you want
to include them, s/#ifdef// in the comment.
> void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to);
> unsigned int skb_zerocopy_headlen(const struct sk_buff *from);
> int skb_zerocopy(struct sk_buff *to, struct sk_buff *from,
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 61059a0..74fad8a 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -1781,9 +1781,9 @@ static bool __splice_segment(struct page *page, unsigned int poff,
> * 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 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)
> +static bool __maybe_unused __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;
>
> @@ -1821,6 +1821,7 @@ static bool __skb_splice_bits(struct sk_buff *skb, struct pipe_inode_info *pipe,
> * the frag list, if such a thing exists. We'd probably need to recurse to
> * handle that cleanly.
> */
> +#ifdef CONFIG_SYSCALL_SPLICE
> int skb_splice_bits(struct sk_buff *skb, unsigned int offset,
> struct pipe_inode_info *pipe, unsigned int tlen,
> unsigned int flags)
> @@ -1876,6 +1877,8 @@ done:
>
> return ret;
> }
> +#endif /* #ifdef CONFIG_SYSCALL_SPLICE */
> +
This extra blank line shouldn't be here.
> /**
> * skb_store_bits - store bits from kernel buffer to skb
> --
> 1.9.1
>
^ permalink raw reply
* [PATCH 5/6] net/core: support compiling out splice
From: Pieter Smith @ 2014-11-22 21:00 UTC (permalink / raw)
To: pieter
Cc: Josh Triplett, David S. Miller, Tom Herbert, Eric Dumazet,
Daniel Borkmann, Willem de Bruijn, Michael S. Tsirkin,
Alexander Duyck, Paul Durrant, Thomas Graf, Jan Beulich,
Miklos Szeredi, open list, open list:NETWORKING [GENERAL]
In-Reply-To: <1416690001-20817-1-git-send-email-pieter@boesman.nl>
Compile out splice support from networking core when the splice-family of
syscalls is not supported by the system (i.e. CONFIG_SYSCALL_SPLICE is
undefined).
Signed-off-by: Pieter Smith <pieter@boesman.nl>
---
include/linux/skbuff.h | 9 +++++++++
net/core/skbuff.c | 9 ++++++---
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index a59d934..8c28524 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2640,9 +2640,18 @@ int skb_copy_bits(const struct sk_buff *skb, int offset, void *to, int len);
int skb_store_bits(struct sk_buff *skb, int offset, const void *from, int len);
__wsum skb_copy_and_csum_bits(const struct sk_buff *skb, int offset, u8 *to,
int len, __wsum csum);
+#ifdef CONFIG_SYSCALL_SPLICE
int skb_splice_bits(struct sk_buff *skb, unsigned int offset,
struct pipe_inode_info *pipe, unsigned int len,
unsigned int flags);
+#else /* #ifdef CONFIG_SYSCALL_SPLICE */
+static inline int skb_splice_bits(struct sk_buff *skb, unsigned int offset,
+ struct pipe_inode_info *pipe, unsigned int len,
+ unsigned int flags)
+{
+ return -EPERM;
+}
+#endif /* #ifdef CONFIG_SYSCALL_SPLICE */
void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to);
unsigned int skb_zerocopy_headlen(const struct sk_buff *from);
int skb_zerocopy(struct sk_buff *to, struct sk_buff *from,
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 61059a0..74fad8a 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1781,9 +1781,9 @@ static bool __splice_segment(struct page *page, unsigned int poff,
* 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 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)
+static bool __maybe_unused __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;
@@ -1821,6 +1821,7 @@ static bool __skb_splice_bits(struct sk_buff *skb, struct pipe_inode_info *pipe,
* the frag list, if such a thing exists. We'd probably need to recurse to
* handle that cleanly.
*/
+#ifdef CONFIG_SYSCALL_SPLICE
int skb_splice_bits(struct sk_buff *skb, unsigned int offset,
struct pipe_inode_info *pipe, unsigned int tlen,
unsigned int flags)
@@ -1876,6 +1877,8 @@ done:
return ret;
}
+#endif /* #ifdef CONFIG_SYSCALL_SPLICE */
+
/**
* skb_store_bits - store bits from kernel buffer to skb
--
1.9.1
^ permalink raw reply related
* Re: [RFC PATCH 1/4] rtnetlink: new flag NLM_F_HW_OFFLOAD to indicate kernel object offload to hardware
From: Sergei Shtylyov @ 2014-11-22 20:08 UTC (permalink / raw)
To: roopa, jiri, sfeldma, jhs, bcrl, tgraf, john.fastabend, stephen,
linville, nhorman, nicolas.dichtel, vyasevic, f.fainelli, buytenh,
aviadr
Cc: netdev, davem, shrijeet, gospo
In-Reply-To: <1416610170-21224-2-git-send-email-roopa@cumulusnetworks.com>
Hello.
On 11/22/2014 1:49 AM, roopa@cumulusnetworks.com wrote:
> From: Roopa Prabhu <roopa@cumulusnetworks.com>
> This patch adds new flags in netlink header nlmsg_flags to signal if the
> message is for the kernel, hw or both.
> This can be used to indicate hw offload for all kind of objects
> routes, fdb entries, neighs, link objects like bonds, bridges, vxlan.
> Adding it in the header makes it possible to use it accross all objects and
> across all messages (sets/gets/deletes).
> Other alternative to this is a per kernel object netlink attribute/flag.
> But that leads to duplicating the attribute in different subsystems.
> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
> ---
> include/uapi/linux/netlink.h | 2 ++
> 1 file changed, 2 insertions(+)
> diff --git a/include/uapi/linux/netlink.h b/include/uapi/linux/netlink.h
> index 1a85940..f78522d 100644
> --- a/include/uapi/linux/netlink.h
> +++ b/include/uapi/linux/netlink.h
> @@ -54,6 +54,8 @@ struct nlmsghdr {
> #define NLM_F_ACK 4 /* Reply with ack, with zero or error code */
> #define NLM_F_ECHO 8 /* Echo this request */
> #define NLM_F_DUMP_INTR 16 /* Dump was inconsistent due to sequence change */
> ++#define NLM_F_KERNEL 32 /* This msg is only for the kernel */
I don't think you really meant double '+'.
> +#define NLM_F_HW_OFFLOAD 64 /* offload this msg to hw */
[...]
WBR, Sergei
^ permalink raw reply
* [PATCH net-next 2/2] enic: use spin_lock(wq_lock) instead of spin_lock_irqsave(wq_lock)
From: Govindarajulu Varadarajan @ 2014-11-22 19:52 UTC (permalink / raw)
To: davem, netdev; +Cc: ssujith, benve, Govindarajulu Varadarajan
In-Reply-To: <1416685972-1368-1-git-send-email-_govind@gmx.com>
All the access to wq has been moved out of hardirq context. We no longer need to
use spin_lock_irqsave.
Signed-off-by: Govindarajulu Varadarajan <_govind@gmx.com>
---
drivers/net/ethernet/cisco/enic/enic_main.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
index b42a480..4664740 100644
--- a/drivers/net/ethernet/cisco/enic/enic_main.c
+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
@@ -529,7 +529,6 @@ static netdev_tx_t enic_hard_start_xmit(struct sk_buff *skb,
{
struct enic *enic = netdev_priv(netdev);
struct vnic_wq *wq;
- unsigned long flags;
unsigned int txq_map;
struct netdev_queue *txq;
@@ -554,14 +553,14 @@ static netdev_tx_t enic_hard_start_xmit(struct sk_buff *skb,
return NETDEV_TX_OK;
}
- spin_lock_irqsave(&enic->wq_lock[txq_map], flags);
+ spin_lock(&enic->wq_lock[txq_map]);
if (vnic_wq_desc_avail(wq) <
skb_shinfo(skb)->nr_frags + ENIC_DESC_MAX_SPLITS) {
netif_tx_stop_queue(txq);
/* This is a hard error, log it */
netdev_err(netdev, "BUG! Tx ring full when queue awake!\n");
- spin_unlock_irqrestore(&enic->wq_lock[txq_map], flags);
+ spin_unlock(&enic->wq_lock[txq_map]);
return NETDEV_TX_BUSY;
}
@@ -572,7 +571,7 @@ static netdev_tx_t enic_hard_start_xmit(struct sk_buff *skb,
if (!skb->xmit_more || netif_xmit_stopped(txq))
vnic_wq_doorbell(wq);
- spin_unlock_irqrestore(&enic->wq_lock[txq_map], flags);
+ spin_unlock(&enic->wq_lock[txq_map]);
return NETDEV_TX_OK;
}
--
2.1.0
^ permalink raw reply related
* [PATCH net-next 1/2] enic: use napi_schedule_irqoff()
From: Govindarajulu Varadarajan @ 2014-11-22 19:52 UTC (permalink / raw)
To: davem, netdev; +Cc: ssujith, benve, Govindarajulu Varadarajan
enic_isr_legacy(), enic_isr_msix() & enic_isr_msi() run from hard
interrupt context.
They can use napi_schedule_irqoff() instead of napi_schedule()
Signed-off-by: Govindarajulu Varadarajan <_govind@gmx.com>
---
drivers/net/ethernet/cisco/enic/enic_main.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
index b9cda2f..b42a480 100644
--- a/drivers/net/ethernet/cisco/enic/enic_main.c
+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
@@ -283,12 +283,10 @@ static irqreturn_t enic_isr_legacy(int irq, void *data)
return IRQ_HANDLED;
}
- if (ENIC_TEST_INTR(pba, io_intr)) {
- if (napi_schedule_prep(&enic->napi[0]))
- __napi_schedule(&enic->napi[0]);
- } else {
+ if (ENIC_TEST_INTR(pba, io_intr))
+ napi_schedule_irqoff(&enic->napi[0]);
+ else
vnic_intr_unmask(&enic->intr[io_intr]);
- }
return IRQ_HANDLED;
}
@@ -313,7 +311,7 @@ static irqreturn_t enic_isr_msi(int irq, void *data)
* writes).
*/
- napi_schedule(&enic->napi[0]);
+ napi_schedule_irqoff(&enic->napi[0]);
return IRQ_HANDLED;
}
@@ -322,7 +320,7 @@ static irqreturn_t enic_isr_msix(int irq, void *data)
{
struct napi_struct *napi = data;
- napi_schedule(napi);
+ napi_schedule_irqoff(napi);
return IRQ_HANDLED;
}
--
2.1.0
^ permalink raw reply related
* Re: [RFC PATCH 1/4] rtnetlink: new flag NLM_F_HW_OFFLOAD to indicate kernel object offload to hardware
From: Roopa Prabhu @ 2014-11-22 19:37 UTC (permalink / raw)
To: Thomas Graf
Cc: jiri, sfeldma, jhs, bcrl, john.fastabend, stephen, linville,
nhorman, nicolas.dichtel, vyasevic, f.fainelli, buytenh, aviadr,
netdev, davem, Shrijeet Mukherjee, gospo
In-Reply-To: <20141122122936.GD20810@casper.infradead.org>
On 11/22/14, 4:29 AM, Thomas Graf wrote:
> On 11/21/14 at 04:10pm, Roopa Prabhu wrote:
>> On 11/21/14, 3:12 PM, Thomas Graf wrote:
>>> On 11/21/14 at 02:49pm, roopa@cumulusnetworks.com wrote:
>>>> diff --git a/include/uapi/linux/netlink.h b/include/uapi/linux/netlink.h
>>>> index 1a85940..f78522d 100644
>>>> --- a/include/uapi/linux/netlink.h
>>>> +++ b/include/uapi/linux/netlink.h
>>>> @@ -54,6 +54,8 @@ struct nlmsghdr {
>>>> #define NLM_F_ACK 4 /* Reply with ack, with zero or error code */
>>>> #define NLM_F_ECHO 8 /* Echo this request */
>>>> #define NLM_F_DUMP_INTR 16 /* Dump was inconsistent due to sequence change */
>>>> ++#define NLM_F_KERNEL 32 /* This msg is only for the kernel */
>>>> +#define NLM_F_HW_OFFLOAD 64 /* offload this msg to hw */
>>>> /* Modifiers to GET request */
>>>> #define NLM_F_ROOT 0x100 /* specify tree root */
>>> The NLM_F_ flag space applies to all Netlink messages including non
>>> networking bits and is reserved for flags vital to the functioning
>>> of the Netlink protocol itself. I suggest you move this to a
>>> RTNETLINK specific flags space.
>> I did try to add it at a layer lower than the netlink header. But, nothing
>> else fits so well as this :).
>> I did not find a place where i could make it a global flag for just
>> networking objects. As I mention in my patch description,
>> If not here it will be a per subsystem flag/attribute. I can post a patch
>> showing that approach as well.
> Global variables have their appeal ;-) The issue I see with this
> besides polluting a wide namespace is that it is not extendable.
> We get a single bit and if a single bit is not enough we'll start
> adding things in lower layers anyway (as you already do).
>
> I think this should really be an IFF_ flag for net_device so its
> state is exposed to user space as well.
I did start with a IFF_HW_OFFLOAD flag. This is going exactly in the
direction i was thinking it will go. :). I had to start at the top,
hence started with the netlink header first.
Now, going one step lower, It can be a flag or a netlink attribute.
Going with the flag,
Doing a quick survey of all the rtnetlink handlers..(keeping future in
mind)....for the top objects in the current context (link, route, fdb
and neigh)
we can add it in the below flags.
struct ifinfomsg -> ifi_flags
struct ndmsg ->ndm_flags
struct rtmsg -> rtm_flags
If this is preferred .., I can repost the series with these changes.
Thanks,
Roopa
^ permalink raw reply
* Re: [patch -next] bpf: null dereference allocating large arrays
From: Alexei Starovoitov @ 2014-11-22 18:45 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Alexei Starovoitov, netdev@vger.kernel.org, kernel-janitors
In-Reply-To: <20141122183059.GC6994@mwanda>
On Sat, Nov 22, 2014 at 10:30 AM, Dan Carpenter
<dan.carpenter@oracle.com> wrote:
> There is a typo here, "array" is null so we can't dereference it and
> also the size calculation should match the kzalloc() on the lines
> before.
Not sure what tree you're looking at...
it was more than typo, but it was fixed 4 days ago.
See commit daaf427c6ab39 ("bpf: fix arraymap NULL deref and missing
overflow and zero size checks")
^ permalink raw reply
* [patch -next] bpf: null dereference allocating large arrays
From: Dan Carpenter @ 2014-11-22 18:30 UTC (permalink / raw)
To: Alexei Starovoitov; +Cc: netdev, kernel-janitors
There is a typo here, "array" is null so we can't dereference it and
also the size calculation should match the kzalloc() on the lines
before.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c
index 58b80c1..662a412 100644
--- a/kernel/bpf/arraymap.c
+++ b/kernel/bpf/arraymap.c
@@ -38,7 +38,7 @@ static struct bpf_map *array_map_alloc(union bpf_attr *attr)
array = kzalloc(sizeof(*array) + attr->max_entries * elem_size,
GFP_USER | __GFP_NOWARN);
if (!array) {
- array = vzalloc(array->map.max_entries * array->elem_size);
+ array = vzalloc(sizeof(*array) + attr->max_entries * elem_size);
if (!array)
return ERR_PTR(-ENOMEM);
}
^ permalink raw reply related
* Re: [net-next 14/17] i40e: implement ethtool RSS config
From: Eric Dumazet @ 2014-11-22 18:22 UTC (permalink / raw)
To: Jeff Kirsher; +Cc: davem, Mitch Williams, netdev, nhorman, sassmann, jogreene
In-Reply-To: <1416635708-4765-16-git-send-email-jeffrey.t.kirsher@intel.com>
On Fri, 2014-11-21 at 21:55 -0800, Jeff Kirsher wrote:
> From: Mitch Williams <mitch.a.williams@intel.com>
>
> Support ethtool methods for getting and setting the RSS look-up table.
>
> Change-ID: I52707fb371fc11fe9fd4c287e08542cde38f79d4
> Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
> Tested-by: Jim Young <jamesx.m.young@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
> drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 104 +++++++++++++++++++++++++
> 1 file changed, 104 insertions(+)
>
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> index fcd815d..f9f68ea 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> @@ -2237,6 +2237,106 @@ static int i40e_set_channels(struct net_device *dev,
> return -EINVAL;
> }
>
> +#define I40E_HLUT_ARRAY_SIZE ((I40E_PFQF_HLUT_MAX_INDEX + 1) * 4)
> +#define I40E_HKEY_ARRAY_SIZE ((I40E_PFQF_HKEY_MAX_INDEX * 1) * 4)
> +/**
> + * i40e_get_rxfh_key_size - get the RSS hash key size
> + * @netdev: network interface device structure
> + *
> + * Returns the table size.
> + **/
> +static u32 i40e_get_rxfh_key_size(struct net_device *netdev)
> +{
> + return I40E_HKEY_ARRAY_SIZE;
> +}
> +
> +/**
> + * i40e_get_rxfh_indir_size - get the rx flow hash indirection table size
> + * @netdev: network interface device structure
> + *
> + * Returns the table size.
> + **/
> +static u32 i40e_get_rxfh_indir_size(struct net_device *netdev)
> +{
> + return I40E_HLUT_ARRAY_SIZE;
> +}
> +
> +/**
> + * i40e_get_rxfh - get the rx flow hash indirection table
> + * @netdev: network interface device structure
> + * @indir: indirection table
> + * @key: hash key
> + *
> + * Reads the indirection table directly from the hardware. Always returns 0.
> + **/
> +static int i40e_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key)
> +{
> + struct i40e_netdev_priv *np = netdev_priv(netdev);
> + struct i40e_vsi *vsi = np->vsi;
> + struct i40e_pf *pf = vsi->back;
> + struct i40e_hw *hw = &pf->hw;
> + u32 reg_val;
> + int i, j;
> +
> + for (i = 0, j = 0; i <= I40E_PFQF_HLUT_MAX_INDEX; i++) {
> + reg_val = rd32(hw, I40E_PFQF_HLUT(i));
> + indir[j++] = reg_val & 0xff;
> + indir[j++] = (reg_val >> 8) & 0xff;
> + indir[j++] = (reg_val >> 16) & 0xff;
> + indir[j++] = (reg_val >> 24) & 0xff;
> + }
> + if (key) {
> + for (i = 0, j = 0; i <= I40E_PFQF_HKEY_MAX_INDEX; i++) {
> + reg_val = rd32(hw, I40E_PFQF_HKEY(i));
> + key[j++] = (u8)(reg_val & 0xff);
> + key[j++] = (u8)((reg_val >> 8) & 0xff);
> + key[j++] = (u8)((reg_val >> 16) & 0xff);
> + key[j++] = (u8)((reg_val >> 24) & 0xff);
Nit:
put_unaligned_le32(reg_val, key + i * 4);
> + }
> + }
> + return 0;
> +}
> +
> +/**
> + * i40e_set_rxfh - set the rx flow hash indirection table
> + * @netdev: network interface device structure
> + * @indir: indirection table
> + * @key: hash key
> + *
> + * Returns -EINVAL if the table specifies an inavlid queue id, otherwise
> + * returns 0 after programming the table.
> + **/
> +static int i40e_set_rxfh(struct net_device *netdev, const u32 *indir,
> + const u8 *key)
> +{
> + struct i40e_netdev_priv *np = netdev_priv(netdev);
> + struct i40e_vsi *vsi = np->vsi;
> + struct i40e_pf *pf = vsi->back;
> + struct i40e_hw *hw = &pf->hw;
> + u32 reg_val;
> + int i, j;
> +
> + if (indir) {
> + for (i = 0, j = 0; i <= I40E_PFQF_HLUT_MAX_INDEX; i++) {
> + reg_val = indir[j++];
Shouldn't you check the indir[X] values are in correct range ?
( seems to be between 0 and [pf->rss_size_max - 1] )
> + reg_val |= indir[j++] << 8;
> + reg_val |= indir[j++] << 16;
> + reg_val |= indir[j++] << 24;
> + wr32(hw, I40E_PFQF_HLUT(i), reg_val);
> + }
> + }
> + if (key) {
> + for (i = 0, j = 0; i <= I40E_PFQF_HKEY_MAX_INDEX; i++) {
> + reg_val = key[j++];
> + reg_val |= key[j++] << 8;
> + reg_val |= key[j++] << 16;
> + reg_val |= key[j++] << 24;
Nit:
reg_val = get_unaligned_le32(key + i * 4);
> + wr32(hw, I40E_PFQF_HKEY(i), reg_val);
> + }
> + }
^ permalink raw reply
* Re: Problem about Setting TCP Congestion Window to a Small Constant
From: Eric Dumazet @ 2014-11-22 17:50 UTC (permalink / raw)
To: wc8348; +Cc: netdev
In-Reply-To: <a7b958c622a1f1ebed77d4ce44109ceb.squirrel@webmail.cs.utexas.edu>
On Sat, 2014-11-22 at 10:29 -0600, wc8348@cs.utexas.edu wrote:
> Hi all,
> My name is Wenzhi Cui, a graduate student working on TCP congestion
> control in Linux Kernel. I have a problem about congestion control in
> linux kernel.
>
> Recently I am playing with TCP Congestion Control Protocol by setting
> the congestion window size to a constant, say 1, and measure the TCP
> flow throughput to see the relationship between cwnd size and
> transmission rate (on a stable environment).
>
> The problem is, when I am setting the snd_cwnd to 1, the real
> transmission rate is around 25MBps. However, since I am testing TCP
> on our department network with 1Gbps (which is 125MBps) bandwidth and
> 300 micro seconds Round trip time (measured by analyzing tcpdump
> trace). So the theoretical sending rate should be
> CWND * MSS / RTT = 1 * 1460 Byte / 300 us = around 5 MBps
> which is far less than the observed 25 MBps bandwidth. I have taken a look
> at tcp_cong.c, tcp_input output.c, etc. but I still cannot find the
> problem.
>
> Can somebody help me figure out what is missing, maybe what may
> affect the real TCP transmission other than CWND or what will happen
> when CWND is set to a very small constant?
You probably did something wrong ?
tcpdump will probably show that your cwnd must be bigger than 1.
(or rtt is way smaller than 300 usec, which sounds quite big to me)
^ permalink raw reply
* Re: [RFC] situation with csum_and_copy_... API
From: Linus Torvalds @ 2014-11-22 17:48 UTC (permalink / raw)
To: Al Viro
Cc: David Miller, Network Development, Linux Kernel Mailing List,
target-devel, Nicholas A. Bellinger, Christoph Hellwig
In-Reply-To: <20141122042856.GZ7996@ZenIV.linux.org.uk>
On Fri, Nov 21, 2014 at 8:28 PM, Al Viro <viro@zeniv.linux.org.uk> wrote:
> OK, here's the next bunch.
Looks like good patches to me. Not that I actually _tested_ it, or
even have a good test-case (yeah, that "historical" ATM fix? I don't
think anybody cares ;), but it all seemed sane.
Linus
^ permalink raw reply
* Re: Problem about Setting TCP Congestion Window to a Small Constant
From: John Heffner @ 2014-11-22 17:34 UTC (permalink / raw)
To: wc8348; +Cc: Netdev
In-Reply-To: <a7b958c622a1f1ebed77d4ce44109ceb.squirrel@webmail.cs.utexas.edu>
On Sat, Nov 22, 2014 at 11:29 AM, <wc8348@cs.utexas.edu> wrote:
> Hi all,
> My name is Wenzhi Cui, a graduate student working on TCP congestion
> control in Linux Kernel. I have a problem about congestion control in
> linux kernel.
>
> Recently I am playing with TCP Congestion Control Protocol by setting
> the congestion window size to a constant, say 1, and measure the TCP
> flow throughput to see the relationship between cwnd size and
> transmission rate (on a stable environment).
>
> The problem is, when I am setting the snd_cwnd to 1, the real
> transmission rate is around 25MBps. However, since I am testing TCP
> on our department network with 1Gbps (which is 125MBps) bandwidth and
> 300 micro seconds Round trip time (measured by analyzing tcpdump
> trace). So the theoretical sending rate should be
> CWND * MSS / RTT = 1 * 1460 Byte / 300 us = around 5 MBps
> which is far less than the observed 25 MBps bandwidth. I have taken a look
> at tcp_cong.c, tcp_input output.c, etc. but I still cannot find the
> problem.
>
> Can somebody help me figure out what is missing, maybe what may
> affect the real TCP transmission other than CWND or what will happen
> when CWND is set to a very small constant?
Looking at a tcptrace "outstanding data graph" may be illuminating.
-John
^ permalink raw reply
* Re: [PATCH] can: eliminate banner[] variable and switch to pr_info()
From: Marc Kleine-Budde @ 2014-11-22 16:59 UTC (permalink / raw)
To: Jeremiah Mahler, Oliver Hartkopp
Cc: David S. Miller, linux-can, netdev, linux-kernel
In-Reply-To: <1416642155-31816-1-git-send-email-jmmahler@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 801 bytes --]
On 11/22/2014 08:42 AM, Jeremiah Mahler wrote:
> Several CAN modules use a design pattern with a banner[] variable at the
> top which defines a string that is used once during init to print the
> banner. The string is also embedded with KERN_INFO which makes it
> printk() specific.
>
> Improve the code by eliminating the banner[] variable and moving the
> string to where it is printed. Then switch from printk(KERN_INFO to
> pr_info() for the lines that were changed.
Applied to can-next.
Thanks,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* Re: [PATCH] can: eliminate banner[] variable and switch to pr_info()
From: Oliver Hartkopp @ 2014-11-22 16:41 UTC (permalink / raw)
To: Jeremiah Mahler; +Cc: David S. Miller, linux-can, netdev, linux-kernel
In-Reply-To: <1416642155-31816-1-git-send-email-jmmahler@gmail.com>
On 22.11.2014 08:42, Jeremiah Mahler wrote:
> Several CAN modules use a design pattern with a banner[] variable at the
> top which defines a string that is used once during init to print the
> banner. The string is also embedded with KERN_INFO which makes it
> printk() specific.
>
> Improve the code by eliminating the banner[] variable and moving the
> string to where it is printed. Then switch from printk(KERN_INFO to
> pr_info() for the lines that were changed.
>
> Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Next time please only post on linux-can ML which is the first address for CAN
related stuff - as long as you don't feel it's a networking relevant issue.
But for almost editorial changes - which is not urgent - linux-can should be
enough.
Thanks,
Oliver
> ---
> net/can/af_can.c | 5 +----
> net/can/bcm.c | 4 +---
> net/can/raw.c | 4 +---
> 3 files changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/net/can/af_can.c b/net/can/af_can.c
> index ce82337..ac05be1 100644
> --- a/net/can/af_can.c
> +++ b/net/can/af_can.c
> @@ -64,9 +64,6 @@
>
> #include "af_can.h"
>
> -static __initconst const char banner[] = KERN_INFO
> - "can: controller area network core (" CAN_VERSION_STRING ")\n";
> -
> MODULE_DESCRIPTION("Controller Area Network PF_CAN core");
> MODULE_LICENSE("Dual BSD/GPL");
> MODULE_AUTHOR("Urs Thuermann <urs.thuermann@volkswagen.de>, "
> @@ -896,7 +893,7 @@ static __init int can_init(void)
> offsetof(struct can_frame, data) !=
> offsetof(struct canfd_frame, data));
>
> - printk(banner);
> + pr_info("can: controller area network core (" CAN_VERSION_STRING ")\n");
>
> memset(&can_rx_alldev_list, 0, sizeof(can_rx_alldev_list));
>
> diff --git a/net/can/bcm.c b/net/can/bcm.c
> index dcb75c0..9aa3f76 100644
> --- a/net/can/bcm.c
> +++ b/net/can/bcm.c
> @@ -78,8 +78,6 @@
> (CAN_SFF_MASK | CAN_EFF_FLAG | CAN_RTR_FLAG))
>
> #define CAN_BCM_VERSION CAN_VERSION
> -static __initconst const char banner[] = KERN_INFO
> - "can: broadcast manager protocol (rev " CAN_BCM_VERSION " t)\n";
>
> MODULE_DESCRIPTION("PF_CAN broadcast manager protocol");
> MODULE_LICENSE("Dual BSD/GPL");
> @@ -1615,7 +1613,7 @@ static int __init bcm_module_init(void)
> {
> int err;
>
> - printk(banner);
> + pr_info("can: broadcast manager protocol (rev " CAN_BCM_VERSION " t)\n");
>
> err = can_proto_register(&bcm_can_proto);
> if (err < 0) {
> diff --git a/net/can/raw.c b/net/can/raw.c
> index 081e81f..e3250e2 100644
> --- a/net/can/raw.c
> +++ b/net/can/raw.c
> @@ -56,8 +56,6 @@
> #include <net/net_namespace.h>
>
> #define CAN_RAW_VERSION CAN_VERSION
> -static __initconst const char banner[] =
> - KERN_INFO "can: raw protocol (rev " CAN_RAW_VERSION ")\n";
>
> MODULE_DESCRIPTION("PF_CAN raw protocol");
> MODULE_LICENSE("Dual BSD/GPL");
> @@ -810,7 +808,7 @@ static __init int raw_module_init(void)
> {
> int err;
>
> - printk(banner);
> + pr_info("can: raw protocol (rev " CAN_RAW_VERSION ")\n");
>
> err = can_proto_register(&raw_can_proto);
> if (err < 0)
>
^ permalink raw reply
* Problem about Setting TCP Congestion Window to a Small Constant
From: wc8348 @ 2014-11-22 16:29 UTC (permalink / raw)
To: netdev
Hi all,
My name is Wenzhi Cui, a graduate student working on TCP congestion
control in Linux Kernel. I have a problem about congestion control in
linux kernel.
Recently I am playing with TCP Congestion Control Protocol by setting
the congestion window size to a constant, say 1, and measure the TCP
flow throughput to see the relationship between cwnd size and
transmission rate (on a stable environment).
The problem is, when I am setting the snd_cwnd to 1, the real
transmission rate is around 25MBps. However, since I am testing TCP
on our department network with 1Gbps (which is 125MBps) bandwidth and
300 micro seconds Round trip time (measured by analyzing tcpdump
trace). So the theoretical sending rate should be
CWND * MSS / RTT = 1 * 1460 Byte / 300 us = around 5 MBps
which is far less than the observed 25 MBps bandwidth. I have taken a look
at tcp_cong.c, tcp_input output.c, etc. but I still cannot find the
problem.
Can somebody help me figure out what is missing, maybe what may
affect the real TCP transmission other than CWND or what will happen
when CWND is set to a very small constant?
Thanks,
Wenzhi Cui
^ permalink raw reply
* [PATCH 0/6] fix error return code
From: Julia Lawall @ 2014-11-22 14:39 UTC (permalink / raw)
To: linux-rdma
Cc: kernel-janitors, linux-wireless, linux-kernel, linux-edac,
linux-atm-general, netdev, Dan Williams, linux-arm-kernel,
dmaengine
The complate semantic patch that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@ok exists@
identifier f,ret,i;
expression e;
constant c;
@@
// identify a function that returns a negative return value at least once.
f(...) {
... when any
(
return -c@i;
|
ret = -c@i;
... when != ret = e
return ret;
|
if (ret < 0) { ... return ret; }
)
... when any
}
@r exists@
identifier ret,ok.f,fn;
expression e1,e2,e3,e4,e5,e6,x;
statement S,S1;
position p1,p2,p3;
@@
// identify a case where the return variable is set to a non-negative value
// and then returned in error-handling code
f(...) {
... when any
(
if@p1 (\(ret < 0\|ret != 0\))
{ ... return ret; }
|
ret@p1 = 0
)
... when != \(ret = e1\|ret++\|ret--\|ret+=e1\|ret-=e1\)
when != &ret
when any
(
if (<+... ret = e5 ...+>) S1
|
if (<+... &ret ...+>) S1
|
if@p2(<+...x = fn(...)...+>)
{
... when != ret = e6
when forall
return@p3 ret;
}
|
break;
|
x = fn(...)
... when != \(ret = e4\|ret++\|ret--\|ret+=e4\|ret-=e4\)
when != &ret
(
if (<+... ret = e3 ...+>) S
|
if (<+... &ret ...+>) S
|
if@p2(<+...\(x != 0\|x < 0\|x == NULL\|IS_ERR(x)\)...+>)
{
... when != ret = e2
when forall
return@p3 ret;
}
)
)
... when any
}
@printer depends on r@
position p;
identifier ok.f,pr;
constant char [] c;
@@
f(...) { <...pr@p(...,c,...)...> }
@bad0 exists@
identifier r.ret,ok.f,g != {ERR_PTR,IS_ERR};
position p != printer.p;
@@
f(...) { ... when any
g@p(...,ret,...)
... when any
}
@bad depends on !bad0 exists@
position r.p1,r.p2;
statement S1,S2;
identifier r.ret;
expression e1;
@@
// ignore the above if there is some path where the variable is set to
// something else
(
if@p1 (\(ret < 0\|ret != 0\)) S1
|
ret@p1 = 0
)
... when any
\(ret = e1\|ret++\|ret--\|ret+=e1\|ret-=e1\|&ret\)
... when any
if@p2(...) S2
@bad1 depends on !bad0 && !bad exists@
position r.p2;
statement S2;
identifier r.ret;
expression e1;
constant c;
@@
ret = -c
... when != \(ret = e1\|ret++\|ret--\|ret+=e1\|ret-=e1\)
when != &ret
when any
if@p2(...) S2
@bad2 depends on !bad0 && !bad && !bad1 exists@
position r.p1,r.p2;
identifier r.ret;
expression e1;
statement S2;
constant c;
@@
// likewise ignore it if there has been an intervening return
ret@p1 = 0
... when != if (...) { ... ret = e1 ... return ret; }
when != if (...) { ... return -c; }
when any
if@p2(...) S2
@script:python depends on !bad0 && !bad && !bad1 && !bad2@
p1 << r.p1;
p2 << r.p2;
p3 << r.p3;
@@
cocci.print_main("",p1)
cocci.print_secs("",p2)
cocci.print_secs("",p3)
// </smpl>
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox