Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH] f_phonet: use page-sized rather than MTU-sized RX buffers
From: David Miller @ 2009-08-13  5:15 UTC (permalink / raw)
  To: remi.denis-courmont; +Cc: netdev
In-Reply-To: <1249631804-7438-2-git-send-email-remi.denis-courmont@nokia.com>

From: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Date: Fri,  7 Aug 2009 10:56:44 +0300

> From: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
> 
> Instead of a large (physically) linear buffer, we generate a set of
> paged sk_buff, so no extra memory copy is involved. This removes
> high-order allocations and saves quite a bit of memory. Phonet MTU is
> 65541 bytes, so the two buffers were padded to 128 kilo-bytes each.
> Now, we create 17 page buffers, almost a 75% memory use reduction.
> 
> Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>

Applied.

^ permalink raw reply

* Re: Use correct NET_RX_* returns for atalk_rcv()
From: David Miller @ 2009-08-13  5:15 UTC (permalink / raw)
  To: lk-netdev; +Cc: acme, netdev
In-Reply-To: <20090807185122.30f022de.lk-netdev@lk-netdev.nosense.org>

From: Mark Smith <lk-netdev@lk-netdev.nosense.org>
Date: Fri, 7 Aug 2009 18:51:22 +0930

> 
>     In all rx'd SKB cases, atalk_rcv() either eventually jumps to or falls through
>     to the label out:, which  returns numeric 0. Numeric 0 corresponds to
>     NET_RX_SUCCESS, which is incorrect in failed SKB cases.
>     
>     This patch makes atalk_rcv() provide the correct returns by:
>     
>     o  explicitly returning NET_RX_SUCCESS in the two success cases
>     o  having the out: label return NET_RX_DROP, instead of numeric 0
>     o  making the failed SKB labels and processing more consistent with other
>        _rcv() routines in the kernel, simplifying validation and removing a
>        backwards goto
> 
> Signed-off-by: Mark Smith <markzzzsmith@yahoo.com.au>

Applied.

^ permalink raw reply

* Re: [PATCH] include/netdevice.h: fix nanodoc mismatch
From: David Miller @ 2009-08-13  5:16 UTC (permalink / raw)
  To: w.sang; +Cc: netdev, trivial
In-Reply-To: <1249902289-25798-1-git-send-email-w.sang@pengutronix.de>

From: Wolfram Sang <w.sang@pengutronix.de>
Date: Mon, 10 Aug 2009 13:04:49 +0200

> nanodoc was missing an ndo_-prefix.
> 
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>

I'll apply this, thanks.

^ permalink raw reply

* Re: [net-next-2.6 PATCH 1/3] be2net: Clear pending tx completions before destroying tx queue
From: David Miller @ 2009-08-13  5:16 UTC (permalink / raw)
  To: sathyap; +Cc: netdev
In-Reply-To: <20090810134243.GA10640@serverengines.com>

From: Sathya Perla <sathyap@serverengines.com>
Date: Mon, 10 Aug 2009 19:12:43 +0530

> Clear pending tx completions in be_close() (ndo.stop method) so that after
> unregister_netdev() calls be_close(), all tx skbs are freed and there are
> no more tx completions when txq is destroyed.
> 
> Signed-off-by: Sathya Perla <sathyap@serverengines.com>

Applied.

^ permalink raw reply

* Re: [net-next-2.6 PATCH 2/3] be2net: fix bad queue traversal in be_rx_q_clean()
From: David Miller @ 2009-08-13  5:16 UTC (permalink / raw)
  To: sathyap; +Cc: netdev
In-Reply-To: <20090810134323.GA10857@serverengines.com>

From: Sathya Perla <sathyap@serverengines.com>
Date: Mon, 10 Aug 2009 19:13:23 +0530

> Using "for(tail != head)" to traverse a queue from tail to head
> fails in the case of a fully filled queue. Use "for(used != 0)" instead.
> 
> Signed-off-by: Sathya Perla <sathyap@serverengines.com>

Applied.

^ permalink raw reply

* Re: [net-next-2.6 PATCH 3/3] be2net: clear & notify residual events before destroying event queues
From: David Miller @ 2009-08-13  5:16 UTC (permalink / raw)
  To: sathyap; +Cc: netdev
In-Reply-To: <20090810134351.GA10874@serverengines.com>

From: Sathya Perla <sathyap@serverengines.com>
Date: Mon, 10 Aug 2009 19:13:51 +0530

> Any events rcvd after interrupts are disabled (in the driver unload path),
> must be cleared and notified before the event queues are destroyed
> 
> Signed-off-by: Sathya Perla <sathyap@serverengines.com>

Applied.

^ permalink raw reply

* Re: [PATCH net-next 0/6] r8169 updates
From: David Miller @ 2009-08-13  5:17 UTC (permalink / raw)
  To: romieu; +Cc: edward_hsu, netdev
In-Reply-To: <20090811054039.GA16446@electric-eye.fr.zoreil.com>

From: Francois Romieu <romieu@fr.zoreil.com>
Date: Tue, 11 Aug 2009 07:40:39 +0200

> Hi,
> 
>   this series contains a minor fix (#1), an helper update (#2) as well as
> a set of phy related changes taken from Realtek's own driver (#3 .. #6).

All applied, thanks a lot Francois!

^ permalink raw reply

* Re: [PATCH net-next] Phonet: fix /proc/net/phonet with network namespaces
From: David Miller @ 2009-08-13  5:17 UTC (permalink / raw)
  To: remi.denis-courmont; +Cc: netdev
In-Reply-To: <1249996327-8460-1-git-send-email-remi.denis-courmont@nokia.com>

From: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Date: Tue, 11 Aug 2009 16:12:07 +0300

> From: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
> 
> seq_open_net() and seq_release() are needed for seq_file_net().
> 
> Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>

Applied.

^ permalink raw reply

* Re: 8139cp dma-debug warning.
From: David Miller @ 2009-08-13  5:20 UTC (permalink / raw)
  To: davej; +Cc: netdev
In-Reply-To: <20090812171333.GD3116@redhat.com>

From: Dave Jones <davej@redhat.com>
Date: Wed, 12 Aug 2009 13:13:33 -0400

> There's another instance of the same further in the file.
> 
> Does this look right?

Dave, Francois posted the following fix to lkml (he forgot
to CC: netdev and the people reporting this bug, oh well)

Did you see it?  It should fix the bug.

8139cp: balance dma_map_single vs dma_unmap_single pair

The driver always:
1. allocate cp->rx_buf_sz + NET_IP_ALIGN
2. map cp->rx_buf_sz

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 drivers/net/8139cp.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index 50efde1..d0dbbf3 100644
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -515,7 +515,7 @@ rx_status_loop:
 		dma_addr_t mapping;
 		struct sk_buff *skb, *new_skb;
 		struct cp_desc *desc;
-		unsigned buflen;
+		const unsigned buflen = cp->rx_buf_sz;
 
 		skb = cp->rx_skb[rx_tail];
 		BUG_ON(!skb);
@@ -549,8 +549,7 @@ rx_status_loop:
 			pr_debug("%s: rx slot %d status 0x%x len %d\n",
 			       dev->name, rx_tail, status, len);
 
-		buflen = cp->rx_buf_sz + NET_IP_ALIGN;
-		new_skb = netdev_alloc_skb(dev, buflen);
+		new_skb = netdev_alloc_skb(dev, buflen + NET_IP_ALIGN);
 		if (!new_skb) {
 			dev->stats.rx_dropped++;
 			goto rx_next;
-- 
1.6.3.4


^ permalink raw reply related

* Re: [PATCH 2/2] vhost_net: a kernel-level virtio server
From: Michael S. Tsirkin @ 2009-08-13  5:55 UTC (permalink / raw)
  To: Ira W. Snyder; +Cc: Arnd Bergmann, virtualization, netdev, kvm, linux-kernel
In-Reply-To: <20090812174821.GD24151@ovro.caltech.edu>

On Wed, Aug 12, 2009 at 10:48:21AM -0700, Ira W. Snyder wrote:
> On Wed, Aug 12, 2009 at 08:31:04PM +0300, Michael S. Tsirkin wrote:
> > On Wed, Aug 12, 2009 at 10:19:22AM -0700, Ira W. Snyder wrote:
> 
> [ snip out code ]
> 
> > > > 
> > > > We discussed this before, and I still think this could be directly derived
> > > > from struct virtqueue, in the same way that vring_virtqueue is derived from
> > > > struct virtqueue. That would make it possible for simple device drivers
> > > > to use the same driver in both host and guest, similar to how Ira Snyder
> > > > used virtqueues to make virtio_net run between two hosts running the
> > > > same code [1].
> > > > 
> > > > Ideally, I guess you should be able to even make virtio_net work in the
> > > > host if you do that, but that could bring other complexities.
> > > 
> > > I have no comments about the vhost code itself, I haven't reviewed it.
> > > 
> > > It might be interesting to try using a virtio-net in the host kernel to
> > > communicate with the virtio-net running in the guest kernel. The lack of
> > > a management interface is the biggest problem you will face (setting MAC
> > > addresses, negotiating features, etc. doesn't work intuitively).
> > 
> > That was one of the reasons I decided to move most of code out to
> > userspace. My kernel driver only handles datapath,
> > it's much smaller than virtio net.
> > 
> > > Getting
> > > the network interfaces talking is relatively easy.
> > > 
> > > Ira
> > 
> > Tried this, but
> > - guest memory isn't pinned, so copy_to_user
> >   to access it, errors need to be handled in a sane way
> > - used/available roles are reversed
> > - kick/interrupt roles are reversed
> > 
> > So most of the code then looks like
> > 
> > 	if (host) {
> > 	} else {
> > 	}
> > 	return
> > 
> > 
> > The only common part is walking the descriptor list,
> > but that's like 10 lines of code.
> > 
> > At which point it's better to keep host/guest code separate, IMO.
> > 
> 
> Ok, that makes sense. Let me see if I understand the concept of the
> driver. Here's a picture of what makes sense to me:
> 
> guest system
> ---------------------------------
> | userspace applications        |
> ---------------------------------
> | kernel network stack          |
> ---------------------------------
> | virtio-net                    |
> ---------------------------------
> | transport (virtio-ring, etc.) |
> ---------------------------------
>                |
>                |
> ---------------------------------
> | transport (virtio-ring, etc.) |
> ---------------------------------
> | some driver (maybe vhost?)    | <-- [1]
> ---------------------------------
> | kernel network stack          |
> ---------------------------------
> host system
> 
> >From the host's network stack, packets can be forwarded out to the
> physical network, or be consumed by a normal userspace application on
> the host. Just as if this were any other network interface.
> 
> In my patch, [1] was the virtio-net driver, completely unmodified.
> 
> So, does this patch accomplish the above diagram?

Not exactly. vhost passes packets to a physical device,
through a raw socket, not into host network stack.

> If so, why the copy_to_user(), etc?

Guest memory is not pinned. Memory access needs to go through
translation process, could cause page faults, etc.

> Maybe I'm confusing this with my system, where the
> "guest" is another physical system, separated by the PCI bus.
> 
> Ira

Yes, that's different.

^ permalink raw reply

* Re: [PATCH 2/2] vhost_net: a kernel-level virtio server
From: Michael S. Tsirkin @ 2009-08-13  6:06 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: virtualization, Ira W. Snyder, netdev, kvm, linux-kernel
In-Reply-To: <200908121959.47222.arnd@arndb.de>

On Wed, Aug 12, 2009 at 07:59:47PM +0200, Arnd Bergmann wrote:
> The trick is to swap the virtqueues instead. virtio-net is actually
> mostly symmetric in just the same way that the physical wires on a
> twisted pair ethernet are symmetric (I like how that analogy fits).

You need to really squint hard for it to look symmetric.

For example, for RX, virtio allocates an skb, puts a descriptor on a
ring and waits for host to fill it in. Host system can not do the same:
guest does not have access to host memory.

You can do a copy in transport to hide this fact, but it will kill
performance.

-- 
MST

^ permalink raw reply

* Re: [net-next 00/36] bnx2x patch series
From: David Miller @ 2009-08-13  6:09 UTC (permalink / raw)
  To: eilong; +Cc: netdev, yanivr, vladz, gertner, benli
In-Reply-To: <1250101162.27379.151.camel@lb-tlvb-eilong>

From: "Eilon Greenstein" <eilong@broadcom.com>
Date: Wed, 12 Aug 2009 21:19:22 +0300

> Here is a patch series for the bnx2x. This patch series also replace the
> FW, so
> it contains two big blobs - the new fw and the removal of the old one.
> Those
> patches do not contain anything but the ihex - the actually change to
> the driver
> is in patch number 2 which is small enough to fit the mailing list.
> 
> For those who wish to see all the patches, including the ihex, I also
> updated
> http://linux.broadcom.com/eilong/ to contain this patch series.
> 
> Please consider applying to net-next.

I've applied it all, but sincerely this is absolutely the last
time I'm taking in a patch bomb for a Broadcom ethernet driver.

If it's new stuff, keep it to ~10 patches.

If it's bug fixes outside of the merge window, keep it at
2 or 3 patches.

Post them very near to when you write them, so people have a chance of
actually reviewing your work (I guarentee I am the only non-Broadcom
person who looked over all 36 patches, or who ever will).

"Early and often" as it were...

Thanks.


^ permalink raw reply

* Re: [PATCH 2/2] vhost_net: a kernel-level virtio server
From: Michael S. Tsirkin @ 2009-08-13  6:31 UTC (permalink / raw)
  To: Anthony Liguori
  Cc: Arnd Bergmann, virtualization, Ira W. Snyder, netdev, kvm,
	linux-kernel
In-Reply-To: <4A8317A3.4030303@codemonkey.ws>

On Wed, Aug 12, 2009 at 02:27:31PM -0500, Anthony Liguori wrote:
> Arnd Bergmann wrote:
>>> As I pointed out earlier, most code in virtio net is asymmetrical: guest
>>> provides buffers, host consumes them.  Possibly, one could use virtio
>>> rings in a symmetrical way, but support of existing guest virtio net
>>> means there's almost no shared code.
>>>     
>>
>> The trick is to swap the virtqueues instead. virtio-net is actually
>> mostly symmetric in just the same way that the physical wires on a
>> twisted pair ethernet are symmetric (I like how that analogy fits).
>>   
>
> It's already been done between two guests.  See  
> http://article.gmane.org/gmane.linux.kernel.virtualization/5423
>
> Regards,
>
> Anthony Liguori

Yes, this works by copying data (see PATCH 5/5).  Another possibility is
page flipping.  Either will kill performance.

-- 
MST

^ permalink raw reply

* [RFC] defer skb allocation in virtio_net -- mergable buff part
From: Shirley Ma @ 2009-08-13  6:33 UTC (permalink / raw)
  To: netdev, kvm, linux-kernel

Guest virtio_net receives packets from its pre-allocated vring 
buffers, then it delivers these packets to upper layer protocols
as skb buffs. So it's not necessary to pre-allocate skb for each
mergable buffer, then frees it when it's useless. 

This patch has deferred skb allocation to when receiving packets, 
it reduces skb pre-allocations and skb_frees. And it induces two 
page list: freed_pages and used_page list, used_pages is used to 
track pages pre-allocated, it is only useful when removing virtio_net.

This patch has tested and measured against 2.6.31-rc4 git,
I thought this patch will improve large packet performance, but I saw
netperf TCP_STREAM performance improved for small packet for both 
local guest to host and host to local guest cases. It also reduces 
UDP packets drop rate from host to local guest. I am not fully understand 
why.

The netperf results from my laptop are:

mtu=1500
netperf -H xxx -l 120

		w/o patch	w/i patch (two runs)	
guest to host:  3336.84Mb/s   3730.14Mb/s ~ 3582.88Mb/s

host to guest:  3165.10Mb/s   3370.39Mb/s ~ 3407.96Mb/s

Here is the patch for your review. The same approach can apply to non-mergable
buffs too, so we can use code in common. If there is no objection, I will 
submit the non-mergable buffs patch later.


Signed-off-by: Shirley Ma <xma@us.ibm.com>
---

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 2a6e81d..e31ebc9 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -17,6 +17,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 //#define DEBUG
+#include <linux/list.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
@@ -39,6 +40,12 @@ module_param(gso, bool, 0444);
 
 #define VIRTNET_SEND_COMMAND_SG_MAX    2
 
+struct page_list
+{
+	struct page *page;
+	struct list_head list;
+};
+
 struct virtnet_info
 {
 	struct virtio_device *vdev;
@@ -72,6 +79,8 @@ struct virtnet_info
 
 	/* Chain pages by the private ptr. */
 	struct page *pages;
+	struct list_head used_pages;
+	struct list_head freed_pages;
 };
 
 static inline void *skb_vnet_hdr(struct sk_buff *skb)
@@ -106,6 +115,26 @@ static struct page *get_a_page(struct virtnet_info *vi, gfp_t gfp_mask)
 	return p;
 }
 
+static struct page_list *get_a_free_page(struct virtnet_info *vi, gfp_t gfp_mask)
+{
+	struct page_list *plist;
+
+	if (list_empty(&vi->freed_pages)) {
+		plist = kmalloc(sizeof(struct page_list), gfp_mask);
+		if (!plist)
+			return NULL;
+		list_add_tail(&plist->list, &vi->freed_pages);
+		plist->page = alloc_page(gfp_mask);
+	} else {
+		plist = list_first_entry(&vi->freed_pages, struct page_list, list);
+		if (!plist->page)
+			plist->page = alloc_page(gfp_mask);
+	}
+	if (plist->page)
+		list_move_tail(&plist->list, &vi->used_pages);
+	return plist;
+}
+
 static void skb_xmit_done(struct virtqueue *svq)
 {
 	struct virtnet_info *vi = svq->vdev->priv;
@@ -121,14 +150,14 @@ static void skb_xmit_done(struct virtqueue *svq)
 	tasklet_schedule(&vi->tasklet);
 }
 
-static void receive_skb(struct net_device *dev, struct sk_buff *skb,
+static void receive_skb(struct net_device *dev, void *buf,
 			unsigned len)
 {
 	struct virtnet_info *vi = netdev_priv(dev);
-	struct virtio_net_hdr *hdr = skb_vnet_hdr(skb);
 	int err;
 	int i;
-
+	struct sk_buff *skb = NULL;
+	struct virtio_net_hdr *hdr = NULL;
 	if (unlikely(len < sizeof(struct virtio_net_hdr) + ETH_HLEN)) {
 		pr_debug("%s: short packet %i\n", dev->name, len);
 		dev->stats.rx_length_errors++;
@@ -136,15 +165,30 @@ static void receive_skb(struct net_device *dev, struct sk_buff *skb,
 	}
 
 	if (vi->mergeable_rx_bufs) {
-		struct virtio_net_hdr_mrg_rxbuf *mhdr = skb_vnet_hdr(skb);
+		struct virtio_net_hdr_mrg_rxbuf *mhdr;
 		unsigned int copy;
-		char *p = page_address(skb_shinfo(skb)->frags[0].page);
+		skb_frag_t *f;
+		struct page_list *plist = (struct page_list *)buf;
+		char *p = page_address(plist->page);
+
+		skb = netdev_alloc_skb(vi->dev, GOOD_COPY_LEN + NET_IP_ALIGN);
+		if (unlikely(!skb)) {
+			/* drop the packet */
+			dev->stats.rx_dropped++;
+			list_move_tail(&plist->list, &vi->freed_pages);
+			return;
+		}
+
+		skb_reserve(skb, NET_IP_ALIGN);
 
 		if (len > PAGE_SIZE)
 			len = PAGE_SIZE;
 		len -= sizeof(struct virtio_net_hdr_mrg_rxbuf);
 
-		memcpy(hdr, p, sizeof(*mhdr));
+		mhdr = skb_vnet_hdr(skb);
+		memcpy(mhdr, p, sizeof(*mhdr));
+		hdr = (struct virtio_net_hdr *)mhdr;
+
 		p += sizeof(*mhdr);
 
 		copy = len;
@@ -155,20 +199,20 @@ static void receive_skb(struct net_device *dev, struct sk_buff *skb,
 
 		len -= copy;
 
-		if (!len) {
-			give_a_page(vi, skb_shinfo(skb)->frags[0].page);
-			skb_shinfo(skb)->nr_frags--;
-		} else {
-			skb_shinfo(skb)->frags[0].page_offset +=
+		if (len) {
+			f = &skb_shinfo(skb)->frags[0];
+			f->page = plist->page;
+			skb_shinfo(skb)->frags[0].page_offset =
 				sizeof(*mhdr) + copy;
 			skb_shinfo(skb)->frags[0].size = len;
 			skb->data_len += len;
 			skb->len += len;
+			skb_shinfo(skb)->nr_frags++;
+			plist->page = NULL;
 		}
+		list_move_tail(&plist->list, &vi->freed_pages);
 
 		while (--mhdr->num_buffers) {
-			struct sk_buff *nskb;
-
 			i = skb_shinfo(skb)->nr_frags;
 			if (i >= MAX_SKB_FRAGS) {
 				pr_debug("%s: packet too long %d\n", dev->name,
@@ -177,30 +221,30 @@ static void receive_skb(struct net_device *dev, struct sk_buff *skb,
 				goto drop;
 			}
 
-			nskb = vi->rvq->vq_ops->get_buf(vi->rvq, &len);
-			if (!nskb) {
+			plist = vi->rvq->vq_ops->get_buf(vi->rvq, &len);
+			if (!plist) {
 				pr_debug("%s: rx error: %d buffers missing\n",
 					 dev->name, mhdr->num_buffers);
 				dev->stats.rx_length_errors++;
 				goto drop;
 			}
-
-			__skb_unlink(nskb, &vi->recv);
 			vi->num--;
-
-			skb_shinfo(skb)->frags[i] = skb_shinfo(nskb)->frags[0];
-			skb_shinfo(nskb)->nr_frags = 0;
-			kfree_skb(nskb);
-
+			f = &skb_shinfo(skb)->frags[i];
+			f->page = plist->page;
+			f->page_offset = 0;
+			
 			if (len > PAGE_SIZE)
 				len = PAGE_SIZE;
-
 			skb_shinfo(skb)->frags[i].size = len;
 			skb_shinfo(skb)->nr_frags++;
 			skb->data_len += len;
 			skb->len += len;
+			plist->page = NULL;
+			list_move_tail(&plist->list, &vi->freed_pages);
 		}
 	} else {
+		skb = (struct sk_buff *)buf;
+		hdr = skb_vnet_hdr(skb);
 		len -= sizeof(struct virtio_net_hdr);
 
 		if (len <= MAX_PACKET_LEN)
@@ -329,7 +373,6 @@ static void try_fill_recv_maxbufs(struct virtnet_info *vi)
 
 static void try_fill_recv(struct virtnet_info *vi)
 {
-	struct sk_buff *skb;
 	struct scatterlist sg[1];
 	int err;
 
@@ -339,39 +382,21 @@ static void try_fill_recv(struct virtnet_info *vi)
 	}
 
 	for (;;) {
-		skb_frag_t *f;
-
-		skb = netdev_alloc_skb(vi->dev, GOOD_COPY_LEN + NET_IP_ALIGN);
-		if (unlikely(!skb))
-			break;
-
-		skb_reserve(skb, NET_IP_ALIGN);
-
-		f = &skb_shinfo(skb)->frags[0];
-		f->page = get_a_page(vi, GFP_ATOMIC);
-		if (!f->page) {
-			kfree_skb(skb);
+		struct page_list *plist = get_a_free_page(vi, GFP_ATOMIC);
+		if (!plist || !plist->page)
 			break;
-		}
-
-		f->page_offset = 0;
-		f->size = PAGE_SIZE;
-
-		skb_shinfo(skb)->nr_frags++;
-
-		sg_init_one(sg, page_address(f->page), PAGE_SIZE);
-		skb_queue_head(&vi->recv, skb);
-
-		err = vi->rvq->vq_ops->add_buf(vi->rvq, sg, 0, 1, skb);
+		sg_init_one(sg, page_address(plist->page), PAGE_SIZE);
+		err = vi->rvq->vq_ops->add_buf(vi->rvq, sg, 0, 1, plist);
 		if (err) {
-			skb_unlink(skb, &vi->recv);
-			kfree_skb(skb);
+			list_move_tail(&plist->list, &vi->freed_pages);
 			break;
 		}
 		vi->num++;
 	}
+
 	if (unlikely(vi->num > vi->max))
 		vi->max = vi->num;
+	
 	vi->rvq->vq_ops->kick(vi->rvq);
 }
 
@@ -388,14 +413,15 @@ static void skb_recv_done(struct virtqueue *rvq)
 static int virtnet_poll(struct napi_struct *napi, int budget)
 {
 	struct virtnet_info *vi = container_of(napi, struct virtnet_info, napi);
-	struct sk_buff *skb = NULL;
+	void *buf = NULL;
 	unsigned int len, received = 0;
 
 again:
 	while (received < budget &&
-	       (skb = vi->rvq->vq_ops->get_buf(vi->rvq, &len)) != NULL) {
-		__skb_unlink(skb, &vi->recv);
-		receive_skb(vi->dev, skb, len);
+	       (buf = vi->rvq->vq_ops->get_buf(vi->rvq, &len)) != NULL) {
+		if (!vi->mergeable_rx_bufs)
+			__skb_unlink((struct sk_buff *)buf, &vi->recv);
+		receive_skb(vi->dev, buf, len);
 		vi->num--;
 		received++;
 	}
@@ -893,6 +919,8 @@ static int virtnet_probe(struct virtio_device *vdev)
 	vi->vdev = vdev;
 	vdev->priv = vi;
 	vi->pages = NULL;
+	INIT_LIST_HEAD(&vi->used_pages);
+	INIT_LIST_HEAD(&vi->freed_pages);
 
 	/* If they give us a callback when all buffers are done, we don't need
 	 * the timer. */
@@ -969,6 +997,7 @@ static void virtnet_remove(struct virtio_device *vdev)
 {
 	struct virtnet_info *vi = vdev->priv;
 	struct sk_buff *skb;
+	struct page_list *plist, *tp;
 
 	/* Stop all the virtqueues. */
 	vdev->config->reset(vdev);
@@ -977,14 +1006,23 @@ static void virtnet_remove(struct virtio_device *vdev)
 		del_timer_sync(&vi->xmit_free_timer);
 
 	/* Free our skbs in send and recv queues, if any. */
-	while ((skb = __skb_dequeue(&vi->recv)) != NULL) {
-		kfree_skb(skb);
-		vi->num--;
+	if (!vi->mergeable_rx_bufs) {
+		while ((skb = __skb_dequeue(&vi->recv)) != NULL) {
+			kfree_skb(skb);
+			vi->num--;
+		}
+		BUG_ON(vi->num != 0);
+	} else {
+		list_splice_init(&vi->used_pages, &vi->freed_pages);
+		list_for_each_entry_safe(plist, tp, &vi->freed_pages, list) {
+			vi->num--;
+			if (plist->page)
+				__free_pages(plist->page, 0);
+			kfree(plist);
+		}
 	}
 	__skb_queue_purge(&vi->send);
 
-	BUG_ON(vi->num != 0);
-
 	unregister_netdev(vi->dev);
 
 	vdev->config->del_vqs(vi->vdev);



^ permalink raw reply related

* Re: [net-next 00/36] bnx2x patch series
From: Eilon Greenstein @ 2009-08-13  6:35 UTC (permalink / raw)
  To: David Miller
  Cc: netdev@vger.kernel.org, Yaniv Rosner, Vladislav Zolotarov,
	Yitchak Gertner, Benjamin Li
In-Reply-To: <20090812.230912.102740872.davem@davemloft.net>

On Wed, 2009-08-12 at 23:09 -0700, David Miller wrote:
> From: "Eilon Greenstein" <eilong@broadcom.com>
> Date: Wed, 12 Aug 2009 21:19:22 +0300
> 
> > Here is a patch series for the bnx2x. This patch series also replace the
> > FW, so
> > it contains two big blobs - the new fw and the removal of the old one.
> > Those
> > patches do not contain anything but the ihex - the actually change to
> > the driver
> > is in patch number 2 which is small enough to fit the mailing list.
> > 
> > For those who wish to see all the patches, including the ihex, I also
> > updated
> > http://linux.broadcom.com/eilong/ to contain this patch series.
> > 
> > Please consider applying to net-next.
> 
> I've applied it all, but sincerely this is absolutely the last
> time I'm taking in a patch bomb for a Broadcom ethernet driver.
> 
> If it's new stuff, keep it to ~10 patches.
> 
> If it's bug fixes outside of the merge window, keep it at
> 2 or 3 patches.
> 
> Post them very near to when you write them, so people have a chance of
> actually reviewing your work (I guarentee I am the only non-Broadcom
> person who looked over all 36 patches, or who ever will).
> 
> "Early and often" as it were...
> 
Will do!

Thanks,
Eilon



^ permalink raw reply

* [net-next-2.6 PATCH] be2net:Creating/destroying queues regardless of netif_running() in suspend/resume path
From: Sarveshwar Bandi @ 2009-08-13  7:01 UTC (permalink / raw)
  To: davem; +Cc: netdev

Signed-off-by: sarveshwarb <sarveshwarb@serverengines.com>
---
 drivers/net/benet/be_main.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 2db879c..45507d8 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -1972,9 +1972,9 @@ static int be_suspend(struct pci_dev *pd
 	if (netif_running(netdev)) {
 		rtnl_lock();
 		be_close(netdev);
-		be_clear(adapter);
 		rtnl_unlock();
 	}
+	be_clear(adapter);
 
 	pci_save_state(pdev);
 	pci_disable_device(pdev);
@@ -1997,9 +1997,9 @@ static int be_resume(struct pci_dev *pde
 	pci_set_power_state(pdev, 0);
 	pci_restore_state(pdev);
 
+	be_setup(adapter);
 	if (netif_running(netdev)) {
 		rtnl_lock();
-		be_setup(adapter);
 		be_open(netdev);
 		rtnl_unlock();
 	}
-- 
1.4.0


^ permalink raw reply related

* [PATCH] Speed-up pfifo_fast lookup using a bitmap
From: Krishna Kumar @ 2009-08-13  7:28 UTC (permalink / raw)
  To: davem; +Cc: Jarek Poplawski, netdev, herbert, Krishna Kumar, kaber

Maintain a per-qdisc bitmap indicating availability of skbs for
each band. This helps in faster lookup for a skb when there are
no high priority skbs. Also, it helps in (rare) cases where there
are no skbs on the list where an immediate lookup helps rather
than iterating through the three bands.

Another option I considered was to create a private qdisc pointer
and avoid touching Qdisc structure:
	struct pfifo_fast_priv {
		unsigned long bitmap;
		struct sk_buff_head q[PFIFO_FAST_BANDS];
	};
but the test numbers came a little less, since it takes a few more
memory references on enqueue/dequeue.

By keeping the bitmap in Qdisc, it is possible to implement the
lookup for other schedulers, maybe sch_prio which goes through 16
bands?

The BW numbers are average across 5 iterations for multiple
netperf sessions (1-12 on x86_64, and 1-32 on P6) tested with
Chelsio 10 gbps cards over a 2 hour run:

-------------------------------------------------------------------------
     |         x86_64 (Mb/s)          |               P6 (Mb/s)
--------------------------------------|----------------------------------
Size |  ORG BW          NEW BW        |    ORG BW          NEW BW       
-----|--------------------------------|----------------------------------
16K  |  157700          158237        |    153876          156696
64K  |  155916          157882        |    154176          155987
128K |  155122          155628        |    154983          155904
256K |  154808          158913        |    153898          155164
-------------------------------------------------------------------------

Thanks,

- KK

Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>
---

 include/net/sch_generic.h |    1 
 net/sched/sch_generic.c   |   46 +++++++++++++++++++++++-------------
 2 files changed, 31 insertions(+), 16 deletions(-)

diff -ruNp org/include/net/sch_generic.h new/include/net/sch_generic.h
--- org/include/net/sch_generic.h	2009-08-07 12:05:43.000000000 +0530
+++ new/include/net/sch_generic.h	2009-08-07 19:35:16.000000000 +0530
@@ -72,6 +72,7 @@ struct Qdisc
 	 * For performance sake on SMP, we put highly modified fields at the end
 	 */
 	unsigned long		state;
+	unsigned long		bitmap;
 	struct sk_buff_head	q;
 	struct gnet_stats_basic bstats;
 	struct gnet_stats_queue	qstats;
diff -ruNp org/net/sched/sch_generic.c new/net/sched/sch_generic.c
--- org/net/sched/sch_generic.c	2009-08-07 12:05:43.000000000 +0530
+++ new/net/sched/sch_generic.c	2009-08-13 11:57:54.000000000 +0530
@@ -406,18 +406,29 @@ static const u8 prio2band[TC_PRIO_MAX+1]
 
 #define PFIFO_FAST_BANDS 3
 
-static inline struct sk_buff_head *prio2list(struct sk_buff *skb,
-					     struct Qdisc *qdisc)
+/*
+ * Convert a bitmap to the first band number where an skb is queue'd, where:
+ * 	bitmap=0 means there are no skbs for any bands
+ * 	bitmap=1 means there is a skb on band 0
+ *	bitmap=7 means there are skbs on all 3 bands, etc.
+ */
+static const int bitmap2band[] =
+	{-1, 0, 1, 0, 2, 0, 1, 0};
+
+static inline struct sk_buff_head *band2list(struct Qdisc *qdisc, int band)
 {
 	struct sk_buff_head *list = qdisc_priv(qdisc);
-	return list + prio2band[skb->priority & TC_PRIO_MAX];
+
+	return list + band;
 }
 
 static int pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc* qdisc)
 {
-	struct sk_buff_head *list = prio2list(skb, qdisc);
+	int band = prio2band[skb->priority & TC_PRIO_MAX];
+	struct sk_buff_head *list = band2list(qdisc, band);
 
 	if (skb_queue_len(list) < qdisc_dev(qdisc)->tx_queue_len) {
+		qdisc->bitmap |= (1 << band);
 		qdisc->q.qlen++;
 		return __qdisc_enqueue_tail(skb, qdisc, list);
 	}
@@ -427,14 +438,17 @@ static int pfifo_fast_enqueue(struct sk_
 
 static struct sk_buff *pfifo_fast_dequeue(struct Qdisc* qdisc)
 {
-	int prio;
-	struct sk_buff_head *list = qdisc_priv(qdisc);
+	int band = bitmap2band[qdisc->bitmap];
 
-	for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) {
-		if (!skb_queue_empty(list + prio)) {
-			qdisc->q.qlen--;
-			return __qdisc_dequeue_head(qdisc, list + prio);
-		}
+	if (likely(band >= 0)) {
+		struct sk_buff_head *list = qdisc_priv(qdisc);
+		struct sk_buff *skb = __qdisc_dequeue_head(qdisc, list + band);
+
+		qdisc->q.qlen--;
+		if (skb_queue_empty(list + band))
+			qdisc->bitmap &= ~(1 << band);
+
+		return skb;
 	}
 
 	return NULL;
@@ -442,12 +456,12 @@ static struct sk_buff *pfifo_fast_dequeu
 
 static struct sk_buff *pfifo_fast_peek(struct Qdisc* qdisc)
 {
-	int prio;
-	struct sk_buff_head *list = qdisc_priv(qdisc);
+	int band = bitmap2band[qdisc->bitmap];
+
+	if (band >= 0) {
+		struct sk_buff_head *list = qdisc_priv(qdisc);
 
-	for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) {
-		if (!skb_queue_empty(list + prio))
-			return skb_peek(list + prio);
+		return skb_peek(list + band);
 	}
 
 	return NULL;

^ permalink raw reply

* Re: [PATCH] ipv6: Log the explicit address that triggered DAD failure
From: Jens Rosenboom @ 2009-08-13  8:16 UTC (permalink / raw)
  To: Brian Haley; +Cc: Linux Network Developers, David Miller
In-Reply-To: <4A836D70.1040702@hp.com>

On Wed, 2009-08-12 at 21:33 -0400, Brian Haley wrote:
[...]
> The other thing I've come across that is similar to this is the
> issue that when DAD fails, /sbin/ip doesn't show that it did,
> the address just stays in a tentative state forever:
> 
>     inet6 dead:beef::1/64 scope global tentative 
>        valid_lft forever preferred_lft forever
> 
> Does anyone have an issue of adding a "dadfailed" flag to make
> this more obvious:
> 
>     inet6 dead:beef::1/64 scope global tentative dadfailed
>        valid_lft forever preferred_lft forever

It looks like you would have to spend the last available bit in
ifa_flags for that, not sure if that is worth it, how about setting it
to tentative|deprecated instead?

Some action should maybe also happen in the case that the address wasn't
tentative anymore in ndisc_recv_na(). At least it should also log the
address itself:

diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 9eb68e9..1ba42bd 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -955,8 +955,8 @@ static void ndisc_recv_na(struct sk_buff *skb)
 		 */
 		if (skb->pkt_type != PACKET_LOOPBACK)
 			ND_PRINTK1(KERN_WARNING
-			   "ICMPv6 NA: someone advertises our address on %s!\n",
-			   ifp->idev->dev->name);
+			   "ICMPv6 NA: someone advertises our address %pI6 on %s!\n",
+			   &ifp->addr, ifp->idev->dev->name);
 		in6_ifa_put(ifp);
 		return;
 	}



^ permalink raw reply related

* Re: [PATCH 2/2] vhost_net: a kernel-level virtio server
From: Michael S. Tsirkin @ 2009-08-13  8:45 UTC (permalink / raw)
  To: Anthony Liguori
  Cc: Arnd Bergmann, virtualization, Ira W. Snyder, netdev, kvm,
	linux-kernel
In-Reply-To: <4A83167E.2080701@codemonkey.ws>

On Wed, Aug 12, 2009 at 02:22:38PM -0500, Anthony Liguori wrote:
> Michael S. Tsirkin wrote:
>>>
>>> We discussed this before, and I still think this could be directly derived
>>> from struct virtqueue, in the same way that vring_virtqueue is derived from
>>> struct virtqueue.
>>>     
>>
>> I prefer keeping it simple. Much of abstraction in virtio is due to the
>> fact that it needs to work on top of different hardware emulations:
>> lguest,kvm, possibly others in the future.  vhost is always working on
>> real hardware, using eventfd as the interface, so it does not need that.
>>   
>
> Actually, vhost may not always be limited to real hardware.

Yes, any ethernet device will do. What I mean is that vhost does not
deal with emulation at all. All setup is done in userspace.

>
> We may on day use vhost as the basis of a driver domain.  There's quite  
> a lot of interest in this for networking.

You can use veth for this. This works today.

> At any rate, I'd like to see performance results before we consider  
> trying to reuse virtio code.
> 
> Regards,
>
> Anthony Liguori

^ permalink raw reply

* Re: Use correct NET_RX_* returns for atalk_rcv()
From: Mark Smith @ 2009-08-13  9:30 UTC (permalink / raw)
  To: David Miller; +Cc: acme, netdev
In-Reply-To: <20090812.221550.173145055.davem@davemloft.net>

On Wed, 12 Aug 2009 22:15:50 -0700 (PDT)
David Miller <davem@davemloft.net> wrote:

> From: Mark Smith <lk-netdev@lk-netdev.nosense.org>
> Date: Fri, 7 Aug 2009 18:51:22 +0930
> 
> > 
> >     In all rx'd SKB cases, atalk_rcv() either eventually jumps to or falls through
> >     to the label out:, which  returns numeric 0. Numeric 0 corresponds to
> >     NET_RX_SUCCESS, which is incorrect in failed SKB cases.
> >     
> >     This patch makes atalk_rcv() provide the correct returns by:
> >     
> >     o  explicitly returning NET_RX_SUCCESS in the two success cases
> >     o  having the out: label return NET_RX_DROP, instead of numeric 0
> >     o  making the failed SKB labels and processing more consistent with other
> >        _rcv() routines in the kernel, simplifying validation and removing a
> >        backwards goto
> > 
> > Signed-off-by: Mark Smith <markzzzsmith@yahoo.com.au>
> 
> Applied.

Thanks David.

^ permalink raw reply

* Re: [PATCH] Speed-up pfifo_fast lookup using a bitmap
From: Jarek Poplawski @ 2009-08-13 10:08 UTC (permalink / raw)
  To: Krishna Kumar; +Cc: davem, netdev, herbert, kaber
In-Reply-To: <20090813072818.7541.77365.sendpatchset@localhost.localdomain>

On Thu, Aug 13, 2009 at 12:58:18PM +0530, Krishna Kumar wrote:
> Maintain a per-qdisc bitmap indicating availability of skbs for
> each band. This helps in faster lookup for a skb when there are
> no high priority skbs. Also, it helps in (rare) cases where there
> are no skbs on the list where an immediate lookup helps rather
> than iterating through the three bands.
> 
> Another option I considered was to create a private qdisc pointer
> and avoid touching Qdisc structure:
> 	struct pfifo_fast_priv {
> 		unsigned long bitmap;
> 		struct sk_buff_head q[PFIFO_FAST_BANDS];
> 	};
> but the test numbers came a little less, since it takes a few more
> memory references on enqueue/dequeue.

If it's exactly "a little less" I'd consider keeping it private yet...

> 
> By keeping the bitmap in Qdisc, it is possible to implement the
> lookup for other schedulers, maybe sch_prio which goes through 16
> bands?
> 
> The BW numbers are average across 5 iterations for multiple
> netperf sessions (1-12 on x86_64, and 1-32 on P6) tested with
> Chelsio 10 gbps cards over a 2 hour run:
> 
> -------------------------------------------------------------------------
>      |         x86_64 (Mb/s)          |               P6 (Mb/s)
> --------------------------------------|----------------------------------
> Size |  ORG BW          NEW BW        |    ORG BW          NEW BW       
> -----|--------------------------------|----------------------------------
> 16K  |  157700          158237        |    153876          156696
> 64K  |  155916          157882        |    154176          155987
> 128K |  155122          155628        |    154983          155904
> 256K |  154808          158913        |    153898          155164
> -------------------------------------------------------------------------

Btw, I wonder how much gain of your previous (_CAN_BYPASS) patch is
saved after this change...

> 
> Thanks,
> 
> - KK
> 
> Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>
> ---
> 
>  include/net/sch_generic.h |    1 
>  net/sched/sch_generic.c   |   46 +++++++++++++++++++++++-------------
>  2 files changed, 31 insertions(+), 16 deletions(-)
> 
> diff -ruNp org/include/net/sch_generic.h new/include/net/sch_generic.h
> --- org/include/net/sch_generic.h	2009-08-07 12:05:43.000000000 +0530
> +++ new/include/net/sch_generic.h	2009-08-07 19:35:16.000000000 +0530
> @@ -72,6 +72,7 @@ struct Qdisc
>  	 * For performance sake on SMP, we put highly modified fields at the end
>  	 */
>  	unsigned long		state;
> +	unsigned long		bitmap;
>  	struct sk_buff_head	q;
>  	struct gnet_stats_basic bstats;
>  	struct gnet_stats_queue	qstats;
> diff -ruNp org/net/sched/sch_generic.c new/net/sched/sch_generic.c
> --- org/net/sched/sch_generic.c	2009-08-07 12:05:43.000000000 +0530
> +++ new/net/sched/sch_generic.c	2009-08-13 11:57:54.000000000 +0530
> @@ -406,18 +406,29 @@ static const u8 prio2band[TC_PRIO_MAX+1]
>  
>  #define PFIFO_FAST_BANDS 3
>  
> -static inline struct sk_buff_head *prio2list(struct sk_buff *skb,
> -					     struct Qdisc *qdisc)
> +/*
> + * Convert a bitmap to the first band number where an skb is queue'd, where:

 - * Convert a bitmap to the first band number where an skb is queue'd, where:
 + * Convert a bitmap to the first band number where an skb is queued, where:

> + * 	bitmap=0 means there are no skbs for any bands
> + * 	bitmap=1 means there is a skb on band 0

 - * 	bitmap=1 means there is a skb on band 0
 + * 	bitmap=1 means there is an skb on band 0

> + *	bitmap=7 means there are skbs on all 3 bands, etc.
> + */
> +static const int bitmap2band[] =
> +	{-1, 0, 1, 0, 2, 0, 1, 0};

Why wrapped?

...
 ... pfifo_fast_reset(...)
 {
	...
+	qdisc->bitmap = 0; ?
 }

Thanks,
Jarek P.

^ permalink raw reply

* [PATCH] Pegasus: Add MAC programmability
From: Davide Rizzo @ 2009-08-13 10:10 UTC (permalink / raw)
  To: linux-usb-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	petkan-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f

Added capability to set mac address and to program it into EEPROM

Signed-off-by: Davide Rizzo <elpa.rizzo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
diff -urNp linux-2.6.30.4/drivers/net/usb/pegasus.c
linux-2.6.30.4.elpa/drivers/net/usb/pegasus.c
--- linux-2.6.30.4/drivers/net/usb/pegasus.c	2009-08-13 07:14:57.000000000 +0200
+++ linux-2.6.30.4.elpa/drivers/net/usb/pegasus.c	2009-08-13
08:39:01.000000000 +0200
@@ -469,8 +467,49 @@ fail:
 		dev_warn(&pegasus->intf->dev, "%s failed\n", __func__);
 	return -ETIMEDOUT;
 }
+
+/* Got from adm 8515 starter kit */
+static const __u16 def_eeprom[] = {
+			  0x8515, 0x0170, 0x0082, 0x0409, 0x0000,
+	0x07a6, 0x8515, 0x100e, 0x202a, 0x380a, 0x0000, 0x0000, 0x0000,
+	0x030e, 0x0041, 0x0044, 0x004d, 0x0074, 0x0065, 0x006b, 0x0000,
+	0x001e, 0x0055, 0x0053, 0x0042, 0x0020, 0x0031, 0x0030, 0x002f,
+	0x032a, 0x0055, 0x0053, 0x0042, 0x0020, 0x0054, 0x006f, 0x0020,
+	0x004c, 0x0041, 0x004e, 0x0020, 0x0043, 0x006f, 0x006e, 0x0076,
+	0x0065, 0x0072, 0x0074, 0x0065, 0x0072, 0x0000, 0x0000, 0x0000,
+	0x030a, 0x0030, 0x0030, 0x0030, 0x0031, 0x0000, 0x0000, 0x0000,
+};
 #endif				/* PEGASUS_WRITE_EEPROM */

+static int pegasus_set_mac_address(struct net_device *netdev, void *p)
+{
+	struct sockaddr *addr = p;
+	pegasus_t *pegasus = (pegasus_t *) netdev_priv(netdev);
+	int i;
+
+	if (netif_running(netdev))
+		return -EBUSY;
+	memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
+	dbg("%s: Setting MAC address to ", netdev->name);
+	for (i = 0; i < 5; i++)
+		dbg("%02X:", netdev->dev_addr[i]);
+	dbg("%02X\n", netdev->dev_addr[i]);
+	/* Set the IDR registers. */
+	set_registers(pegasus, EthID, 6, netdev->dev_addr);
+#ifdef PEGASUS_WRITE_EEPROM
+	write_eprom_word(pegasus, 0,
+		(netdev->dev_addr[1] << 8) + netdev->dev_addr[0]);
+	write_eprom_word(pegasus, 1,
+		(netdev->dev_addr[3] << 8) + netdev->dev_addr[2]);
+	write_eprom_word(pegasus, 2,
+		(netdev->dev_addr[5] << 8) + netdev->dev_addr[4]);
+	for (i = 0; i < ARRAY_SIZE(def_eeprom); i++)
+		write_eprom_word(pegasus, i + 3, def_eeprom[i]);
+
+#endif                         /* PEGASUS_WRITE_EEPROM */
+	return 0;
+}
+
 static inline void get_node_id(pegasus_t * pegasus, __u8 * id)
 {
 	int i;
@@ -1492,6 +1531,7 @@ static const struct net_device_ops pegas
 	.ndo_start_xmit =		pegasus_start_xmit,
 	.ndo_set_multicast_list =	pegasus_set_multicast,
 	.ndo_get_stats =		pegasus_netdev_stats,
+	.ndo_set_mac_address =	pegasus_set_mac_address,
 	.ndo_tx_timeout =		pegasus_tx_timeout,
 	.ndo_change_mtu =		eth_change_mtu,
 	.ndo_set_mac_address =		eth_mac_addr,
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Pegasus: Bug / Correction (?)
From: Davide Rizzo @ 2009-08-13 10:11 UTC (permalink / raw)
  To: linux-usb-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	petkan-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f

Bug Correction
ADM8515 fails to read central 2 bytes of MAC address
This patch solves the problem, but I didn't understand it.

Signed-off-by: Davide Rizzo <elpa.rizzo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
diff -urNp linux-2.6.30.4/drivers/net/usb/pegasus.c
linux-2.6.30.4.elpa/drivers/net/usb/pegasus.c
--- linux-2.6.30.4/drivers/net/usb/pegasus.c	2009-08-13 07:14:57.000000000 +0200
+++ linux-2.6.30.4.elpa/drivers/net/usb/pegasus.c	2009-08-13
08:39:01.000000000 +0200
@@ -425,7 +425,6 @@ fail:
 static inline void enable_eprom_write(pegasus_t * pegasus)
 {
 	__u8 tmp;
-	int ret;

 	get_registers(pegasus, EthCtrl2, 1, &tmp);
 	set_register(pegasus, EthCtrl2, tmp | EPROM_WR_ENABLE);
@@ -434,7 +433,6 @@ static inline void enable_eprom_write(pe
 static inline void disable_eprom_write(pegasus_t * pegasus)
 {
 	__u8 tmp;
-	int ret;

 	get_registers(pegasus, EthCtrl2, 1, &tmp);
 	set_register(pegasus, EpromCtrl, 0);
@@ -486,9 +525,9 @@ static void set_ethernet_addr(pegasus_t
 {
 	__u8 node_id[6];

-	if (pegasus->features & PEGASUS_II) {
+/*if (pegasus->features & PEGASUS_II) {
 		get_registers(pegasus, 0x10, sizeof(node_id), node_id);
-	} else {
+	} else*/ {
 		get_node_id(pegasus, node_id);
 		set_registers(pegasus, EthID, sizeof (node_id), node_id);
 	}
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [Iproute2]: failed replacing internal netem qdisc with pfifo
From: Marcela Maslanova @ 2009-08-13 10:26 UTC (permalink / raw)
  To: netdev; +Cc: shemminger
In-Reply-To: <1937368901.914631250159066876.JavaMail.root@zmail07.collab.prod.int.phx2.redhat.com>

Hello,
I've received bug report about not being replaced netem with pfifo
anymore: https://bugzilla.redhat.com/show_bug.cgi?id=515522
This should be possible according to documentation [1].
Is this intentional change or is it a bug?

It worked with kernel-2.6.27.5-117.fc10 and iproute-2.6.27. The problem
is still present with current iproute and kernel-2.6.29.6-217.2.3.fc11.

Best regards,
Marcela Mašláňová

[1] http://www.linuxfoundation.org/en/Net:Netem#How_to_reorder_packets_based_on_jitter.3F

^ permalink raw reply

* Re: [RFC] ipv6: Change %pI6 format to output compacted addresses?
From: Joe Perches @ 2009-08-13 10:39 UTC (permalink / raw)
  To: Brian Haley; +Cc: Jens Rosenboom, Linux Network Developers
In-Reply-To: <4A836D6D.1040400@hp.com>

On Wed, 2009-08-12 at 21:33 -0400, Brian Haley wrote:
> Jens Rosenboom wrote:
> > Currently the output looks like 2001:0db8:0000:0000:0000:0000:0000:0001
> > which might be compacted to 2001:db8::1. The code to do this could be
> > adapted from inet_ntop in glibc, which would add about 80 lines to
> > lib/vsprintf.c. How do you guys value the tradeoff between more readable
> > logging and increased kernel size?
> > 
> > This was already mentioned in
> > http://kerneltrap.org/mailarchive/linux-netdev/2008/11/25/4231684 but
> > noone seems to have taken up on it.
> 
> Anyways, can you try this patch, it's less than 40 new lines :)
> It might be good enough, but could probably use some help.

You'll need to invent a new %p qualifier type to allow
compressed representation.  Your patch will change current uses
with seq_<foo> output in net, which could break userspace.



^ 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