Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH -next] tcm_vhost: remove unused variable in vhost_scsi_allocate_cmd()
From: Nicholas A. Bellinger @ 2012-11-09  5:24 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: kvm, mst, netdev, virtualization, yongjun_wei, target-devel
In-Reply-To: <CAPgLHd81=dTwwSTgUtd9YbgWf8YLMfi3VJQ-76h71+0W_mx_2g@mail.gmail.com>

Hello Wei,

On Wed, 2012-11-07 at 20:53 +0800, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> The variable se_sess is initialized but never used
> otherwise, so remove the unused variable.
> 
> dpatch engine is used to auto generate this patch.
> (https://github.com/weiyj/dpatch)
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
>  drivers/vhost/tcm_vhost.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c
> index 23c138f..551fff0 100644
> --- a/drivers/vhost/tcm_vhost.c
> +++ b/drivers/vhost/tcm_vhost.c
> @@ -415,14 +415,12 @@ static struct tcm_vhost_cmd *vhost_scsi_allocate_cmd(
>  {
>  	struct tcm_vhost_cmd *tv_cmd;
>  	struct tcm_vhost_nexus *tv_nexus;
> -	struct se_session *se_sess;
>  
>  	tv_nexus = tv_tpg->tpg_nexus;
>  	if (!tv_nexus) {
>  		pr_err("Unable to locate active struct tcm_vhost_nexus\n");
>  		return ERR_PTR(-EIO);
>  	}
> -	se_sess = tv_nexus->tvn_se_sess;
>  
>  	tv_cmd = kzalloc(sizeof(struct tcm_vhost_cmd), GFP_ATOMIC);
>  	if (!tv_cmd) {
> 
> --

Looks fine to me.

Reviewed-by + Acked-by: Nicholas Bellinger <nab@linux-iscsi.org>

Thanks!

^ permalink raw reply

* Re: [PATCH] socket.7: Correctly describe SO_SNDTIMEO for connect
From: Michael Kerrisk (man-pages) @ 2012-11-09  6:00 UTC (permalink / raw)
  To: Andi Kleen
  Cc: linux-man-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	Andi Kleen
In-Reply-To: <1352390123-28658-1-git-send-email-andi-Vw/NltI1exuRpAAqCnN02g@public.gmane.org>

Hi Andi,

On Thu, Nov 8, 2012 at 4:55 PM, Andi Kleen <andi-Vw/NltI1exuRpAAqCnN02g@public.gmane.org> wrote:
> From: Andi Kleen <ak-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
>
> When SO_SNDTIMEO is set before connect() connect may return EWOULDBLOCK
> when the timeout fires. Describe this correctly.

Thanks.

Applied.

Cheers,

Michael


> Signed-off-by: Andi Kleen <ak-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> ---
>  man7/socket.7 |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/man7/socket.7 b/man7/socket.7
> index cd75746..9e05f48 100644
> --- a/man7/socket.7
> +++ b/man7/socket.7
> @@ -434,6 +434,9 @@ set to
>  .B EAGAIN
>  or
>  .B EWOULDBLOCK
> +or
> +.B EINPROGRESS
> +(for connect)
>  .\" in fact to EAGAIN
>  just as if the socket was specified to be nonblocking.
>  If the timeout is set to zero (the default)
> @@ -442,6 +445,7 @@ Timeouts only have effect for system calls that perform socket I/O (e.g.,
>  .BR read (2),
>  .BR recvmsg (2),
>  .BR send (2),
> +.BR connect (2),
>  .BR sendmsg (2));
>  timeouts have no effect for
>  .BR select (2),
> --
> 1.7.7.6
>



-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface"; http://man7.org/tlpi/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" 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] vmxnet3: convert BUG_ON(true) into a simple BUG()
From: Shreyas Bhatewara @ 2012-11-09  6:02 UTC (permalink / raw)
  To: Sasha Levin; +Cc: VMware, Inc., netdev, linux-kernel
In-Reply-To: <1352406191-14303-1-git-send-email-sasha.levin@oracle.com>


----- Original Message -----
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> ---
>  drivers/net/vmxnet3/vmxnet3_drv.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Signed-off-by: Shreyas N Bhatewara <sbhatewara@vmware.com>

^ permalink raw reply

* Re: [PATCH v4 3/5] usbnet: smsc95xx: fix memory leak in smsc95xx_suspend
From: David Miller @ 2012-11-09  7:25 UTC (permalink / raw)
  To: mankad.maulik-Re5JQEeQqe8AvxtiuMwx3w
  Cc: ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, oneukum-l3A5Bk7waGM,
	netdev-u79uwXL29TY76Z2rM5mHXA, linux-usb-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <CAEtNAxntrPne0AxqR2Pn-Vrrv_R12U-CxmW6=mFSfUS6U3BMKg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

From: Maulik Mankad <mankad.maulik-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Date: Fri, 9 Nov 2012 12:28:17 +0530

> We don't need memset() here.
> May be command[2] = {0}; offset[2] = {0}; crc[4] = {0}; is enough.

The compiler can see this an will eliminate the unnecessary
clears.

So it's better to use memset and make the code much clearer
and easier to audit.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH] ipv6: fix two typos in a comment in xfrm6_init()
From: Steffen Klassert @ 2012-11-09  7:57 UTC (permalink / raw)
  To: David Miller; +Cc: roy.qing.li, netdev
In-Reply-To: <20121108.145939.2274479010583117059.davem@davemloft.net>

On Thu, Nov 08, 2012 at 02:59:39PM -0500, David Miller wrote:
> From: Steffen Klassert <steffen.klassert@secunet.com>
> > 
> > The routing cache is removed, so this comment is obsolete. But it reminds
> > me that we set the gc threshold to ip_rt_max_size/2 in ipv4. With the
> > routing cache removal patch, ip_rt_max_size was set to INT_MAX. So the gc
> > starts to remove entries when a threshold of INT_MAX/2 is reached.
> > 
> > cat /proc/sys/net/ipv4/xfrm4_gc_thresh
> > 1073741823
> > 
> > I guess this was not intentional.
> 
> Do you mean for IPSEC routes?  For non-IPSEC routes on ipv4 there
> is nothing to garbage collect.

Yes, I mean IPsec routes. We still cache them at the flow cache
and at sockets, so we should do some garbage collecting.

We could either go back to a static threshold, as it was before

git commit a33bc5c15154c835aae26f16e6a3a7d9ad4acb45
xfrm: select sane defaults for xfrm[4|6] gc_thresh

or do the same as ipv6 does. I'll take care of this.

Btw. it seems to me that the flow cache has similar limitations
as the routing cache had. At least I was able to fill the flow
cache with a nmap scan from a remote entity. In practice, it's
hard to DOS the flow cache because we use a Jenkins hash with
a random initialization value, but this was the same with the
routing cache.

^ permalink raw reply

* Re: Your Unsubscribe Request to users@subversion.tigris.org
From: admin @ 2012-11-09  7:59 UTC (permalink / raw)
  To: netdev

This is to inform you that your recent unsubscribe request was unsuccessful. This is probably because we could find no current subscription in your name.

^ permalink raw reply

* Re: [PATCH] xfrm: remove redundant replay_esn check
From: Steffen Klassert @ 2012-11-09  7:59 UTC (permalink / raw)
  To: David Miller; +Cc: ulrich.weber, netdev
In-Reply-To: <20121108.220020.884271049343560692.davem@davemloft.net>

On Thu, Nov 08, 2012 at 10:00:20PM -0500, David Miller wrote:
> From: Ulrich Weber <ulrich.weber@sophos.com>
> Date: Thu, 8 Nov 2012 11:15:44 +0100
> 
> > x->replay_esn is already checked in if clause,
> > so remove check and ident properly
> > 
> > Signed-off-by: Ulrich Weber <ulrich.weber@sophos.com>
> 
> Steffen, I assume you'll pick this one up.

Yes, it was already in my queue. Now applied to ipsec-next.

Thanks!

^ permalink raw reply

* [PATCH][net-next v2] gianfar: Fix alloc_skb_resources on -ENOMEM cleanup path
From: Claudiu Manoil @ 2012-11-09  8:11 UTC (permalink / raw)
  To: netdev; +Cc: Paul Gortmaker, Claudiu Manoil

Should gfar_init_bds() return with -ENOMEM inside gfar_alloc_skb_resources(),
free_skb_resources() will be called twice in a row on the "cleanup" path,
leading to duplicate kfree() calls for rx_|tx_queue->rx_|tx_skbuff resulting
in segmentation fault.
This patch prevents the segmentation fault to happen in the future
(rx_|tx_sbkbuff set to NULL), and corrects the error path handling
for gfar_init_bds().

Cc: Paul Gortmaker <paul.gortmaker@windriver.com>

Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com>
---
v1: do free_skb_resources() on the cleanup path of gfar_init_bds()'s parent
v2: (minor change) no "goto" construct inside gfar_restore()

 drivers/net/ethernet/freescale/gianfar.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index 1d03dcd..81a0f33 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -210,7 +210,7 @@ static int gfar_init_bds(struct net_device *ndev)
 				skb = gfar_new_skb(ndev);
 				if (!skb) {
 					netdev_err(ndev, "Can't allocate RX buffers\n");
-					goto err_rxalloc_fail;
+					return -ENOMEM;
 				}
 				rx_queue->rx_skbuff[j] = skb;
 
@@ -223,10 +223,6 @@ static int gfar_init_bds(struct net_device *ndev)
 	}
 
 	return 0;
-
-err_rxalloc_fail:
-	free_skb_resources(priv);
-	return -ENOMEM;
 }
 
 static int gfar_alloc_skb_resources(struct net_device *ndev)
@@ -1356,7 +1352,11 @@ static int gfar_restore(struct device *dev)
 	if (!netif_running(ndev))
 		return 0;
 
-	gfar_init_bds(ndev);
+	if (gfar_init_bds(ndev)) {
+		free_skb_resources(priv);
+		return -ENOMEM;
+	}
+
 	init_registers(ndev);
 	gfar_set_mac_address(ndev);
 	gfar_init_mac(ndev);
@@ -1709,6 +1709,7 @@ static void free_skb_tx_queue(struct gfar_priv_tx_q *tx_queue)
 		tx_queue->tx_skbuff[i] = NULL;
 	}
 	kfree(tx_queue->tx_skbuff);
+	tx_queue->tx_skbuff = NULL;
 }
 
 static void free_skb_rx_queue(struct gfar_priv_rx_q *rx_queue)
@@ -1732,6 +1733,7 @@ static void free_skb_rx_queue(struct gfar_priv_rx_q *rx_queue)
 		rxbdp++;
 	}
 	kfree(rx_queue->rx_skbuff);
+	rx_queue->rx_skbuff = NULL;
 }
 
 /* If there are any tx skbs or rx skbs still around, free them.
-- 
1.6.6

^ permalink raw reply related

* Re: [PATCH] ipv6: fix the bug when propagating Redirect Message
From: Steffen Klassert @ 2012-11-09  8:54 UTC (permalink / raw)
  To: Duan Jiong; +Cc: davem, netdev
In-Reply-To: <20121024045410.GF27385@secunet.com>

On Wed, Oct 24, 2012 at 06:54:10AM +0200, Steffen Klassert wrote:
> On Tue, Oct 23, 2012 at 11:26:25PM +0800, Duan Jiong wrote:
> > +	while (opt_len) {
> > +		int l;
> > +	
> > +		if (opt_len < sizeof(struct nd_opt_hdr)) {
> > +			return;
> > +		}
> > +		l = nd_opt->nd_opt_len << 3;
> > +		if (opt_len < l || l == 0) {
> > +			return;
> > +		}
> > +		if (nd_opt->nd_opt_type == ND_OPT_REDIRECT_HDR) {
> > +			__skb_pull(skb, ndisc_head_len + opt_offset + 8);
> > +			break;
> > +		}
> > +		opt_len -= l;
> > +		nd_opt = ((void *)nd_opt) + 1;
> > +		opt_offset += 1;
> > +	}
> 
> Instead of the above loop, you could use ndisc_parse_options().
> This does the same what you are doing here and it would make it
> a bit clearer what's going on.
> 

Duan, are you going to update your patches? We really need fixes
for the problems you have discovered.

Thanks!

^ permalink raw reply

* [PATCH net-next 0/4] Advertise tunnel parameters via netlink
From: Nicolas Dichtel @ 2012-11-09  9:51 UTC (permalink / raw)
  To: netdev; +Cc: davem

The goal of this serie is to advertise tunnel parameters via netlink.

The patch against iproute2 will be sent once the patches are included and
net-next merged. I can send it on demand.

The last patch is a fix after a code review.

Comments are welcome.

Regards,
Nicolas

^ permalink raw reply

* [PATCH net-next 1/4] ipip: advertise tunnel param via rtnl
From: Nicolas Dichtel @ 2012-11-09  9:51 UTC (permalink / raw)
  To: netdev; +Cc: davem, Nicolas Dichtel
In-Reply-To: <1352454671-4336-1-git-send-email-nicolas.dichtel@6wind.com>

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
 include/uapi/linux/if_tunnel.h | 11 ++++++++
 net/ipv4/ipip.c                | 57 +++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 67 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/if_tunnel.h b/include/uapi/linux/if_tunnel.h
index 5db5942..ccb21d5 100644
--- a/include/uapi/linux/if_tunnel.h
+++ b/include/uapi/linux/if_tunnel.h
@@ -37,6 +37,17 @@ struct ip_tunnel_parm {
 	struct iphdr		iph;
 };
 
+enum {
+	IFLA_IPTUN_UNSPEC,
+	IFLA_IPTUN_LINK,
+	IFLA_IPTUN_LOCAL,
+	IFLA_IPTUN_REMOTE,
+	IFLA_IPTUN_TTL,
+	IFLA_IPTUN_TOS,
+	__IFLA_IPTUN_MAX,
+};
+#define IFLA_IPTUN_MAX	(__IFLA_IPTUN_MAX - 1)
+
 /* SIT-mode i_flags */
 #define	SIT_ISATAP	0x0001
 
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index e15b452..37e1ca2 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -138,6 +138,7 @@ struct ipip_net {
 static int ipip_tunnel_init(struct net_device *dev);
 static void ipip_tunnel_setup(struct net_device *dev);
 static void ipip_dev_free(struct net_device *dev);
+static struct rtnl_link_ops ipip_link_ops __read_mostly;
 
 /*
  * Locking : hash tables are protected by RCU and RTNL
@@ -305,6 +306,7 @@ static struct ip_tunnel *ipip_tunnel_locate(struct net *net,
 		goto failed_free;
 
 	strcpy(nt->parms.name, dev->name);
+	dev->rtnl_link_ops = &ipip_link_ops;
 
 	dev_hold(dev);
 	ipip_tunnel_link(ipn, nt);
@@ -829,6 +831,47 @@ static int __net_init ipip_fb_tunnel_init(struct net_device *dev)
 	return 0;
 }
 
+static size_t ipip_get_size(const struct net_device *dev)
+{
+	return
+		/* IFLA_IPTUN_LINK */
+		nla_total_size(4) +
+		/* IFLA_IPTUN_LOCAL */
+		nla_total_size(4) +
+		/* IFLA_IPTUN_REMOTE */
+		nla_total_size(4) +
+		/* IFLA_IPTUN_TTL */
+		nla_total_size(1) +
+		/* IFLA_IPTUN_TOS */
+		nla_total_size(1) +
+		0;
+}
+
+static int ipip_fill_info(struct sk_buff *skb, const struct net_device *dev)
+{
+	struct ip_tunnel *tunnel = netdev_priv(dev);
+	struct ip_tunnel_parm *parm = &tunnel->parms;
+
+	if (nla_put_u32(skb, IFLA_IPTUN_LINK, parm->link) ||
+	    nla_put_be32(skb, IFLA_IPTUN_LOCAL, parm->iph.saddr) ||
+	    nla_put_be32(skb, IFLA_IPTUN_REMOTE, parm->iph.daddr) ||
+	    nla_put_u8(skb, IFLA_IPTUN_TTL, parm->iph.ttl) ||
+	    nla_put_u8(skb, IFLA_IPTUN_TOS, parm->iph.tos))
+		goto nla_put_failure;
+	return 0;
+
+nla_put_failure:
+	return -EMSGSIZE;
+}
+
+static struct rtnl_link_ops ipip_link_ops __read_mostly = {
+	.kind		= "ipip",
+	.maxtype	= IFLA_IPTUN_MAX,
+	.priv_size	= sizeof(struct ip_tunnel),
+	.get_size	= ipip_get_size,
+	.fill_info	= ipip_fill_info,
+};
+
 static struct xfrm_tunnel ipip_handler __read_mostly = {
 	.handler	=	ipip_rcv,
 	.err_handler	=	ipip_err,
@@ -925,14 +968,26 @@ static int __init ipip_init(void)
 		return err;
 	err = xfrm4_tunnel_register(&ipip_handler, AF_INET);
 	if (err < 0) {
-		unregister_pernet_device(&ipip_net_ops);
 		pr_info("%s: can't register tunnel\n", __func__);
+		goto xfrm_tunnel_failed;
 	}
+	err = rtnl_link_register(&ipip_link_ops);
+	if (err < 0)
+		goto rtnl_link_failed;
+
+out:
 	return err;
+
+rtnl_link_failed:
+	xfrm4_tunnel_deregister(&ipip_handler, AF_INET);
+xfrm_tunnel_failed:
+	unregister_pernet_device(&ipip_net_ops);
+	goto out;
 }
 
 static void __exit ipip_fini(void)
 {
+	rtnl_link_unregister(&ipip_link_ops);
 	if (xfrm4_tunnel_deregister(&ipip_handler, AF_INET))
 		pr_info("%s: can't deregister tunnel\n", __func__);
 
-- 
1.7.12

^ permalink raw reply related

* [PATCH net-next 2/4] sit: advertise tunnel param via rtnl
From: Nicolas Dichtel @ 2012-11-09  9:51 UTC (permalink / raw)
  To: netdev; +Cc: davem, Nicolas Dichtel
In-Reply-To: <1352454671-4336-1-git-send-email-nicolas.dichtel@6wind.com>

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
 net/ipv6/sit.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 56 insertions(+), 1 deletion(-)

diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 3ed54ff..b543c56 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -68,6 +68,7 @@
 static int ipip6_tunnel_init(struct net_device *dev);
 static void ipip6_tunnel_setup(struct net_device *dev);
 static void ipip6_dev_free(struct net_device *dev);
+static struct rtnl_link_ops sit_link_ops __read_mostly;
 
 static int sit_net_id __read_mostly;
 struct sit_net {
@@ -282,6 +283,7 @@ static struct ip_tunnel *ipip6_tunnel_locate(struct net *net,
 		goto failed_free;
 
 	strcpy(nt->parms.name, dev->name);
+	dev->rtnl_link_ops = &sit_link_ops;
 
 	dev_hold(dev);
 
@@ -1216,6 +1218,47 @@ static int __net_init ipip6_fb_tunnel_init(struct net_device *dev)
 	return 0;
 }
 
+static size_t sit_get_size(const struct net_device *dev)
+{
+	return
+		/* IFLA_IPTUN_LINK */
+		nla_total_size(4) +
+		/* IFLA_IPTUN_LOCAL */
+		nla_total_size(4) +
+		/* IFLA_IPTUN_REMOTE */
+		nla_total_size(4) +
+		/* IFLA_IPTUN_TTL */
+		nla_total_size(1) +
+		/* IFLA_IPTUN_TOS */
+		nla_total_size(1) +
+		0;
+}
+
+static int sit_fill_info(struct sk_buff *skb, const struct net_device *dev)
+{
+	struct ip_tunnel *tunnel = netdev_priv(dev);
+	struct ip_tunnel_parm *parm = &tunnel->parms;
+
+	if (nla_put_u32(skb, IFLA_IPTUN_LINK, parm->link) ||
+	    nla_put_be32(skb, IFLA_IPTUN_LOCAL, parm->iph.saddr) ||
+	    nla_put_be32(skb, IFLA_IPTUN_REMOTE, parm->iph.daddr) ||
+	    nla_put_u8(skb, IFLA_IPTUN_TTL, parm->iph.ttl) ||
+	    nla_put_u8(skb, IFLA_IPTUN_TOS, parm->iph.tos))
+		goto nla_put_failure;
+	return 0;
+
+nla_put_failure:
+	return -EMSGSIZE;
+}
+
+static struct rtnl_link_ops sit_link_ops __read_mostly = {
+	.kind		= "sit",
+	.maxtype	= IFLA_IPTUN_MAX,
+	.priv_size	= sizeof(struct ip_tunnel),
+	.get_size	= sit_get_size,
+	.fill_info	= sit_fill_info,
+};
+
 static struct xfrm_tunnel sit_handler __read_mostly = {
 	.handler	=	ipip6_rcv,
 	.err_handler	=	ipip6_err,
@@ -1302,6 +1345,7 @@ static struct pernet_operations sit_net_ops = {
 
 static void __exit sit_cleanup(void)
 {
+	rtnl_link_unregister(&sit_link_ops);
 	xfrm4_tunnel_deregister(&sit_handler, AF_INET6);
 
 	unregister_pernet_device(&sit_net_ops);
@@ -1319,10 +1363,21 @@ static int __init sit_init(void)
 		return err;
 	err = xfrm4_tunnel_register(&sit_handler, AF_INET6);
 	if (err < 0) {
-		unregister_pernet_device(&sit_net_ops);
 		pr_info("%s: can't add protocol\n", __func__);
+		goto xfrm_tunnel_failed;
 	}
+	err = rtnl_link_register(&sit_link_ops);
+	if (err < 0)
+		goto rtnl_link_failed;
+
+out:
 	return err;
+
+rtnl_link_failed:
+	xfrm4_tunnel_deregister(&sit_handler, AF_INET6);
+xfrm_tunnel_failed:
+	unregister_pernet_device(&sit_net_ops);
+	goto out;
 }
 
 module_init(sit_init);
-- 
1.7.12

^ permalink raw reply related

* [PATCH net-next 3/4] ip6tnl: advertise tunnel param via rtnl
From: Nicolas Dichtel @ 2012-11-09  9:51 UTC (permalink / raw)
  To: netdev; +Cc: davem, Nicolas Dichtel
In-Reply-To: <1352454671-4336-1-git-send-email-nicolas.dichtel@6wind.com>

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
 include/uapi/linux/if_tunnel.h |  3 +++
 net/ipv6/ip6_tunnel.c          | 57 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+)

diff --git a/include/uapi/linux/if_tunnel.h b/include/uapi/linux/if_tunnel.h
index ccb21d5..c1bf0b5 100644
--- a/include/uapi/linux/if_tunnel.h
+++ b/include/uapi/linux/if_tunnel.h
@@ -44,6 +44,9 @@ enum {
 	IFLA_IPTUN_REMOTE,
 	IFLA_IPTUN_TTL,
 	IFLA_IPTUN_TOS,
+	IFLA_IPTUN_ENCAP_LIMIT,
+	IFLA_IPTUN_FLOWINFO,
+	IFLA_IPTUN_FLAGS,
 	__IFLA_IPTUN_MAX,
 };
 #define IFLA_IPTUN_MAX	(__IFLA_IPTUN_MAX - 1)
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 09482f7..424ed45 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -83,6 +83,7 @@ static u32 HASH(const struct in6_addr *addr1, const struct in6_addr *addr2)
 
 static int ip6_tnl_dev_init(struct net_device *dev);
 static void ip6_tnl_dev_setup(struct net_device *dev);
+static struct rtnl_link_ops ip6_link_ops __read_mostly;
 
 static int ip6_tnl_net_id __read_mostly;
 struct ip6_tnl_net {
@@ -299,6 +300,7 @@ static struct ip6_tnl *ip6_tnl_create(struct net *net, struct __ip6_tnl_parm *p)
 		goto failed_free;
 
 	strcpy(t->parms.name, dev->name);
+	dev->rtnl_link_ops = &ip6_link_ops;
 
 	dev_hold(dev);
 	ip6_tnl_link(ip6n, t);
@@ -1504,6 +1506,55 @@ static int __net_init ip6_fb_tnl_dev_init(struct net_device *dev)
 	return 0;
 }
 
+static size_t ip6_get_size(const struct net_device *dev)
+{
+	return
+		/* IFLA_IPTUN_LINK */
+		nla_total_size(4) +
+		/* IFLA_IPTUN_LOCAL */
+		nla_total_size(sizeof(struct in6_addr)) +
+		/* IFLA_IPTUN_REMOTE */
+		nla_total_size(sizeof(struct in6_addr)) +
+		/* IFLA_IPTUN_TTL */
+		nla_total_size(1) +
+		/* IFLA_IPTUN_ENCAP_LIMIT */
+		nla_total_size(1) +
+		/* IFLA_IPTUN_FLOWINFO */
+		nla_total_size(4) +
+		/* IFLA_IPTUN_FLAGS */
+		nla_total_size(4) +
+		0;
+}
+
+static int ip6_fill_info(struct sk_buff *skb, const struct net_device *dev)
+{
+	struct ip6_tnl *tunnel = netdev_priv(dev);
+	struct __ip6_tnl_parm *parm = &tunnel->parms;
+
+	if (nla_put_u32(skb, IFLA_IPTUN_LINK, parm->link) ||
+	    nla_put(skb, IFLA_IPTUN_LOCAL, sizeof(struct in6_addr),
+		    &parm->raddr) ||
+	    nla_put(skb, IFLA_IPTUN_REMOTE, sizeof(struct in6_addr),
+		    &parm->laddr) ||
+	    nla_put_u8(skb, IFLA_IPTUN_TTL, parm->hop_limit) ||
+	    nla_put_u8(skb, IFLA_IPTUN_ENCAP_LIMIT, parm->encap_limit) ||
+	    nla_put_be32(skb, IFLA_IPTUN_FLOWINFO, parm->flowinfo) ||
+	    nla_put_u32(skb, IFLA_IPTUN_FLAGS, parm->flags))
+		goto nla_put_failure;
+	return 0;
+
+nla_put_failure:
+	return -EMSGSIZE;
+}
+
+static struct rtnl_link_ops ip6_link_ops __read_mostly = {
+	.kind		= "ip6tnl",
+	.maxtype	= IFLA_IPTUN_MAX,
+	.priv_size	= sizeof(struct ip6_tnl),
+	.get_size	= ip6_get_size,
+	.fill_info	= ip6_fill_info,
+};
+
 static struct xfrm6_tunnel ip4ip6_handler __read_mostly = {
 	.handler	= ip4ip6_rcv,
 	.err_handler	= ip4ip6_err,
@@ -1612,9 +1663,14 @@ static int __init ip6_tunnel_init(void)
 		pr_err("%s: can't register ip6ip6\n", __func__);
 		goto out_ip6ip6;
 	}
+	err = rtnl_link_register(&ip6_link_ops);
+	if (err < 0)
+		goto rtnl_link_failed;
 
 	return 0;
 
+rtnl_link_failed:
+	xfrm6_tunnel_deregister(&ip6ip6_handler, AF_INET6);
 out_ip6ip6:
 	xfrm6_tunnel_deregister(&ip4ip6_handler, AF_INET);
 out_ip4ip6:
@@ -1629,6 +1685,7 @@ out_pernet:
 
 static void __exit ip6_tunnel_cleanup(void)
 {
+	rtnl_link_unregister(&ip6_link_ops);
 	if (xfrm6_tunnel_deregister(&ip4ip6_handler, AF_INET))
 		pr_info("%s: can't deregister ip4ip6\n", __func__);
 
-- 
1.7.12

^ permalink raw reply related

* [PATCH net-next 4/4] gre6: fix rtnl dump messages
From: Nicolas Dichtel @ 2012-11-09  9:51 UTC (permalink / raw)
  To: netdev; +Cc: davem, Nicolas Dichtel
In-Reply-To: <1352454671-4336-1-git-send-email-nicolas.dichtel@6wind.com>

Spotted after a code review.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
 net/ipv6/ip6_gre.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index bbe2e7b..12aa473 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -1633,9 +1633,9 @@ static size_t ip6gre_get_size(const struct net_device *dev)
 		/* IFLA_GRE_OKEY */
 		nla_total_size(4) +
 		/* IFLA_GRE_LOCAL */
-		nla_total_size(4) +
+		nla_total_size(sizeof(struct in6_addr)) +
 		/* IFLA_GRE_REMOTE */
-		nla_total_size(4) +
+		nla_total_size(sizeof(struct in6_addr)) +
 		/* IFLA_GRE_TTL */
 		nla_total_size(1) +
 		/* IFLA_GRE_TOS */
@@ -1659,8 +1659,8 @@ static int ip6gre_fill_info(struct sk_buff *skb, const struct net_device *dev)
 	    nla_put_be16(skb, IFLA_GRE_OFLAGS, p->o_flags) ||
 	    nla_put_be32(skb, IFLA_GRE_IKEY, p->i_key) ||
 	    nla_put_be32(skb, IFLA_GRE_OKEY, p->o_key) ||
-	    nla_put(skb, IFLA_GRE_LOCAL, sizeof(struct in6_addr), &p->raddr) ||
-	    nla_put(skb, IFLA_GRE_REMOTE, sizeof(struct in6_addr), &p->laddr) ||
+	    nla_put(skb, IFLA_GRE_LOCAL, sizeof(struct in6_addr), &p->laddr) ||
+	    nla_put(skb, IFLA_GRE_REMOTE, sizeof(struct in6_addr), &p->raddr) ||
 	    nla_put_u8(skb, IFLA_GRE_TTL, p->hop_limit) ||
 	    /*nla_put_u8(skb, IFLA_GRE_TOS, t->priority) ||*/
 	    nla_put_u8(skb, IFLA_GRE_ENCAP_LIMIT, p->encap_limit) ||
-- 
1.7.12

^ permalink raw reply related

* Re: [PATCH net-next] ipv6: export IP6_RT_PRIO_* to userland
From: Nicolas Dichtel @ 2012-11-09  9:43 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <5098127A.2040405@6wind.com>

Le 05/11/2012 20:24, Nicolas Dichtel a écrit :
> Le 05/11/2012 18:43, David Miller a écrit :
>> From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
>> Date: Mon, 05 Nov 2012 18:22:39 +0100
>>
>>> Le 05/11/2012 18:00, David Miller a écrit :
>>>> From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
>>>> Date: Mon,  5 Nov 2012 16:28:18 +0100
>>>>
>>>>> The kernel uses some default metric when routes are managed. For
>>>>> example, a
>>>>> static route added with a metric set to 0 is inserted in the kernel
>>>>> with
>>>>> metric 1024 (IP6_RT_PRIO_USER).
>>>>> It is useful for routing daemons to know these values, to be able to
>>>>> set routes
>>>>> without interfering with what the kernel does.
>>>>>
>>>>> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
>>>>
>>>> But these belong in the libc headers anyways.
>>>>
>>>> If we haven't provided them for so long, there's no real value of
>>>> adding them now.
>>>>
>>> But how can a daemon know which default values are used? If it wants
>>> to add a route with metric = default + x, it should first add it with
>>> metric = 0, check the result and then change the metric.
>>
>> What do we do on the ipv4 side and how do daemons cope in that situation?
>>
> In IPv4, there is no such default metric. If you add a route with metric X, it
> remains X in the kernel, even if it's 0.
So we need to duplicate these values in the daemon?

^ permalink raw reply

* [PATCH] kaweth:BQL support
From: Oliver Neukum @ 2012-11-09 12:19 UTC (permalink / raw)
  To: davem, netdev; +Cc: Oliver Neukum, Oliver Neukum

This adds the callbacks for the statistics necessary for BQL

Signed-off-by: Oliver Neukum <oneukum@suse.de>
---
 drivers/net/usb/kaweth.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
index afb117c..f30e07f 100644
--- a/drivers/net/usb/kaweth.c
+++ b/drivers/net/usb/kaweth.c
@@ -715,6 +715,7 @@ static int kaweth_open(struct net_device *net)
 		usb_kill_urb(kaweth->rx_urb);
 		goto err_out;
 	}
+	netdev_reset_queue(net);
 	kaweth->opened = 1;
 
 	netif_start_queue(net);
@@ -783,6 +784,7 @@ static void kaweth_usb_transmit_complete(struct urb *urb)
 {
 	struct kaweth_device *kaweth = urb->context;
 	struct sk_buff *skb = kaweth->tx_skb;
+	struct net_device *net = kaweth->net;
 	int status = urb->status;
 
 	if (unlikely(status != 0))
@@ -790,7 +792,8 @@ static void kaweth_usb_transmit_complete(struct urb *urb)
 			dev_dbg(&urb->dev->dev, "%s: TX status %d.\n",
 				kaweth->net->name, status);
 
-	netif_wake_queue(kaweth->net);
+	netif_wake_queue(net);
+	netdev_completed_queue(net, 1, skb->len - 2);
 	dev_kfree_skb_irq(skb);
 }
 
@@ -854,6 +857,7 @@ skip:
 	{
 		kaweth->stats.tx_packets++;
 		kaweth->stats.tx_bytes += skb->len;
+		netdev_sent_queue(net, skb->len - 2);
 	}
 
 	spin_unlock_irq(&kaweth->device_lock);
-- 
1.7.7

^ permalink raw reply related

* Re: gro vs vlan in myri10ge
From: Andrew Gallatin @ 2012-11-09 12:47 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: netdev
In-Reply-To: <1352428870.19779.496.camel@edumazet-glaptop>

On 11/08/12 21:41, Eric Dumazet wrote:
> On Thu, 2012-11-08 at 21:20 -0500, Andrew Gallatin wrote:
<...>
>> Is this (popping vlan tags in the driver) acceptable, or is it
>> too much of a layering violation?
>
> Given GRO assumes NIC does hardware vlan offloading, I guess
> I would chose to do that.
>
> It seems unfortunate to add vlan decap in GRO path, already very
> complex.

OK, then I will prepare & run through q/a a real patch that does this.

Thanks again,

Drew

^ permalink raw reply

* Re: [PATCH] ipv6: add knob to send unsolicited ND on link-layer address change
From: Hannes Frederic Sowa @ 2012-11-09 13:01 UTC (permalink / raw)
  To: netdev
In-Reply-To: <20121107024620.GD26398@order.stressinduktion.org>

On Wed, Nov 07, 2012 at 03:46:20AM +0100, Hannes Frederic Sowa wrote:
> This patch introduces a new knob ndisc_notify. If enabled, the kernel
> will transmit an unsolicited neighbour advertisement on link-layer address
> change to update the neighbour tables of the corresponding hosts more quickly.
> 
> This is the equivalent to arp_notify in ipv4 world.

If this eases review, I have a test script to demonstrate the behaviour
(this needs the patch to change the mac address of a running veth, which was
merged into net-next some time ago and does only work correctly if unsolicited
neighbour advertisments are send to all-nodes):

#!/bin/bash
set -ex
set -o pipefail
declare -r NETNS=2337 R=$RANDOM
declare -r ULAM="fd8b:abf9:283d:1::/64" ULAM_ADDR="fd8b:abf9:283d:1::1/64"
declare -r ULAS="fd8b:abf9:283d:2::/64" ULAS_ADDR="fd8b:abf9:283d:2::1/64"
declare -r NS="ip netns exec $NETNS"
declare -r NMACM=00:00:6c:55:56:9e NMACS=00:00:6c:55:56:9e
function enable_forward {
    declare -r F="sysctl -w net.ipv6.conf.all.forwarding=1"
    $F
    $NS $F
}
function fetch_gw {
    echo "ip -6 -o a l group $NETNS dev $1 scope link 
	                     | awk '{print \$4}'"
}
case $1 in
    clean)
	ip netns delete $NETNS || true # ignore errors
	# seems to be racy here because deconstruction happens in a workqueue
	sleep 1
	for i in $(ip -o l l group $NETNS|cut -f2 -d:|egrep 'vmeth|dummy'); do
	    ip l d $i || true
	done
	;;
    '')
	declare -r vmeth=vmeth$R vseth=vseth$R
	echo 'file net/ipv6/ndisc.c +pflmt' > /sys/kernel/debug/dynamic_debug/control
	ip netns add $NETNS
	enable_forward
	ip link add name $vmeth type veth peer name $vseth
	ip link set dev $vmeth group $NETNS up
	ip link set dev $vseth netns $NETNS
	$NS ip link set dev $vseth group $NETNS up
	$NS ip l a name dummy$R up type dummy
	$NS ip l set dev dummy$R group $NETNS up
	ip a a $ULAM_ADDR dev $vmeth
	$NS ip a a $ULAS_ADDR dev dummy$R
	declare -r GWS=$(eval $NS $(fetch_gw $vseth))
	declare -r GWM=$(eval $(fetch_gw $vmeth))
	ip -6 r a $ULAS via ${GWS%/64} dev $vmeth
	$NS ip -6 r a $ULAM via ${GWM%/64} dev $vseth
	sleep 5
	time ping6 -w 100 -c 1 ${ULAS_ADDR%/64}
	# perf probes
	$0 internal $vmeth
	;;
    internal)
	sleep 5
	ip l set dev $2 addr $NMACM
	sleep 5
	time ping6 -w 100 -c 1 ${ULAS_ADDR%/64}
	;;
esac

David, if you intend to merge this patch, could you please remove the empty
line I accidently added in the addrconf_sysctl_table, directly following
.proc_handler? As usual, I noticed it just after sending the patch.

^ permalink raw reply

* Re: [PATCH] kaweth:BQL support
From: Eric Dumazet @ 2012-11-09 13:15 UTC (permalink / raw)
  To: Oliver Neukum; +Cc: davem, netdev, Oliver Neukum
In-Reply-To: <1352463587-23899-1-git-send-email-oliver@neukum.org>

On Fri, 2012-11-09 at 13:19 +0100, Oliver Neukum wrote:
> This adds the callbacks for the statistics necessary for BQL
> 
> Signed-off-by: Oliver Neukum <oneukum@suse.de>
> ---
>  drivers/net/usb/kaweth.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
> index afb117c..f30e07f 100644
> --- a/drivers/net/usb/kaweth.c
> +++ b/drivers/net/usb/kaweth.c
> @@ -715,6 +715,7 @@ static int kaweth_open(struct net_device *net)
>  		usb_kill_urb(kaweth->rx_urb);
>  		goto err_out;
>  	}
> +	netdev_reset_queue(net);
>  	kaweth->opened = 1;
>  
>  	netif_start_queue(net);
> @@ -783,6 +784,7 @@ static void kaweth_usb_transmit_complete(struct urb *urb)
>  {
>  	struct kaweth_device *kaweth = urb->context;
>  	struct sk_buff *skb = kaweth->tx_skb;
> +	struct net_device *net = kaweth->net;
>  	int status = urb->status;
>  
>  	if (unlikely(status != 0))
> @@ -790,7 +792,8 @@ static void kaweth_usb_transmit_complete(struct urb *urb)
>  			dev_dbg(&urb->dev->dev, "%s: TX status %d.\n",
>  				kaweth->net->name, status);
>  
> -	netif_wake_queue(kaweth->net);
> +	netif_wake_queue(net);
> +	netdev_completed_queue(net, 1, skb->len - 2);
>  	dev_kfree_skb_irq(skb);
>  }
>  
> @@ -854,6 +857,7 @@ skip:
>  	{
>  		kaweth->stats.tx_packets++;
>  		kaweth->stats.tx_bytes += skb->len;
> +		netdev_sent_queue(net, skb->len - 2);
>  	}
>  
>  	spin_unlock_irq(&kaweth->device_lock);


I am curious to know if it changes anything on the behavior of this
network adapter ?

Because it seems queue is stopped anyway when a packet is in transmit.

(netif_stop_queue() in kaweth_start_xmit(), and netif_wake_queue() in
kaweth_usb_transmit_complete())

What I am missing ?

Thanks

^ permalink raw reply

* Re: [PATCH net-next 1/4] ipip: advertise tunnel param via rtnl
From: Eric Dumazet @ 2012-11-09 13:20 UTC (permalink / raw)
  To: Nicolas Dichtel; +Cc: netdev, davem
In-Reply-To: <1352454671-4336-2-git-send-email-nicolas.dichtel@6wind.com>

On Fri, 2012-11-09 at 10:51 +0100, Nicolas Dichtel wrote:
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> ---

It would be nice you add in the changelog an explicit
use for this feature ?

Its not that obvious...

Thanks

^ permalink raw reply

* Re: [PATCH net-next 4/4] gre6: fix rtnl dump messages
From: Eric Dumazet @ 2012-11-09 13:22 UTC (permalink / raw)
  To: Nicolas Dichtel; +Cc: netdev, davem
In-Reply-To: <1352454671-4336-5-git-send-email-nicolas.dichtel@6wind.com>

On Fri, 2012-11-09 at 10:51 +0100, Nicolas Dichtel wrote:
> Spotted after a code review.
> 
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> ---
>  net/ipv6/ip6_gre.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Hi Nicolas

Could you please write real changelogs ?

This is a bug fix.

So we need for proper tracking of this bug, a reference
of the original commit that introduced this bug.

This will help stable teams work tremendously

Thanks !

^ permalink raw reply

* Re: [PATCH][net-next v2] gianfar: Fix alloc_skb_resources on -ENOMEM cleanup path
From: Paul Gortmaker @ 2012-11-09 14:05 UTC (permalink / raw)
  To: Claudiu Manoil; +Cc: netdev
In-Reply-To: <1352448701-14041-1-git-send-email-claudiu.manoil@freescale.com>

On 12-11-09 03:11 AM, Claudiu Manoil wrote:
> Should gfar_init_bds() return with -ENOMEM inside gfar_alloc_skb_resources(),
> free_skb_resources() will be called twice in a row on the "cleanup" path,
> leading to duplicate kfree() calls for rx_|tx_queue->rx_|tx_skbuff resulting
> in segmentation fault.
> This patch prevents the segmentation fault to happen in the future
> (rx_|tx_sbkbuff set to NULL), and corrects the error path handling
> for gfar_init_bds().
> 
> Cc: Paul Gortmaker <paul.gortmaker@windriver.com>

Acked-by: Paul Gortmaker <paul.gortmaker@windriver.com>

> 
> Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com>
> ---
> v1: do free_skb_resources() on the cleanup path of gfar_init_bds()'s parent
> v2: (minor change) no "goto" construct inside gfar_restore()
> 
>  drivers/net/ethernet/freescale/gianfar.c |   14 ++++++++------
>  1 files changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
> index 1d03dcd..81a0f33 100644
> --- a/drivers/net/ethernet/freescale/gianfar.c
> +++ b/drivers/net/ethernet/freescale/gianfar.c
> @@ -210,7 +210,7 @@ static int gfar_init_bds(struct net_device *ndev)
>  				skb = gfar_new_skb(ndev);
>  				if (!skb) {
>  					netdev_err(ndev, "Can't allocate RX buffers\n");
> -					goto err_rxalloc_fail;
> +					return -ENOMEM;
>  				}
>  				rx_queue->rx_skbuff[j] = skb;
>  
> @@ -223,10 +223,6 @@ static int gfar_init_bds(struct net_device *ndev)
>  	}
>  
>  	return 0;
> -
> -err_rxalloc_fail:
> -	free_skb_resources(priv);
> -	return -ENOMEM;
>  }
>  
>  static int gfar_alloc_skb_resources(struct net_device *ndev)
> @@ -1356,7 +1352,11 @@ static int gfar_restore(struct device *dev)
>  	if (!netif_running(ndev))
>  		return 0;
>  
> -	gfar_init_bds(ndev);
> +	if (gfar_init_bds(ndev)) {
> +		free_skb_resources(priv);
> +		return -ENOMEM;
> +	}
> +
>  	init_registers(ndev);
>  	gfar_set_mac_address(ndev);
>  	gfar_init_mac(ndev);
> @@ -1709,6 +1709,7 @@ static void free_skb_tx_queue(struct gfar_priv_tx_q *tx_queue)
>  		tx_queue->tx_skbuff[i] = NULL;
>  	}
>  	kfree(tx_queue->tx_skbuff);
> +	tx_queue->tx_skbuff = NULL;
>  }
>  
>  static void free_skb_rx_queue(struct gfar_priv_rx_q *rx_queue)
> @@ -1732,6 +1733,7 @@ static void free_skb_rx_queue(struct gfar_priv_rx_q *rx_queue)
>  		rxbdp++;
>  	}
>  	kfree(rx_queue->rx_skbuff);
> +	rx_queue->rx_skbuff = NULL;
>  }
>  
>  /* If there are any tx skbs or rx skbs still around, free them.
> 

^ permalink raw reply

* query on dynamic switching between Ethernet ports
From: Rayagond K @ 2012-11-09 14:32 UTC (permalink / raw)
  To: netdev

Hi All,

I am implementing handling of dynamic switching between Ethernet ports
(1GMbps to 100Mbps mode) using PHY layer, I referred various driver in
LXR and doc and I am able to understand the PHY layer and implement in
my driver.

For now I am able to do following in my driver now,

1. Advertising all the capabilities like FULL duplex, half duplex,
pause frames, MII/GMII etc while registering with PHY layer.
2. Able to detect the link up and link down.
3. Able do the auto-negotiation with remote end link partner and
program my MAC accordingly.
4. Able to establish the link by connecting and disconnecting the
cable many times.

But I am facing one problem ie my driver is not able to establish the
link when I load the driver first time and connected to 1G port. If I
toggle the port connection between MII(10/100Mbps) and GMII(1Gbps) for
two/three times and connect it back to GMII ports then driver works
fine and it establish the link.

-- 
wwr
Rayagond

^ permalink raw reply

* [PATCH] gianfar: ethernet vanishes after restoring from hibernation
From: Paul Gortmaker @ 2012-11-09 14:43 UTC (permalink / raw)
  To: netdev; +Cc: Wang Dongsheng, Claudiu Manoil, Paul Gortmaker
In-Reply-To: <1352181848-24102-1-git-send-email-dongsheng.wang@freescale.com>

From: Wang Dongsheng <dongsheng.wang@freescale.com>

If a gianfar ethernet device is down prior to hibernating a
system, it will no longer be present upon system restore.

For example:

	~# ifconfig eth0 down
	~# echo disk > /sys/power/state

	  <trigger a restore from hibernation>

	~# ifconfig eth0 up
	SIOCSIFFLAGS: No such device

This happens because the restore function bails out early upon
finding devices that were not up at hibernation.  In doing so,
it never gets to the netif_device_attach call at the end of
the restore function.  Adding the netif_device_attach as done
here also makes the gfar_restore code consistent with what is
done in the gfar_resume code.

Cc: Claudiu Manoil <claudiu.manoil@freescale.com>
Signed-off-by: Wang Dongsheng <dongsheng.wang@freescale.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
[v2: expand on details in commit log a bit more, to superceed
 v1 at http://patchwork.ozlabs.org/patch/197412/ ]

 drivers/net/ethernet/freescale/gianfar.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index 1d03dcd..19ac096 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -1353,8 +1353,11 @@ static int gfar_restore(struct device *dev)
 	struct gfar_private *priv = dev_get_drvdata(dev);
 	struct net_device *ndev = priv->ndev;
 
-	if (!netif_running(ndev))
+	if (!netif_running(ndev)) {
+		netif_device_attach(ndev);
+
 		return 0;
+	}
 
 	gfar_init_bds(ndev);
 	init_registers(ndev);
-- 
1.8.0

^ permalink raw reply related

* [PATCH] [trivial] isdn: Fix typo in drivers/isdn
From: Masanari Iida @ 2012-11-09 15:02 UTC (permalink / raw)
  To: linux-kernel, trivial, isdn, netdev; +Cc: davem, Masanari Iida

Correct spelling typo in printk within drivers/isdn

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
---
 drivers/isdn/hardware/mISDN/hfcpci.c    | 2 +-
 drivers/isdn/hardware/mISDN/mISDNisar.c | 2 +-
 drivers/isdn/hisax/callc.c              | 2 +-
 drivers/isdn/hisax/hfc_pci.c            | 2 +-
 drivers/isdn/hisax/hfc_sx.c             | 2 +-
 drivers/isdn/pcbit/layer2.c             | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/isdn/hardware/mISDN/hfcpci.c b/drivers/isdn/hardware/mISDN/hfcpci.c
index 81363ff..6e99d73 100644
--- a/drivers/isdn/hardware/mISDN/hfcpci.c
+++ b/drivers/isdn/hardware/mISDN/hfcpci.c
@@ -490,7 +490,7 @@ receive_dmsg(struct hfc_pci *hc)
 		    (df->data[le16_to_cpu(zp->z1)])) {
 			if (dch->debug & DEBUG_HW)
 				printk(KERN_DEBUG
-				       "empty_fifo hfcpci paket inv. len "
+				       "empty_fifo hfcpci packet inv. len "
 				       "%d or crc %d\n",
 				       rcnt,
 				       df->data[le16_to_cpu(zp->z1)]);
diff --git a/drivers/isdn/hardware/mISDN/mISDNisar.c b/drivers/isdn/hardware/mISDN/mISDNisar.c
index 182ecf0..feafa91 100644
--- a/drivers/isdn/hardware/mISDN/mISDNisar.c
+++ b/drivers/isdn/hardware/mISDN/mISDNisar.c
@@ -1302,7 +1302,7 @@ modeisar(struct isar_ch *ch, u32 bprotocol)
 						   &ch->is->Flags))
 				ch->dpath = 1;
 			else {
-				pr_info("modeisar both pathes in use\n");
+				pr_info("modeisar both paths in use\n");
 				return -EBUSY;
 			}
 			if (bprotocol == ISDN_P_B_HDLC)
diff --git a/drivers/isdn/hisax/callc.c b/drivers/isdn/hisax/callc.c
index a47637b..ddec47a 100644
--- a/drivers/isdn/hisax/callc.c
+++ b/drivers/isdn/hisax/callc.c
@@ -35,7 +35,7 @@ static int chancount;
 /* experimental REJECT after ALERTING for CALLBACK to beat the 4s delay */
 #define ALERT_REJECT 0
 
-/* Value to delay the sending of the first B-channel paket after CONNECT
+/* Value to delay the sending of the first B-channel packet after CONNECT
  * here is no value given by ITU, but experience shows that 300 ms will
  * work on many networks, if you or your other side is behind local exchanges
  * a greater value may be recommented. If the delay is to short the first paket
diff --git a/drivers/isdn/hisax/hfc_pci.c b/drivers/isdn/hisax/hfc_pci.c
index 334fa90..f60d4be 100644
--- a/drivers/isdn/hisax/hfc_pci.c
+++ b/drivers/isdn/hisax/hfc_pci.c
@@ -354,7 +354,7 @@ receive_dmsg(struct IsdnCardState *cs)
 		if ((rcnt > MAX_DFRAME_LEN + 3) || (rcnt < 4) ||
 		    (df->data[zp->z1])) {
 			if (cs->debug & L1_DEB_WARN)
-				debugl1(cs, "empty_fifo hfcpci paket inv. len %d or crc %d", rcnt, df->data[zp->z1]);
+				debugl1(cs, "empty_fifo hfcpci packet inv. len %d or crc %d", rcnt, df->data[zp->z1]);
 #ifdef ERROR_STATISTIC
 			cs->err_rx++;
 #endif
diff --git a/drivers/isdn/hisax/hfc_sx.c b/drivers/isdn/hisax/hfc_sx.c
index 4db846b..4ec279c 100644
--- a/drivers/isdn/hisax/hfc_sx.c
+++ b/drivers/isdn/hisax/hfc_sx.c
@@ -270,7 +270,7 @@ read_fifo(struct IsdnCardState *cs, u_char fifo, int trans_max)
 
 		if ((count > fifo_size) || (count < 4)) {
 			if (cs->debug & L1_DEB_WARN)
-				debugl1(cs, "hfcsx_read_fifo %d paket inv. len %d ", fifo , count);
+				debugl1(cs, "hfcsx_read_fifo %d packet inv. len %d ", fifo , count);
 			while (count) {
 				count--; /* empty fifo */
 				Read_hfc(cs, HFCSX_FIF_DRD);
diff --git a/drivers/isdn/pcbit/layer2.c b/drivers/isdn/pcbit/layer2.c
index a18e639..42ecfef 100644
--- a/drivers/isdn/pcbit/layer2.c
+++ b/drivers/isdn/pcbit/layer2.c
@@ -508,7 +508,7 @@ pcbit_irq_handler(int interrupt, void *devptr)
 		return IRQ_NONE;
 	}
 	if (dev->interrupt) {
-		printk(KERN_DEBUG "pcbit: reentering interrupt hander\n");
+		printk(KERN_DEBUG "pcbit: reentering interrupt handler\n");
 		return IRQ_HANDLED;
 	}
 	dev->interrupt = 1;
-- 
1.8.0.rc3.16.g8ead1bf

^ permalink raw reply related


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