Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next] tcp: tcp_make_synack() consumes dst parameter
From: Eric Dumazet @ 2012-06-04  6:33 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

From: Eric Dumazet <edumazet@google.com>

tcp_make_synack() clones the dst, and callers release it.

We can avoid two atomic operations per SYNACK if tcp_make_synack()
consumes dst instead of cloning it.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
To be applied after "tcp: tcp_make_synack() can use alloc_skb()"

 net/ipv4/tcp_ipv4.c   |    1 -
 net/ipv4/tcp_output.c |   18 ++++++++++++++----
 net/ipv6/tcp_ipv6.c   |    1 -
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index c8d28c4..3d9c1a4 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -848,7 +848,6 @@ static int tcp_v4_send_synack(struct sock *sk, struct dst_entry *dst,
 		err = net_xmit_eval(err);
 	}
 
-	dst_release(dst);
 	return err;
 }
 
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index f0b0e44..c465d3e 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2442,7 +2442,16 @@ int tcp_send_synack(struct sock *sk)
 	return tcp_transmit_skb(sk, skb, 1, GFP_ATOMIC);
 }
 
-/* Prepare a SYN-ACK. */
+/**
+ * tcp_make_synack - Prepare a SYN-ACK.
+ * sk: listener socket
+ * dst: dst entry attached to the SYNACK
+ * req: request_sock pointer
+ * rvp: request_values pointer
+ *
+ * Allocate one skb and build a SYNACK packet.
+ * @dst is consumed : Caller should not use it again.
+ */
 struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst,
 				struct request_sock *req,
 				struct request_values *rvp)
@@ -2462,13 +2471,14 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst,
 	if (cvp != NULL && cvp->s_data_constant && cvp->s_data_desired)
 		s_data_desired = cvp->s_data_desired;
 	skb = alloc_skb(MAX_TCP_HEADER + 15 + s_data_desired, GFP_ATOMIC);
-	if (skb == NULL)
+	if (unlikely(!skb)) {
+		dst_release(dst);
 		return NULL;
-
+	}
 	/* Reserve space for headers. */
 	skb_reserve(skb, MAX_TCP_HEADER);
 
-	skb_dst_set(skb, dst_clone(dst));
+	skb_dst_set(skb, dst);
 
 	mss = dst_metric_advmss(dst);
 	if (tp->rx_opt.user_mss && tp->rx_opt.user_mss < mss)
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 3a9aec2..8075825 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -522,7 +522,6 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req,
 done:
 	if (opt && opt != np->opt)
 		sock_kfree_s(sk, opt, opt->tot_len);
-	dst_release(dst);
 	return err;
 }
 

^ permalink raw reply related

* [PATCH net-next] tcp: tcp_make_synack() can use alloc_skb()
From: Eric Dumazet @ 2012-06-04  5:50 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

From: Eric Dumazet <edumazet@google.com>

There is no value using sock_wmalloc() in tcp_make_synack().

A listener socket only sends SYNACK packets, they are not queued in a
socket queue, only in Qdisc and device layers, so the number of in
flight packets is limited in these layers. We used sock_wmalloc() with
the %force parameter set to 1 to ignore socket limits anyway.

This patch removes two atomic operations per SYNACK packet.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/ipv4/tcp_output.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 803cbfe..f0b0e44 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2461,7 +2461,7 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst,
 
 	if (cvp != NULL && cvp->s_data_constant && cvp->s_data_desired)
 		s_data_desired = cvp->s_data_desired;
-	skb = sock_wmalloc(sk, MAX_TCP_HEADER + 15 + s_data_desired, 1, GFP_ATOMIC);
+	skb = alloc_skb(MAX_TCP_HEADER + 15 + s_data_desired, GFP_ATOMIC);
 	if (skb == NULL)
 		return NULL;
 

^ permalink raw reply related

* Re: [PATCHv3 6/6] tun: experimental zero copy tx support
From: Jason Wang @ 2012-06-04  4:48 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: eric.dumazet, netdev, linux-kernel, ebiederm, davem, Ian Campbell
In-Reply-To: <5ace2b9c3f15259cdf29af03f9231faac673e719.1338735323.git.mst@redhat.com>

On 05/13/2012 08:34 PM, Michael S. Tsirkin wrote:
> Let vhost-net utilize zero copy tx when used with tun.
>
> Signed-off-by: Michael S. Tsirkin<mst@redhat.com>
> ---
>   drivers/net/tun.c | 146 +++++++++++++++++++++++++++++++++++++++++++++++++-----
>   1 file changed, 134 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index fe5cd2f3..74d7e5e 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -100,6 +100,8 @@ do {								\
>   } while (0)
>   #endif
>
> +#define GOODCOPY_LEN 128
> +
>   #define FLT_EXACT_COUNT 8
>   struct tap_filter {
>   	unsigned int    count;    /* Number of addrs. Zero means disabled */
> @@ -602,19 +604,100 @@ static struct sk_buff *tun_alloc_skb(struct tun_struct *tun,
>   	return skb;
>   }
>
> +/* set skb frags from iovec, this can move to core network code for reuse */
> +static int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from,
> +				  int offset, size_t count)
> +{
> +	int len = iov_length(from, count) - offset;
> +	int copy = skb_headlen(skb);
> +	int size, offset1 = 0;
> +	int i = 0;
> +
> +	/* Skip over from offset */
> +	while (count&&  (offset>= from->iov_len)) {
> +		offset -= from->iov_len;
> +		++from;
> +		--count;
> +	}
> +
> +	/* copy up to skb headlen */
> +	while (count&&  (copy>  0)) {
> +		size = min_t(unsigned int, copy, from->iov_len - offset);
> +		if (copy_from_user(skb->data + offset1, from->iov_base + offset,
> +				   size))
> +			return -EFAULT;
> +		if (copy>  size) {
> +			++from;
> +			--count;
> +			offset = 0;
> +		} else
> +			offset += size;
> +		copy -= size;
> +		offset1 += size;
> +	}
> +
> +	if (len == offset1)
> +		return 0;
> +
> +	while (count--) {
> +		struct page *page[MAX_SKB_FRAGS];
> +		int num_pages;
> +		unsigned long base;
> +		unsigned long truesize;
> +
> +		len = from->iov_len - offset;
> +		if (!len) {
> +			offset = 0;
> +			++from;
> +			continue;
> +		}
> +		base = (unsigned long)from->iov_base + offset;
> +		size = ((base&  ~PAGE_MASK) + len + ~PAGE_MASK)>>  PAGE_SHIFT;
> +		if (i + size>  MAX_SKB_FRAGS)
> +			return -EMSGSIZE;
> +		num_pages = get_user_pages_fast(base, size, 0,&page[i]);
> +		if (num_pages != size) {
> +			for (i = 0; i<  num_pages; i++)
> +				put_page(page[i]);
> +			return -EFAULT;
> +		}
> +		truesize = size * PAGE_SIZE;
> +		skb->data_len += len;
> +		skb->len += len;
> +		skb->truesize += truesize;
> +		atomic_add(truesize,&skb->sk->sk_wmem_alloc);
> +		while (len) {
> +			int off = base&  ~PAGE_MASK;
> +			int size = min_t(int, len, PAGE_SIZE - off);
> +			__skb_fill_page_desc(skb, i, page[i], off, size);
> +			skb_shinfo(skb)->nr_frags++;
> +			/* increase sk_wmem_alloc */
> +			base += size;
> +			len -= size;
> +			i++;
> +		}
> +		offset = 0;
> +		++from;
> +	}
> +	return 0;
> +}
> +
>   /* Get packet from user space buffer */
> -static ssize_t tun_get_user(struct tun_struct *tun,
> -			    const struct iovec *iv, size_t count,
> -			    int noblock)
> +static ssize_t tun_get_user(struct tun_struct *tun, void *msg_control,
> +			    const struct iovec *iv, size_t total_len,
> +			    size_t count, int noblock)
>   {

Looks like V2 uses count as the number of vectors and V3 correct this, 
so does V3 still have any issue during test?
>   	struct tun_pi pi = { 0, cpu_to_be16(ETH_P_IP) };
>   	struct sk_buff *skb;
> -	size_t len = count, align = NET_SKB_PAD;
> +	size_t len = total_len, align = NET_SKB_PAD;
>   	struct virtio_net_hdr gso = { 0 };
>   	int offset = 0;
> +	int copylen;
> +	bool zerocopy = false;
> +	int err;
>
>   	if (!(tun->flags&  TUN_NO_PI)) {
> -		if ((len -= sizeof(pi))>  count)
> +		if ((len -= sizeof(pi))>  total_len)
>   			return -EINVAL;
>
>   		if (memcpy_fromiovecend((void *)&pi, iv, 0, sizeof(pi)))
> @@ -623,7 +706,7 @@ static ssize_t tun_get_user(struct tun_struct *tun,
>   	}
>
>   	if (tun->flags&  TUN_VNET_HDR) {
> -		if ((len -= tun->vnet_hdr_sz)>  count)
> +		if ((len -= tun->vnet_hdr_sz)>  total_len)
>   			return -EINVAL;
>
>   		if (memcpy_fromiovecend((void *)&gso, iv, offset, sizeof(gso)))
> @@ -645,14 +728,46 @@ static ssize_t tun_get_user(struct tun_struct *tun,
>   			return -EINVAL;
>   	}
>   

Add a check of UIO_MAXIOV like macvtap? Other looks good to me.
Thanks.
> -	skb = tun_alloc_skb(tun, align, len, gso.hdr_len, noblock);
> +	if (msg_control)
> +		zerocopy = true;
> +
> +	if (zerocopy) {
> +		/* Userspace may produce vectors with count greater than
> +		 * MAX_SKB_FRAGS, so we need to linearize parts of the skb
> +		 * to let the rest of data to be fit in the frags.
> +		 */
> +		if (count>  MAX_SKB_FRAGS) {
> +			copylen = iov_length(iv, count - MAX_SKB_FRAGS);
> +			if (copylen<  offset)
> +				copylen = 0;
> +			else
> +				copylen -= offset;
> +		} else
> +				copylen = 0;
> +		/* There are 256 bytes to be copied in skb, so there is enough
> +		 * room for skb expand head in case it is used.
> +		 * The rest of the buffer is mapped from userspace.
> +		 */
> +		if (copylen<  gso.hdr_len)
> +			copylen = gso.hdr_len;
> +		if (!copylen)
> +			copylen = GOODCOPY_LEN;
> +	} else
> +		copylen = len;
> +
> +	skb = tun_alloc_skb(tun, align, copylen, gso.hdr_len, noblock);
>   	if (IS_ERR(skb)) {
>   		if (PTR_ERR(skb) != -EAGAIN)
>   			tun->dev->stats.rx_dropped++;
>   		return PTR_ERR(skb);
>   	}
>
> -	if (skb_copy_datagram_from_iovec(skb, 0, iv, offset, len)) {
> +	if (zerocopy)
> +		err = zerocopy_sg_from_iovec(skb, iv, offset, count);
> +	else
> +		err = skb_copy_datagram_from_iovec(skb, 0, iv, offset, len);
> +
> +	if (err) {
>   		tun->dev->stats.rx_dropped++;
>   		kfree_skb(skb);
>   		return -EFAULT;
> @@ -726,12 +841,18 @@ static ssize_t tun_get_user(struct tun_struct *tun,
>   		skb_shinfo(skb)->gso_segs = 0;
>   	}
>
> +	/* copy skb_ubuf_info for callback when skb has no error */
> +	if (zerocopy) {
> +		skb_shinfo(skb)->destructor_arg = msg_control;
> +		skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY;
> +	}
> +
>   	netif_rx_ni(skb);
>
>   	tun->dev->stats.rx_packets++;
>   	tun->dev->stats.rx_bytes += len;
>
> -	return count;
> +	return total_len;
>   }
>
>   static ssize_t tun_chr_aio_write(struct kiocb *iocb, const struct iovec *iv,
> @@ -746,7 +867,7 @@ static ssize_t tun_chr_aio_write(struct kiocb *iocb, const struct iovec *iv,
>
>   	tun_debug(KERN_INFO, tun, "tun_chr_write %ld\n", count);
>
> -	result = tun_get_user(tun, iv, iov_length(iv, count),
> +	result = tun_get_user(tun, NULL, iv, iov_length(iv, count), count,
>   			      file->f_flags&  O_NONBLOCK);
>
>   	tun_put(tun);
> @@ -960,8 +1081,8 @@ static int tun_sendmsg(struct kiocb *iocb, struct socket *sock,
>   		       struct msghdr *m, size_t total_len)
>   {
>   	struct tun_struct *tun = container_of(sock, struct tun_struct, socket);
> -	return tun_get_user(tun, m->msg_iov, total_len,
> -			    m->msg_flags&  MSG_DONTWAIT);
> +	return tun_get_user(tun, m->msg_control, m->msg_iov, total_len,
> +			    m->msg_iovlen, m->msg_flags&  MSG_DONTWAIT);
>   }
>
>   static int tun_recvmsg(struct kiocb *iocb, struct socket *sock,
> @@ -1130,6 +1251,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
>   		sock_init_data(&tun->socket, sk);
>   		sk->sk_write_space = tun_sock_write_space;
>   		sk->sk_sndbuf = INT_MAX;
> +		sock_set_flag(sk, SOCK_ZEROCOPY);
>
>   		tun_sk(sk)->tun = tun;
>

^ permalink raw reply

* [PATCH] net: Remove casts to same type
From: Joe Perches @ 2012-06-04  3:41 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev

Adding casts of objects to the same type is unnecessary
and confusing for a human reader.

For example, this cast:

	int y;
	int *p = (int *)&y;

I used the coccinelle script below to find and remove these
unnecessary casts.  I manually removed the conversions this
script produces of casts with __force and __user.

@@
type T;
T *p;
@@

-	(T *)p
+	p

Signed-off-by: Joe Perches <joe@perches.com>
---

Let me know if this needs to be broken up by maintainer.

 net/9p/client.c                        |    2 +-
 net/atm/lec.c                          |    2 +-
 net/decnet/dn_nsp_out.c                |    2 +-
 net/ipv4/af_inet.c                     |    2 +-
 net/ipv4/fib_trie.c                    |   13 ++++++-------
 net/ipv4/netfilter/nf_nat_snmp_basic.c |    4 ++--
 net/ipv6/exthdrs.c                     |    4 ++--
 net/irda/irqueue.c                     |    6 +++---
 net/l2tp/l2tp_ppp.c                    |    8 ++++----
 net/mac80211/scan.c                    |    3 +--
 net/netfilter/nf_conntrack_core.c      |    2 +-
 net/packet/af_packet.c                 |    9 ++++-----
 net/tipc/port.c                        |    9 ++++-----
 net/tipc/socket.c                      |    2 +-
 14 files changed, 32 insertions(+), 36 deletions(-)

diff --git a/net/9p/client.c b/net/9p/client.c
index a170893..5cbea90 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -1548,7 +1548,7 @@ p9_client_read(struct p9_fid *fid, char *data, char __user *udata, u64 offset,
 			kernel_buf = 1;
 			indata = data;
 		} else
-			indata = (char *)udata;
+			indata = udata;
 		/*
 		 * response header len is 11
 		 * PDU Header(7) + IO Size (4)
diff --git a/net/atm/lec.c b/net/atm/lec.c
index a7d1721..cbe1ebc 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -1602,7 +1602,7 @@ static void lec_arp_expire_vcc(unsigned long data)
 {
 	unsigned long flags;
 	struct lec_arp_table *to_remove = (struct lec_arp_table *)data;
-	struct lec_priv *priv = (struct lec_priv *)to_remove->priv;
+	struct lec_priv *priv = to_remove->priv;
 
 	del_timer(&to_remove->timer);
 
diff --git a/net/decnet/dn_nsp_out.c b/net/decnet/dn_nsp_out.c
index 564a6ad..8a96047c 100644
--- a/net/decnet/dn_nsp_out.c
+++ b/net/decnet/dn_nsp_out.c
@@ -322,7 +322,7 @@ static __le16 *dn_mk_ack_header(struct sock *sk, struct sk_buff *skb, unsigned c
 	/* Set "cross subchannel" bit in ackcrs */
 	ackcrs |= 0x2000;
 
-	ptr = (__le16 *)dn_mk_common_header(scp, skb, msgflag, hlen);
+	ptr = dn_mk_common_header(scp, skb, msgflag, hlen);
 
 	*ptr++ = cpu_to_le16(acknum);
 	*ptr++ = cpu_to_le16(ackcrs);
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index c8f7aee..e4e8e00 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -553,7 +553,7 @@ int inet_dgram_connect(struct socket *sock, struct sockaddr *uaddr,
 
 	if (!inet_sk(sk)->inet_num && inet_autobind(sk))
 		return -EAGAIN;
-	return sk->sk_prot->connect(sk, (struct sockaddr *)uaddr, addr_len);
+	return sk->sk_prot->connect(sk, uaddr, addr_len);
 }
 EXPORT_SYMBOL(inet_dgram_connect);
 
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 30b88d7..18cbc15 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1007,9 +1007,9 @@ static void trie_rebalance(struct trie *t, struct tnode *tn)
 	while (tn != NULL && (tp = node_parent((struct rt_trie_node *)tn)) != NULL) {
 		cindex = tkey_extract_bits(key, tp->pos, tp->bits);
 		wasfull = tnode_full(tp, tnode_get_child(tp, cindex));
-		tn = (struct tnode *) resize(t, (struct tnode *)tn);
+		tn = (struct tnode *)resize(t, tn);
 
-		tnode_put_child_reorg((struct tnode *)tp, cindex,
+		tnode_put_child_reorg(tp, cindex,
 				      (struct rt_trie_node *)tn, wasfull);
 
 		tp = node_parent((struct rt_trie_node *) tn);
@@ -1024,7 +1024,7 @@ static void trie_rebalance(struct trie *t, struct tnode *tn)
 
 	/* Handle last (top) tnode */
 	if (IS_TNODE(tn))
-		tn = (struct tnode *)resize(t, (struct tnode *)tn);
+		tn = (struct tnode *)resize(t, tn);
 
 	rcu_assign_pointer(t->trie, (struct rt_trie_node *)tn);
 	tnode_free_flush();
@@ -1125,7 +1125,7 @@ static struct list_head *fib_insert_node(struct trie *t, u32 key, int plen)
 		node_set_parent((struct rt_trie_node *)l, tp);
 
 		cindex = tkey_extract_bits(key, tp->pos, tp->bits);
-		put_child(t, (struct tnode *)tp, cindex, (struct rt_trie_node *)l);
+		put_child(t, tp, cindex, (struct rt_trie_node *)l);
 	} else {
 		/* Case 3: n is a LEAF or a TNODE and the key doesn't match. */
 		/*
@@ -1160,8 +1160,7 @@ static struct list_head *fib_insert_node(struct trie *t, u32 key, int plen)
 
 		if (tp) {
 			cindex = tkey_extract_bits(key, tp->pos, tp->bits);
-			put_child(t, (struct tnode *)tp, cindex,
-				  (struct rt_trie_node *)tn);
+			put_child(t, tp, cindex, (struct rt_trie_node *)tn);
 		} else {
 			rcu_assign_pointer(t->trie, (struct rt_trie_node *)tn);
 			tp = tn;
@@ -1620,7 +1619,7 @@ static void trie_leaf_remove(struct trie *t, struct leaf *l)
 
 	if (tp) {
 		t_key cindex = tkey_extract_bits(l->key, tp->pos, tp->bits);
-		put_child(t, (struct tnode *)tp, cindex, NULL);
+		put_child(t, tp, cindex, NULL);
 		trie_rebalance(t, tp);
 	} else
 		RCU_INIT_POINTER(t->trie, NULL);
diff --git a/net/ipv4/netfilter/nf_nat_snmp_basic.c b/net/ipv4/netfilter/nf_nat_snmp_basic.c
index 746edec..bac7122 100644
--- a/net/ipv4/netfilter/nf_nat_snmp_basic.c
+++ b/net/ipv4/netfilter/nf_nat_snmp_basic.c
@@ -405,7 +405,7 @@ static unsigned char asn1_octets_decode(struct asn1_ctx *ctx,
 
 	ptr = *octets;
 	while (ctx->pointer < eoc) {
-		if (!asn1_octet_decode(ctx, (unsigned char *)ptr++)) {
+		if (!asn1_octet_decode(ctx, ptr++)) {
 			kfree(*octets);
 			*octets = NULL;
 			return 0;
@@ -759,7 +759,7 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx,
 		}
 		break;
 	case SNMP_OBJECTID:
-		if (!asn1_oid_decode(ctx, end, (unsigned long **)&lp, &len)) {
+		if (!asn1_oid_decode(ctx, end, &lp, &len)) {
 			kfree(id);
 			return 0;
 		}
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index 6447dc4..fa3d9c3 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -791,14 +791,14 @@ static int ipv6_renew_option(void *ohdr,
 		if (ohdr) {
 			memcpy(*p, ohdr, ipv6_optlen((struct ipv6_opt_hdr *)ohdr));
 			*hdr = (struct ipv6_opt_hdr *)*p;
-			*p += CMSG_ALIGN(ipv6_optlen(*(struct ipv6_opt_hdr **)hdr));
+			*p += CMSG_ALIGN(ipv6_optlen(*hdr));
 		}
 	} else {
 		if (newopt) {
 			if (copy_from_user(*p, newopt, newoptlen))
 				return -EFAULT;
 			*hdr = (struct ipv6_opt_hdr *)*p;
-			if (ipv6_optlen(*(struct ipv6_opt_hdr **)hdr) > newoptlen)
+			if (ipv6_optlen(*hdr) > newoptlen)
 				return -EINVAL;
 			*p += CMSG_ALIGN(newoptlen);
 		}
diff --git a/net/irda/irqueue.c b/net/irda/irqueue.c
index f06947c..7152624 100644
--- a/net/irda/irqueue.c
+++ b/net/irda/irqueue.c
@@ -523,7 +523,7 @@ void *hashbin_remove_first( hashbin_t *hashbin)
 		 * Dequeue the entry...
 		 */
 		dequeue_general( (irda_queue_t**) &hashbin->hb_queue[ bin ],
-				 (irda_queue_t*) entry );
+				 entry);
 		hashbin->hb_size--;
 		entry->q_next = NULL;
 		entry->q_prev = NULL;
@@ -615,7 +615,7 @@ void* hashbin_remove( hashbin_t* hashbin, long hashv, const char* name)
 	 */
 	if ( found ) {
 		dequeue_general( (irda_queue_t**) &hashbin->hb_queue[ bin ],
-				 (irda_queue_t*) entry );
+				 entry);
 		hashbin->hb_size--;
 
 		/*
@@ -685,7 +685,7 @@ void* hashbin_remove_this( hashbin_t* hashbin, irda_queue_t* entry)
 	 * Dequeue the entry...
 	 */
 	dequeue_general( (irda_queue_t**) &hashbin->hb_queue[ bin ],
-			 (irda_queue_t*) entry );
+			 entry);
 	hashbin->hb_size--;
 	entry->q_next = NULL;
 	entry->q_prev = NULL;
diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c
index 8ef6b94..286366e 100644
--- a/net/l2tp/l2tp_ppp.c
+++ b/net/l2tp/l2tp_ppp.c
@@ -1522,8 +1522,8 @@ static int pppol2tp_session_getsockopt(struct sock *sk,
  * handler, according to whether the PPPoX socket is a for a regular session
  * or the special tunnel type.
  */
-static int pppol2tp_getsockopt(struct socket *sock, int level,
-			       int optname, char __user *optval, int __user *optlen)
+static int pppol2tp_getsockopt(struct socket *sock, int level, int optname,
+			       char __user *optval, int __user *optlen)
 {
 	struct sock *sk = sock->sk;
 	struct l2tp_session *session;
@@ -1535,7 +1535,7 @@ static int pppol2tp_getsockopt(struct socket *sock, int level,
 	if (level != SOL_PPPOL2TP)
 		return udp_prot.getsockopt(sk, level, optname, optval, optlen);
 
-	if (get_user(len, (int __user *) optlen))
+	if (get_user(len, optlen))
 		return -EFAULT;
 
 	len = min_t(unsigned int, len, sizeof(int));
@@ -1568,7 +1568,7 @@ static int pppol2tp_getsockopt(struct socket *sock, int level,
 		err = pppol2tp_session_getsockopt(sk, session, optname, &val);
 
 	err = -EFAULT;
-	if (put_user(len, (int __user *) optlen))
+	if (put_user(len, optlen))
 		goto end_put_sess;
 
 	if (copy_to_user((void __user *) optval, &val, len))
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 169da07..6d90a56 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -114,8 +114,7 @@ ieee80211_bss_info_update(struct ieee80211_local *local,
 
 	if (elems->tim && (!elems->parse_error ||
 			   !(bss->valid_data & IEEE80211_BSS_VALID_DTIM))) {
-		struct ieee80211_tim_ie *tim_ie =
-			(struct ieee80211_tim_ie *)elems->tim;
+		struct ieee80211_tim_ie *tim_ie = elems->tim;
 		bss->dtim_period = tim_ie->dtim_period;
 		if (!elems->parse_error)
 				bss->valid_data |= IEEE80211_BSS_VALID_DTIM;
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index ac3af97..95976a5 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -531,7 +531,7 @@ __nf_conntrack_confirm(struct sk_buff *skb)
 	tstamp = nf_conn_tstamp_find(ct);
 	if (tstamp) {
 		if (skb->tstamp.tv64 == 0)
-			__net_timestamp((struct sk_buff *)skb);
+			__net_timestamp(skb);
 
 		tstamp->start = ktime_to_ns(skb->tstamp);
 	}
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 0f66174..71ac655 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -592,7 +592,7 @@ static void init_prb_bdqc(struct packet_sock *po,
 	p1->knxt_seq_num = 1;
 	p1->pkbdq = pg_vec;
 	pbd = (struct tpacket_block_desc *)pg_vec[0].buffer;
-	p1->pkblk_start	= (char *)pg_vec[0].buffer;
+	p1->pkblk_start	= pg_vec[0].buffer;
 	p1->kblk_size = req_u->req3.tp_block_size;
 	p1->knum_blocks	= req_u->req3.tp_block_nr;
 	p1->hdrlen = po->tp_hdrlen;
@@ -824,8 +824,7 @@ static void prb_open_block(struct tpacket_kbdq_core *pkc1,
 		h1->ts_first_pkt.ts_sec = ts.tv_sec;
 		h1->ts_first_pkt.ts_nsec = ts.tv_nsec;
 		pkc1->pkblk_start = (char *)pbd1;
-		pkc1->nxt_offset = (char *)(pkc1->pkblk_start +
-		BLK_PLUS_PRIV(pkc1->blk_sizeof_priv));
+		pkc1->nxt_offset = pkc1->pkblk_start + BLK_PLUS_PRIV(pkc1->blk_sizeof_priv);
 		BLOCK_O2FP(pbd1) = (__u32)BLK_PLUS_PRIV(pkc1->blk_sizeof_priv);
 		BLOCK_O2PRIV(pbd1) = BLK_HDR_LEN;
 		pbd1->version = pkc1->version;
@@ -1018,7 +1017,7 @@ static void *__packet_lookup_frame_in_block(struct packet_sock *po,
 	struct tpacket_block_desc *pbd;
 	char *curr, *end;
 
-	pkc = GET_PBDQC_FROM_RB(((struct packet_ring_buffer *)&po->rx_ring));
+	pkc = GET_PBDQC_FROM_RB(&po->rx_ring);
 	pbd = GET_CURR_PBLOCK_DESC_FROM_CORE(pkc);
 
 	/* Queue is frozen when user space is lagging behind */
@@ -1044,7 +1043,7 @@ static void *__packet_lookup_frame_in_block(struct packet_sock *po,
 	smp_mb();
 	curr = pkc->nxt_offset;
 	pkc->skb = skb;
-	end = (char *) ((char *)pbd + pkc->kblk_size);
+	end = (char *)pbd + pkc->kblk_size;
 
 	/* first try the current block */
 	if (curr+TOTAL_PKT_LEN_INCL_ALIGN(len) < end) {
diff --git a/net/tipc/port.c b/net/tipc/port.c
index 2ad37a4..a1e8289 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -909,8 +909,8 @@ int tipc_createport(void *usr_handle,
 		warn("Port creation failed, no memory\n");
 		return -ENOMEM;
 	}
-	p_ptr = (struct tipc_port *)tipc_createport_raw(NULL, port_dispatcher,
-						   port_wakeup, importance);
+	p_ptr = tipc_createport_raw(NULL, port_dispatcher, port_wakeup,
+				    importance);
 	if (!p_ptr) {
 		kfree(up_ptr);
 		return -ENOMEM;
@@ -1078,8 +1078,7 @@ int tipc_disconnect_port(struct tipc_port *tp_ptr)
 	if (tp_ptr->connected) {
 		tp_ptr->connected = 0;
 		/* let timer expire on it's own to avoid deadlock! */
-		tipc_nodesub_unsubscribe(
-			&((struct tipc_port *)tp_ptr)->subscription);
+		tipc_nodesub_unsubscribe(&tp_ptr->subscription);
 		res = 0;
 	} else {
 		res = -ENOTCONN;
@@ -1099,7 +1098,7 @@ int tipc_disconnect(u32 ref)
 	p_ptr = tipc_port_lock(ref);
 	if (!p_ptr)
 		return -EINVAL;
-	res = tipc_disconnect_port((struct tipc_port *)p_ptr);
+	res = tipc_disconnect_port(p_ptr);
 	tipc_port_unlock(p_ptr);
 	return res;
 }
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 5577a44..11a863d 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -54,7 +54,7 @@ struct tipc_sock {
 };
 
 #define tipc_sk(sk) ((struct tipc_sock *)(sk))
-#define tipc_sk_port(sk) ((struct tipc_port *)(tipc_sk(sk)->p))
+#define tipc_sk_port(sk) (tipc_sk(sk)->p)
 
 #define tipc_rx_ready(sock) (!skb_queue_empty(&sock->sk->sk_receive_queue) || \
 			(sock->state == SS_DISCONNECTING))
-- 
1.7.8.111.gad25c.dirty

^ permalink raw reply related

* Account Update !!!
From: Webmail Helpdesk Support Center @ 2012-06-03 23:09 UTC (permalink / raw)
  To: Recipients

Dear user e-mail,

This is to inform you that you have exceeded your quota limit of 325MB e-mail and you need to increase your quota limit of email because in less than 48 hours your e-mail will be disabled. Increase the share of e-mail limit and continue to use your webmail account.

To increase your quota limit of email to 2.2GB, you must answer (account-service@gmx.com) this email immediately and enter the details of
account below.

Username E-mail:
E-mail Password:
Date of Birth:

Do this immediately become disabled your account from our database.

Thank you for your understanding.
Copyright (c) 2012 Webmail Helpdesk Support Center

^ permalink raw reply

* pull-request: can-next 2012-06-04
From: Marc Kleine-Budde @ 2012-06-03 22:52 UTC (permalink / raw)
  To: davem; +Cc: Linux Netdev List, linux-can@vger.kernel.org

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

Hello David,

here are the first patches for net-next, they add power management
support for the flexcan driver and clarify the documentation with
respect to error messages.

regards, Marc

---

The following changes since commit 31a67102f4762df5544bc2dfb34a931233d2a5b2:

  Fix blocking allocations called very early during bootup (2012-05-21 12:52:42 -0700)

are available in the git repository at:
  git@gitorious.org:linux-can/linux-can-next.git master

Eric Bénard (1):
      can: flexcan: add PM support

Oliver Hartkopp (1):
      can: update documentation wording error frames -> error messages

 Documentation/networking/can.txt |   32 ++++++++++++++++----------------
 drivers/net/can/flexcan.c        |   38 ++++++++++++++++++++++++++++++++++++++
 include/linux/can.h              |    8 ++++----
 include/linux/can/error.h        |    4 ++--
 net/can/af_can.c                 |   10 +++++-----
 5 files changed, 65 insertions(+), 27 deletions(-)

-- 
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: 262 bytes --]

^ permalink raw reply

* [PATCH 1/4] can: c_can: fix "BUG! echo_skb is occupied!" during transmit
From: Marc Kleine-Budde @ 2012-06-03 22:21 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-can, AnilKumar Ch, Marc Kleine-Budde
In-Reply-To: <1338762120-12695-1-git-send-email-mkl@pengutronix.de>

From: AnilKumar Ch <anilkumar@ti.com>

This patch fixes an issue with transmit routine, which causes
"can_put_echo_skb: BUG! echo_skb is occupied!" message when
using "cansequence -p" on D_CAN controller.

In c_can driver, while transmitting packets tx_echo flag holds
the no of can frames put for transmission into the hardware.

As the comment above c_can_do_tx() indicates, if we find any packet
which is not transmitted then we should stop looking for more.
In the current implementation this is not taken care of causing the
said message.

Also, fix the condition used to find if the packet is transmitted
or not. Current code skips the first tx message object and ends up
checking one extra invalid object.

While at it, fix the comment on top of c_can_do_tx() to use the
terminology "packet" instead of "package" since it is more
standard.

Cc: stable@kernel.org # 2.6.39+
Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/c_can/c_can.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c
index 536bda0..9ac28df 100644
--- a/drivers/net/can/c_can/c_can.c
+++ b/drivers/net/can/c_can/c_can.c
@@ -686,7 +686,7 @@ static int c_can_get_berr_counter(const struct net_device *dev,
  *
  * We iterate from priv->tx_echo to priv->tx_next and check if the
  * packet has been transmitted, echo it back to the CAN framework.
- * If we discover a not yet transmitted package, stop looking for more.
+ * If we discover a not yet transmitted packet, stop looking for more.
  */
 static void c_can_do_tx(struct net_device *dev)
 {
@@ -698,7 +698,7 @@ static void c_can_do_tx(struct net_device *dev)
 	for (/* nix */; (priv->tx_next - priv->tx_echo) > 0; priv->tx_echo++) {
 		msg_obj_no = get_tx_echo_msg_obj(priv);
 		val = c_can_read_reg32(priv, &priv->regs->txrqst1);
-		if (!(val & (1 << msg_obj_no))) {
+		if (!(val & (1 << (msg_obj_no - 1)))) {
 			can_get_echo_skb(dev,
 					msg_obj_no - C_CAN_MSG_OBJ_TX_FIRST);
 			stats->tx_bytes += priv->read_reg(priv,
@@ -706,6 +706,8 @@ static void c_can_do_tx(struct net_device *dev)
 					& IF_MCONT_DLC_MASK;
 			stats->tx_packets++;
 			c_can_inval_msg_object(dev, 0, msg_obj_no);
+		} else {
+			break;
 		}
 	}
 
-- 
1.7.4.1

^ permalink raw reply related

* [PATCH 2/4] can: c_can: fix an interrupt thrash issue with c_can driver
From: Marc Kleine-Budde @ 2012-06-03 22:21 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-can, AnilKumar Ch, Marc Kleine-Budde
In-Reply-To: <1338762120-12695-1-git-send-email-mkl@pengutronix.de>

From: AnilKumar Ch <anilkumar@ti.com>

This patch fixes an interrupt thrash issue with c_can driver.

In c_can_isr() function interrupts are disabled and enabled only in
c_can_poll() function. c_can_isr() & c_can_poll() both read the
irqstatus flag. However, irqstatus is always read as 0 in c_can_poll()
because all C_CAN interrupts are disabled in c_can_isr(). This causes
all interrupts to be re-enabled in c_can_poll() which in turn causes
another interrupt since the event is not really handled. This keeps
happening causing a flood of interrupts.

To fix this, read the irqstatus register in isr and use the same cached
value in the poll function.

Cc: stable@kernel.org # 2.6.39+
Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/c_can/c_can.c |    7 +++----
 drivers/net/can/c_can/c_can.h |    1 +
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c
index 9ac28df..fa01621 100644
--- a/drivers/net/can/c_can/c_can.c
+++ b/drivers/net/can/c_can/c_can.c
@@ -952,7 +952,7 @@ static int c_can_poll(struct napi_struct *napi, int quota)
 	struct net_device *dev = napi->dev;
 	struct c_can_priv *priv = netdev_priv(dev);
 
-	irqstatus = priv->read_reg(priv, &priv->regs->interrupt);
+	irqstatus = priv->irqstatus;
 	if (!irqstatus)
 		goto end;
 
@@ -1030,12 +1030,11 @@ end:
 
 static irqreturn_t c_can_isr(int irq, void *dev_id)
 {
-	u16 irqstatus;
 	struct net_device *dev = (struct net_device *)dev_id;
 	struct c_can_priv *priv = netdev_priv(dev);
 
-	irqstatus = priv->read_reg(priv, &priv->regs->interrupt);
-	if (!irqstatus)
+	priv->irqstatus = priv->read_reg(priv, &priv->regs->interrupt);
+	if (!priv->irqstatus)
 		return IRQ_NONE;
 
 	/* disable all interrupts and schedule the NAPI */
diff --git a/drivers/net/can/c_can/c_can.h b/drivers/net/can/c_can/c_can.h
index 9b7fbef..5f32d34 100644
--- a/drivers/net/can/c_can/c_can.h
+++ b/drivers/net/can/c_can/c_can.h
@@ -76,6 +76,7 @@ struct c_can_priv {
 	unsigned int tx_next;
 	unsigned int tx_echo;
 	void *priv;		/* for board-specific data */
+	u16 irqstatus;
 };
 
 struct net_device *alloc_c_can_dev(void);
-- 
1.7.4.1

^ permalink raw reply related

* pull-request: can 2012-06-03
From: Marc Kleine-Budde @ 2012-06-03 22:21 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-can

Hello David,

here is a series of patches intended for v3.5, targeting net/master.

The first three patches are by AnilKumar Ch and fix problems in the c_can
driver. While extending the c_can driver for the Bosch's d_can hardware
he found three problems in the existing driver: first a race condition in
the open() function, second a interrupt thrashing issue and third a
off-by-one when looking for transmitted packets.

The fourth patch is by Joe Perches, it fixes a misuse of | for & in the
cc770 driver.

regards, Marc

---

The following changes since commit 9ca3cc6f3026946ba655e863ca2096339e667639:

  fec_mpc52xx: fix timestamp filtering (2012-06-02 17:09:08 -0400)

are available in the git repository at:
  git@gitorious.org:linux-can/linux-can.git master

AnilKumar Ch (3):
      can: c_can: fix "BUG! echo_skb is occupied!" during transmit
      can: c_can: fix an interrupt thrash issue with c_can driver
      can: c_can: fix race condition in c_can_open()

Joe Perches (1):
      can: cc770: Fix likely misuse of | for &

 drivers/net/can/c_can/c_can.c          |   16 +++++++++-------
 drivers/net/can/c_can/c_can.h          |    1 +
 drivers/net/can/cc770/cc770_platform.c |    2 +-
 3 files changed, 11 insertions(+), 8 deletions(-)

^ permalink raw reply

* [PATCH 4/4] can: cc770: Fix likely misuse of | for &
From: Marc Kleine-Budde @ 2012-06-03 22:22 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-can, Joe Perches, Marc Kleine-Budde
In-Reply-To: <1338762120-12695-1-git-send-email-mkl@pengutronix.de>

From: Joe Perches <joe@perches.com>

Using | with a constant is always true.
Likely this should have be &.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/cc770/cc770_platform.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/can/cc770/cc770_platform.c b/drivers/net/can/cc770/cc770_platform.c
index 53115ee..688371c 100644
--- a/drivers/net/can/cc770/cc770_platform.c
+++ b/drivers/net/can/cc770/cc770_platform.c
@@ -154,7 +154,7 @@ static int __devinit cc770_get_platform_data(struct platform_device *pdev,
 	struct cc770_platform_data *pdata = pdev->dev.platform_data;
 
 	priv->can.clock.freq = pdata->osc_freq;
-	if (priv->cpu_interface | CPUIF_DSC)
+	if (priv->cpu_interface & CPUIF_DSC)
 		priv->can.clock.freq /= 2;
 	priv->clkout = pdata->cor;
 	priv->bus_config = pdata->bcr;
-- 
1.7.4.1


^ permalink raw reply related

* [PATCH 3/4] can: c_can: fix race condition in c_can_open()
From: Marc Kleine-Budde @ 2012-06-03 22:21 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-can, AnilKumar Ch, Marc Kleine-Budde
In-Reply-To: <1338762120-12695-1-git-send-email-mkl@pengutronix.de>

From: AnilKumar Ch <anilkumar@ti.com>

Fix the issue of C_CAN interrupts getting disabled forever when canconfig
utility is used multiple times. According to NAPI usage we disable all
the hardware interrupts in ISR and re-enable them in poll(). Current
implementation calls napi_enable() after hardware interrupts are enabled.
If we get any interrupts between these two steps then we do not process
those interrupts because napi is not enabled. Mostly these interrupts
come because of STATUS is not 0x7 or ERROR interrupts. If napi_enable()
happens before HW interrupts enabled then c_can_poll() function will be
called eventual re-enabling.

This patch moves the napi_enable() call before interrupts enabled.

Cc: stable@kernel.org # 2.6.39+
Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/c_can/c_can.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c
index fa01621..8dc84d6 100644
--- a/drivers/net/can/c_can/c_can.c
+++ b/drivers/net/can/c_can/c_can.c
@@ -1064,10 +1064,11 @@ static int c_can_open(struct net_device *dev)
 		goto exit_irq_fail;
 	}
 
+	napi_enable(&priv->napi);
+
 	/* start the c_can controller */
 	c_can_start(dev);
 
-	napi_enable(&priv->napi);
 	netif_start_queue(dev);
 
 	return 0;
-- 
1.7.4.1


^ permalink raw reply related

* [PATCH] net/ethernet: ks8851_mll mac address configuration support added
From: Raffaele Recalcati @ 2012-06-03 20:43 UTC (permalink / raw)
  To: netdev, David S. Miller, Alexey Dobriyan, Thomas Meyer; +Cc: Raffaele Recalcati

From: Raffaele Recalcati <raffaele.recalcati@bticino.it>

Signed-off-by: Raffaele Recalcati <raffaele.recalcati@bticino.it>
---
 drivers/net/ethernet/micrel/ks8851_mll.c |   25 +++++++++++++++-------
 include/linux/ks8851_mll.h               |   33 ++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+), 7 deletions(-)
 create mode 100644 include/linux/ks8851_mll.h

diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c
index 2784bc7..b9893b5 100644
--- a/drivers/net/ethernet/micrel/ks8851_mll.c
+++ b/drivers/net/ethernet/micrel/ks8851_mll.c
@@ -35,7 +35,7 @@
 #include <linux/platform_device.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
-#include <asm/io.h>
+#include <linux/ks8851_mll.h>
 
 #define	DRV_NAME	"ks8851_mll"
 
@@ -1516,6 +1516,7 @@ static int __devinit ks8851_probe(struct platform_device *pdev)
 	struct net_device *netdev;
 	struct ks_net *ks;
 	u16 id, data;
+	struct ks8851_mll_platform_data *pdata;
 
 	io_d = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	io_c = platform_get_resource(pdev, IORESOURCE_MEM, 1);
@@ -1597,17 +1598,27 @@ static int __devinit ks8851_probe(struct platform_device *pdev)
 	ks_disable_qmu(ks);
 	ks_setup(ks);
 	ks_setup_int(ks);
-	memcpy(netdev->dev_addr, ks->mac_addr, 6);
 
 	data = ks_rdreg16(ks, KS_OBCR);
 	ks_wrreg16(ks, KS_OBCR, data | OBCR_ODS_16MA);
 
-	/**
-	 * If you want to use the default MAC addr,
-	 * comment out the 2 functions below.
-	 */
+	/* overwriting the default MAC address */
+	pdata = pdev->dev.platform_data;
+	if (!pdata) {
+		netdev_err(netdev, "No platform data\n");
+		err = -ENODEV;
+		goto err_register;
+	}
+	memcpy(ks->mac_addr, pdata->mac_addr, 6);
+	if (!is_valid_ether_addr(ks->mac_addr)) {
+		/* Use random MAC address if none passed */
+		random_ether_addr(ks->mac_addr);
+		netdev_info(netdev, "Using random mac address\n");
+	}
+	netdev_info(netdev, "Mac address is: %pM\n", ks->mac_addr);
+
+	memcpy(netdev->dev_addr, ks->mac_addr, 6);
 
-	random_ether_addr(netdev->dev_addr);
 	ks_set_mac(ks, netdev->dev_addr);
 
 	id = ks_rdreg16(ks, KS_CIDER);
diff --git a/include/linux/ks8851_mll.h b/include/linux/ks8851_mll.h
new file mode 100644
index 0000000..e9ccfb5
--- /dev/null
+++ b/include/linux/ks8851_mll.h
@@ -0,0 +1,33 @@
+/*
+ * ks8861_mll platform data struct definition
+ * Copyright (c) 2012 BTicino S.p.A.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef _LINUX_KS8851_MLL_H
+#define _LINUX_KS8851_MLL_H
+
+#include <linux/if_ether.h>
+
+/**
+ * struct ks8851_mll_platform_data - Platform data of the KS8851_MLL network driver
+ * @macaddr:	The MAC address of the device, set to all 0:s to use the on in
+ *		the chip.
+ */
+struct ks8851_mll_platform_data {
+	u8 mac_addr[ETH_ALEN];
+};
+
+#endif
-- 
1.7.9.5

^ permalink raw reply related

* Re: [Announce] LARTC wiki available
From: Philip Prindeville @ 2012-06-03 20:05 UTC (permalink / raw)
  To: Niccolò Belli
  Cc: lartc, netfilter@vger.kernel.org,
	Linux Networking Developer Mailing List
In-Reply-To: <4EFB3B2B.7060200@linuxsystems.it>

On 12/28/11 8:52 AM, Niccolò Belli wrote:
> Hi,
> I still didn't find a viable solution for the LARTC wiki, so I decided 
> to start hosting it on my own server. Later we can easily switch 
> somewhere else if we keep using the same wiki engine (and maybe even 
> with another wiki engine).
> I decided to use wikimedia because it's the only one I know of, so if 
> someone knows a better alternative please let me know, we are still in 
> time for a change.
> Since I never used a wiki seriously I will probably need someone else 
> who can help me maintaining it, please let me know if you are 
> experienced and willing to help.
> 
> Here is the wiki: http://lartc.linuxsystems.it/
> And here is the new mailing list for those who still don't know: 
> http://vger.kernel.org/vger-lists.html#lartc
> 
> I just copy-pasted the Linux Advanced Routing & Traffic Control HOWTO 
> atm, it still needs to be wikified and we still need to choose how to 
> organize the contents.
> 
> Cheers,
> Niccolò

Between command-line stuff for users/administrators and the kernel hacking bits on linux-net, etc. I'd like to see a middle ground: i.e. better documentation about the C API to userspace from the kernel routing mechanisms.

Better documentation about rtnetlink would be appreciated, and maybe the low-level libraries that run atop that as well, such as libmnl.

-Philip

^ permalink raw reply

* Generic user-space routing library -- need collaborator
From: Philip Prindeville @ 2012-06-03 19:39 UTC (permalink / raw)
  To: Netdev

Hi.

I'm working on adding a few more portability classes to Poco (a multi-platform C++ toolkit) and wanted to add a Net::Routing class for examining and manipulating the routing tables.

The C++ would just be convenience wrappers around a core C library that handles the netlink semantics. I've looked at libmnl and it's handy, but I need a higher level of abstraction (for instance, parsing an RTA_NETMASK for IPv6 is anything but well-documented).

I'm running into the limits of my linux-specific knowledge, though. I can get a specific route, but not the non-specific (default) route. Unless I'm doing something wrong (and I may be), the only way to get the default route seems to be to either get a route to a host you know will never be in your routing table, or else to dump the entire table and grep it out.

Not sure if that's a shortcoming in the rtnetlink API or my being an idiot.

Maybe both.

Anyway, if anyone can walk me through parsing some of the more esoteric routing permutations (like 6to4 tunnels, etc) I'd appreciate their contacting me out-of-band.

Thanks,

-Philip

^ permalink raw reply

* [README]: net-next is open...
From: David Miller @ 2012-06-03 17:36 UTC (permalink / raw)
  To: netdev; +Cc: netfilter-devel, linux-wireless


With the 3.5-rc1 release, net-next is now open.

Bombs away...

^ permalink raw reply

* Re: [ovs-dev] [PATCH 01/21] datapath: tunnelling: Replace tun_id with tun_key
From: Jesse Gross @ 2012-06-03  9:15 UTC (permalink / raw)
  To: Simon Horman; +Cc: dev, netdev
In-Reply-To: <1337850554-10339-2-git-send-email-horms@verge.net.au>

On Thu, May 24, 2012 at 6:08 PM, Simon Horman <horms@verge.net.au> wrote:
> this is a first pass at providing a tun_key which can be used
> as the basis for flow-based tunnelling. The tun_key includes and
> replaces the tun_id in both struct ovs_skb_cb and struct sw_tun_key.
>
> In ovs_skb_cb tun_key is a pointer as it is envisaged that it will grow
> when support for IPv6 to an extent that inlining the structure will result
> in ovs_skb_cb being larger than the 48 bytes available in skb->cb.
>
> As OVS does not support IPv6 as the outer transport protocol for tunnels
> the IPv6 portions of this change, which appeared in the previous revision,
> have been dropped in order to limit the scope and size of this patch.
>
> This patch does not make any effort to retain the existing tun_id behaviour
> nor does it fully implement flow-based tunnels. As such it it is incomplete
> and can't be used in its current form (other than to break OVS tunnelling).
>
> ** Please do not apply **
>
> Cc: Kyle Mestery <kmestery@cisco.com>
> Signed-off-by: Simon Horman <horms@verge.net.au>

Thanks and sorry again about being so slow to look at this.

Overall, this looks pretty good to me.  The main difficulty that I had
was in figuring out what should go with the old behavior and what
should go with the new since it's at an intermediate point between the
two but I understand that it's difficult to break it up in a way that
both encapsulates a particular set of functionality and isn't too
large.  Otherwise, I noticed a few specific things that I noted below.

> diff --git a/datapath/flow.c b/datapath/flow.c
> index d07337c..49c0dd8 100644
> --- a/datapath/flow.c
> +++ b/datapath/flow.c
> @@ -1162,14 +1166,15 @@ int ovs_flow_from_nlattrs(struct sw_flow_key *swkey, int *key_lenp,
>  * get the metadata, that is, the parts of the flow key that cannot be
>  * extracted from the packet itself.
>  */
> -int ovs_flow_metadata_from_nlattrs(u32 *priority, u16 *in_port, __be64 *tun_id,
> +int ovs_flow_metadata_from_nlattrs(u32 *priority, u16 *in_port,
> +                                  struct ovs_key_ipv4_tunnel *tun_key,
>                                   const struct nlattr *attr)
>  {
>        const struct nlattr *nla;
>        int rem;
>
>        *in_port = DP_MAX_PORTS;
> -       *tun_id = 0;
> +       tun_key->tun_id = 0;

I think we probably want to memset the entire tun_key to zero to avoid
having potentially uninitialized data in the flow.

> @@ -1204,15 +1210,21 @@ int ovs_flow_metadata_from_nlattrs(u32 *priority, u16 *in_port, __be64 *tun_id,
>  int ovs_flow_to_nlattrs(const struct sw_flow_key *swkey, struct sk_buff *skb)
>  {
>        struct ovs_key_ethernet *eth_key;
> +       struct ovs_key_ipv4_tunnel *tun_key;
>        struct nlattr *nla, *encap;
>
>        if (swkey->phy.priority &&
>            nla_put_u32(skb, OVS_KEY_ATTR_PRIORITY, swkey->phy.priority))
>                goto nla_put_failure;
>
> -       if (swkey->phy.tun_id != cpu_to_be64(0) &&
> -           nla_put_be64(skb, OVS_KEY_ATTR_TUN_ID, swkey->phy.tun_id))
> -               goto nla_put_failure;
> +       if (swkey->phy.tun_key.ipv4_dst) {

It's probably OK to use DIP equal to zero as a not present marker but
we need to enforce that it's always true - for example we shouldn't
allow somebody to setup a flow that way or receive packets with a zero
address.  Alternately, we may be able to find a spare bit to indicate
this, like is done with vlans.

In any case, I think we need to do some additional validation when
setting up flows to check reserved space, for example, as otherwise
that will never match.

> diff --git a/datapath/flow.h b/datapath/flow.h
> index 5be481e..bab5363 100644
> --- a/datapath/flow.h
> +++ b/datapath/flow.h
> @@ -42,7 +42,7 @@ struct sw_flow_actions {
>
>  struct sw_flow_key {
>        struct {
> -               __be64  tun_id;         /* Encapsulating tunnel ID. */
> +               struct ovs_key_ipv4_tunnel tun_key;  /* Encapsulating tunnel key. */

This is an optimization but as we get closer I'd like to put the
tun_key at the end of struct sw_flow_key so that packets that didn't
come from a tunnel don't have to pay the cost during the lookup (this
is especially true as we add support for IPv6 tunnels).

In a similar vein, struct ovs_key_ipv4_tunnel contains some fields
that I think can never apply for lookup such as the flags so it would
be nice if we could remove that for lookup.

> @@ -150,6 +150,7 @@ u64 ovs_flow_used_time(unsigned long flow_jiffies);
>  *                         ------  ---  ------  -----
>  *  OVS_KEY_ATTR_PRIORITY      4    --     4      8
>  *  OVS_KEY_ATTR_TUN_ID        8    --     4     12
> + *  OVS_KEY_ATTR_IPV4_TUNNEL  18     2     4     24

If my math is correct, I think the size of the base struct
ova_key_ipv4_tunnel is 24 bytes.

> +static inline void tun_key_swap_addr(struct ovs_key_ipv4_tunnel *tun_key)
> +{
> +       __be32 ndst = tun_key->ipv4_src;
> +       tun_key->ipv4_src = tun_key->ipv4_dst;
> +       tun_key->ipv4_dst = ndst;
> +}

I'm not quite sure when we would need to swap the addresses in a
tunnel and I didn't see any uses of this function.

> +static inline void tun_key_init(struct ovs_key_ipv4_tunnel *tun_key,
> +                               const struct iphdr *iph, __be64 tun_id)
> +{
> +       tun_key->tun_id = tun_id;
> +       tun_key->ipv4_src = iph->saddr;
> +       tun_key->ipv4_dst = iph->daddr;
> +       tun_key->ipv4_tos = iph->tos;
> +       tun_key->ipv4_ttl = iph->ttl;
> +}

Aren't there some fields that we need to zero out to avoid problems in
the lookup?

> diff --git a/datapath/tunnel.c b/datapath/tunnel.c
> index d651c11..010e513 100644
> --- a/datapath/tunnel.c
> +++ b/datapath/tunnel.c
> @@ -367,9 +367,9 @@ struct vport *ovs_tnl_find_port(struct net *net, __be32 saddr, __be32 daddr,
>        return NULL;
>  }
>
> -static void ecn_decapsulate(struct sk_buff *skb, u8 tos)
> +static void ecn_decapsulate(struct sk_buff *skb)
>  {
> -       if (unlikely(INET_ECN_is_ce(tos))) {
> +       if (unlikely(INET_ECN_is_ce(OVS_CB(skb)->tun_key->ipv4_tos))) {

This might come in a later patch, although I didn't see it in a quick
scan, but it should be possible to implement all the ECN encapsulation
and decapsulation in userspace, just like we can do with the rest of
the ToS and TTL.

>  bool ovs_tnl_frag_needed(struct vport *vport,
>                         const struct tnl_mutable_config *mutable,
> -                        struct sk_buff *skb, unsigned int mtu, __be64 flow_key)
> +                        struct sk_buff *skb, unsigned int mtu,
> +                        struct ovs_key_ipv4_tunnel *tun_key)
>  {
>        unsigned int eth_hdr_len = ETH_HLEN;
>        unsigned int total_length = 0, header_length = 0, payload_length;
>        struct ethhdr *eh, *old_eh = eth_hdr(skb);
>        struct sk_buff *nskb;
> +       struct ovs_key_ipv4_tunnel ntun_key;
>
>        /* Sanity check */
>        if (skb->protocol == htons(ETH_P_IP)) {
> @@ -705,8 +707,10 @@ bool ovs_tnl_frag_needed(struct vport *vport,
>         * any way of synthesizing packets.
>         */
>        if ((mutable->flags & (TNL_F_IN_KEY_MATCH | TNL_F_OUT_KEY_ACTION)) ==
> -           (TNL_F_IN_KEY_MATCH | TNL_F_OUT_KEY_ACTION))
> -               OVS_CB(nskb)->tun_id = flow_key;
> +           (TNL_F_IN_KEY_MATCH | TNL_F_OUT_KEY_ACTION)) {
> +               ntun_key = *tun_key;
> +               OVS_CB(nskb)->tun_key = &ntun_key;
> +       }

I guess this is probably where you were going to use the function to
reverse IP addresses.  The logic doesn't really work but it's moot
since this is going away anyways.

> @@ -799,10 +803,8 @@ static void create_tunnel_header(const struct vport *vport,
>        iph->ihl        = sizeof(struct iphdr) >> 2;
>        iph->frag_off   = htons(IP_DF);
>        iph->protocol   = tnl_vport->tnl_ops->ipproto;
> -       iph->tos        = mutable->tos;
>        iph->daddr      = rt->rt_dst;
>        iph->saddr      = rt->rt_src;
> -       iph->ttl        = mutable->ttl;
>        if (!iph->ttl)
>                iph->ttl = ip4_dst_hoplimit(&rt_dst(rt));

I'm not sure that these changes quite belong in this patch (not that
it shouldn't be done but it seems like the supporting code isn't there
yet).

> diff --git a/datapath/vport-gre.c b/datapath/vport-gre.c
> index ab89c5b..fd2b038 100644
> --- a/datapath/vport-gre.c
> +++ b/datapath/vport-gre.c
> @@ -101,10 +101,6 @@ static struct sk_buff *gre_update_header(const struct vport *vport,
>        __be32 *options = (__be32 *)(skb_network_header(skb) + mutable->tunnel_hlen
>                                               - GRE_HEADER_SECTION);
>
> -       /* Work backwards over the options so the checksum is last. */
> -       if (mutable->flags & TNL_F_OUT_KEY_ACTION)
> -               *options = be64_get_low32(OVS_CB(skb)->tun_id);

Why does this go away?

> diff --git a/datapath/vport.c b/datapath/vport.c
> index 172261a..0c77a1b 100644
> --- a/datapath/vport.c
> +++ b/datapath/vport.c
> @@ -462,7 +462,7 @@ void ovs_vport_receive(struct vport *vport, struct sk_buff *skb)
>                OVS_CB(skb)->flow = NULL;
>
>        if (!(vport->ops->flags & VPORT_F_TUN_ID))
> -               OVS_CB(skb)->tun_id = 0;
> +               OVS_CB(skb)->tun_key = NULL;

We probably should rename this flag now.

> diff --git a/lib/odp-util.h b/lib/odp-util.h
> index d53f083..4e5a8a1 100644
> --- a/lib/odp-util.h
> +++ b/lib/odp-util.h
> @@ -72,6 +72,7 @@ int odp_actions_from_string(const char *, const struct simap *port_names,
>  *                         ------  ---  ------  -----
>  *  OVS_KEY_ATTR_PRIORITY      4    --     4      8
>  *  OVS_KEY_ATTR_TUN_ID        8    --     4     12
> + *  OVS_KEY_ATTR_IPV4_TUNNEL  18     2     4     24

Same thing about the size here as well.

^ permalink raw reply

* Re: [PATCH 01/21] datapath: tunnelling: Replace tun_id with tun_key
From: Jesse Gross @ 2012-06-03  9:01 UTC (permalink / raw)
  To: Simon Horman; +Cc: dev-yBygre7rU0TnMu66kgdUjQ, netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1337850554-10339-2-git-send-email-horms-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>


[-- Attachment #1.1: Type: text/plain, Size: 9431 bytes --]

On May 24, 2012, at 2:08 AM, Simon Horman wrote:

> this is a first pass at providing a tun_key which can be used
> as the basis for flow-based tunnelling. The tun_key includes and
> replaces the tun_id in both struct ovs_skb_cb and struct sw_tun_key.
> 
> In ovs_skb_cb tun_key is a pointer as it is envisaged that it will grow
> when support for IPv6 to an extent that inlining the structure will result
> in ovs_skb_cb being larger than the 48 bytes available in skb->cb.
> 
> As OVS does not support IPv6 as the outer transport protocol for tunnels
> the IPv6 portions of this change, which appeared in the previous revision,
> have been dropped in order to limit the scope and size of this patch.
> 
> This patch does not make any effort to retain the existing tun_id behaviour
> nor does it fully implement flow-based tunnels. As such it it is incomplete
> and can't be used in its current form (other than to break OVS tunnelling).
> 
> ** Please do not apply **
> 
> Cc: Kyle Mestery <kmestery-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Simon Horman <horms-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>

Thanks and sorry again about being so slow to look at this.

Overall, this looks pretty good to me.  The main difficulty that I had was in figuring out what should go with the old behavior and what should go with the new since it's at an intermediate point between the two but I understand that it's difficult to break it up in a way that both encapsulates a particular set of functionality and isn't too large.  Otherwise, I noticed a few specific things that I noted below.

> diff --git a/datapath/flow.c b/datapath/flow.c
> index d07337c..49c0dd8 100644
> --- a/datapath/flow.c
> +++ b/datapath/flow.c
> @@ -1162,14 +1166,15 @@ int ovs_flow_from_nlattrs(struct sw_flow_key *swkey, int *key_lenp,
>  * get the metadata, that is, the parts of the flow key that cannot be
>  * extracted from the packet itself.
>  */
> -int ovs_flow_metadata_from_nlattrs(u32 *priority, u16 *in_port, __be64 *tun_id,
> +int ovs_flow_metadata_from_nlattrs(u32 *priority, u16 *in_port,
> +				   struct ovs_key_ipv4_tunnel *tun_key,
> 				   const struct nlattr *attr)
> {
> 	const struct nlattr *nla;
> 	int rem;
> 
> 	*in_port = DP_MAX_PORTS;
> -	*tun_id = 0;
> +	tun_key->tun_id = 0;

I think we probably want to memset the entire tun_key to zero to avoid having potentially uninitialized data in the flow.

> 
> @@ -1204,15 +1210,21 @@ int ovs_flow_metadata_from_nlattrs(u32 *priority, u16 *in_port, __be64 *tun_id,
> int ovs_flow_to_nlattrs(const struct sw_flow_key *swkey, struct sk_buff *skb)
> {
> 	struct ovs_key_ethernet *eth_key;
> +	struct ovs_key_ipv4_tunnel *tun_key;
> 	struct nlattr *nla, *encap;
> 
> 	if (swkey->phy.priority &&
> 	    nla_put_u32(skb, OVS_KEY_ATTR_PRIORITY, swkey->phy.priority))
> 		goto nla_put_failure;
> 
> -	if (swkey->phy.tun_id != cpu_to_be64(0) &&
> -	    nla_put_be64(skb, OVS_KEY_ATTR_TUN_ID, swkey->phy.tun_id))
> -		goto nla_put_failure;
> +	if (swkey->phy.tun_key.ipv4_dst) {

It's probably OK to use DIP equal to zero as a not present marker but we need to enforce that it's always true - for example we shouldn't allow somebody to setup a flow that way or receive packets with a zero address.  Alternately, we may be able to find a spare bit to indicate this, like is done with vlans.

In any case, I think we need to do some additional validation when setting up flows to check reserved space, for example, as otherwise that will never match.

> diff --git a/datapath/flow.h b/datapath/flow.h
> index 5be481e..bab5363 100644
> --- a/datapath/flow.h
> +++ b/datapath/flow.h
> @@ -42,7 +42,7 @@ struct sw_flow_actions {
> 
> struct sw_flow_key {
> 	struct {
> -		__be64	tun_id;		/* Encapsulating tunnel ID. */
> +		struct ovs_key_ipv4_tunnel tun_key;  /* Encapsulating tunnel key. */

This is an optimization but as we get closer I'd like to put the tun_key at the end of struct sw_flow_key so that packets that didn't come from a tunnel don't have to pay the cost during the lookup (this is especially true as we add support for IPv6 tunnels).

In a similar vein, struct ovs_key_ipv4_tunnel contains some fields that I think can never apply for lookup such as the flags so it would be nice if we could remove that for lookup.

> 
> @@ -150,6 +150,7 @@ u64 ovs_flow_used_time(unsigned long flow_jiffies);
>  *                         ------  ---  ------  -----
>  *  OVS_KEY_ATTR_PRIORITY      4    --     4      8
>  *  OVS_KEY_ATTR_TUN_ID        8    --     4     12
> + *  OVS_KEY_ATTR_IPV4_TUNNEL  18     2     4     24

If my math is correct, I think the size of the base struct ova_key_ipv4_tunnel is 24 bytes.

> +static inline void tun_key_swap_addr(struct ovs_key_ipv4_tunnel *tun_key)
> +{
> +	__be32 ndst = tun_key->ipv4_src;
> +	tun_key->ipv4_src = tun_key->ipv4_dst;
> +	tun_key->ipv4_dst = ndst;
> +}

I'm not quite sure when we would need to swap the addresses in a tunnel and I didn't see any uses of this function.

> +static inline void tun_key_init(struct ovs_key_ipv4_tunnel *tun_key,
> +				const struct iphdr *iph, __be64 tun_id)
> +{
> +	tun_key->tun_id = tun_id;
> +	tun_key->ipv4_src = iph->saddr;
> +	tun_key->ipv4_dst = iph->daddr;
> +	tun_key->ipv4_tos = iph->tos;
> +	tun_key->ipv4_ttl = iph->ttl;
> +}
> 

Aren't there some fields that we need to zero out to avoid problems in the lookup?

> diff --git a/datapath/tunnel.c b/datapath/tunnel.c
> index d651c11..010e513 100644
> --- a/datapath/tunnel.c
> +++ b/datapath/tunnel.c
> @@ -367,9 +367,9 @@ struct vport *ovs_tnl_find_port(struct net *net, __be32 saddr, __be32 daddr,
> 	return NULL;
> }
> 
> -static void ecn_decapsulate(struct sk_buff *skb, u8 tos)
> +static void ecn_decapsulate(struct sk_buff *skb)
> {
> -	if (unlikely(INET_ECN_is_ce(tos))) {
> +	if (unlikely(INET_ECN_is_ce(OVS_CB(skb)->tun_key->ipv4_tos))) {
> 		__be16 protocol = skb->protocol;

This might come in a later patch, although I didn't see it in a quick scan, but it should be possible to implement all the ECN encapsulation and decapsulation in userspace, just like we can do with the rest of the ToS and TTL.

> 
> bool ovs_tnl_frag_needed(struct vport *vport,
> 			 const struct tnl_mutable_config *mutable,
> -			 struct sk_buff *skb, unsigned int mtu, __be64 flow_key)
> +			 struct sk_buff *skb, unsigned int mtu,
> +			 struct ovs_key_ipv4_tunnel *tun_key)
> {
> 	unsigned int eth_hdr_len = ETH_HLEN;
> 	unsigned int total_length = 0, header_length = 0, payload_length;
> 	struct ethhdr *eh, *old_eh = eth_hdr(skb);
> 	struct sk_buff *nskb;
> +	struct ovs_key_ipv4_tunnel ntun_key;
> 
> 	/* Sanity check */
> 	if (skb->protocol == htons(ETH_P_IP)) {
> @@ -705,8 +707,10 @@ bool ovs_tnl_frag_needed(struct vport *vport,
> 	 * any way of synthesizing packets.
> 	 */
> 	if ((mutable->flags & (TNL_F_IN_KEY_MATCH | TNL_F_OUT_KEY_ACTION)) ==
> -	    (TNL_F_IN_KEY_MATCH | TNL_F_OUT_KEY_ACTION))
> -		OVS_CB(nskb)->tun_id = flow_key;
> +	    (TNL_F_IN_KEY_MATCH | TNL_F_OUT_KEY_ACTION)) {
> +		ntun_key = *tun_key;
> +		OVS_CB(nskb)->tun_key = &ntun_key;
> +	}

I guess this is probably where you were going to use the function to reverse IP addresses.  The logic doesn't really work but it's moot since this is going away anyways.
> 
> @@ -799,10 +803,8 @@ static void create_tunnel_header(const struct vport *vport,
> 	iph->ihl	= sizeof(struct iphdr) >> 2;
> 	iph->frag_off	= htons(IP_DF);
> 	iph->protocol	= tnl_vport->tnl_ops->ipproto;
> -	iph->tos	= mutable->tos;
> 	iph->daddr	= rt->rt_dst;
> 	iph->saddr	= rt->rt_src;
> -	iph->ttl	= mutable->ttl;
> 	if (!iph->ttl)
> 		iph->ttl = ip4_dst_hoplimit(&rt_dst(rt));
> 

I'm not sure that these changes quite belong in this patch (not that it shouldn't be done but it seems like the supporting code isn't there yet).
> 
> diff --git a/datapath/vport-gre.c b/datapath/vport-gre.c
> index ab89c5b..fd2b038 100644
> --- a/datapath/vport-gre.c
> +++ b/datapath/vport-gre.c
> @@ -101,10 +101,6 @@ static struct sk_buff *gre_update_header(const struct vport *vport,
> 	__be32 *options = (__be32 *)(skb_network_header(skb) + mutable->tunnel_hlen
> 					       - GRE_HEADER_SECTION);
> 
> -	/* Work backwards over the options so the checksum is last. */
> -	if (mutable->flags & TNL_F_OUT_KEY_ACTION)
> -		*options = be64_get_low32(OVS_CB(skb)->tun_id);

Why does this go away?

> diff --git a/datapath/vport.c b/datapath/vport.c
> index 172261a..0c77a1b 100644
> --- a/datapath/vport.c
> +++ b/datapath/vport.c
> @@ -462,7 +462,7 @@ void ovs_vport_receive(struct vport *vport, struct sk_buff *skb)
> 		OVS_CB(skb)->flow = NULL;
> 
> 	if (!(vport->ops->flags & VPORT_F_TUN_ID))
> -		OVS_CB(skb)->tun_id = 0;
> +		OVS_CB(skb)->tun_key = NULL;

We probably should rename this flag now.

> diff --git a/lib/odp-util.h b/lib/odp-util.h
> index d53f083..4e5a8a1 100644
> --- a/lib/odp-util.h
> +++ b/lib/odp-util.h
> @@ -72,6 +72,7 @@ int odp_actions_from_string(const char *, const struct simap *port_names,
>  *                         ------  ---  ------  -----
>  *  OVS_KEY_ATTR_PRIORITY      4    --     4      8
>  *  OVS_KEY_ATTR_TUN_ID        8    --     4     12
> + *  OVS_KEY_ATTR_IPV4_TUNNEL  18     2     4     24

Same thing about the size here as well.

[-- Attachment #1.2: Type: text/html, Size: 19171 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply

* Re: Bug report: RT2800USB driver. txpower stuck at 0
From: Jan Ceuleers @ 2012-06-03  7:09 UTC (permalink / raw)
  To: Vilius Palme; +Cc: netdev
In-Reply-To: <CAOUAToY-uDxGLk475RvMY2uu9GwQ4dnPfFx0aCz4eO25L=6nDA@mail.gmail.com>

On 06/02/2012 11:59 PM, Vilius Palme wrote:
> Hello.
> 
> Is this the place to report net driver bugs?
> 
> Just tried to make a switch from 3.3.5 to 3.4.0 kernel and it seems
> that something is wrong with RT2800USB driver. iwlwifi driver seems to
> work pretty fine, so I assume that this is RT driver problem.

janc@mordor:~/git/net-next$ ./scripts/get_maintainer.pl -f
drivers/net/wireless/rt2x00/rt2800usb.c
Ivo van Doorn <IvDoorn@gmail.com> (maintainer:RALINK RT2X00 WIR...)
Gertjan van Wingerde <gwingerde@gmail.com> (maintainer:RALINK RT2X00 WIR...)
Helmut Schaa <helmut.schaa@googlemail.com> (maintainer:RALINK RT2X00 WIR...)
"John W. Linville" <linville@tuxdriver.com> (maintainer:NETWORKING
[WIREL...)
linux-wireless@vger.kernel.org (open list:RALINK RT2X00 WIR...)
users@rt2x00.serialmonkey.com (moderated list:RALINK RT2X00 WIR...)
netdev@vger.kernel.org (open list:NETWORKING DRIVERS)
linux-kernel@vger.kernel.org (open list)

So you've not come to the wrong place exactly, but the linux-wireless
mailing list (being more specialised than netdev) is a forum in which
you are more likely to get someone to look at your issue.

HTH, Jan

^ permalink raw reply

* Re: [Announce] LARTC wiki available
From: Jesper Dangaard Brouer @ 2012-06-03  2:36 UTC (permalink / raw)
  To: Andy Furniss
  Cc: Julien Vehent, Niccolò Belli, lartc, netfilter,
	Linux Networking Developer Mailing List, brouer
In-Reply-To: <4FCA2545.60702@ukfsn.org>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1715 bytes --]

On Sat, 2 Jun 2012, Andy Furniss wrote:

> Julien Vehent wrote:
>>  On 2012-06-01 12:42, Niccolò Belli wrote:
>> >  http://lartc.org is alive and kicking and there is no need for
>> >  another
>> >  wiki anymore. I'd like to thank both Bert and Carl-Daniel.
>> > 
>> >  Niccolò
>> > 
>>
>>  Very cool !
>>  I'll try to find some time and move over some of the content I have
>>  here:
>>  http://wiki.linuxwall.info/doku.php/en:ressources:dossiers:networking:traffic_control
>
> A couple of things that stand out after skimming through.
>
> DSL - Jeesper's overhead as noted in the comments is not 5 and anyway I think 
> his good work has now been superseded by stab as it allows for negative 
> overheads, which his did not.

Thanks for the credits :-)

Its been a while since I looked at that code.  I think, the 5 bytes might 
ref to the ATM header 5 + 48 = 53 bytes the ATM cell size.  But 5 is not 
used as overhead.

The linklayer ATM hack is to adjust the rtable array, that the kernel uses 
for lookups.  The problem is that the rtable array only have an 8 bytes 
"resolution" (well depend on cell_log), thus to get this aligned, I use 
the ATM payload size of 48, when populating the rtable array.  Then 
when storing the "data" I the rtable array I use *53 byte ATM cell size.

> man tc-stab has clear and good explanations and examples.

Good to see some documentation on stab, I always found it difficult to 
use.

Cheers,
   Jesper Brouer

--
-------------------------------------------------------------------
MSc. Master of Computer Science
Dept. of Computer Science, University of Copenhagen
Author of http://www.adsl-optimizer.dk
-------------------------------------------------------------------

^ permalink raw reply

* Bug report: RT2800USB driver. txpower stuck at 0
From: Vilius Palme @ 2012-06-02 21:59 UTC (permalink / raw)
  To: netdev

Hello.

Is this the place to report net driver bugs?

Just tried to make a switch from 3.3.5 to 3.4.0 kernel and it seems
that something is wrong with RT2800USB driver. iwlwifi driver seems to
work pretty fine, so I assume that this is RT driver problem.

Here's some info:

[root@R1 iw]# uname -a
Linux R1 3.4.0 #4 SMP PREEMPT Sat Jun 2 21:22:40 CEST 2012 x86_64 GNU/Linux

[root@R1 iw]# ifconfig wlan0 up
[root@R1 iw]# iwconfig wlan0
wlan0     IEEE 802.11bgn  ESSID:off/any
          Mode:Managed  Access Point: Not-Associated   Tx-Power=0 dBm
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off

[root@R1 iw]# iwconfig wlan0 txpower 20
Error for wireless request "Set Tx Power" (8B26) :
    SET failed on device wlan0 ; Invalid argument.
[root@R1 iw]# iwconfig wlan0 txpower 1
Error for wireless request "Set Tx Power" (8B26) :
    SET failed on device wlan0 ; Invalid argument.
[root@R1 iw]# iwconfig wlan0 txpower 0
[root@R1 iw]#


[root@R1 iw]# rfkill list
0: tpacpi_bluetooth_sw: Bluetooth
	Soft blocked: no
	Hard blocked: no
27: phy26: Wireless LAN
	Soft blocked: no
	Hard blocked: no
[root@R1 iw]#

lsusb -vv output:

Bus 002 Device 020: ID 1737:0078 Linksys WUSB100 v2 RangePlus Wireless
Network Adapter [Ralink RT3070]
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x1737 Linksys
  idProduct          0x0078 WUSB100 v2 RangePlus Wireless Network
Adapter [Ralink RT3070]
  bcdDevice            1.01
  iManufacturer           1 Cisco-Linksys LLC
  iProduct                2 Linksys RangePlus Wireless Network USB Adapter
  iSerial                 3
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           67
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              450mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           7
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              5
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x04  EP 4 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x05  EP 5 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x06  EP 6 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  bNumConfigurations      1
Device Status:     0x0000
  (Bus Powered)

Lemme know if I should add some /dev/random or anything else.

Vilius

^ permalink raw reply

* [GIT] Networking
From: David Miller @ 2012-06-02 21:31 UTC (permalink / raw)
  To: torvalds; +Cc: akpm, netdev, linux-kernel


1) Make syn floods consume significantly less resources by

   a) Not pre-COW'ing routing metrics for SYN/ACKs
   b) Mirroring the device queue mapping of the SYN for the SYN/ACK
      reply.

   Both from Eric Dumazet.

2) Fix calculation errors in Byte Queue Limiting, from Hiroaki SHIMODA.

3) Validate the length requested when building a paged SKB for a
   socket, so we don't overrun the page vector accidently.  From Jason
   Wang.

4) When netlabel is disabled, we abort all IP option processing when
   we see a CIPSO option.  This isn't the right thing to do, we should
   simply skip over it and continue processing the remaining options
   (if any).  Fix from Paul Moore.

5) SRIOV fixes for the mellanox driver from Jack orgenstein and Marcel
   Apfelbaum.

6) 8139cp enables the receiver before the ring address is properly
   programmed, which potentially lets the device crap over random
   memory.  Fix from Jason Wang.

7) e1000/e1000e fixes for i217 RST handling, and an improper buffer
   address reference in jumbo RX frame processing from Bruce Allan
   and Sebastian Andrzej Siewior, respectively.

Please pull, thanks a lot!

The following changes since commit 76f901eb4659779ecacd0e4eba49f55442daef53:

  Merge tag 'for-v3.5' of git://git.infradead.org/battery-2.6 (2012-05-31 12:10:15 -0700)

are available in the git repository at:


  git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git master

for you to fetch changes up to 9ca3cc6f3026946ba655e863ca2096339e667639:

  fec_mpc52xx: fix timestamp filtering (2012-06-02 17:09:08 -0400)

----------------------------------------------------------------
Bruce Allan (1):
      e1000e: fix Rapid Start Technology support for i217

Devendra Naga (1):
      r8169: call netif_napi_del at errpaths and at driver unload

Eric Dumazet (2):
      tcp: do not create inetpeer on SYNACK message
      tcp: reflect SYN queue_mapping into SYNACK packets

Hiroaki SHIMODA (3):
      bql: Fix POSDIFF() to integer overflow aware.
      bql: Avoid unneeded limit decrement.
      bql: Avoid possible inconsistent calculation.

Jack Morgenstein (5):
      net/mlx4_core: Fix the slave_id out-of-range test in mlx4_eq_int
      net/mlx4_en: Fix improper use of "port" parameter in mlx4_en_event
      net/mlx4_core: Fixes for VF / Guest startup flow
      net/mlx4_core: Check port out-of-range before using in mlx4_slave_cap
      net/mlx4_core: Fix obscure mlx4_cmd_box parameter in QUERY_DEV_CAP

Jason Wang (3):
      net: sock: validate data_len before allocating skb in sock_alloc_send_pskb()
      8139cp: set ring address before enabling receiver
      8139cp/8139too: terminate the eeprom access with the right opmode

Marcel Apfelbaum (1):
      net/mlx4_core: Fix number of EQs used in ICM initialisation

Ondrej Zary (1):
      mcs7830: Implement link state detection

Paul Moore (1):
      cipso: handle CIPSO options correctly when NetLabel is disabled

Sebastian Andrzej Siewior (1):
      e1000: look into the page instead of skb->data for e1000_tbi_adjust_stats()

Stephan Gatzka (1):
      fec_mpc52xx: fix timestamp filtering

 drivers/net/ethernet/freescale/fec_mpc52xx.c  |    2 +-
 drivers/net/ethernet/intel/e1000/e1000_main.c |    2 +-
 drivers/net/ethernet/intel/e1000e/ich8lan.c   |   18 +++++++++---------
 drivers/net/ethernet/mellanox/mlx4/cmd.c      |    4 ++--
 drivers/net/ethernet/mellanox/mlx4/en_main.c  |   12 +++++++-----
 drivers/net/ethernet/mellanox/mlx4/eq.c       |    2 +-
 drivers/net/ethernet/mellanox/mlx4/fw.c       |   51 +++++++++++++++++++++++++++++++++++++++++++++++---
 drivers/net/ethernet/mellanox/mlx4/main.c     |   40 +++++++++++++--------------------------
 drivers/net/ethernet/mellanox/mlx4/mlx4.h     |   10 ++++++++++
 drivers/net/ethernet/mellanox/mlx4/profile.c  |    9 ++++++---
 drivers/net/ethernet/realtek/8139cp.c         |   24 ++++++++++++------------
 drivers/net/ethernet/realtek/8139too.c        |    2 +-
 drivers/net/ethernet/realtek/r8169.c          |    3 +++
 drivers/net/usb/mcs7830.c                     |   25 +++++++++++++++++++++++--
 include/linux/mlx4/device.h                   |    6 ++++++
 include/net/cipso_ipv4.h                      |   29 +++++++++++++++++++++++++++-
 lib/dynamic_queue_limits.c                    |   18 +++++++++++-------
 net/core/sock.c                               |    7 +++++--
 net/ipv4/inet_connection_sock.c               |    3 ++-
 net/ipv4/tcp_ipv4.c                           |    9 ++++++---
 net/ipv6/tcp_ipv6.c                           |    9 ++++++---
 21 files changed, 201 insertions(+), 84 deletions(-)

^ permalink raw reply

* Re: [PATCH 1/1] fec_mpc52xx: fix timestamp filtering
From: David Miller @ 2012-06-02 21:09 UTC (permalink / raw)
  To: richardcochran; +Cc: stephan, netdev, stable
In-Reply-To: <20120602190605.GA2202@netboy.at.omicron.at>

From: Richard Cochran <richardcochran@gmail.com>
Date: Sat, 2 Jun 2012 21:06:05 +0200

> On Sat, Jun 02, 2012 at 03:04:06PM +0200, Stephan Gatzka wrote:
>> skb_defer_rx_timestamp was called with a freshly allocated skb but must
>> be called with rskb instead.
> 
> Thanks for checking this, and sorry for the trouble it caused you.
> 
> Acked-by: Richard Cochran <richardcochran@gmail.com>

Applied.

^ permalink raw reply

* Re: [PATCH] mcs7830: Implement link state detection
From: David Miller @ 2012-06-02 21:09 UTC (permalink / raw)
  To: linux; +Cc: andi, netdev, linux-kernel
In-Reply-To: <201206012229.11530.linux@rainbow-software.org>

From: Ondrej Zary <linux@rainbow-software.org>
Date: Fri, 1 Jun 2012 22:29:08 +0200

> Add .status callback that detects link state changes.
> Tested with MCS7832CV-AA chip (9710:7830, identified as rev.C by the driver).
> Fixes https://bugzilla.kernel.org/show_bug.cgi?id=28532
> 
> Signed-off-by: Ondrej Zary <linux@rainbow-software.org>

Applied.

^ permalink raw reply

* Re: [net 0/2][pull request] Intel Wired LAN Driver Update
From: David Miller @ 2012-06-02 21:08 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: netdev, gospo, sassmann
In-Reply-To: <1338621416-22425-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Sat,  2 Jun 2012 00:16:54 -0700

> This series contains fixes for e1000 and e1000e.
> 
> The following are changes since commit ad1be8d345416a794dea39761a374032aa471a76:
>   r8169: call netif_napi_del at errpaths and at driver unload
> and are available in the git repository at:
>   git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net master
> 
> Bruce Allan (1):
>   e1000e: fix Rapid Start Technology support for i217
> 
> Sebastian Andrzej Siewior (1):
>   e1000: look into the page instead of skb->data for
>     e1000_tbi_adjust_stats()

Pulled, thanks Jeff.

^ permalink raw reply

* [PATCH iproute2] Add reference to tc-codel(8) to the SEE ALSO section
From: Jan Ceuleers @ 2012-06-02 19:45 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: andyqos, netdev

Reported-by: Andy Furniss <andyqos@ukfsn.org>
Signed-off-by: Jan Ceuleers <jan.ceuleers@computer.org>
---
 man/man8/tc.8 |    1 +
 1 file changed, 1 insertion(+)

diff --git a/man/man8/tc.8 b/man/man8/tc.8
index 6576377..14a1cd8 100644
--- a/man/man8/tc.8
+++ b/man/man8/tc.8
@@ -368,6 +368,7 @@ was written by Alexey N. Kuznetsov and added in Linux 2.2.
 .SH SEE ALSO
 .BR tc-cbq (8),
 .BR tc-choke (8),
+.BR tc-codel (8),
 .BR tc-drr (8),
 .BR tc-htb (8),
 .BR tc-hfsc (8),
-- 
1.7.9.5

^ 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