Netdev List
 help / color / mirror / Atom feed
* Re: [patch] netfilter: default to NF_DROP in sip_help_tcp()
From: Patrick McHardy @ 2010-08-04 16:10 UTC (permalink / raw)
  To: Simon Horman; +Cc: netfilter-devel, netdev
In-Reply-To: <20100804080742.GC10740@verge.net.au>

Am 04.08.2010 10:07, schrieb Simon Horman:
> On Wed, Jul 14, 2010 at 02:23:01PM +0200, Patrick McHardy wrote:
>> On 10.07.2010 05:16, Simon Horman wrote:
>>> I initially noticed this because of the compiler warning below, but it does
>>> seem to be a valid concern in the case where ct_sip_get_header() returns 0
>>> in the first iteration of the while loop.
>>>
>>> net/netfilter/nf_conntrack_sip.c: In function 'sip_help_tcp':
>>> net/netfilter/nf_conntrack_sip.c:1379: warning: 'ret' may be used uninitialized in this function
>>
>> Thanks Simon. I've applied the patch, but changed NF_DROP to
>> NF_ACCEPT since we should avoid dropping packets with unknown
>> contents (not SIP) if possible.
> 
> Hi Patrick,
> 
> I'm not seeing this patch in nf-next-2.6.
> Am I looking in the wrong place?

I was struggling with some file system corruption and didn't manage
to send it out in time, sorry. I'll include it in the next batch of
patches for .36 and will also push it to -stable.

^ permalink raw reply

* Re: [PATCH v2 2/4] cls_flow: add sanity check for the packet length
From: Patrick McHardy @ 2010-08-04 16:12 UTC (permalink / raw)
  To: Changli Gao; +Cc: Jamal Hadi Salim, David S. Miller, netdev
In-Reply-To: <1280933292-12176-1-git-send-email-xiaosuo@gmail.com>

Am 04.08.2010 16:48, schrieb Changli Gao:
> The packet length should be checked before the packet data is dereferenced.
> 

Thanks.

Acked-by: Patrick McHardy <kaber@trash.net>


^ permalink raw reply

* [PATCH v5 1/2] core: Factor out flow calculation from get_rps_cpu
From: Krishna Kumar @ 2010-08-04 16:15 UTC (permalink / raw)
  To: davem, arnd; +Cc: mst, netdev, xiaosuo, bhutchings, Krishna Kumar, therbert

From: Krishna Kumar <krkumar2@in.ibm.com>

Factor out flow calculation code from get_rps_cpu, since other
functions can use the same code.

Revisions:

v2 (Ben): Separate flow calcuation out and use in select queue.
v3 (Arnd): Don't re-implement MIN.
v4 (Changli): skb->data points to ethernet header in macvtap, and
	make a fast path. Tested macvtap with this patch.
v5 (Changli):
	- Cache skb->rxhash in skb_get_rxhash
	- macvtap may not have pow(2) queues, so change code for
	  queue selection.
    (Arnd):
	- Use first available queue if all fails.


Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>
---
 include/linux/skbuff.h |    9 +++
 net/core/dev.c         |  106 ++++++++++++++++++++++-----------------
 2 files changed, 71 insertions(+), 44 deletions(-)

diff -ruNp org/include/linux/skbuff.h new/include/linux/skbuff.h
--- org/include/linux/skbuff.h	2010-08-04 20:45:19.000000000 +0530
+++ new/include/linux/skbuff.h	2010-08-04 20:47:02.000000000 +0530
@@ -558,6 +558,15 @@ extern unsigned int   skb_find_text(stru
 				    unsigned int to, struct ts_config *config,
 				    struct ts_state *state);
 
+extern __u32 __skb_get_rxhash(struct sk_buff *skb);
+static inline __u32 skb_get_rxhash(struct sk_buff *skb)
+{
+	if (!skb->rxhash)
+		skb->rxhash = __skb_get_rxhash(skb);
+
+	return skb->rxhash;
+}
+
 #ifdef NET_SKBUFF_DATA_USES_OFFSET
 static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
 {
diff -ruNp org/net/core/dev.c new/net/core/dev.c
--- org/net/core/dev.c	2010-08-04 20:45:19.000000000 +0530
+++ new/net/core/dev.c	2010-08-04 21:13:37.000000000 +0530
@@ -2259,69 +2259,41 @@ static inline void ____napi_schedule(str
 	__raise_softirq_irqoff(NET_RX_SOFTIRQ);
 }
 
-#ifdef CONFIG_RPS
-
-/* One global table that all flow-based protocols share. */
-struct rps_sock_flow_table *rps_sock_flow_table __read_mostly;
-EXPORT_SYMBOL(rps_sock_flow_table);
-
 /*
- * get_rps_cpu is called from netif_receive_skb and returns the target
- * CPU from the RPS map of the receiving queue for a given skb.
- * rcu_read_lock must be held on entry.
+ * __skb_get_rxhash: calculate a flow hash based on src/dst addresses
+ * and src/dst port numbers. Returns a non-zero hash number on success
+ * and 0 on failure.
  */
-static int get_rps_cpu(struct net_device *dev, struct sk_buff *skb,
-		       struct rps_dev_flow **rflowp)
+__u32 __skb_get_rxhash(struct sk_buff *skb)
 {
+	int nhoff, hash = 0;
 	struct ipv6hdr *ip6;
 	struct iphdr *ip;
-	struct netdev_rx_queue *rxqueue;
-	struct rps_map *map;
-	struct rps_dev_flow_table *flow_table;
-	struct rps_sock_flow_table *sock_flow_table;
-	int cpu = -1;
 	u8 ip_proto;
-	u16 tcpu;
 	u32 addr1, addr2, ihl;
 	union {
 		u32 v32;
 		u16 v16[2];
 	} ports;
 
-	if (skb_rx_queue_recorded(skb)) {
-		u16 index = skb_get_rx_queue(skb);
-		if (unlikely(index >= dev->num_rx_queues)) {
-			WARN_ONCE(dev->num_rx_queues > 1, "%s received packet "
-				"on queue %u, but number of RX queues is %u\n",
-				dev->name, index, dev->num_rx_queues);
-			goto done;
-		}
-		rxqueue = dev->_rx + index;
-	} else
-		rxqueue = dev->_rx;
-
-	if (!rxqueue->rps_map && !rxqueue->rps_flow_table)
-		goto done;
-
-	if (skb->rxhash)
-		goto got_hash; /* Skip hash computation on packet header */
+	nhoff = skb_network_offset(skb);
 
 	switch (skb->protocol) {
 	case __constant_htons(ETH_P_IP):
-		if (!pskb_may_pull(skb, sizeof(*ip)))
+		if (!pskb_may_pull(skb, sizeof(*ip) + nhoff))
 			goto done;
 
-		ip = (struct iphdr *) skb->data;
+		ip = (struct iphdr *) skb->data + nhoff;
 		ip_proto = ip->protocol;
 		addr1 = (__force u32) ip->saddr;
 		addr2 = (__force u32) ip->daddr;
 		ihl = ip->ihl;
 		break;
 	case __constant_htons(ETH_P_IPV6):
-		if (!pskb_may_pull(skb, sizeof(*ip6)))
+		if (!pskb_may_pull(skb, sizeof(*ip6) + nhoff))
 			goto done;
 
-		ip6 = (struct ipv6hdr *) skb->data;
+		ip6 = (struct ipv6hdr *) skb->data + nhoff;
 		ip_proto = ip6->nexthdr;
 		addr1 = (__force u32) ip6->saddr.s6_addr32[3];
 		addr2 = (__force u32) ip6->daddr.s6_addr32[3];
@@ -2330,6 +2302,7 @@ static int get_rps_cpu(struct net_device
 	default:
 		goto done;
 	}
+
 	switch (ip_proto) {
 	case IPPROTO_TCP:
 	case IPPROTO_UDP:
@@ -2338,8 +2311,9 @@ static int get_rps_cpu(struct net_device
 	case IPPROTO_AH:
 	case IPPROTO_SCTP:
 	case IPPROTO_UDPLITE:
-		if (pskb_may_pull(skb, (ihl * 4) + 4)) {
-			ports.v32 = * (__force u32 *) (skb->data + (ihl * 4));
+		if (pskb_may_pull(skb, (ihl * 4) + 4 + nhoff)) {
+			ports.v32 = * (__force u32 *) (skb->data + nhoff +
+						       (ihl * 4));
 			if (ports.v16[1] < ports.v16[0])
 				swap(ports.v16[0], ports.v16[1]);
 			break;
@@ -2352,11 +2326,55 @@ static int get_rps_cpu(struct net_device
 	/* get a consistent hash (same value on both flow directions) */
 	if (addr2 < addr1)
 		swap(addr1, addr2);
-	skb->rxhash = jhash_3words(addr1, addr2, ports.v32, hashrnd);
-	if (!skb->rxhash)
-		skb->rxhash = 1;
 
-got_hash:
+	hash = jhash_3words(addr1, addr2, ports.v32, hashrnd);
+	if (!hash)
+		hash = 1;
+
+done:
+	return hash;
+}
+EXPORT_SYMBOL(__skb_get_rxhash);
+
+#ifdef CONFIG_RPS
+
+/* One global table that all flow-based protocols share. */
+struct rps_sock_flow_table *rps_sock_flow_table __read_mostly;
+EXPORT_SYMBOL(rps_sock_flow_table);
+
+/*
+ * get_rps_cpu is called from netif_receive_skb and returns the target
+ * CPU from the RPS map of the receiving queue for a given skb.
+ * rcu_read_lock must be held on entry.
+ */
+static int get_rps_cpu(struct net_device *dev, struct sk_buff *skb,
+		       struct rps_dev_flow **rflowp)
+{
+	struct netdev_rx_queue *rxqueue;
+	struct rps_map *map;
+	struct rps_dev_flow_table *flow_table;
+	struct rps_sock_flow_table *sock_flow_table;
+	int cpu = -1;
+	u16 tcpu;
+
+	if (skb_rx_queue_recorded(skb)) {
+		u16 index = skb_get_rx_queue(skb);
+		if (unlikely(index >= dev->num_rx_queues)) {
+			WARN_ONCE(dev->num_rx_queues > 1, "%s received packet "
+				"on queue %u, but number of RX queues is %u\n",
+				dev->name, index, dev->num_rx_queues);
+			goto done;
+		}
+		rxqueue = dev->_rx + index;
+	} else
+		rxqueue = dev->_rx;
+
+	if (!rxqueue->rps_map && !rxqueue->rps_flow_table)
+		goto done;
+
+	if (!skb_get_rxhash(skb))
+		goto done;
+
 	flow_table = rcu_dereference(rxqueue->rps_flow_table);
 	sock_flow_table = rcu_dereference(rps_sock_flow_table);
 	if (flow_table && sock_flow_table) {

^ permalink raw reply

* [PATCH v5 2/2] macvtap: Implement multiqueue for macvtap driver
From: Krishna Kumar @ 2010-08-04 16:15 UTC (permalink / raw)
  To: davem, arnd; +Cc: mst, netdev, xiaosuo, bhutchings, Krishna Kumar, therbert
In-Reply-To: <20100804161552.3814.56839.sendpatchset@krkumar2.in.ibm.com>

From: Krishna Kumar <krkumar2@in.ibm.com>

Implement multiqueue facility for macvtap driver. The idea is that
a macvtap device can be opened multiple times and the fd's can be
used to register eg, as backend for vhost.

Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>
---
 drivers/net/macvtap.c      |   99 ++++++++++++++++++++++++++++-------
 include/linux/if_macvlan.h |    9 ++-
 2 files changed, 90 insertions(+), 18 deletions(-)

diff -ruNp org/include/linux/if_macvlan.h new/include/linux/if_macvlan.h
--- org/include/linux/if_macvlan.h	2010-08-04 20:45:19.000000000 +0530
+++ new/include/linux/if_macvlan.h	2010-08-04 20:45:19.000000000 +0530
@@ -40,6 +40,12 @@ struct macvlan_rx_stats {
 	unsigned long		rx_errors;
 };
 
+/*
+ * Maximum times a macvtap device can be opened. This can be used to
+ * configure the number of receive queue, e.g. for multiqueue virtio.
+ */
+#define MAX_MACVTAP_QUEUES	(NR_CPUS < 16 ? NR_CPUS : 16)
+
 struct macvlan_dev {
 	struct net_device	*dev;
 	struct list_head	list;
@@ -50,7 +56,8 @@ struct macvlan_dev {
 	enum macvlan_mode	mode;
 	int (*receive)(struct sk_buff *skb);
 	int (*forward)(struct net_device *dev, struct sk_buff *skb);
-	struct macvtap_queue	*tap;
+	struct macvtap_queue	*taps[MAX_MACVTAP_QUEUES];
+	int			numvtaps;
 };
 
 static inline void macvlan_count_rx(const struct macvlan_dev *vlan,
diff -ruNp org/drivers/net/macvtap.c new/drivers/net/macvtap.c
--- org/drivers/net/macvtap.c	2010-08-04 20:45:19.000000000 +0530
+++ new/drivers/net/macvtap.c	2010-08-04 21:20:49.000000000 +0530
@@ -84,26 +84,45 @@ static const struct proto_ops macvtap_so
 static DEFINE_SPINLOCK(macvtap_lock);
 
 /*
- * Choose the next free queue, for now there is only one
+ * get_slot: return a [unused/occupied] slot in vlan->taps[]:
+ *	- if 'q' is NULL, return the first empty slot;
+ *	- otherwise, return the slot this pointer occupies.
  */
+static int get_slot(struct macvlan_dev *vlan, struct macvtap_queue *q)
+{
+	int i;
+
+	for (i = 0; i < MAX_MACVTAP_QUEUES; i++) {
+		if (rcu_dereference(vlan->taps[i]) == q)
+			return i;
+	}
+
+	/* Should never happen */
+	BUG_ON(1);
+}
+
 static int macvtap_set_queue(struct net_device *dev, struct file *file,
 				struct macvtap_queue *q)
 {
 	struct macvlan_dev *vlan = netdev_priv(dev);
+	int index;
 	int err = -EBUSY;
 
 	spin_lock(&macvtap_lock);
-	if (rcu_dereference(vlan->tap))
+	if (vlan->numvtaps == MAX_MACVTAP_QUEUES)
 		goto out;
 
 	err = 0;
+	index = get_slot(vlan, NULL);
 	rcu_assign_pointer(q->vlan, vlan);
-	rcu_assign_pointer(vlan->tap, q);
+	rcu_assign_pointer(vlan->taps[index], q);
 	sock_hold(&q->sk);
 
 	q->file = file;
 	file->private_data = q;
 
+	vlan->numvtaps++;
+
 out:
 	spin_unlock(&macvtap_lock);
 	return err;
@@ -124,9 +143,12 @@ static void macvtap_put_queue(struct mac
 	spin_lock(&macvtap_lock);
 	vlan = rcu_dereference(q->vlan);
 	if (vlan) {
-		rcu_assign_pointer(vlan->tap, NULL);
+		int index = get_slot(vlan, q);
+
+		rcu_assign_pointer(vlan->taps[index], NULL);
 		rcu_assign_pointer(q->vlan, NULL);
 		sock_put(&q->sk);
+		--vlan->numvtaps;
 	}
 
 	spin_unlock(&macvtap_lock);
@@ -136,39 +158,82 @@ static void macvtap_put_queue(struct mac
 }
 
 /*
- * Since we only support one queue, just dereference the pointer.
+ * Select a queue based on the rxq of the device on which this packet
+ * arrived. If the incoming device is not mq, calculate a flow hash
+ * to select a queue. If all fails, find the first available queue.
+ * Cache vlan->numvtaps since it can become zero during the execution
+ * of this function.
  */
 static struct macvtap_queue *macvtap_get_queue(struct net_device *dev,
 					       struct sk_buff *skb)
 {
 	struct macvlan_dev *vlan = netdev_priv(dev);
+	struct macvtap_queue *tap = NULL;
+	int numvtaps = vlan->numvtaps;
+	__u32 rxq;
+
+	if (!numvtaps)
+		goto out;
+
+	if (likely(skb_rx_queue_recorded(skb))) {
+		rxq = skb_get_rx_queue(skb);
+
+		while (unlikely(rxq >= numvtaps))
+			rxq -= numvtaps;
+
+		tap = rcu_dereference(vlan->taps[rxq]);
+		if (tap)
+			goto out;
+	}
+
+	/* Check if we can use flow to select a queue */
+	rxq = skb_get_rxhash(skb);
+	if (rxq) {
+		tap = rcu_dereference(vlan->taps[rxq % numvtaps]);
+		if (tap)
+			goto out;
+	}
 
-	return rcu_dereference(vlan->tap);
+	/* Everything failed - find first available queue */
+	for (rxq = 0; rxq < MAX_MACVTAP_QUEUES; rxq++) {
+		tap = rcu_dereference(vlan->taps[rxq]);
+		if (tap)
+			break;
+	}
+
+out:
+	return tap;
 }
 
 /*
  * The net_device is going away, give up the reference
- * that it holds on the queue (all the queues one day)
- * and safely set the pointer from the queues to NULL.
+ * that it holds on all queues and safely set the pointer
+ * from the queues to NULL.
  */
 static void macvtap_del_queues(struct net_device *dev)
 {
 	struct macvlan_dev *vlan = netdev_priv(dev);
-	struct macvtap_queue *q;
+	struct macvtap_queue *q, *qlist[MAX_MACVTAP_QUEUES];
+	int i, j = 0;
 
+	/* macvtap_put_queue can free some slots, so go through all slots */
 	spin_lock(&macvtap_lock);
-	q = rcu_dereference(vlan->tap);
-	if (!q) {
-		spin_unlock(&macvtap_lock);
-		return;
+	for (i = 0; i < MAX_MACVTAP_QUEUES && vlan->numvtaps; i++) {
+		q = rcu_dereference(vlan->taps[i]);
+		if (q) {
+			qlist[j++] = q;
+			rcu_assign_pointer(vlan->taps[i], NULL);
+			rcu_assign_pointer(q->vlan, NULL);
+			vlan->numvtaps--;
+		}
 	}
-
-	rcu_assign_pointer(vlan->tap, NULL);
-	rcu_assign_pointer(q->vlan, NULL);
+	BUG_ON(vlan->numvtaps != 0);
 	spin_unlock(&macvtap_lock);
 
 	synchronize_rcu();
-	sock_put(&q->sk);
+
+	for (--j; j >= 0; j--)
+		sock_put(&qlist[j]->sk);
 }
 
 /*

^ permalink raw reply

* Re: [ANNOUNCE]: Release of iptables-1.4.9
From: Patrick McHardy @ 2010-08-04 16:16 UTC (permalink / raw)
  To: Gabor Z. Papp
  Cc: Jan Engelhardt, Netfilter Development Mailinglist,
	Linux Netdev List, 'netfilter@vger.kernel.org',
	netfilter-announce
In-Reply-To: <x6sk2vo9eq@gzp>

Am 03.08.2010 20:09, schrieb Gabor Z. Papp:
> * Jan Engelhardt <jengelh@medozas.de>:
> 
> | (BTW, with --disable-shared you remove the possibility to use any .so
> | files whatsoever. You can use --enable-static --enable-shared to get
> | both "all in one binary" and ".so support".)
> 
> And how to force linking the binaries against the static libs?
> 
> | The following changes since commit 371cea299f0b2eb100b9fc9fb99089640d2d606f:
> 
> |   xtables: remove unnecessary cast (2010-08-03 19:56:11 +0200)
> 
> | are available in the git repository at:
> |   git://dev.medozas.de/iptables master
> 
> Fixed, compiled fine.

Thanks, I'll release a .1 with this patch tommorrow.


^ permalink raw reply

* Re: Yet another bridge netfilter crash
From: Patrick McHardy @ 2010-08-04 16:30 UTC (permalink / raw)
  To: Herbert Xu; +Cc: Stephen Hemminger, netdev
In-Reply-To: <20100723152609.GA7576@gondor.apana.org.au>

Am 23.07.2010 17:26, schrieb Herbert Xu:
> On Fri, Jul 23, 2010 at 05:17:42PM +0200, Patrick McHardy wrote:
>>
>>> There's also the matter of fragments jumping between bridges.
>>
>> Conntrack zones can be used to avoid that, but that currently needs
>> manual configuration.
> 
> I think this is something that we need to fix.  Because as it
> stands, it can still crash if you get the wrong nf_bridge.
> 
> The reason is that skb->dev does not hold a ref count.  So the
> reassembly code just throws it away and always uses the dev of
> the last fragment.
> 
> This breaks when two bridges combine to reassemble a single
> packet, as the nf_bridge attribute of the reassembled packet
> may come from an skb whose device is now dead.  This is then
> used to fill in the skb->dev (via nf_bridge->physindev).

We could perform a new device lookup on reassembly as we do
when expiring a fragment queue, but we probably shouldn't even
be reassembling fragments from different bridges. One way to
avoid this would be to automatically assign each bridge device
to a different conntrack zone, but conntrack zones are limited
to 2^16 and this might also have other unwanted side-effects.

Until we come up with something better the best fix seems to
be to perform the device lookup based on the iif.

^ permalink raw reply

* Re: [ANNOUNCE]: Release of iptables-1.4.9
From: Jan Engelhardt @ 2010-08-04 16:32 UTC (permalink / raw)
  To: Patrick McHardy
  Cc: Gabor Z. Papp, Netfilter Development Mailinglist,
	Linux Netdev List, 'netfilter@vger.kernel.org',
	netfilter-announce
In-Reply-To: <4C599275.2080007@trash.net>

On Wednesday 2010-08-04 18:16, Patrick McHardy wrote:
>Am 03.08.2010 20:09, schrieb Gabor Z. Papp:
>> * Jan Engelhardt <jengelh@medozas.de>:
>> 
>> | (BTW, with --disable-shared you remove the possibility to use any .so
>> | files whatsoever. You can use --enable-static --enable-shared to get
>> | both "all in one binary" and ".so support".)
>> 
>> And how to force linking the binaries against the static libs?
>> 
>> | The following changes since commit 371cea299f0b2eb100b9fc9fb99089640d2d606f:
>> 
>> |   xtables: remove unnecessary cast (2010-08-03 19:56:11 +0200)
>> 
>> | are available in the git repository at:
>> |   git://dev.medozas.de/iptables master
>> 
>> Fixed, compiled fine.
>
>Thanks, I'll release a .1 with this patch tommorrow.

You probably want to add to your personal release script section one 
that testcompiles all configurations before possibly creating a tarball. 
I do so too with Xtables-addons (all kernels from 2.6.17 onwards, 
quite a disk eater).

./configure --enable-static --enable-shared && make

^ permalink raw reply

* Re: Yet another bridge netfilter crash
From: Herbert Xu @ 2010-08-04 16:41 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: Stephen Hemminger, netdev
In-Reply-To: <4C5995C2.1010909@trash.net>

On Wed, Aug 04, 2010 at 06:30:58PM +0200, Patrick McHardy wrote:
>
> We could perform a new device lookup on reassembly as we do
> when expiring a fragment queue, but we probably shouldn't even
> be reassembling fragments from different bridges. One way to
> avoid this would be to automatically assign each bridge device
> to a different conntrack zone, but conntrack zones are limited
> to 2^16 and this might also have other unwanted side-effects.
> 
> Until we come up with something better the best fix seems to
> be to perform the device lookup based on the iif.

I don't think we can as the iif will point to the bridge device.
The physindev contains the original physical device where the
packet came in.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply

* [PATCH net-next] drivers/s390/net/qeth_l3_main.c: Use %pI6
From: Joe Perches @ 2010-08-04 16:50 UTC (permalink / raw)
  To: Frank Blaschka; +Cc: Ursula Braun, linux390, linux-s390, netdev, LKML

Format an ipv6 address using vsprintf extensions.

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/s390/net/qeth_l3_main.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index e22ae24..561bdc8 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -103,12 +103,7 @@ int qeth_l3_string_to_ipaddr4(const char *buf, __u8 *addr)
 
 void qeth_l3_ipaddr6_to_string(const __u8 *addr, char *buf)
 {
-	sprintf(buf, "%02x%02x:%02x%02x:%02x%02x:%02x%02x"
-		     ":%02x%02x:%02x%02x:%02x%02x:%02x%02x",
-		     addr[0], addr[1], addr[2], addr[3],
-		     addr[4], addr[5], addr[6], addr[7],
-		     addr[8], addr[9], addr[10], addr[11],
-		     addr[12], addr[13], addr[14], addr[15]);
+	sprintf(buf, "%pI6", addr);
 }
 
 int qeth_l3_string_to_ipaddr6(const char *buf, __u8 *addr)

^ permalink raw reply related

* Re: Yet another bridge netfilter crash
From: Patrick McHardy @ 2010-08-04 16:50 UTC (permalink / raw)
  To: Herbert Xu; +Cc: Stephen Hemminger, netdev
In-Reply-To: <20100804164119.GA6256@gondor.apana.org.au>

Am 04.08.2010 18:41, schrieb Herbert Xu:
> On Wed, Aug 04, 2010 at 06:30:58PM +0200, Patrick McHardy wrote:
>>
>> We could perform a new device lookup on reassembly as we do
>> when expiring a fragment queue, but we probably shouldn't even
>> be reassembling fragments from different bridges. One way to
>> avoid this would be to automatically assign each bridge device
>> to a different conntrack zone, but conntrack zones are limited
>> to 2^16 and this might also have other unwanted side-effects.
>>
>> Until we come up with something better the best fix seems to
>> be to perform the device lookup based on the iif.
> 
> I don't think we can as the iif will point to the bridge device.
> The physindev contains the original physical device where the
> packet came in.

If it originally points to the bridge device, there doesn't
seem anything wrong with the device pointing to the bridge
device after reassembly. Am I missing something?

^ permalink raw reply

* Fw: [Bug 16483] New: linux 2.6.30 kernel update to 2.6.34 appear networking's bug
From: Stephen Hemminger @ 2010-08-04 16:59 UTC (permalink / raw)
  To: netdev

Cryptic bug report, more info in bugzilla comments.

Begin forwarded message:

Date: Fri, 30 Jul 2010 07:57:46 GMT
From: bugzilla-daemon@bugzilla.kernel.org
To: shemminger@linux-foundation.org
Subject: [Bug 16483] New: linux 2.6.30 kernel update to 2.6.34 appear networking's bug


https://bugzilla.kernel.org/show_bug.cgi?id=16483

           Summary: linux 2.6.30 kernel update to 2.6.34 appear
                    networking's bug
           Product: Networking
           Version: 2.5
    Kernel Version: 2.6.34
          Platform: All
        OS/Version: Linux
              Tree: Mainline
            Status: NEW
          Severity: high
          Priority: P1
         Component: IPV4
        AssignedTo: shemminger@linux-foundation.org
        ReportedBy: lys0212@qq.com
        Regression: No


linux 2.6.30 kernel update to 2.6.34 appear networking's bug
my server machine install linux 5.5 and 2.6.30 kernel,it has two NIC:eth0 and
eth1.
eth0 and eth1 have different's ip and gateway .all configuration is normal.i
can ping both the eth0 and eth1 .but,when i update to kernel 2.6.34,i can't
ping both the eth0 and eth1,only can ping  the eth0 when the default gw is
eth0's gw.when i change the default gw to eth1's gw ,i can ping the eth1
only,eth0 can't ping .Very strange!
when i use the kernel 2.6.30 to boot the system ,all is normal ,i can ping both
eth0 and eth1 .but when i use the kernel 2.6.34,one of the ethX is normal only.
   the follows show how i update 2.6.30 to 2.6.34:
mv linux-2.6.34.tar.bz2  /usr/src
cd /usr/src/
tar -xvf linux-2.6.34.tar.bz2
ln -s /usr/src/linux-2.6.34  /usr/src/linux 

cd linux
make menuconfig 
#cp the boot initilization configuration to  /usr/src/linux/.config
cp /boot/config-2.6.18-194.el5 /usr/src/linux/.config
make menuconfig

# choose ip range      network -> Netfilter > Core NetFilter >iprange
select:
(1)General setup ---> Prompt for development and/or incomplete code/drivers。 
(2) Networking ---> Networking options ---> Network packet filtering framework
(Netfilter) ---> Core Netfilter Configuration ---> 和 IP: Netfilter
Configuration ---> (select all)
vi .config
CONFIG_NF_CONNTRACK_IPV4=y
CONFIG_SYSFS_DEPRECATED_V2=y

-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


-- 

^ permalink raw reply

* RE: [RFC PATCH v8 00/16] Provide a zero-copy method on KVM virtio-net.
From: Shirley Ma @ 2010-08-04 17:09 UTC (permalink / raw)
  To: Dong, Eddie
  Cc: Arnd Bergmann, Xin, Xiaohui, netdev@vger.kernel.org,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org, mst@redhat.com,
	mingo@elte.hu, davem@davemloft.net, herbert@gondor.apana.org.au,
	jdike@linux.intel.com
In-Reply-To: <1A42CE6F5F474C41B63392A5F80372B228FCE7B1@shsmsx501.ccr.corp.intel.com>

Hello Eddie,

On Wed, 2010-08-04 at 10:06 +0800, Dong, Eddie wrote:
> But zero-copy is a Linux generic feature that can be used by other
> VMMs as well if the BE service drivers want to incorporate.  If we can
> make mp device VMM-agnostic (it may be not yet in current patch), that
> will help Linux more.

First other VMMs support tun/tap which provides most funcs but not zero
copy.

Second mp patch only supports zero copy for vhost now, macvtap zero copy
will not be used by vhost only.

Third, the current mp device doesn't fallback to copy when failure.

So you can extend mp device to support all funcs, but the usage/funcs
will be similar with macvtap, then either mp device will replace macvtap
in the future with similar funcs or we can use enhance macvtap to
support zero copy. It is not necessary to have both in Linux.

I think it's better to implement zero copy in macvtap, tun/tap instead
of creating a new mp device.

Thanks
Shirley


^ permalink raw reply

* Re: [PATCH 1/6] bna: Brocade 10Gb Ethernet device driver
From: Stephen Hemminger @ 2010-08-04 17:09 UTC (permalink / raw)
  To: Rasesh Mody; +Cc: netdev, ddutt, huangj
In-Reply-To: <201008040515.o745FaRu028739@blc-10-10.brocade.com>

On Tue, 3 Aug 2010 22:15:36 -0700
Rasesh Mody <rmody@brocade.com> wrote:

> From: Rasesh Mody <rmody@brocade.com>
> 
> This is patch 1/6 which contains linux driver source for
> Brocade's BR1010/BR1020 10Gb CEE capable ethernet adapter.
> Source is based against net-next-2.6.
> 
> We wish this patch to be considered for inclusion in net-next-2.6
> 
> Signed-off-by: Rasesh Mody <rmody@brocade.com>
> ---
>  bnad.c         | 3326 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  bnad.h         |  474 ++++++++
>  bnad_ethtool.c | 1269 +++++++++++++++++++++
>  3 files changed, 5069 insertions(+)
> 
> diff -ruP net-next-2.6.35-rc1-orig/drivers/net/bna/bnad.c net-next-2.6.35-rc1-mod/drivers/net/bna/bnad.c
> --- net-next-2.6.35-rc1-orig/drivers/net/bna/bnad.c	1969-12-31 16:00:00.000000000 -0800
> +++ net-next-2.6.35-rc1-mod/drivers/net/bna/bnad.c	2010-08-02 17:19:19.447239000 -0700
> @@ -0,0 +1,3326 @@
> +/*
> + * Linux network driver for Brocade Converged Network Adapter.
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License (GPL) 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.
> + */
> +/*
> + * Copyright (c) 2005-2009 Brocade Communications Systems, Inc.
> + * All rights reserved
> + * www.brocade.com
> + */
> +#include <linux/netdevice.h>
> +#include <linux/skbuff.h>
> +#include <linux/etherdevice.h>
> +#include <linux/in.h>
> +#include <linux/ethtool.h>
> +#include <linux/if_vlan.h>
> +#include <linux/if_ether.h>
> +#include <linux/ip.h>
> +
> +#include "bnad.h"
> +#include "bna.h"
> +#include "cna.h"
> +
> +DEFINE_MUTEX(bnad_fwimg_mutex);
> +
> +/*
> + * Module params
> + */
> +static uint bnad_msix_disable;
> +module_param(bnad_msix_disable, uint, 0444);
> +MODULE_PARM_DESC(bnad_msix_disable, "Disable MSIX mode");
> +
> +static uint bnad_ioc_auto_recover = 1;
> +module_param(bnad_ioc_auto_recover, uint, 0444);
> +MODULE_PARM_DESC(bnad_ioc_auto_recover, "Enable / Disable auto recovery");
> +
> +/*
> + * Global variables
> + */
> +u32 bna_id;
> +u32 bnad_rxqs_per_cq = 2;
> +
> +DECLARE_MUTEX(bnad_list_sem);
> +LIST_HEAD(bnad_list);
> +
> +const u8 bnad_bcast_addr[] =  {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};

Surprised this isn't defined somewhere else.

> +
> +/*
> + * Local MACROS
> + */
> +#define BNAD_TX_UNMAPQ_DEPTH (bnad->txq_depth * 2)
> +
> +#define BNAD_RX_UNMAPQ_DEPTH (bnad->rxq_depth)
> +
> +#define BNAD_GET_MBOX_IRQ(_bnad)				\
> +	(((_bnad)->cfg_flags & BNAD_CF_MSIX) ?			\
> +	 ((_bnad)->msix_table[(_bnad)->msix_num - 1].vector) : 	\
> +	 ((_bnad)->pcidev->irq))
> +
> +#define BNAD_FILL_UNMAPQ_MEM_REQ(_res_info, _num, _depth)	\
> +do {								\
> +	(_res_info)->res_type = BNA_RES_T_MEM;			\
> +	(_res_info)->res_u.mem_info.mem_type = BNA_MEM_T_KVA;	\
> +	(_res_info)->res_u.mem_info.num = (_num);		\
> +	(_res_info)->res_u.mem_info.len =			\
> +	sizeof(struct bnad_unmap_q) +				\
> +	(sizeof(struct bnad_skb_unmap) * ((_depth) - 1));	\
> +} while (0)
> +
> +void
> +bnad_add_to_list(struct bnad *bnad)
> +{
> +	down(&bnad_list_sem);
> +	list_add_tail(&bnad->list_entry, &bnad_list);
> +	bna_id++;
> +	up(&bnad_list_sem);
> +}

Why do you need to list semaphore? Isn't RTNL mutex held
when this is done. If you have to have own exclusion use
a mutex for this.

> +void
> +bnad_remove_from_list(struct bnad *bnad)
> +{
> +	down(&bnad_list_sem);
> +	list_del(&bnad->list_entry);
> +	up(&bnad_list_sem);
> +}
> +
> +const struct pci_device_id bnad_pci_id_table[] = {
> +	{
> +		PCI_DEVICE(PCI_VENDOR_ID_BROCADE,
> +			PCI_DEVICE_ID_BROCADE_CT),
> +		.class = PCI_CLASS_NETWORK_ETHERNET << 8,
> +		.class_mask =  0xffff00
> +	}, {0,  }
> +};

Why is this not static?


> +/* TX */
> +/* bnad_start_xmit : Netdev entry point for Transmit */
> +/*		     Called under lock held by net_device */
> +
> +netdev_tx_t
> +bnad_start_xmit(struct sk_buff *skb, struct net_device *netdev)

Should also be static...

> +{
> +	struct bnad *bnad = netdev_priv(netdev);
> +
> +	u16 		txq_prod, vlan_tag = 0;
> +	u32 		unmap_prod, wis, wis_used, wi_range;
> +	u32 		vectors, vect_id, i, acked;
> +	u32		tx_id;
> +	int 			err;
> +
> +	struct bnad_tx_info *tx_info;
> +	struct bna_tcb *tcb;
> +	struct bnad_unmap_q *unmap_q;
> +	dma_addr_t 		dma_addr;
> +	struct bna_txq_entry *txqent;
> +	bna_txq_wi_ctrl_flag_t 	flags;
> +
> +	if (unlikely
> +	    (skb->len <= ETH_HLEN || skb->len > BFI_TX_MAX_DATA_PER_PKT)) {
> +		dev_kfree_skb(skb);
> +		return NETDEV_TX_OK;
> +	}
> +
> +	/*
> +	 * Takes care of the Tx that is scheduled between clearing the flag
> +	 * and the netif_stop_queue() call.
> +	 */
> +	if (unlikely(!test_bit(BNAD_RF_TX_STARTED, &bnad->run_flags))) {
> +		dev_kfree_skb(skb);
> +		return NETDEV_TX_OK;
> +	}
> +
> +	tx_id = BNAD_GET_TX_ID(skb);
> +
> +	tx_info = &bnad->tx_info[tx_id];
> +	tcb = tx_info->tcb[tx_id];
> +	unmap_q = tcb->unmap_q;
> +
> +	vectors = 1 + skb_shinfo(skb)->nr_frags;
> +	if (vectors > BFI_TX_MAX_VECTORS_PER_PKT) {
> +		dev_kfree_skb(skb);
> +		return NETDEV_TX_OK;
> +	}
> +	wis = BNA_TXQ_WI_NEEDED(vectors);	/* 4 vectors per work item */
> +	acked = 0;
> +	if (unlikely
> +	    (wis > BNA_QE_FREE_CNT(tcb, tcb->q_depth) ||
> +	     vectors > BNA_QE_FREE_CNT(unmap_q, unmap_q->q_depth))) {
> +		if ((u16) (*tcb->hw_consumer_index) !=
> +		    tcb->consumer_index &&
> +		    !test_and_set_bit(BNAD_TXQ_FREE_SENT, &tcb->flags)) {
> +			acked = bnad_free_txbufs(bnad, tcb);
> +			bna_ib_ack(tcb->i_dbell, acked);
> +			smp_mb__before_clear_bit();
> +			clear_bit(BNAD_TXQ_FREE_SENT, &tcb->flags);
> +		} else {
> +			netif_stop_queue(netdev);
> +			BNAD_UPDATE_CTR(bnad, netif_queue_stop);
> +		}
> +
> +		smp_mb();
> +		/*
> +		 * Check again to deal with race condition between
> +		 * netif_stop_queue here, and netif_wake_queue in
> +		 * interrupt handler which is not inside netif tx lock.
> +		 */
> +		if (likely
> +		    (wis > BNA_QE_FREE_CNT(tcb, tcb->q_depth) ||
> +		     vectors > BNA_QE_FREE_CNT(unmap_q, unmap_q->q_depth))) {
> +			BNAD_UPDATE_CTR(bnad, netif_queue_stop);
> +			return NETDEV_TX_BUSY;

The transmit routine should check for available space after
queueing to device, so you can avoid having to return
TX_BUSY.

^ permalink raw reply

* Re: [ANNOUNCE]: Release of iptables-1.4.9
From: Gabor Z. Papp @ 2010-08-04 17:23 UTC (permalink / raw)
  To: Jan Engelhardt
  Cc: Patrick McHardy, Netfilter Development Mailinglist,
	Linux Netdev List, 'netfilter@vger.kernel.org',
	netfilter-announce
In-Reply-To: <alpine.LSU.2.01.1008032033200.6329@obet.zrqbmnf.qr>

* Jan Engelhardt <jengelh@medozas.de>:

| >| (BTW, with --disable-shared you remove the possibility to use any .so
| >| files whatsoever. You can use --enable-static --enable-shared to get
| >| both "all in one binary" and ".so support".)
| >
| >And how to force linking the binaries against the static libs?

| What libs?

Link iptables-multi against static versions of libip6tc and libxtables.

^ permalink raw reply

* Re: [PATCH 2/3] PPTP: PPP over IPv4 (Point-to-Point Tunneling Protocol)
From: Stephen Hemminger @ 2010-08-04 17:24 UTC (permalink / raw)
  To: xeb; +Cc: netdev
In-Reply-To: <E1OgbTZ-0006nb-00.xeb-mail-ru@f279.mail.ru>

On Wed, 04 Aug 2010 14:45:33 +0400
xeb@mail.ru wrote:

> +struct pptp_gre_header {
> +  u_int8_t flags;		/* bitfield */
> +  u_int8_t ver;			/* should be PPTP_GRE_VER (enhanced GRE) */
> +  u_int16_t protocol;		/* should be PPTP_GRE_PROTO (ppp-encaps) */
> +  u_int16_t payload_len;	/* size of ppp payload, not inc. gre header */
> +  u_int16_t call_id;		/* peer's call_id for this session */
> +  u_int32_t seq;		/* sequence number.  Present if S==1 */
> +  u_int32_t ack;		/* seq number of highest packet recieved by */
> +  			

Use u8, u16, u32 in kernel code.

-- 

^ permalink raw reply

* Re: [PATCH 2/3] PPTP: PPP over IPv4 (Point-to-Point Tunneling Protocol)
From: Stephen Hemminger @ 2010-08-04 17:25 UTC (permalink / raw)
  To: xeb; +Cc: netdev
In-Reply-To: <E1OgbTZ-0006nb-00.xeb-mail-ru@f279.mail.ru>

On Wed, 04 Aug 2010 14:45:33 +0400
xeb@mail.ru wrote:

> +static DEFINE_RWLOCK(chan_lock);

A reader-writer lock is going to be slower than a spin lock
(or RCU) for this. IF possible, could you use RCU?

-- 

^ permalink raw reply

* [PATCH] ppp: make channel_ops const
From: Stephen Hemminger @ 2010-08-04 17:34 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linux-ppp, netdev

The PPP channel ops structure should be const.
Cleanup the declarations to use standard C99 format.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


---
 drivers/char/pcmcia/ipwireless/network.c |    2 +-
 drivers/net/ppp_async.c                  |    6 +++---
 drivers/net/ppp_synctty.c                |    6 +++---
 drivers/net/pppoe.c                      |    4 ++--
 include/linux/ppp_channel.h              |    2 +-
 net/atm/pppoatm.c                        |    2 +-
 net/irda/irnet/irnet_ppp.c               |    2 +-
 net/l2tp/l2tp_ppp.c                      |    5 ++++-
 8 files changed, 16 insertions(+), 13 deletions(-)

--- a/drivers/char/pcmcia/ipwireless/network.c	2010-08-04 10:27:11.127905769 -0700
+++ b/drivers/char/pcmcia/ipwireless/network.c	2010-08-04 10:27:25.891960410 -0700
@@ -239,7 +239,7 @@ static int ipwireless_ppp_ioctl(struct p
 	return err;
 }
 
-static struct ppp_channel_ops ipwireless_ppp_channel_ops = {
+static const struct ppp_channel_ops ipwireless_ppp_channel_ops = {
 	.start_xmit = ipwireless_ppp_start_xmit,
 	.ioctl      = ipwireless_ppp_ioctl
 };
--- a/drivers/net/ppp_async.c	2010-08-04 10:27:11.143905820 -0700
+++ b/drivers/net/ppp_async.c	2010-08-04 10:27:56.180089452 -0700
@@ -108,9 +108,9 @@ static void ppp_async_process(unsigned l
 static void async_lcp_peek(struct asyncppp *ap, unsigned char *data,
 			   int len, int inbound);
 
-static struct ppp_channel_ops async_ops = {
-	ppp_async_send,
-	ppp_async_ioctl
+static const struct ppp_channel_ops async_ops = {
+	.start_xmit = ppp_async_send,
+	.ioctl      = ppp_async_ioctl,
 };
 
 /*
--- a/drivers/net/ppp_synctty.c	2010-08-04 10:27:11.159905879 -0700
+++ b/drivers/net/ppp_synctty.c	2010-08-04 10:28:16.548188773 -0700
@@ -97,9 +97,9 @@ static void ppp_sync_flush_output(struct
 static void ppp_sync_input(struct syncppp *ap, const unsigned char *buf,
 			   char *flags, int count);
 
-static struct ppp_channel_ops sync_ops = {
-	ppp_sync_send,
-	ppp_sync_ioctl
+static const struct ppp_channel_ops sync_ops = {
+	.start_xmit = ppp_sync_send,
+	.ioctl      = ppp_sync_ioctl,
 };
 
 /*
--- a/drivers/net/pppoe.c	2010-08-04 10:27:11.175905937 -0700
+++ b/drivers/net/pppoe.c	2010-08-04 10:31:18.101487390 -0700
@@ -92,7 +92,7 @@
 static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb);
 
 static const struct proto_ops pppoe_ops;
-static struct ppp_channel_ops pppoe_chan_ops;
+static const struct ppp_channel_ops pppoe_chan_ops;
 
 /* per-net private data for this module */
 static int pppoe_net_id __read_mostly;
@@ -963,7 +963,7 @@ static int pppoe_xmit(struct ppp_channel
 	return __pppoe_xmit(sk, skb);
 }
 
-static struct ppp_channel_ops pppoe_chan_ops = {
+static const struct ppp_channel_ops pppoe_chan_ops = {
 	.start_xmit = pppoe_xmit,
 };
 
--- a/include/linux/ppp_channel.h	2010-08-04 10:27:11.191905992 -0700
+++ b/include/linux/ppp_channel.h	2010-08-04 10:30:10.388919874 -0700
@@ -36,7 +36,7 @@ struct ppp_channel_ops {
 
 struct ppp_channel {
 	void		*private;	/* channel private data */
-	struct ppp_channel_ops *ops;	/* operations for this channel */
+	const struct ppp_channel_ops *ops; /* operations for this channel */
 	int		mtu;		/* max transmit packet size */
 	int		hdrlen;		/* amount of headroom channel needs */
 	void		*ppp;		/* opaque to channel */
--- a/net/atm/pppoatm.c	2010-08-04 10:27:11.207906046 -0700
+++ b/net/atm/pppoatm.c	2010-08-04 10:28:41.956326440 -0700
@@ -260,7 +260,7 @@ static int pppoatm_devppp_ioctl(struct p
 	return -ENOTTY;
 }
 
-static /*const*/ struct ppp_channel_ops pppoatm_ops = {
+static const struct ppp_channel_ops pppoatm_ops = {
 	.start_xmit = pppoatm_send,
 	.ioctl = pppoatm_devppp_ioctl,
 };
--- a/net/irda/irnet/irnet_ppp.c	2010-08-04 10:27:11.219906092 -0700
+++ b/net/irda/irnet/irnet_ppp.c	2010-08-04 10:28:48.764365886 -0700
@@ -20,7 +20,7 @@
 /* Please put other headers in irnet.h - Thanks */
 
 /* Generic PPP callbacks (to call us) */
-static struct ppp_channel_ops irnet_ppp_ops = {
+static const struct ppp_channel_ops irnet_ppp_ops = {
 	.start_xmit = ppp_irnet_send,
 	.ioctl = ppp_irnet_ioctl
 };
--- a/net/l2tp/l2tp_ppp.c	2010-08-04 10:27:11.235906147 -0700
+++ b/net/l2tp/l2tp_ppp.c	2010-08-04 10:29:11.948508171 -0700
@@ -135,7 +135,10 @@ struct pppol2tp_session {
 
 static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb);
 
-static struct ppp_channel_ops pppol2tp_chan_ops = { pppol2tp_xmit , NULL };
+static const struct ppp_channel_ops pppol2tp_chan_ops = {
+	.start_xmit =  pppol2tp_xmit,
+};
+
 static const struct proto_ops pppol2tp_ops;
 
 /* Helpers to obtain tunnel/session contexts from sockets.

^ permalink raw reply

* [ANNOUNCE] iproute2 2.6.35
From: Stephen Hemminger @ 2010-08-04 18:03 UTC (permalink / raw)
  To: linux-net, netdev; +Cc: linux-kernel

This version of iproute2 utilities intended for use with 2.6.35 or
later kernel, but should be backward compatible with older releases.
In addition to build and man page fixes, this release includes a
support for a couple of new kernel features:

   * 64 bit network device stats
   * multicast rules

he tar ball is available at:
  http://devresources.linuxfoundation.org/dev/iproute2/download/iproute2-2.6.35.tar.bz2

Repository:
  git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2.git

For more info on iproute2 see:
  http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2

Report problems (or enhancements) to the netdev@vger.kernel.org mailing list.

Changes since last release (2.6.34)

Andreas Henriksson (1):
      tc: make symbols loaded from tc action modules global.

Arnd Hannemann (1):
      iproute2: Add dsfield as alias for tos for ip rules

Ben Greear (1):
      iproute2: Fix batch-mode for mrules.

Jan Engelhardt (1):
      Add IFLA_STATS64 support

Mike Frysinger (3):
      tc: revert "echo" in install target
      dnet: fix strict aliasing warnings
      netem: fix installs of dist files

Patrick McHardy (1):
      ip: add support for multicast rules

Petr Lautrbach (1):
      iproute: fix tc generating ipv6 priority filter

Stephen Hemminger (5):
      Update kernel derived headers
      Update ARP header type table
      Fix NULL pointer reference when using basic match
      Fix byte order of ether address match for u32
      snapshot 100804

Steve Fink (1):
      ss -p is much too slow

Ulrich Weber (3):
      iproute2: filter routing entries based on clone flag
      iproute2: use get_user_hz() for IPv6 print_route
      iproute2: use int instead of long for RTAX_HOPLIMIT compare

^ permalink raw reply

* RE: e1000e crashes with 2.6.34.x and ThinkPad T60
From: Tantilov, Emil S @ 2010-08-04 18:23 UTC (permalink / raw)
  To: Marc Haber
  Cc: Linux Kernel Developers, Linux Kernel Network Developers,
	Allan, Bruce W
In-Reply-To: <20100730125452.GA21444@torres.zugschlus.de>

Marc Haber wrote:
> Hi,
> 
> On Tue, Jul 27, 2010 at 06:33:49PM -0600, Tantilov, Emil S wrote:
>> Marc Haber wrote:
>>> I have a new notebook, a Thinkpad T60, which is freezing in random
>>> intervals (like 30 minutes to two days) as long as I am using the
>>> on-board wired ethernet interface, which is an e1000e, [8086:109a].
>>> As long as I keep using the WLAN, the system runs for weeks despite
>>> frequent suspend/resume cycles etc. The crashes seem really to be
>>> tied to using the wired ethernet. This is a hard freeze, with
>>> nothing happening on the system, only a long push on the power
>>> button helps. 
>> 
>> When the crashes occur - is there a trace on the screen?
> 
> Not that I can see any. I'm working in X11, and the screen simply
> freezes. Mouse doesn't move any more, clock stops. System is not
> pingable, does not react to Ctrl-Alt-Bksp nor to any Magic Sysrq, nor
> does it shut down when I have the power button issue an acpi shutdown
> event.
> 
>> Do you know of a way to reproduce the issue? For example were
>> you downloading files, browsing internet, or using the ethernet
>> device in any way when the system crashed?
> 
> Sadly, no. I have it happen when typing in a remote ssh session, while
> on the other hand hundreds of megabytes can be downloaded just fine.
> It just happens "at random", two or three times a day. I have resorted
> to using the WLAN instead of the wired ethernet, but that's not a
> long-term solution.
> 
>>> Full dmesg and lspci-nn attached, please say if you need more.
>> 
>> Doesn't seem that there were any attachments to this email.
> 
> I forgot, sorry.
> 
>> Could you also provide the kernel config?
> 
> Attached as well.

I have a T60 running with 2.6.34.1 using your config and so far no issues. 

Looking at your lspci output - your system has a slightly different HW, but I don't know if this is significant.

Are you loading the kernel with any parameters (cat /proc/cmdline)?

Do you have firewall configured (iptables -L)?

Also now that 2.6.35 is out - could you give it a try and see if the situation had improved?

> 
> Greetings
> Marc

Thanks,
Emil


^ permalink raw reply

* Re: [Bugme-new] [Bug 16503] New: Upgrade to 2.6.34.2 breaks ethernet network
From: Dave Morgan @ 2010-08-04 18:59 UTC (permalink / raw)
  To: Andrew Morton
  Cc: netdev, bugzilla-daemon, bugme-daemon, Gary Zambrano, stable
In-Reply-To: <20100803132740.946cf78a.akpm@linux-foundation.org>

On 03/08/10 at 01:27pm, Andrew Morton wrote:
>
> (switched to email.  Please respond via emailed reply-to-all, not via the
> bugzilla web interface).
>
> On Tue, 3 Aug 2010 20:14:34 GMT
> bugzilla-daemon@bugzilla.kernel.org wrote:
>
> > https://bugzilla.kernel.org/show_bug.cgi?id=16503
> >
> >            Summary: Upgrade to 2.6.34.2 breaks ethernet network
> >            Product: Networking
> >            Version: 2.5
> >           Platform: All
> >         OS/Version: Linux
> >               Tree: Mainline
> >             Status: NEW
> >           Severity: normal
> >           Priority: P1
> >          Component: Other
> >         AssignedTo: acme@ghostprotocols.net
> >         ReportedBy: davemorgan353@btinternet.com
> >         Regression: No
> >
> >
> > Using Arch Linux with fully up-to-date system.
> >
> > Upgrading kernel from 2.6.34.1 to 2.6.34.2 breaks my ethernet connection.  I
> > get dhcp timeouts but no errors in the logs regarding the kernel or the card.
> >
> > Dell Inspiron 1720.
> >
> > 03:00.0 Ethernet controller: Broadcom Corporation BCM4401-B0 100Base-TX (rev
> > 02)
> >
> > Downgrading the kernel fixes the issue.
> >
>
> There are no changes to b44.c in patch-2.6.34.2.  Perhaps you could
> generate the dmesg logs for 2.6.34.1 and 2.6.34.2 and run `diff -u'
> against them, see if anything interesting pops out?
>

There's nothing obvious to me in the logs.

However, it looks like it may be related to the ssb issues affecting
b43.

https://bugzilla.kernel.org/attachment.cgi?id=27335&action=diff

There are reports of my card working with 2.6.35 so I will upgrade to
that version.

--
Dave.

^ permalink raw reply

* Re: [GIT] Networking
From: Linus Torvalds @ 2010-08-04 19:06 UTC (permalink / raw)
  To: David Miller; +Cc: akpm, netdev, linux-kernel
In-Reply-To: <20100803.203814.59697285.davem@davemloft.net>

On Tue, Aug 3, 2010 at 8:38 PM, David Miller <davem@davemloft.net> wrote:
>
> Another release, another merge window, another set of networking
> changes to merge :-)

Ok, merged. But you should double-check my merge resolution fixes,

I'm also a bit unhappy about how it introduces new warnings in very
subtle ways. I started wondering why the hell I suddenly had SCSI
warnings even though I hadn't pulled the SCSI tree yet. It was due to
the dev_printk() changes in commit 99bcf217183e0 (""), which ends up
causing things like

  drivers/scsi/constants.c: In function ‘scsi_print_sense’:
  drivers/scsi/constants.c:1407: warning: zero-length gnu_printf format string
  drivers/scsi/constants.c:1413: warning: zero-length gnu_printf format string
  drivers/scsi/constants.c: In function ‘scsi_print_result’:
  drivers/scsi/constants.c:1456: warning: zero-length gnu_printf format string
  ...

which is a bit annoying. But more annoying was that you must have
known about this, and I'd have been much happier not seeing it as a
new surprise.

            Linus

^ permalink raw reply

* Re: [PATCH 2/3] PPTP: PPP over IPv4 (Point-to-Point Tunneling Protocol)
From: Dan Williams @ 2010-08-04 19:19 UTC (permalink / raw)
  To: xeb; +Cc: netdev
In-Reply-To: <E1OgbTZ-0006nb-00.xeb-mail-ru@f279.mail.ru>

On Wed, 2010-08-04 at 14:45 +0400, xeb@mail.ru wrote:
> This is patch 2/3 which contains pptp driver source.

Can this be used in place of the userspace ppp+pptp combo?  If so, how
would I go about setting that up?

Dan

> ---
>  drivers/net/Kconfig      |   11 +
>  drivers/net/Makefile     |    1 +
>  drivers/net/pptp.c       |  821 ++++++++++++++++++++++++++++++++++++++++++++++
>  include/linux/if_pppox.h |   20 +-
>  4 files changed, 852 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
> index ce2fcdd..2fa0516 100644
> --- a/drivers/net/Kconfig
> +++ b/drivers/net/Kconfig
> @@ -3167,6 +3167,17 @@ config PPPOE
>  	  which contains instruction on how to use this driver (under 
>  	  the heading "Kernel mode PPPoE").
>  
> +config PPTP
> +	tristate "PPP over IPv4 (PPTP) (EXPERIMENTAL)"
> +	depends on EXPERIMENTAL && PPP && NET_IPGRE_DEMUX
> +	help
> +	  Support for PPP over IPv4.(Point-to-Point Tunneling Protocol)
> +
> +	  This driver requires pppd plugin to work in client mode or
> +	  modified pptpd (poptop) to work in server mode.
> +	  See http://accel-pptp.sourceforge.net/ for information how to
> +	  utilize this module.
> +
>  config PPPOATM
>  	tristate "PPP over ATM"
>  	depends on ATM && PPP
> diff --git a/drivers/net/Makefile b/drivers/net/Makefile
> index 0a0512a..b33fef1 100644
> --- a/drivers/net/Makefile
> +++ b/drivers/net/Makefile
> @@ -162,6 +162,7 @@ obj-$(CONFIG_PPP_BSDCOMP) += bsd_comp.o
>  obj-$(CONFIG_PPP_MPPE) += ppp_mppe.o
>  obj-$(CONFIG_PPPOE) += pppox.o pppoe.o
>  obj-$(CONFIG_PPPOL2TP) += pppox.o
> +obj-$(CONFIG_PPTP) += pppox.o pptp.o
>  
>  obj-$(CONFIG_SLIP) += slip.o
>  obj-$(CONFIG_SLHC) += slhc.o
> diff --git a/drivers/net/pptp.c b/drivers/net/pptp.c
> new file mode 100644
> index 0000000..0c2dbe9
> --- /dev/null
> +++ b/drivers/net/pptp.c
> @@ -0,0 +1,821 @@
> +/*
> + *  Point-to-Point Tunneling Protocol for Linux
> + *
> + *	Authors: Dmitry Kozlov <xeb@mail.ru>
> + *
> + *	This program is free software; you can redistribute it and/or
> + *	modify it under the terms of the GNU General Public License
> + *	as published by the Free Software Foundation; either version
> + *	2 of the License, or (at your option) any later version.
> + *
> + */
> +
> +#include <linux/string.h>
> +#include <linux/module.h>
> +#include <linux/kernel.h>
> +#include <linux/slab.h>
> +#include <linux/errno.h>
> +#include <linux/netdevice.h>
> +#include <linux/net.h>
> +#include <linux/skbuff.h>
> +#include <linux/init.h>
> +#include <linux/ppp_channel.h>
> +#include <linux/ppp_defs.h>
> +#include <linux/if_pppox.h>
> +#include <linux/if_ppp.h>
> +#include <linux/notifier.h>
> +#include <linux/file.h>
> +#include <linux/in.h>
> +#include <linux/ip.h>
> +#include <linux/netfilter.h>
> +#include <linux/netfilter_ipv4.h>
> +#include <linux/version.h>
> +#include <linux/spinlock.h>
> +
> +#include <net/sock.h>
> +#include <net/protocol.h>
> +#include <net/ip.h>
> +#include <net/icmp.h>
> +#include <net/route.h>
> +#include <net/gre.h>
> +
> +#include <asm/uaccess.h>
> +
> +#define DEBUG
> +
> +#define PPTP_DRIVER_VERSION "0.8.4"
> +
> +static int log_level = 0;
> +static int log_packets = 10;
> +
> +#define MAX_CALLID 65535
> +#define PPP_LCP_ECHOREQ 0x09
> +#define PPP_LCP_ECHOREP 0x0A
> +#define SC_RCV_BITS	(SC_RCV_B7_1|SC_RCV_B7_0|SC_RCV_ODDP|SC_RCV_EVNP)
> +
> +static unsigned long *callid_bitmap = NULL;
> +static struct pppox_sock **callid_sock=NULL;
> +
> +
> +static DEFINE_RWLOCK(chan_lock);
> +
> +static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb);
> +static int pptp_ppp_ioctl(struct ppp_channel *chan, unsigned int cmd,
> +			   unsigned long arg);
> +static int pptp_rcv_core(struct sock *sk,struct sk_buff *skb);
> +
> +static struct ppp_channel_ops pptp_chan_ops = {
> +	.start_xmit = pptp_xmit,
> +	.ioctl      = pptp_ppp_ioctl,
> +};
> +
> +
> +#define MISSING_WINDOW 20
> +#define WRAPPED( curseq, lastseq) \
> +    ((((curseq) & 0xffffff00) == 0) && \
> +     (((lastseq) & 0xffffff00 ) == 0xffffff00))
> +
> +/* gre header structure: -------------------------------------------- */
> +
> +#define PPTP_GRE_PROTO  0x880B
> +#define PPTP_GRE_VER    0x1
> +
> +#define PPTP_GRE_FLAG_C	0x80
> +#define PPTP_GRE_FLAG_R	0x40
> +#define PPTP_GRE_FLAG_K	0x20
> +#define PPTP_GRE_FLAG_S	0x10
> +#define PPTP_GRE_FLAG_A	0x80
> +
> +#define PPTP_GRE_IS_C(f) ((f)&PPTP_GRE_FLAG_C)
> +#define PPTP_GRE_IS_R(f) ((f)&PPTP_GRE_FLAG_R)
> +#define PPTP_GRE_IS_K(f) ((f)&PPTP_GRE_FLAG_K)
> +#define PPTP_GRE_IS_S(f) ((f)&PPTP_GRE_FLAG_S)
> +#define PPTP_GRE_IS_A(f) ((f)&PPTP_GRE_FLAG_A)
> +
> +#define PPTP_HEADER_OVERHEAD (2+sizeof(struct pptp_gre_header))
> +struct pptp_gre_header {
> +  u_int8_t flags;		/* bitfield */
> +  u_int8_t ver;			/* should be PPTP_GRE_VER (enhanced GRE) */
> +  u_int16_t protocol;		/* should be PPTP_GRE_PROTO (ppp-encaps) */
> +  u_int16_t payload_len;	/* size of ppp payload, not inc. gre header */
> +  u_int16_t call_id;		/* peer's call_id for this session */
> +  u_int32_t seq;		/* sequence number.  Present if S==1 */
> +  u_int32_t ack;		/* seq number of highest packet recieved by */
> +  				/*  sender in this session */
> +};
> +
> +static struct pppox_sock * lookup_chan(__u16 call_id, __be32 s_addr)
> +{
> +	struct pppox_sock *sock;
> +	struct pptp_opt *opt;
> +	
> +	read_lock(&chan_lock);
> +	sock = callid_sock[call_id];
> +	if (sock) {
> +		opt = &sock->proto.pptp;
> +		if (opt->dst_addr.sin_addr.s_addr != s_addr) sock = NULL;
> +		else sock_hold(sk_pppox(sock));
> +	}
> +	read_unlock(&chan_lock);
> +	
> +	return sock;
> +}
> +
> +static int lookup_chan_dst(__u16 call_id, __be32 d_addr)
> +{
> +	struct pppox_sock *sock;
> +	struct pptp_opt *opt;
> +	int i;
> +	
> +	read_lock(&chan_lock);
> +	for(i = find_next_bit(callid_bitmap,MAX_CALLID,1); i < MAX_CALLID; i = find_next_bit(callid_bitmap,MAX_CALLID,i+1)) {
> +	    sock = callid_sock[i];
> +	    opt = &sock->proto.pptp;
> +	    if (opt->dst_addr.call_id == call_id && opt->dst_addr.sin_addr.s_addr == d_addr) break;
> +	}
> +	read_unlock(&chan_lock);
> +	
> +	return i < MAX_CALLID;
> +}
> +
> +static int add_chan(struct pppox_sock *sock)
> +{
> +	static int call_id = 0;
> +	int res = -1;
> +
> +	write_lock_bh(&chan_lock);
> +	
> +	if (!sock->proto.pptp.src_addr.call_id)	{
> +	    call_id = find_next_zero_bit(callid_bitmap,MAX_CALLID,call_id+1);
> +	    if (call_id == MAX_CALLID)
> +				call_id = find_next_zero_bit(callid_bitmap,MAX_CALLID,1);
> +	    sock->proto.pptp.src_addr.call_id = call_id;
> +	}
> +	else if (test_bit(sock->proto.pptp.src_addr.call_id,callid_bitmap))
> +		goto exit;
> +	
> +	set_bit(sock->proto.pptp.src_addr.call_id,callid_bitmap);
> +	callid_sock[sock->proto.pptp.src_addr.call_id] = sock;
> +	res = 0;
> +
> +exit:	
> +	write_unlock_bh(&chan_lock);
> +	
> +	return res;
> +}
> +
> +static void del_chan(struct pppox_sock *sock)
> +{
> +	write_lock_bh(&chan_lock);
> +	clear_bit(sock->proto.pptp.src_addr.call_id,callid_bitmap);
> +	callid_sock[sock->proto.pptp.src_addr.call_id] = NULL;
> +	write_unlock_bh(&chan_lock);
> +}
> +
> +static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
> +{
> +	struct sock *sk = (struct sock *) chan->private;
> +	struct pppox_sock *po = pppox_sk(sk);
> +	struct pptp_opt *opt = &po->proto.pptp;
> +	struct pptp_gre_header *hdr;
> +	unsigned int header_len = sizeof(*hdr);
> +	int err = 0;
> +	int islcp;
> +	int len;
> +	unsigned char *data;
> +	__u32 seq_recv;
> +	
> +	
> +	struct rtable *rt;     			/* Route to the other host */
> +	struct net_device *tdev;			/* Device to other host */
> +	struct iphdr  *iph;			/* Our new IP header */
> +	int    max_headroom;			/* The extra header space needed */
> +
> +	if (sk_pppox(po)->sk_state & PPPOX_DEAD)
> +	    goto tx_error;
> +
> +	{
> +		struct flowi fl = { .oif = 0,
> +				    .nl_u = { .ip4_u =
> +					      { .daddr = opt->dst_addr.sin_addr.s_addr,
> +						.saddr = opt->src_addr.sin_addr.s_addr,
> +						.tos = RT_TOS(0) } },
> +				    .proto = IPPROTO_GRE };
> +		if ((err=ip_route_output_key(&init_net,&rt, &fl))) {
> +			goto tx_error;
> +		}
> +	}
> +	tdev = rt->u.dst.dev;
> +
> +	max_headroom = LL_RESERVED_SPACE(tdev) + sizeof(*iph)+sizeof(*hdr)+2;
> +
> +	if (skb_headroom(skb) < max_headroom || skb_cloned(skb) || skb_shared(skb)) {
> +		struct sk_buff *new_skb = skb_realloc_headroom(skb, max_headroom);
> +		if (!new_skb) {
> +			ip_rt_put(rt);
> +			goto tx_error;
> +		}
> +		if (skb->sk)
> +		skb_set_owner_w(new_skb, skb->sk);
> +		kfree_skb(skb);
> +		skb = new_skb;
> +	}
> +
> +	data = skb->data;
> +	islcp = ((data[0] << 8) + data[1])== PPP_LCP && 1 <= data[2] && data[2] <= 7;
> +
> +	/* compress protocol field */
> +	if ((opt->ppp_flags & SC_COMP_PROT) && data[0] == 0 && !islcp)
> +		skb_pull(skb,1);
> +
> +	/*
> +		* Put in the address/control bytes if necessary
> +		*/
> +	if ((opt->ppp_flags & SC_COMP_AC) == 0 || islcp) {
> +		data = skb_push(skb,2);
> +		data[0] = PPP_ALLSTATIONS;
> +		data[1] = PPP_UI;
> +	}
> +	
> +	len = skb->len;
> +  
> +	seq_recv = opt->seq_recv;
> +  
> +	if (opt->ack_sent == seq_recv) header_len -= sizeof(hdr->ack);
> +
> +	// Push down and install GRE header
> +	skb_push(skb,header_len);
> +	hdr = (struct pptp_gre_header *)(skb->data);
> +
> +	hdr->flags       = PPTP_GRE_FLAG_K;
> +	hdr->ver         = PPTP_GRE_VER;
> +	hdr->protocol    = htons(PPTP_GRE_PROTO);
> +	hdr->call_id     = htons(opt->dst_addr.call_id);
> +
> +	hdr->flags      |= PPTP_GRE_FLAG_S;
> +	hdr->seq         = htonl(++opt->seq_sent);
> +	#ifdef DEBUG
> +	if (log_level >= 3 && opt->seq_sent <= log_packets)
> +		printk(KERN_INFO"PPTP[%i]: send packet: seq=%i",opt->src_addr.call_id,opt->seq_sent);
> +	#endif
> +	if (opt->ack_sent != seq_recv)	{
> +	/* send ack with this message */
> +		hdr->ver |= PPTP_GRE_FLAG_A;
> +		hdr->ack  = htonl(seq_recv);
> +		opt->ack_sent = seq_recv;
> +		#ifdef DEBUG
> +		if (log_level >= 3 && opt->seq_sent <= log_packets)
> +			printk(" ack=%i",seq_recv);
> +		#endif
> +	}
> +	hdr->payload_len = htons(len);
> +	#ifdef DEBUG
> +	if (log_level >= 3 && opt->seq_sent <= log_packets)
> +		printk("\n");
> +	#endif
> +
> +	/*
> +	 *	Push down and install the IP header.
> +	 */
> +
> +	skb_reset_transport_header(skb);
> +	skb_push(skb, sizeof(*iph));
> +	skb_reset_network_header(skb);
> +	memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
> +	IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED | IPSKB_REROUTED);
> +
> +	iph =	ip_hdr(skb);
> +	iph->version =	4;
> +	iph->ihl =	sizeof(struct iphdr) >> 2;
> +	if (ip_dont_fragment(sk, &rt->u.dst))
> +		iph->frag_off	=	htons(IP_DF);
> +	else
> +		iph->frag_off	=	0;
> +	iph->protocol	=	IPPROTO_GRE;
> +	iph->tos		  =	0;
> +	iph->daddr		=	rt->rt_dst;
> +	iph->saddr		=	rt->rt_src;
> +	iph->ttl      = dst_metric(&rt->u.dst, RTAX_HOPLIMIT);
> +	iph->tot_len  = htons(skb->len);
> +
> +	skb_dst_drop(skb);
> +	skb_dst_set(skb,&rt->u.dst);
> +
> +	nf_reset(skb);
> +
> +	skb->ip_summed = CHECKSUM_NONE;
> +	ip_select_ident(iph, &rt->u.dst, NULL);
> +	ip_send_check(iph);
> +
> + 	ip_local_out(skb);
> +
> +tx_error:
> +	return 1;
> +}
> +
> +static int pptp_rcv_core(struct sock *sk,struct sk_buff *skb)
> +{
> +	struct pppox_sock *po = pppox_sk(sk);
> +	struct pptp_opt *opt = &po->proto.pptp;
> +	int headersize,payload_len,seq;
> +	__u8 *payload;
> +	struct pptp_gre_header *header;
> +
> +	if (!(sk->sk_state & PPPOX_CONNECTED)) {
> +		if (sock_queue_rcv_skb(sk, skb))
> +			goto drop;
> +		return NET_RX_SUCCESS;
> +	}
> +	
> +	header = (struct pptp_gre_header *)(skb->data);
> +
> +	/* test if acknowledgement present */
> +	if (PPTP_GRE_IS_A(header->ver)){
> +			__u32 ack = (PPTP_GRE_IS_S(header->flags))?
> +					header->ack:header->seq; /* ack in different place if S = 0 */
> +
> +			ack = ntohl( ack);
> +
> +			if (ack > opt->ack_recv) opt->ack_recv = ack;
> +			/* also handle sequence number wrap-around  */
> +			if (WRAPPED(ack,opt->ack_recv)) opt->ack_recv = ack;
> +	}
> +
> +	/* test if payload present */
> +	if (!PPTP_GRE_IS_S(header->flags)){
> +		goto drop;
> +	}
> +
> +	headersize  = sizeof(*header);
> +	payload_len = ntohs(header->payload_len);
> +	seq         = ntohl(header->seq);
> +
> +	/* no ack present? */
> +	if (!PPTP_GRE_IS_A(header->ver)) headersize -= sizeof(header->ack);
> +	/* check for incomplete packet (length smaller than expected) */
> +	if (skb->len - headersize < payload_len) {
> +		#ifdef DEBUG
> +		if (log_level >= 1)
> +			printk(KERN_INFO"PPTP: discarding truncated packet (expected %d, got %d bytes)\n",
> +						payload_len, skb->len - headersize);
> +		#endif
> +		goto drop;
> +	}
> +
> +	payload = skb->data+headersize;
> +	/* check for expected sequence number */
> +	if ( seq < opt->seq_recv + 1 || WRAPPED(opt->seq_recv, seq) ) {
> +		if ( (payload[0] == PPP_ALLSTATIONS) && (payload[1] == PPP_UI) &&
> +		     (PPP_PROTOCOL(payload) == PPP_LCP) &&
> +		     ((payload[4] == PPP_LCP_ECHOREQ) || (payload[4] == PPP_LCP_ECHOREP)) ) {
> +			#ifdef DEBUG
> +			if ( log_level >= 1)
> +				printk(KERN_INFO"PPTP[%i]: allowing old LCP Echo packet %d (expecting %d)\n", opt->src_addr.call_id,
> +							seq, opt->seq_recv + 1);
> +			#endif
> +			goto allow_packet;
> +		}
> +		#ifdef DEBUG
> +		if ( log_level >= 1)
> +			printk(KERN_INFO"PPTP[%i]: discarding duplicate or old packet %d (expecting %d)\n",opt->src_addr.call_id,
> +							seq, opt->seq_recv + 1);
> +		#endif
> +	}else{
> +		opt->seq_recv = seq;
> +allow_packet:
> +		#ifdef DEBUG
> +		if ( log_level >= 3 && opt->seq_sent<=log_packets)
> +			printk(KERN_INFO"PPTP[%i]: accepting packet %d size=%i (%02x %02x %02x %02x %02x %02x)\n",opt->src_addr.call_id, seq,payload_len,
> +				*(payload +0),
> +				*(payload +1),
> +				*(payload +2),
> +				*(payload +3),
> +				*(payload +4),
> +				*(payload +5));
> +		#endif
> +
> +		skb_pull(skb,headersize);
> +
> +		if (payload[0] == PPP_ALLSTATIONS && payload[1] == PPP_UI) {
> +			/* chop off address/control */
> +			if (skb->len < 3)
> +				goto drop;
> +			skb_pull(skb,2);
> +		}
> +
> +		if ((*skb->data) & 1){
> +			/* protocol is compressed */
> +			skb_push(skb, 1)[0] = 0;
> +		}
> +
> +		skb->ip_summed = CHECKSUM_NONE;
> +		skb_set_network_header(skb,skb->head-skb->data);
> +		ppp_input(&po->chan,skb);
> +
> +		return NET_RX_SUCCESS;
> +	}
> +drop:
> +	kfree_skb(skb);
> +	return NET_RX_DROP;
> +}
> +
> +static int pptp_rcv(struct sk_buff *skb)
> +{
> +	struct pppox_sock *po;
> +	struct pptp_gre_header *header;
> +	struct iphdr *iph;
> +
> +	if (skb->pkt_type != PACKET_HOST)
> +		goto drop;
> +
> +	if (!pskb_may_pull(skb, 12))
> +		goto drop;
> +
> +	iph = ip_hdr(skb);
> +
> +	header = (struct pptp_gre_header *)skb->data;
> +
> +	if (    /* version should be 1 */
> +					((header->ver & 0x7F) != PPTP_GRE_VER) ||
> +					/* PPTP-GRE protocol for PPTP */
> +					(ntohs(header->protocol) != PPTP_GRE_PROTO)||
> +					/* flag C should be clear   */
> +					PPTP_GRE_IS_C(header->flags) ||
> +					/* flag R should be clear   */
> +					PPTP_GRE_IS_R(header->flags) ||
> +					/* flag K should be set     */
> +					(!PPTP_GRE_IS_K(header->flags)) ||
> +					/* routing and recursion ctrl = 0  */
> +					((header->flags&0xF) != 0)){
> +			/* if invalid, discard this packet */
> +		if (log_level >=1 )
> +			printk(KERN_INFO"PPTP: Discarding GRE: %X %X %X %X %X %X\n",
> +							header->ver&0x7F, ntohs(header->protocol),
> +							PPTP_GRE_IS_C(header->flags),
> +							PPTP_GRE_IS_R(header->flags),
> +							PPTP_GRE_IS_K(header->flags),
> +							header->flags & 0xF);
> +		goto drop;
> +	}
> +
> +
> +	if ((po=lookup_chan(htons(header->call_id),iph->saddr))) {
> +		skb_dst_drop(skb);
> +		skb_dst_set(skb,NULL);
> +		nf_reset(skb);
> +		return sk_receive_skb(sk_pppox(po), skb, 0);
> +	} else {
> +		if (log_level >= 1)
> +			printk(KERN_INFO"PPTP: Discarding packet from unknown call_id %i\n",htons(header->call_id));
> +	}
> +
> +drop:
> +	kfree_skb(skb);
> +	return NET_RX_DROP;
> +}
> +
> +static int pptp_bind(struct socket *sock,struct sockaddr *uservaddr,int sockaddr_len)
> +{
> +	struct sock *sk = sock->sk;
> +	struct sockaddr_pppox *sp = (struct sockaddr_pppox *) uservaddr;
> +	struct pppox_sock *po = pppox_sk(sk);
> +	struct pptp_opt *opt = &po->proto.pptp;
> +	int error = 0;
> +
> +	#ifdef DEBUG	
> +	if (log_level >= 1)
> +		printk(KERN_INFO"PPTP: bind: addr=%X call_id=%i\n",sp->sa_addr.pptp.sin_addr.s_addr,
> +						sp->sa_addr.pptp.call_id);
> +	#endif
> +	lock_sock(sk);
> +
> +	opt->src_addr = sp->sa_addr.pptp;
> +	if (add_chan(po)) {
> +	  release_sock(sk);
> +		error = -EBUSY;
> +	}
> +	#ifdef DEBUG
> +	if (log_level >= 1)
> +		printk(KERN_INFO"PPTP: using call_id %i\n",opt->src_addr.call_id);
> +	#endif
> +
> +	release_sock(sk);
> +	return error;
> +}
> +
> +static int pptp_connect(struct socket *sock, struct sockaddr *uservaddr,
> +		  int sockaddr_len, int flags)
> +{
> +	struct sock *sk = sock->sk;
> +	struct sockaddr_pppox *sp = (struct sockaddr_pppox *) uservaddr;
> +	struct pppox_sock *po = pppox_sk(sk);
> +	struct pptp_opt *opt = &po->proto.pptp;
> +	struct rtable *rt;     			/* Route to the other host */
> +	int error=0;
> +
> +	if (sp->sa_protocol != PX_PROTO_PPTP)
> +		return -EINVAL;
> +	
> +	#ifdef DEBUG
> +	if (log_level >= 1)
> +		printk(KERN_INFO"PPTP[%i]: connect: addr=%X call_id=%i\n",opt->src_addr.call_id,
> +						sp->sa_addr.pptp.sin_addr.s_addr,sp->sa_addr.pptp.call_id);
> +	#endif
> +	
> +	if (lookup_chan_dst(sp->sa_addr.pptp.call_id,sp->sa_addr.pptp.sin_addr.s_addr))
> +		return -EALREADY;
> +
> +	lock_sock(sk);
> +	/* Check for already bound sockets */
> +	if (sk->sk_state & PPPOX_CONNECTED){
> +		error = -EBUSY;
> +		goto end;
> +	}
> +
> +	/* Check for already disconnected sockets, on attempts to disconnect */
> +	if (sk->sk_state & PPPOX_DEAD){
> +		error = -EALREADY;
> +		goto end;
> +	}
> +
> +	if (!opt->src_addr.sin_addr.s_addr || !sp->sa_addr.pptp.sin_addr.s_addr){
> +		error = -EINVAL;
> +		goto end;
> +	}
> +
> +	po->chan.private = sk;
> +	po->chan.ops = &pptp_chan_ops;
> +
> +	{
> +		struct flowi fl = {
> +				    .nl_u = { .ip4_u =
> +					      { .daddr = opt->dst_addr.sin_addr.s_addr,
> +						.saddr = opt->src_addr.sin_addr.s_addr,
> +						.tos = RT_CONN_FLAGS(sk) } },
> +				    .proto = IPPROTO_GRE };
> +		security_sk_classify_flow(sk, &fl);
> +		if (ip_route_output_key(&init_net, &rt, &fl)) {
> +			error = -EHOSTUNREACH;
> +			goto end;
> +		}
> +		sk_setup_caps(sk, &rt->u.dst);
> +	}
> +	po->chan.mtu = dst_mtu(&rt->u.dst);
> +	if (!po->chan.mtu) po->chan.mtu = PPP_MTU;
> +	ip_rt_put(rt);
> +	po->chan.mtu -= PPTP_HEADER_OVERHEAD;
> +
> +	po->chan.hdrlen = 2 + sizeof(struct pptp_gre_header);
> +	error = ppp_register_channel(&po->chan);
> +	if (error) {
> +		printk(KERN_ERR "PPTP: failed to register PPP channel (%d)\n",error);
> +		goto end;
> +	}
> +
> +	opt->dst_addr = sp->sa_addr.pptp;
> +	sk->sk_state = PPPOX_CONNECTED;
> +
> + end:
> +	release_sock(sk);
> +	return error;
> +}
> +
> +static int pptp_getname(struct socket *sock, struct sockaddr *uaddr,
> +		  int *usockaddr_len, int peer)
> +{
> +	int len = sizeof(struct sockaddr_pppox);
> +	struct sockaddr_pppox sp;
> +
> +	sp.sa_family	  = AF_PPPOX;
> +	sp.sa_protocol  = PX_PROTO_PPTP;
> +	sp.sa_addr.pptp = pppox_sk(sock->sk)->proto.pptp.src_addr;
> +
> +	memcpy(uaddr, &sp, len);
> +
> +	*usockaddr_len = len;
> +
> +	return 0;
> +}
> +
> +static int pptp_release(struct socket *sock)
> +{
> +	struct sock *sk = sock->sk;
> +	struct pppox_sock *po;
> +	struct pptp_opt *opt;
> +	int error = 0;
> +
> +	if (!sk)
> +	    return 0;
> +
> +	lock_sock(sk);
> +
> +	if (sock_flag(sk, SOCK_DEAD)) {
> +	    release_sock(sk);
> +	    return -EBADF;
> +	}
> +		
> +	po = pppox_sk(sk);
> +	opt = &po->proto.pptp;
> +	del_chan(po);
> +
> +	pppox_unbind_sock(sk);
> +	sk->sk_state = PPPOX_DEAD;
> +
> +	#ifdef DEBUG
> +	if (log_level >= 1)
> +		printk(KERN_INFO"PPTP[%i]: release\n",opt->src_addr.call_id);
> +	#endif
> +
> +	sock_orphan(sk);
> +	sock->sk = NULL;
> +
> +	release_sock(sk);
> +	sock_put(sk);
> +
> +	return error;
> +}
> +
> +
> +static struct proto pptp_sk_proto = {
> +	.name	    = "PPTP",
> +	.owner	  = THIS_MODULE,
> +	.obj_size = sizeof(struct pppox_sock),
> +};
> +
> +static struct proto_ops pptp_ops = {
> +    .family		  = AF_PPPOX,
> +    .owner		  = THIS_MODULE,
> +    .release    = pptp_release,
> +    .bind	   	  = pptp_bind,
> +    .connect	  = pptp_connect,
> +    .socketpair	= sock_no_socketpair,
> +    .accept		  = sock_no_accept,
> +    .getname		= pptp_getname,
> +    .poll	    	= sock_no_poll,
> +    .listen		  = sock_no_listen,
> +    .shutdown		= sock_no_shutdown,
> +    .setsockopt	= sock_no_setsockopt,
> +    .getsockopt	= sock_no_getsockopt,
> +    .sendmsg		= sock_no_sendmsg,
> +    .recvmsg		= sock_no_recvmsg,
> +    .mmap		    = sock_no_mmap,
> +    .ioctl		  = pppox_ioctl,
> +};
> +
> +static void pptp_sock_destruct(struct sock *sk)
> +{
> +    if (!(sk->sk_state & PPPOX_DEAD)) {
> +	    del_chan(pppox_sk(sk));
> +	    pppox_unbind_sock(sk);
> +    }
> +    skb_queue_purge(&sk->sk_receive_queue);
> +}
> +static int pptp_create(struct net *net, struct socket *sock)
> +{
> +	int error = -ENOMEM;
> +	struct sock *sk;
> +	struct pppox_sock *po;
> +	struct pptp_opt *opt;
> +
> +	sk = sk_alloc(net,PF_PPPOX, GFP_KERNEL, &pptp_sk_proto);
> +	if (!sk)
> +		goto out;
> +
> +	sock_init_data(sock, sk);
> +
> +	sock->state = SS_UNCONNECTED;
> +	sock->ops   = &pptp_ops;
> +
> +	sk->sk_backlog_rcv = pptp_rcv_core;
> +	sk->sk_state	     = PPPOX_NONE;
> +	sk->sk_type	       = SOCK_STREAM;
> +	sk->sk_family	     = PF_PPPOX;
> +	sk->sk_protocol	   = PX_PROTO_PPTP;
> +	sk->sk_destruct	   = pptp_sock_destruct;
> +
> +	po = pppox_sk(sk);
> +	opt = &po->proto.pptp;
> +
> +	opt->seq_sent = 0; opt->seq_recv = 0;
> +	opt->ack_recv = 0; opt->ack_sent = 0;
> +
> +	error = 0;
> +out:
> +	return error;
> +}
> +
> +static int pptp_ppp_ioctl(struct ppp_channel *chan, unsigned int cmd,
> +			   unsigned long arg)
> +{
> +	struct sock *sk = (struct sock *) chan->private;
> +	struct pppox_sock *po = pppox_sk(sk);
> +	struct pptp_opt *opt = &po->proto.pptp;
> +	void __user *argp = (void __user *)arg;
> +	int __user *p = argp;
> +	int err, val;
> +
> +	err = -EFAULT;
> +	switch (cmd) {
> +	case PPPIOCGFLAGS:
> +		val = opt->ppp_flags;
> +		if (put_user(val, p))
> +			break;
> +		err = 0;
> +		break;
> +	case PPPIOCSFLAGS:
> +		if (get_user(val, p))
> +			break;
> +		opt->ppp_flags = val & ~SC_RCV_BITS;
> +		err = 0;
> +		break;
> +	default:
> +		err = -ENOTTY;
> +	}
> +
> +	return err;
> +}
> +
> +
> +static struct pppox_proto pppox_pptp_proto = {
> +    .create	= pptp_create,
> +    .owner	= THIS_MODULE,
> +};
> +
> +
> +static struct gre_protocol gre_pptp_protocol = {
> +	.handler	= pptp_rcv,
> +	//.err_handler	=	pptp_err,
> +};
> +
> +static int __init pptp_init_module(void)
> +{
> +	int err=0;
> +	printk(KERN_INFO "PPTP driver version " PPTP_DRIVER_VERSION "\n");
> +
> +	if (gre_add_protocol(&gre_pptp_protocol, GREPROTO_PPTP) < 0) {
> +		printk(KERN_INFO "PPTP: can't add protocol\n");
> +		goto out;
> +	}
> +
> +	err = proto_register(&pptp_sk_proto, 0);
> +	if (err) {
> +		printk(KERN_INFO "PPTP: can't register sk_proto\n");
> +		goto out_inet_del_protocol;
> +	}
> +
> + 	err = register_pppox_proto(PX_PROTO_PPTP, &pppox_pptp_proto);
> +	if (err) {
> +		printk(KERN_INFO "PPTP: can't register pppox_proto\n");
> +		goto out_unregister_sk_proto;
> +	}
> +	
> +	
> +	//assuming PAGESIZE is 4096 bytes
> +	callid_bitmap = (unsigned long*)__get_free_pages(GFP_KERNEL,1);
> +	memset(callid_bitmap,0,PAGE_SIZE << 1);
> +
> +	#if (BITS_PER_LONG == 32)
> +	callid_sock = (struct pppox_sock **)__get_free_pages(GFP_KERNEL,6);
> +	memset(callid_sock,0,PAGE_SIZE << 6);
> +	#elif (BITS_PER_LONG == 64)
> +	callid_sock = (struct pppox_sock **)__get_free_pages(GFP_KERNEL,7);
> +	memset(callid_sock,0,PAGE_SIZE << 7);
> +	#else
> +	#error unknown size of LONG
> +	#endif
> +
> +out:
> +	return err;
> +out_unregister_sk_proto:
> +	proto_unregister(&pptp_sk_proto);
> +out_inet_del_protocol:
> +	gre_del_protocol(&gre_pptp_protocol, GREPROTO_PPTP);
> +	return err;
> +}
> +
> +static void __exit pptp_exit_module(void)
> +{
> +	unregister_pppox_proto(PX_PROTO_PPTP);
> +	proto_unregister(&pptp_sk_proto);
> +	gre_del_protocol(&gre_pptp_protocol, GREPROTO_PPTP);
> +	if (callid_bitmap) free_pages((unsigned long)callid_bitmap,1);
> +	if (callid_sock) {
> +	    #if (BITS_PER_LONG == 32)
> +	    free_pages((unsigned long)callid_sock,6);
> +	    #elif (BITS_PER_LONG == 64)
> +	    free_pages((unsigned long)callid_sock,7);
> +	    #endif
> +	}
> +}
> +
> +module_init(pptp_init_module);
> +module_exit(pptp_exit_module);
> +
> +MODULE_DESCRIPTION("Point-to-Point Tunneling Protocol for Linux");
> +MODULE_AUTHOR("D. Kozlov (xeb@mail.ru)");
> +MODULE_LICENSE("GPL");
> +
> +module_param(log_level,int,0);
> +module_param(log_packets,int,0);
> +MODULE_PARM_DESC(log_level,"Logging level (default=0)");
> +
> diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
> index a6577af..455ff56 100644
> --- a/include/linux/if_pppox.h
> +++ b/include/linux/if_pppox.h
> @@ -47,17 +47,27 @@ struct pppoe_addr{
>  }; 
>   
>  /************************************************************************ 
> + * PPTP addressing definition 
> + */ 
> +struct pptp_addr{
> +       __u16           call_id;
> +       struct in_addr  sin_addr;
> +};
> +
> +/************************************************************************ 
>   * Protocols supported by AF_PPPOX 
>   */ 
>  #define PX_PROTO_OE    0 /* Currently just PPPoE */
>  #define PX_PROTO_OL2TP 1 /* Now L2TP also */
> -#define PX_MAX_PROTO   2
> +#define PX_PROTO_PPTP  2
> +#define PX_MAX_PROTO   3
>  
>  struct sockaddr_pppox { 
>         sa_family_t     sa_family;            /* address family, AF_PPPOX */ 
>         unsigned int    sa_protocol;          /* protocol identifier */ 
>         union{ 
>                 struct pppoe_addr       pppoe; 
> +	       			 struct pptp_addr        pptp;
>         }sa_addr; 
>  }__attribute__ ((packed)); 
>  
> @@ -150,6 +160,13 @@ struct pppoe_opt {
>  					     relayed to (PPPoE relaying) */
>  };
>  
> +struct pptp_opt {
> +	struct pptp_addr	src_addr;
> +	struct pptp_addr	dst_addr;
> +	__u32 ack_sent, ack_recv;
> +	__u32 seq_sent, seq_recv;
> +	int ppp_flags;
> +};
>  #include <net/sock.h>
>  
>  struct pppox_sock {
> @@ -159,6 +176,7 @@ struct pppox_sock {
>  	struct pppox_sock	*next;	  /* for hash table */
>  	union {
>  		struct pppoe_opt pppoe;
> +		struct pptp_opt pptp;
>  	} proto;
>  	__be16			num;
>  };
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



^ permalink raw reply

* [PATCH -staging] slicoss: Remove explicit arch dependencies
From: Denis Kirjanov @ 2010-08-04 19:24 UTC (permalink / raw)
  To: gregkh; +Cc: greg, liodot, dkirjanov, charrer, netdev, linux-kernel, devel

Remove explicit arch dependencies

Signed-off-by: Denis Kirjanov <dkirjanov@kernel.org>
---
diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h
index beab400..ebdcc6f 100644
--- a/drivers/staging/slicoss/slic.h
+++ b/drivers/staging/slicoss/slic.h
@@ -515,14 +515,16 @@ struct adapter {
     (largestat) += ((newstat) - (oldstat));                              \
 }
 
-#if defined(CONFIG_X86_64) || defined(CONFIG_IA64)
+#if BITS_PER_LONG == 64
 #define   SLIC_GET_ADDR_LOW(_addr)  (u32)((u64)(_addr) & \
 	0x00000000FFFFFFFF)
 #define   SLIC_GET_ADDR_HIGH(_addr)  (u32)(((u64)(_addr) >> 32) & \
 	0x00000000FFFFFFFF)
-#else
-#define   SLIC_GET_ADDR_LOW(_addr)   (u32)_addr
+#elif BITS_PER_LONG == 32
+#define   SLIC_GET_ADDR_LOW(_addr)   (u32)(_addr)
 #define   SLIC_GET_ADDR_HIGH(_addr)  (u32)0
+#else
+#error BITS_PER_LONG must be 32 or 64
 #endif
 
 #define FLUSH		true
diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index f8c4b12..58ff123 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -1099,19 +1099,17 @@ static void slic_link_upr_complete(struct adapter *adapter, u32 isr)
 		struct slic_shmem *pshmem;
 
 		pshmem = (struct slic_shmem *)adapter->phys_shmem;
-#if defined(CONFIG_X86_64)
+#if BITS_PER_LONG == 64
 		slic_upr_queue_request(adapter,
 				       SLIC_UPR_RLSR,
 				       SLIC_GET_ADDR_LOW(&pshmem->linkstatus),
 				       SLIC_GET_ADDR_HIGH(&pshmem->linkstatus),
 				       0, 0);
-#elif defined(CONFIG_X86)
+#else
 		slic_upr_queue_request(adapter,
 				       SLIC_UPR_RLSR,
 				       (u32) &pshmem->linkstatus,
 				       SLIC_GET_ADDR_HIGH(pshmem), 0, 0);
-#else
-		Stop Compilation;
 #endif
 		return;
 	}
@@ -1327,7 +1325,7 @@ static ushort slic_eeprom_cksum(char *m, int len)
 	s_util.s = 0;
 
 	w = (u16 *)m;
-#ifdef CONFIG_X86_64
+#if BITS_PER_LONG == 64
 	w_int = (u32) ((ulong) w & 0x00000000FFFFFFFF);
 #else
 	w_int = (u32) (w);
@@ -1439,12 +1437,16 @@ static int slic_rspqueue_init(struct adapter *adapter)
 			slic_rspqueue_free(adapter);
 			return -ENOMEM;
 		}
+		/* FIXME:
+		 * do we really need this assertions (4K PAGE_SIZE aligned addr)? */
+#if 0
 #ifndef CONFIG_X86_64
 		ASSERT(((u32) rspq->vaddr[i] & 0xFFFFF000) ==
 		       (u32) rspq->vaddr[i]);
 		ASSERT(((u32) rspq->paddr[i] & 0xFFFFF000) ==
 		       (u32) rspq->paddr[i]);
 #endif
+#endif
 		memset(rspq->vaddr[i], 0, PAGE_SIZE);
 
 		if (paddrh == 0) {
@@ -1473,13 +1475,13 @@ static struct slic_rspbuf *slic_rspqueue_getnext(struct adapter *adapter)
 		return NULL;
 
 	buf = rspq->rspbuf;
-#ifndef CONFIG_X86_64
+#if BITS_PER_LONG == 32
 	ASSERT((buf->status & 0xFFFFFFE0) == 0);
 #endif
 	ASSERT(buf->hosthandle);
 	if (++rspq->offset < SLIC_RSPQ_BUFSINPAGE) {
 		rspq->rspbuf++;
-#ifndef CONFIG_X86_64
+#if BITS_PER_LONG == 32
 		ASSERT(((u32) rspq->rspbuf & 0xFFFFFFE0) ==
 		       (u32) rspq->rspbuf);
 #endif
@@ -1492,12 +1494,12 @@ static struct slic_rspbuf *slic_rspqueue_getnext(struct adapter *adapter)
 		rspq->offset = 0;
 		rspq->rspbuf = (struct slic_rspbuf *)
 						rspq->vaddr[rspq->pageindex];
-#ifndef CONFIG_X86_64
+#if BITS_PER_LONG == 32
 		ASSERT(((u32) rspq->rspbuf & 0xFFFFF000) ==
 		       (u32) rspq->rspbuf);
 #endif
 	}
-#ifndef CONFIG_X86_64
+#if BITS_PER_LONG == 32
 	ASSERT(((u32) buf & 0xFFFFFFE0) == (u32) buf);
 #endif
 	return buf;
@@ -1538,7 +1540,7 @@ static u32 *slic_cmdqmem_addpage(struct adapter *adapter)
 					&cmdqmem->dma_pages[cmdqmem->pagecnt]);
 	if (!pageaddr)
 		return NULL;
-#ifndef CONFIG_X86_64
+#if BITS_PER_LONG == 32
 	ASSERT(((u32) pageaddr & 0xFFFFF000) == (u32) pageaddr);
 #endif
 	cmdqmem->pages[cmdqmem->pagecnt] = pageaddr;
@@ -1650,7 +1652,7 @@ static int slic_cmdq_init(struct adapter *adapter)
 	adapter->slic_handle_ix = 1;
 	for (i = 0; i < SLIC_CMDQ_INITPAGES; i++) {
 		pageaddr = slic_cmdqmem_addpage(adapter);
-#ifndef CONFIG_X86_64
+#if BITS_PER_LONG == 32
 		ASSERT(((u32) pageaddr & 0xFFFFF000) == (u32) pageaddr);
 #endif
 		if (!pageaddr) {
@@ -2447,18 +2449,16 @@ static void slic_link_event_handler(struct adapter *adapter)
 
 	pshmem = (struct slic_shmem *)adapter->phys_shmem;
 
-#if defined(CONFIG_X86_64)
+#if BITS_PER_LONG == 64
 	status = slic_upr_request(adapter,
 				  SLIC_UPR_RLSR,
 				  SLIC_GET_ADDR_LOW(&pshmem->linkstatus),
 				  SLIC_GET_ADDR_HIGH(&pshmem->linkstatus),
 				  0, 0);
-#elif defined(CONFIG_X86)
+#else
 	status = slic_upr_request(adapter, SLIC_UPR_RLSR,
 		(u32) &pshmem->linkstatus,	/* no 4GB wrap guaranteed */
 				  0, 0, 0);
-#else
-	Stop compilation;
 #endif
 	ASSERT(status == 0);
 }
@@ -2575,14 +2575,12 @@ static void slic_xmit_build_request(struct adapter *adapter,
 	ihcmd->u.slic_buffers.bufs[0].paddrl = SLIC_GET_ADDR_LOW(phys_addr);
 	ihcmd->u.slic_buffers.bufs[0].paddrh = SLIC_GET_ADDR_HIGH(phys_addr);
 	ihcmd->u.slic_buffers.bufs[0].length = skb->len;
-#if defined(CONFIG_X86_64)
+#if BITS_PER_LONG == 64
 	hcmd->cmdsize = (u32) ((((u64)&ihcmd->u.slic_buffers.bufs[1] -
 				     (u64) hcmd) + 31) >> 5);
-#elif defined(CONFIG_X86)
+#else
 	hcmd->cmdsize = ((((u32) &ihcmd->u.slic_buffers.bufs[1] -
 			   (u32) hcmd) + 31) >> 5);
-#else
-	Stop Compilation;
 #endif
 }
 
@@ -3078,16 +3076,14 @@ static int slic_if_init(struct adapter *adapter)
 		spin_lock_irqsave(&adapter->bit64reglock.lock,
 					adapter->bit64reglock.flags);
 
-#if defined(CONFIG_X86_64)
+#if BITS_PER_LONG == 64
 		slic_reg32_write(&slic_regs->slic_addr_upper,
 				 SLIC_GET_ADDR_HIGH(&pshmem->isr), DONT_FLUSH);
 		slic_reg32_write(&slic_regs->slic_isp,
 				 SLIC_GET_ADDR_LOW(&pshmem->isr), FLUSH);
-#elif defined(CONFIG_X86)
+#else
 		slic_reg32_write(&slic_regs->slic_addr_upper, 0, DONT_FLUSH);
 		slic_reg32_write(&slic_regs->slic_isp, (u32)&pshmem->isr, FLUSH);
-#else
-		Stop Compilations
 #endif
 		spin_unlock_irqrestore(&adapter->bit64reglock.lock,
 					adapter->bit64reglock.flags);

^ permalink raw reply related

* Re[2]: [PATCH 2/3] PPTP: PPP over IPv4 (Point-to-Point Tunneling Protocol)
From: xeb @ 2010-08-04 20:36 UTC (permalink / raw)
  To: Dan Williams; +Cc: netdev
In-Reply-To: <1280949557.11056.2.camel@dcbw.foobar.com>

> Can this be used in place of the userspace ppp+pptp combo?  If so, how
> would I go about setting that up?
> 
> Dan

Yes of course, you need plugin for pppd which you can get from accel-pptp package ( http://sourceforge.net/projects/accel-pptp/ ). Also it contains instruction how to use it.


^ permalink raw reply

* Re: [PATCH ethtool 1/2] ethtool: Use inet_aton() to parse IPv4 addresses for RX n-tuple control
From: Jeff Garzik @ 2010-08-04 20:36 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: netdev, linux-net-drivers
In-Reply-To: <1279825899.2104.28.camel@achroite.uk.solarflarecom.com>


FYI, I'm about to roll a new ethtool release for kernel 2.6.35.  Are 
these two patches the only outstanding ones?  (they look good, will be 
applied)

	Jeff



P.S.  The maintainer address is jgarzik@pobox.com, my standard kernel 
address.  jgarzik@redhat.com has a much higher latency, as it doesn't 
get used very much.



^ permalink raw reply


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