Netdev List
 help / color / mirror / Atom feed
* [PATCH v3 5/6] net: calxedaxgmac: rework transmit ring handling
From: Rob Herring @ 2012-11-05 16:22 UTC (permalink / raw)
  To: netdev, davem; +Cc: eric.dumazet, Rob Herring
In-Reply-To: <1352132544-15809-1-git-send-email-robherring2@gmail.com>

From: Rob Herring <rob.herring@calxeda.com>

Only generate tx interrupts on every ring size / 4 descriptors. Move the
netif_stop_queue call to the end of the xmit function rather than
checking at the beginning.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
 drivers/net/ethernet/calxeda/xgmac.c |   24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c
index 8263219..362b35e 100644
--- a/drivers/net/ethernet/calxeda/xgmac.c
+++ b/drivers/net/ethernet/calxeda/xgmac.c
@@ -211,7 +211,7 @@
 #define DMA_INTR_ENA_TIE	0x00000001	/* Transmit Interrupt */
 
 #define DMA_INTR_NORMAL		(DMA_INTR_ENA_NIE | DMA_INTR_ENA_RIE | \
-				 DMA_INTR_ENA_TUE)
+				 DMA_INTR_ENA_TUE | DMA_INTR_ENA_TIE)
 
 #define DMA_INTR_ABNORMAL	(DMA_INTR_ENA_AIE | DMA_INTR_ENA_FBE | \
 				 DMA_INTR_ENA_RWE | DMA_INTR_ENA_RSE | \
@@ -374,6 +374,7 @@ struct xgmac_priv {
 	struct sk_buff **tx_skbuff;
 	unsigned int tx_head;
 	unsigned int tx_tail;
+	int tx_irq_cnt;
 
 	void __iomem *base;
 	unsigned int dma_buf_sz;
@@ -886,7 +887,7 @@ static void xgmac_tx_complete(struct xgmac_priv *priv)
 	}
 
 	if (dma_ring_space(priv->tx_head, priv->tx_tail, DMA_TX_RING_SZ) >
-	    TX_THRESH)
+	    MAX_SKB_FRAGS)
 		netif_wake_queue(priv->dev);
 }
 
@@ -1057,19 +1058,15 @@ static netdev_tx_t xgmac_xmit(struct sk_buff *skb, struct net_device *dev)
 	struct xgmac_priv *priv = netdev_priv(dev);
 	unsigned int entry;
 	int i;
+	u32 irq_flag;
 	int nfrags = skb_shinfo(skb)->nr_frags;
 	struct xgmac_dma_desc *desc, *first;
 	unsigned int desc_flags;
 	unsigned int len;
 	dma_addr_t paddr;
 
-	if (dma_ring_space(priv->tx_head, priv->tx_tail, DMA_TX_RING_SZ) <
-	    (nfrags + 1)) {
-		writel(DMA_INTR_DEFAULT_MASK | DMA_INTR_ENA_TIE,
-			priv->base + XGMAC_DMA_INTR_ENA);
-		netif_stop_queue(dev);
-		return NETDEV_TX_BUSY;
-	}
+	priv->tx_irq_cnt = (priv->tx_irq_cnt + 1) & (DMA_TX_RING_SZ/4 - 1);
+	irq_flag = priv->tx_irq_cnt ? 0 : TXDESC_INTERRUPT;
 
 	desc_flags = (skb->ip_summed == CHECKSUM_PARTIAL) ?
 		TXDESC_CSUM_ALL : 0;
@@ -1110,9 +1107,9 @@ static netdev_tx_t xgmac_xmit(struct sk_buff *skb, struct net_device *dev)
 	/* Interrupt on completition only for the latest segment */
 	if (desc != first)
 		desc_set_tx_owner(desc, desc_flags |
-			TXDESC_LAST_SEG | TXDESC_INTERRUPT);
+			TXDESC_LAST_SEG | irq_flag);
 	else
-		desc_flags |= TXDESC_LAST_SEG | TXDESC_INTERRUPT;
+		desc_flags |= TXDESC_LAST_SEG | irq_flag;
 
 	/* Set owner on first desc last to avoid race condition */
 	wmb();
@@ -1121,6 +1118,9 @@ static netdev_tx_t xgmac_xmit(struct sk_buff *skb, struct net_device *dev)
 	priv->tx_head = dma_ring_incr(entry, DMA_TX_RING_SZ);
 
 	writel(1, priv->base + XGMAC_DMA_TX_POLL);
+	if (dma_ring_space(priv->tx_head, priv->tx_tail, DMA_TX_RING_SZ) <
+	    MAX_SKB_FRAGS)
+		netif_stop_queue(dev);
 
 	return NETDEV_TX_OK;
 }
@@ -1397,7 +1397,7 @@ static irqreturn_t xgmac_interrupt(int irq, void *dev_id)
 	}
 
 	/* TX/RX NORMAL interrupts */
-	if (intr_status & (DMA_STATUS_RI | DMA_STATUS_TU)) {
+	if (intr_status & (DMA_STATUS_RI | DMA_STATUS_TU | DMA_STATUS_TI)) {
 		__raw_writel(DMA_INTR_ABNORMAL, priv->base + XGMAC_DMA_INTR_ENA);
 		napi_schedule(&priv->napi);
 	}
-- 
1.7.10.4

^ permalink raw reply related

* [PATCH v3 4/6] net: calxedaxgmac: drop some unnecessary register writes
From: Rob Herring @ 2012-11-05 16:22 UTC (permalink / raw)
  To: netdev, davem; +Cc: eric.dumazet, Rob Herring
In-Reply-To: <1352132544-15809-1-git-send-email-robherring2@gmail.com>

From: Rob Herring <rob.herring@calxeda.com>

The interrupts have already been cleared, so we don't need to clear them
again. Also, we could miss interrupts if they are cleared, but we don't
process the packet.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
 drivers/net/ethernet/calxeda/xgmac.c |    6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c
index 84cd40e..8263219 100644
--- a/drivers/net/ethernet/calxeda/xgmac.c
+++ b/drivers/net/ethernet/calxeda/xgmac.c
@@ -846,9 +846,6 @@ static void xgmac_free_dma_desc_rings(struct xgmac_priv *priv)
 static void xgmac_tx_complete(struct xgmac_priv *priv)
 {
 	int i;
-	void __iomem *ioaddr = priv->base;
-
-	writel(DMA_STATUS_TU | DMA_STATUS_NIS, ioaddr + XGMAC_DMA_STATUS);
 
 	while (dma_ring_cnt(priv->tx_head, priv->tx_tail, DMA_TX_RING_SZ)) {
 		unsigned int entry = priv->tx_tail;
@@ -1139,9 +1136,6 @@ static int xgmac_rx(struct xgmac_priv *priv, int limit)
 		struct sk_buff *skb;
 		int frame_len;
 
-		writel(DMA_STATUS_RI | DMA_STATUS_NIS,
-		       priv->base + XGMAC_DMA_STATUS);
-
 		entry = priv->rx_tail;
 		p = priv->dma_rx + entry;
 		if (desc_get_owner(p))
-- 
1.7.10.4

^ permalink raw reply related

* [PATCH v3 3/6] net: calxedaxgmac: use raw i/o accessors in rx and tx paths
From: Rob Herring @ 2012-11-05 16:22 UTC (permalink / raw)
  To: netdev, davem; +Cc: eric.dumazet, Rob Herring
In-Reply-To: <1352132544-15809-1-git-send-email-robherring2@gmail.com>

From: Rob Herring <rob.herring@calxeda.com>

The standard readl/writel accessors involve a spinlock and cache sync
operation on ARM platforms with an outer cache. Only DMA triggering
accesses need this, so use the raw variants instead in the critical paths.

The relaxed variants would be more appropriate, but don't exist on all
arches.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
v3:
- Use raw i/o accessors instead of relaxed for better build coverage.

 drivers/net/ethernet/calxeda/xgmac.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c
index 728fcef..84cd40e 100644
--- a/drivers/net/ethernet/calxeda/xgmac.c
+++ b/drivers/net/ethernet/calxeda/xgmac.c
@@ -1203,7 +1203,7 @@ static int xgmac_poll(struct napi_struct *napi, int budget)
 
 	if (work_done < budget) {
 		napi_complete(napi);
-		writel(DMA_INTR_DEFAULT_MASK, priv->base + XGMAC_DMA_INTR_ENA);
+		__raw_writel(DMA_INTR_DEFAULT_MASK, priv->base + XGMAC_DMA_INTR_ENA);
 	}
 	return work_done;
 }
@@ -1348,7 +1348,7 @@ static irqreturn_t xgmac_pmt_interrupt(int irq, void *dev_id)
 	struct xgmac_priv *priv = netdev_priv(dev);
 	void __iomem *ioaddr = priv->base;
 
-	intr_status = readl(ioaddr + XGMAC_INT_STAT);
+	intr_status = __raw_readl(ioaddr + XGMAC_INT_STAT);
 	if (intr_status & XGMAC_INT_STAT_PMT) {
 		netdev_dbg(priv->dev, "received Magic frame\n");
 		/* clear the PMT bits 5 and 6 by reading the PMT */
@@ -1366,9 +1366,9 @@ static irqreturn_t xgmac_interrupt(int irq, void *dev_id)
 	struct xgmac_extra_stats *x = &priv->xstats;
 
 	/* read the status register (CSR5) */
-	intr_status = readl(priv->base + XGMAC_DMA_STATUS);
-	intr_status &= readl(priv->base + XGMAC_DMA_INTR_ENA);
-	writel(intr_status, priv->base + XGMAC_DMA_STATUS);
+	intr_status = __raw_readl(priv->base + XGMAC_DMA_STATUS);
+	intr_status &= __raw_readl(priv->base + XGMAC_DMA_INTR_ENA);
+	__raw_writel(intr_status, priv->base + XGMAC_DMA_STATUS);
 
 	/* It displays the DMA process states (CSR5 register) */
 	/* ABNORMAL interrupts */
@@ -1404,7 +1404,7 @@ static irqreturn_t xgmac_interrupt(int irq, void *dev_id)
 
 	/* TX/RX NORMAL interrupts */
 	if (intr_status & (DMA_STATUS_RI | DMA_STATUS_TU)) {
-		writel(DMA_INTR_ABNORMAL, priv->base + XGMAC_DMA_INTR_ENA);
+		__raw_writel(DMA_INTR_ABNORMAL, priv->base + XGMAC_DMA_INTR_ENA);
 		napi_schedule(&priv->napi);
 	}
 
-- 
1.7.10.4

^ permalink raw reply related

* [PATCH v3 2/6] net: calxedaxgmac: remove explicit rx dma buffer polling
From: Rob Herring @ 2012-11-05 16:22 UTC (permalink / raw)
  To: netdev, davem; +Cc: eric.dumazet, Rob Herring
In-Reply-To: <1352132544-15809-1-git-send-email-robherring2@gmail.com>

From: Rob Herring <rob.herring@calxeda.com>

New received frames will trigger the rx DMA to poll the DMA descriptors,
so there is no need to tell the h/w to poll. We also want to enable
dropping frames from the fifo when there is no buffer.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
 drivers/net/ethernet/calxeda/xgmac.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c
index 7f5fd17..728fcef 100644
--- a/drivers/net/ethernet/calxeda/xgmac.c
+++ b/drivers/net/ethernet/calxeda/xgmac.c
@@ -966,7 +966,7 @@ static int xgmac_hw_init(struct net_device *dev)
 		ctrl |= XGMAC_CONTROL_IPC;
 	writel(ctrl, ioaddr + XGMAC_CONTROL);
 
-	writel(DMA_CONTROL_DFF | DMA_CONTROL_OSF, ioaddr + XGMAC_DMA_CONTROL);
+	writel(DMA_CONTROL_OSF, ioaddr + XGMAC_DMA_CONTROL);
 
 	/* Set the HW DMA mode and the COE */
 	writel(XGMAC_OMR_TSF | XGMAC_OMR_RFD | XGMAC_OMR_RFA |
@@ -1180,8 +1180,6 @@ static int xgmac_rx(struct xgmac_priv *priv, int limit)
 
 	xgmac_rx_refill(priv);
 
-	writel(1, priv->base + XGMAC_DMA_RX_POLL);
-
 	return count;
 }
 
-- 
1.7.10.4

^ permalink raw reply related

* [PATCH v3 1/6] net: calxedaxgmac: enable operate on 2nd frame mode
From: Rob Herring @ 2012-11-05 16:22 UTC (permalink / raw)
  To: netdev, davem; +Cc: eric.dumazet, Rob Herring
In-Reply-To: <1352132544-15809-1-git-send-email-robherring2@gmail.com>

From: Rob Herring <rob.herring@calxeda.com>

Enable the tx dma to start reading the next frame while sending the current
frame.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
 drivers/net/ethernet/calxeda/xgmac.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c
index 16814b3..7f5fd17 100644
--- a/drivers/net/ethernet/calxeda/xgmac.c
+++ b/drivers/net/ethernet/calxeda/xgmac.c
@@ -191,6 +191,7 @@
 #define DMA_CONTROL_ST		0x00002000	/* Start/Stop Transmission */
 #define DMA_CONTROL_SR		0x00000002	/* Start/Stop Receive */
 #define DMA_CONTROL_DFF		0x01000000	/* Disable flush of rx frames */
+#define DMA_CONTROL_OSF		0x00000004	/* Operate on 2nd tx frame */
 
 /* DMA Normal interrupt */
 #define DMA_INTR_ENA_NIE	0x00010000	/* Normal Summary */
@@ -965,8 +966,7 @@ static int xgmac_hw_init(struct net_device *dev)
 		ctrl |= XGMAC_CONTROL_IPC;
 	writel(ctrl, ioaddr + XGMAC_CONTROL);
 
-	value = DMA_CONTROL_DFF;
-	writel(value, ioaddr + XGMAC_DMA_CONTROL);
+	writel(DMA_CONTROL_DFF | DMA_CONTROL_OSF, ioaddr + XGMAC_DMA_CONTROL);
 
 	/* Set the HW DMA mode and the COE */
 	writel(XGMAC_OMR_TSF | XGMAC_OMR_RFD | XGMAC_OMR_RFA |
-- 
1.7.10.4

^ permalink raw reply related

* [PATCH v3 0/6] Calxeda xgmac performance fixes
From: Rob Herring @ 2012-11-05 16:22 UTC (permalink / raw)
  To: netdev, davem; +Cc: eric.dumazet, Rob Herring

From: Rob Herring <rob.herring@calxeda.com>

This is a series of performance improvements to the xgmac driver. The
most significant changes are the alignment fixes to avoid alignment
traps on received frames and using raw i/o accessors.

v3:
- Only patch 3 changed. Use raw i/o accessors instead of relaxed for
better build coverage.

v2:
- Only patch 5 changed. Add a missing enabling of tx irq.

Rob

Rob Herring (6):
  net: calxedaxgmac: enable operate on 2nd frame mode
  net: calxedaxgmac: remove explicit rx dma buffer polling
  net: calxedaxgmac: use raw i/o accessors in rx and tx paths
  net: calxedaxgmac: drop some unnecessary register writes
  net: calxedaxgmac: rework transmit ring handling
  net: calxedaxgmac: ip align receive buffers

 drivers/net/ethernet/calxeda/xgmac.c |   59 +++++++++++++++-------------------
 1 file changed, 26 insertions(+), 33 deletions(-)

-- 
1.7.10.4

^ permalink raw reply

* Re: merging printk and WARN
From: David Sterba @ 2012-11-05 15:42 UTC (permalink / raw)
  To: Julia Lawall
  Cc: linux-kernel, airlied, netdev, arnd, joern, chris.mason, m, jejb,
	faisal.latif, neilb, gregkh, JBottomley, swise, achim_leubner,
	tytso, dri-devel, jason.wessel, kgdb-bugreport, Prasad Joshi,
	logfs, linux-btrfs, Helge Deller, linux-parisc, Roland Dreier,
	Sean Hefty, hal.rosenstock, linux-rdma, linux-raid, linux-usb,
	linux-scsi, Andreas Dilger, linux-ext4
In-Reply-To: <alpine.DEB.2.02.1211042120200.1960@localhost6.localdomain6>

On Sun, Nov 04, 2012 at 09:25:53PM +0100, Julia Lawall wrote:
> It looks like these patches were not a good idea, because in each case the
> printk provides an error level, and WARN then provides another one.

I think this is not a problem within btrfs at the place where this has
changed.

david

^ permalink raw reply

* Re: ping -f is broken in iputils 20121011
From: Mohammad Alsaleh @ 2012-11-05 15:37 UTC (permalink / raw)
  To: netdev; +Cc: Jan Synacek
In-Reply-To: <5097841F.2050905@redhat.com>

>On 10/31/2012 10:11 AM, Mohammad Alsaleh wrote:
>> On Tue, Oct 30, 2012 at 11:52:49PM +0300, Mohammad Alsaleh wrote:
>>> As explained in this bug report(1). ping -f seems to be broken in
>>> iputils 20121011.
>>>
>>> (1) https://bugs.archlinux.org/task/32306
>> 
>> Bisected to commit 8feb586c4c6df32badb159947ed233898891aecd
>> --
>> 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
>> 
>
>Can you please try the attached patch?
>
>-- 
>Jan Synacek
>Software Engineer, BaseOS team Brno, Red Hat
>
>--- iputils-s20121011/ping_common.h	2012-11-05 10:07:40.065281888
>+0100
>+++ iputils-s20121011-new/ping_common.h	2012-11-05 10:07:22.001268362
>+0100
>@@ -141,7 +141,7 @@ static inline void write_stdout(const ch
> 	do {
> 		cc = write(STDOUT_FILENO, str + o, len - o);
> 		o += cc;
>-	} while (len >= o || cc < 0);
>+	} while (len > o || cc < 0);
> }
> 
> /*
>--- iputils-s20121011/ping_common.c	2012-11-05 10:07:40.066281889
>+0100
>+++ iputils-s20121011-new/ping_common.c	2012-11-05 10:07:22.007268368
>+0100
>@@ -776,7 +776,7 @@ restamp:
> 		if (!csfailed)
> 			write_stdout("\b \b", 3);
> 		else
>-			write_stdout("\bC", 1);
>+			write_stdout("\bC", 2);
> 	} else {
> 		int i;
> 		__u8 *cp, *dp;
>

Sorry if this reply does not appear in the right thread. I'm not
subscribed to the list.

I can confirm the patch fixes the bug.

^ permalink raw reply

* Re: ping -f is broken in iputils 20121011
From: Stéphane Gaudreault @ 2012-11-05 15:28 UTC (permalink / raw)
  To: netdev

The patch proposed by Jan Synacek worked to me.
Sorry for not replying to his message, I just subscribed to this ML.

Cheers,

--
Stéphane Gaudreault
Arch Linux developer

^ permalink raw reply

* Re: [PATCH v2 9/9] net: batman-adv: use per_cpu_add helper
From: Christoph Lameter @ 2012-11-05 15:19 UTC (permalink / raw)
  To: Shan Wei
  Cc: NetDev, b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r,
	Kernel-Maillist, siwu-MaAgPAbsBIVS8oHt8HbXEIQuADTiUCJX,
	lindner_marek-LWAfsSFWpa4, David Miller
In-Reply-To: <5094A485.4060409-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On Sat, 3 Nov 2012, Shan Wei wrote:

> > Is this really supposed to be the commit message?
>
> Maybe it's ok when Linus said this. :-)
>
> Christoph is the maintainer of per-cpu.

Well please make the changelog nice and understandable.

^ permalink raw reply

* [PATCH net-next] ipv6: export IP6_RT_PRIO_* to userland
From: Nicolas Dichtel @ 2012-11-05 15:28 UTC (permalink / raw)
  To: netdev; +Cc: davem, Nicolas Dichtel

The kernel uses some default metric when routes are managed. For example, a
static route added with a metric set to 0 is inserted in the kernel with
metric 1024 (IP6_RT_PRIO_USER).
It is useful for routing daemons to know these values, to be able to set routes
without interfering with what the kernel does.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
 include/net/ip6_route.h         | 3 ---
 include/uapi/linux/ipv6_route.h | 3 +++
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 5fa2af0..27d8318 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -1,9 +1,6 @@
 #ifndef _NET_IP6_ROUTE_H
 #define _NET_IP6_ROUTE_H
 
-#define IP6_RT_PRIO_USER	1024
-#define IP6_RT_PRIO_ADDRCONF	256
-
 struct route_info {
 	__u8			type;
 	__u8			length;
diff --git a/include/uapi/linux/ipv6_route.h b/include/uapi/linux/ipv6_route.h
index 0459664..2be7bd1 100644
--- a/include/uapi/linux/ipv6_route.h
+++ b/include/uapi/linux/ipv6_route.h
@@ -55,4 +55,7 @@ struct in6_rtmsg {
 #define RTMSG_NEWROUTE		0x21
 #define RTMSG_DELROUTE		0x22
 
+#define IP6_RT_PRIO_USER	1024
+#define IP6_RT_PRIO_ADDRCONF	256
+
 #endif /* _UAPI_LINUX_IPV6_ROUTE_H */
-- 
1.7.12

^ permalink raw reply related

* Re: [RFC virtio-next 0/4] Introduce CAIF Virtio and reversed Vrings
From: Sjur Brændeland @ 2012-11-05 12:12 UTC (permalink / raw)
  To: Rusty Russell
  Cc: Michael S. Tsirkin, Linus Walleij, Ohad Ben-Cohen, linux-kernel,
	netdev, virtualization, dmitry.tarnyagin
In-Reply-To: <87wqy54vo0.fsf@rustcorp.com.au>

Hi Rusty,

> So, this adds another host-side virtqueue implementation.
>
> Can we combine them together conveniently?  You pulled out more stuff
> into vring.h which is a start, but it's a bit overloaded.
> Perhaps we should separate the common fields into struct vring, and use
> it to build:
>
>         struct vring_guest {
>                 struct vring vr;
>                 u16 last_used_idx;
>         };
>
>         struct vring_host {
>                 struct vring vr;
>                 u16 last_avail_idx;
>         };
> I haven't looked closely at vhost to see what it wants, but I would
> think we could share more code.

I have played around with the code in vhost.c to explore your idea.
The main issue I run into is that vhost.c is accessing user data while my new
code does not. So I end up with some quirky code testing if the ring lives in
user memory or not.  Another issue is sparse warnings when
accessing user memory.

With your suggested changes I end up sharing about 100 lines of code.
So in sum, I feel this add more complexity than what we gain by sharing.

Below is an initial draft of the re-usable code. I added "is_uaccess" to struct
virtio_ring in order to know if the ring lives in user memory.

Let me know what you think.

[snip]
int virtqueue_add_used(struct vring_host *vr, unsigned int head, int len,
		    struct vring_used_elem  **used)
{
	/* The virtqueue contains a ring of used buffers.  Get a pointer to the
	 * next entry in that used ring. */
	*used = &vr->vring.used->ring[vr->last_used_idx % vr->vring.num];
	if (vr->is_uaccess) {
		if(unlikely(__put_user(head, &(*used)->id))) {
			pr_debug("Failed to write used id");
			return -EFAULT;
		}
		if (unlikely(__put_user(len, &(*used)->len))) {
			pr_debug("Failed to write used len");
			return -EFAULT;
		}
		smp_wmb();
		if (__put_user(vr->last_used_idx + 1,
			       &vr->vring.used->idx)) {
			pr_debug("Failed to increment used idx");
			return -EFAULT;
		}
	} else {
		(*used)->id = head;
		(*used)->len = len;
		smp_wmb();
		vr->vring.used->idx = vr->last_used_idx + 1;
	}
	vr->last_used_idx++;
	return 0;
}

/* Each buffer in the virtqueues is actually a chain of descriptors.  This
 * function returns the next descriptor in the chain,
 * or -1U if we're at the end. */
unsigned virtqueue_next_desc(struct vring_desc *desc)
{
	unsigned int next;

	/* If this descriptor says it doesn't chain, we're done. */
	if (!(desc->flags & VRING_DESC_F_NEXT))
		return -1U;

	/* Check they're not leading us off end of descriptors. */
	next = desc->next;
	/* Make sure compiler knows to grab that: we don't want it changing! */
	/* We will use the result as an index in an array, so most
	 * architectures only need a compiler barrier here. */
	read_barrier_depends();

	return next;
}

static int virtqueue_next_avail_desc(struct vring_host *vr)
{
	int head;
	u16 last_avail_idx;

	/* Check it isn't doing very strange things with descriptor numbers. */
	last_avail_idx = vr->last_avail_idx;
	if (vr->is_uaccess) {
		if (__get_user(vr->avail_idx, &vr->vring.avail->idx)) {
			pr_debug("Failed to access avail idx at %p\n",
				 &vr->vring.avail->idx);
			return -EFAULT;
		}
	} else
		vr->avail_idx = vr->vring.avail->idx;

	if (unlikely((u16)(vr->avail_idx - last_avail_idx) > vr->vring.num)) {
		pr_debug("Guest moved used index from %u to %u",
		       last_avail_idx, vr->avail_idx);
		return -EFAULT;
	}

	/* If there's nothing new since last we looked, return invalid. */
	if (vr->avail_idx == last_avail_idx)
		return vr->vring.num;

	/* Only get avail ring entries after they have been exposed by guest. */
	smp_rmb();

	/* Grab the next descriptor number they're advertising, and increment
	 * the index we've seen. */
	if (vr->is_uaccess) {
		if (unlikely(__get_user(head,
				&vr->vring.avail->ring[last_avail_idx
						       % vr->vring.num]))) {
			pr_debug("Failed to read head: idx %d address %p\n",
				 last_avail_idx,
				 &vr->vring.avail->ring[last_avail_idx %
							vr->vring.num]);
			return -EFAULT;
		}
	} else
		head = vr->vring.avail->ring[last_avail_idx % vr->vring.num];

	/* If their number is silly, that's an error. */
	if (unlikely(head >= vr->vring.num)) {
		pr_debug("Guest says index %u > %u is available",
		       head, vr->vring.num);
		return -EINVAL;
	}

	return head;
}

Thanks,
Sjur

^ permalink raw reply

* [PATCH] driver: net: ppp: change 8% to %s for seq_printf of pppoe_seq_show
From: Chen Gang @ 2012-11-05 11:31 UTC (permalink / raw)
  To: David Miller, kuznet, jmorris, yoshfuji, kaber; +Cc: netdev


  the length of po->pppoe_pa.dev is 16 (IFNAMSIZ)
  in seq_printf, it is not suitable to use %8s for po->pppoe_pa.dev.
  so change it to %s, since each line has not been solid any more.

Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
 drivers/net/ppp/pppoe.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
index 20f31d0..7e89710 100644
--- a/drivers/net/ppp/pppoe.c
+++ b/drivers/net/ppp/pppoe.c
@@ -1009,7 +1009,7 @@ static int pppoe_seq_show(struct seq_file *seq,
void *v)
 	po = v;
 	dev_name = po->pppoe_pa.dev;

-	seq_printf(seq, "%08X %pM %8s\n",
+	seq_printf(seq, "%08X %pM %s\n",
 		po->pppoe_pa.sid, po->pppoe_pa.remote, dev_name);
 out:
 	return 0;
-- 
1.7.9.5

^ permalink raw reply related

* Re: [PATCH 0/4] Support the MX6 FEC as a PTP hardware clock
From: Frank Li @ 2012-11-05 11:23 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: Frank.Li@freescale.com, netdev@vger.kernel.org, Richard Cochran,
	shawn.guo@linaro.org, David Miller,
	linux-arm-kernel@lists.infradead.org
In-Reply-To: <1351898728.2703.30.camel@bwh-desktop.uk.solarflarecom.com>


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

在 2012年11月3日星期六,Ben Hutchings 写道:

> On Fri, 2012-11-02 at 09:43 +0100, Richard Cochran wrote:
> > On Fri, Nov 02, 2012 at 10:36:09AM +0800, Frank Li wrote:
> > > >
> > > > All applied to net-next.
> > > >
> > > > Please make sure your changes are in sync with Ben's PTP/PPS
> > > > Kconfig changes of today, and send me any changes if necessary.
> > > >
> > >
> > > Thank you very much.
> > > I checked Ben's patch, which not affect FEC.
> >
> > Maybe just remove the Kconfig line "select PPS".
>
> More than that: FEC should select PTP_1588_CLOCK,


okay, I will do that.


> FEC_PTP should be
> removed and all the conditional code made unconditional.  Alternately,
> if that would cost too much (in terms of performance or memory) on some
> systems where the driver is used, FEC_PTP should default to 'y'.


Bd description will be difference between no PTP and PTP hardware,
So driver will not incompatible at two kind of hardware.

I can set it default is Y at MX6 platform.


> Ben.
>
> --
> Ben Hutchings, Staff Engineer, Solarflare
> Not speaking for my employer; that's the marketing department's job.
> They asked us to note that Solarflare product names are trademarked.
>
>

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

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* [PATCH] net: ipv6: change %8s to %s for seq_printf of if6_seq_stop
From: Chen Gang @ 2012-11-05 11:17 UTC (permalink / raw)
  To: David Miller, kuznet, jmorris, yoshfuji, kaber; +Cc: netdev


  the length of ifp->idev->dev->name is 16 (IFNAMSIZ)
  in seq_printf, it is not suitable to use %8s for rt->dst.dev->name.
  so change it to %s, since each line has not been solid any more.


Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
 net/ipv6/addrconf.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 8f0b12a..9f728a8 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3281,7 +3281,7 @@ static void if6_seq_stop(struct seq_file *seq,
void *v)
 static int if6_seq_show(struct seq_file *seq, void *v)
 {
 	struct inet6_ifaddr *ifp = (struct inet6_ifaddr *)v;
-	seq_printf(seq, "%pi6 %02x %02x %02x %02x %8s\n",
+	seq_printf(seq, "%pi6 %02x %02x %02x %02x %s\n",
 		   &ifp->addr,
 		   ifp->idev->dev->ifindex,
 		   ifp->prefix_len,
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH 8/9] isdn: Make CONFIG_ISDN depend on CONFIG_NETDEVICES
From: Lee Jones @ 2012-11-05 10:31 UTC (permalink / raw)
  To: David Miller; +Cc: pebolle, linux-kernel, isdn, netdev
In-Reply-To: <20121104.123013.700345271120279281.davem@davemloft.net>

Does something like look like a better solution?

Author: Lee Jones <lee.jones@linaro.org>
Date:   Sat Nov 3 22:06:02 2012 +0100

    isdn: Make CONFIG_ISDN depend on CONFIG_NETDEVICES
    
    It doesn't make much sense to enable ISDN services if you don't
    intend to connect to a network. Therefore insisting that ISDN
    depends on NETDEVICES seems logical. We can then remove any
    guards mentioning NETDEVICES inside all subordinate drivers.
    
    This also has the nice side-effect of fixing the warning below
    when ISDN_I4L && !CONFIG_NETDEVICES at compile time.
    
    This patch fixes:
    drivers/isdn/i4l/isdn_common.c: In function ‘isdn_ioctl’:
    drivers/isdn/i4l/isdn_common.c:1278:8: warning: unused variable ‘s’ [-Wunused-variable]
    
    Cc: Karsten Keil <isdn@linux-pingi.de>
    Cc: netdev@vger.kernel.org
    Signed-off-by: Lee Jones <lee.jones@linaro.org>

diff --git a/drivers/isdn/Kconfig b/drivers/isdn/Kconfig
index a233ed5..86cd75a 100644
--- a/drivers/isdn/Kconfig
+++ b/drivers/isdn/Kconfig
@@ -4,7 +4,7 @@
 
 menuconfig ISDN
 	bool "ISDN support"
-	depends on NET
+	depends on NET && NETDEVICES
 	depends on !S390 && !UML
 	---help---
 	  ISDN ("Integrated Services Digital Network", called RNIS in France)
diff --git a/drivers/isdn/i4l/Kconfig b/drivers/isdn/i4l/Kconfig
index 2302fbe..9c6650e 100644
--- a/drivers/isdn/i4l/Kconfig
+++ b/drivers/isdn/i4l/Kconfig
@@ -6,7 +6,7 @@ if ISDN_I4L
 
 config ISDN_PPP
 	bool "Support synchronous PPP"
-	depends on INET && NETDEVICES
+	depends on INET
 	select SLHC
 	help
 	  Over digital connections such as ISDN, there is no need to
diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c
index 8c610fa..e2a945e 100644
--- a/drivers/isdn/i4l/isdn_common.c
+++ b/drivers/isdn/i4l/isdn_common.c
@@ -1312,7 +1312,6 @@ isdn_ioctl(struct file *file, uint cmd, ulong arg)
 			} else
 				return -EINVAL;
 			break;
-#ifdef CONFIG_NETDEVICES
 		case IIOCNETGPN:
 			/* Get peer phone number of a connected
 			 * isdn network interface */
@@ -1322,7 +1321,6 @@ isdn_ioctl(struct file *file, uint cmd, ulong arg)
 				return isdn_net_getpeer(&phone, argp);
 			} else
 				return -EINVAL;
-#endif
 		default:
 			return -EINVAL;
 		}
@@ -1352,7 +1350,6 @@ isdn_ioctl(struct file *file, uint cmd, ulong arg)
 		case IIOCNETLCR:
 			printk(KERN_INFO "INFO: ISDN_ABC_LCR_SUPPORT not enabled\n");
 			return -ENODEV;
-#ifdef CONFIG_NETDEVICES
 		case IIOCNETAIF:
 			/* Add a network-interface */
 			if (arg) {
@@ -1491,7 +1488,6 @@ isdn_ioctl(struct file *file, uint cmd, ulong arg)
 				return -EFAULT;
 			return isdn_net_force_hangup(name);
 			break;
-#endif                          /* CONFIG_NETDEVICES */
 		case IIOCSETVER:
 			dev->net_verbose = arg;
 			printk(KERN_INFO "isdn: Verbose-Level is %d\n", dev->net_verbose);

^ permalink raw reply related

* Re: [PATCH 8/9] isdn: Remove unused variable causing a compile build warning
From: Lee Jones @ 2012-11-05  9:44 UTC (permalink / raw)
  To: Paul Bolle; +Cc: David Miller, linux-kernel, isdn, netdev
In-Reply-To: <1352106704.1434.25.camel@x61.thuisdomein>

On Mon, 05 Nov 2012, Paul Bolle wrote:

> On Mon, 2012-11-05 at 09:44 +0100, Lee Jones wrote:
> > On Sun, 04 Nov 2012, David Miller wrote:
> > > I think the most appropriate thing to do is make CONFIG_ISDN depend
> > > upon CONFIG_NETDEVICES in the Kconfig file.
> > 
> > ... and then remove the CONFIG_NETDEVICES guards in isdn_common.c?
> 
> If ISDN would depend on NETDEVICES, ISDN_I4L would too, since it depends
> on ISDN. In that case CONFIG_NETDEVICES would always be true when
> compiling isdn_common.c. That would make these guards pointless. (The
> dependency of ISDN_PPP on NETDEVICES would then also be pointless.)

I'll submit a patch based on your comments.

Thanks for your time Paul.

-- 
Lee Jones
Linaro ST-Ericsson Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply

* Re: [PATCH v1 0/5] usbnet: avoiding access auto-suspended device
From: Oliver Neukum @ 2012-11-05  9:24 UTC (permalink / raw)
  To: Ming Lei
  Cc: David S. Miller, Greg Kroah-Hartman,
	netdev-u79uwXL29TY76Z2rM5mHXA, linux-usb-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1351992594-12818-1-git-send-email-ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>

On Sunday 04 November 2012 09:29:49 Ming Lei wrote:
> Thip patchset avoids accessing auto-suspended device in ioctl path,
> which is generally triggered by some network utility(ethtool, ifconfig,
> ...)
> 
> Most of network devices have the problem, but as discussed in the
> thread:
> 
>         http://marc.info/?t=135054860600003&r=1&w=2
> 
> the problem should be solved inside driver.
> 
> Considered that only smsc75xx and smsc95xx calls usbnet_read_cmd()
> and usbnet_write_cmd() inside its resume and suspend callback, the
> patcheset introduce the nopm version of the two functions which
> should be called only in the resume and suspend callback. So we
> can solve the problem by runtime resuming device before doing
> control message things.

Hi,

I am happy with these patches.
Dave, do you have a principal objection regarding these patches, too?

	Regards
		Oliver

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: ping -f is broken in iputils 20121011
From: Jan Synacek @ 2012-11-05  9:17 UTC (permalink / raw)
  To: netdev
In-Reply-To: <1TTUJN-000MzR-Tp@internal.tormail.org>

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

On 10/31/2012 10:11 AM, Mohammad Alsaleh wrote:
> On Tue, Oct 30, 2012 at 11:52:49PM +0300, Mohammad Alsaleh wrote:
>> As explained in this bug report(1). ping -f seems to be broken in
>> iputils 20121011.
>>
>> (1) https://bugs.archlinux.org/task/32306
> 
> Bisected to commit 8feb586c4c6df32badb159947ed233898891aecd
> --
> 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
> 

Can you please try the attached patch?

-- 
Jan Synacek
Software Engineer, BaseOS team Brno, Red Hat

[-- Attachment #2: flood.patch --]
[-- Type: text/x-patch, Size: 676 bytes --]

--- iputils-s20121011/ping_common.h	2012-11-05 10:07:40.065281888 +0100
+++ iputils-s20121011-new/ping_common.h	2012-11-05 10:07:22.001268362 +0100
@@ -141,7 +141,7 @@ static inline void write_stdout(const ch
 	do {
 		cc = write(STDOUT_FILENO, str + o, len - o);
 		o += cc;
-	} while (len >= o || cc < 0);
+	} while (len > o || cc < 0);
 }
 
 /*
--- iputils-s20121011/ping_common.c	2012-11-05 10:07:40.066281889 +0100
+++ iputils-s20121011-new/ping_common.c	2012-11-05 10:07:22.007268368 +0100
@@ -776,7 +776,7 @@ restamp:
 		if (!csfailed)
 			write_stdout("\b \b", 3);
 		else
-			write_stdout("\bC", 1);
+			write_stdout("\bC", 2);
 	} else {
 		int i;
 		__u8 *cp, *dp;

^ permalink raw reply

* Re: [PATCH 8/9] isdn: Remove unused variable causing a compile build warning
From: Paul Bolle @ 2012-11-05  9:11 UTC (permalink / raw)
  To: Lee Jones; +Cc: David Miller, linux-kernel, isdn, netdev
In-Reply-To: <20121105084419.GC2699@gmail.com>

On Mon, 2012-11-05 at 09:44 +0100, Lee Jones wrote:
> On Sun, 04 Nov 2012, David Miller wrote:
> > I think the most appropriate thing to do is make CONFIG_ISDN depend
> > upon CONFIG_NETDEVICES in the Kconfig file.
> 
> ... and then remove the CONFIG_NETDEVICES guards in isdn_common.c?

If ISDN would depend on NETDEVICES, ISDN_I4L would too, since it depends
on ISDN. In that case CONFIG_NETDEVICES would always be true when
compiling isdn_common.c. That would make these guards pointless. (The
dependency of ISDN_PPP on NETDEVICES would then also be pointless.)


Paul Bolle

^ permalink raw reply

* Re: [RFC PATCH v2] iproute2: bridge: add veb/vepa toggle
From: Stephen Hemminger @ 2012-11-05  8:50 UTC (permalink / raw)
  To: John Fastabend; +Cc: bhutchings, netdev
In-Reply-To: <20121103032436.8744.12352.stgit@localhost6.localdomain6>

On Fri, 02 Nov 2012 20:24:36 -0700
John Fastabend <john.r.fastabend@intel.com> wrote:

> Test bridge commands to set veb, vepa modes to iproute2.
> 
> [root@jf-dev1-dcblab iproute2]# ./bridge/bridge bridge show
> eth2: mode VEB bridge_flags: self
> eth3: mode VEPA bridge_flags: self
> eth10: mode VEB bridge_flags: self
> eth12: mode VEB bridge_flags: self
> 
> [root@jf-dev1-dcblab iproute2]# ./bridge/bridge bridge state mode veb dev eth3 self
> bridge_mode_set eth3: type 19 family 7 mode VEB flags 0002
> 
> [root@jf-dev1-dcblab iproute2]# ./bridge/bridge bridge show
> eth2: mode VEB bridge_flags: self
> eth3: mode VEB bridge_flags: self
> eth10: mode VEB bridge_flags: self
> eth12: mode VEB bridge_flags: self
> 
> Maybe the final patch should separate protocol (STP) configuraiton
> from the bridge setup (VEB.VEPA). But this is good for testing in
> the meantime.
> 
> v2: remove a lot of the crazy cruft in the last patch
> 
> Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
> ---
> 
>  bridge/br_common.h      |    1 
>  bridge/bridge.c         |    3 -
>  bridge/fdb.c            |  244 +++++++++++++++++++++++++++++++++++++++++++++++
>  include/linux/if_link.h |   16 +++
>  4 files changed, 263 insertions(+), 1 deletions(-)
> 
> diff --git a/bridge/br_common.h b/bridge/br_common.h
> index 718ecb9..3e5dcab 100644
> --- a/bridge/br_common.h
> +++ b/bridge/br_common.h
> @@ -5,6 +5,7 @@ extern int print_fdb(const struct sockaddr_nl *who,
>  		     struct nlmsghdr *n, void *arg);
>  
>  extern int do_fdb(int argc, char **argv);
> +extern int do_bridge(int argc, char **argv);
>  extern int do_monitor(int argc, char **argv);
>  
>  extern int preferred_family;
> diff --git a/bridge/bridge.c b/bridge/bridge.c
> index e2c33b0..b5145c1 100644
> --- a/bridge/bridge.c
> +++ b/bridge/bridge.c
> @@ -27,7 +27,7 @@ static void usage(void)
>  {
>  	fprintf(stderr,
>  "Usage: bridge [ OPTIONS ] OBJECT { COMMAND | help }\n"
> -"where  OBJECT := { fdb |  monitor }\n"
> +"where  OBJECT := { fdb |  monitor | bridge }\n"
>  "       OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails]\n" );
>  	exit(-1);
>  }
> @@ -43,6 +43,7 @@ static const struct cmd {
>  	int (*func)(int argc, char **argv);
>  } cmds[] = {
>  	{ "fdb", 	do_fdb },
> +	{ "bridge",	do_bridge },
>  	{ "monitor",	do_monitor },
>  	{ "help",	do_help },
>  	{ 0 }
> diff --git a/bridge/fdb.c b/bridge/fdb.c
> index 4ca4861..e1c138d 100644
> --- a/bridge/fdb.c
> +++ b/bridge/fdb.c
> @@ -34,6 +34,13 @@ static void usage(void)
>  	exit(-1);
>  }
>  
> +static void bridge_usage(void)
> +{
> +	fprintf(stderr, "Usage: br bridge er mode {veb | vepa} dev DEV\n");
> +	fprintf(stderr, "	br bridge {show} [ dev DEV] \n");
> +	exit(-1);
> +}
> +
>  static const char *state_n2a(unsigned s)
>  {
>  	static char buf[32];
> @@ -269,3 +276,240 @@ int do_fdb(int argc, char **argv)
>  	fprintf(stderr, "Command \"%s\" is unknown, try \"bridge fdb help\".\n", *argv);
>  	exit(-1);
>  }
> +
> +int print_bridge(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
> +{
> +	FILE *fp = arg;
> +	struct ifinfomsg *ifm = NLMSG_DATA(n);
> +	int len = n->nlmsg_len;
> +	struct rtattr * tb[IFLA_MAX+1];
> +       
> +	len -= NLMSG_LENGTH(sizeof(*ifm));
> +	if (len < 0) {
> +		fprintf(stderr, "BUG: wrong nlmsg len %d\n", len);
> +		return -1;
> +	}
> +
> +	if (ifm->ifi_family != AF_BRIDGE) {
> +		fprintf(stderr, "hmm: Not PF_BRIDGE is %i\n", ifm->ifi_family);
> +	}
> +
> +	if (filter_index && filter_index != ifm->ifi_index)
> +		return 0;
> +
> +	parse_rtattr(tb, IFLA_MAX, IFLA_RTA(ifm), len);
> +
> +	if (!tb[IFLA_IFNAME]) {
> +		fprintf(stderr, "%s: missing ifname using ifi_index %u name %s\n",
> +			__func__, ifm->ifi_index,
> +			ll_index_to_name(ifm->ifi_index));
> +	}
> +	if (tb[IFLA_AF_SPEC]) {
> +		struct rtattr *bridge[IFLA_BRIDGE_MAX+1];
> +		__u16 mode = 0, flags = 0;
> +
> +		parse_rtattr_nested(bridge, IFLA_BRIDGE_MAX, tb[IFLA_AF_SPEC]);
> +		if (bridge[IFLA_BRIDGE_MODE])
> +			mode =*(__u16*)RTA_DATA(bridge[IFLA_BRIDGE_MODE]);
> +		if (bridge[IFLA_BRIDGE_FLAGS])
> +			flags =*(__u16*)RTA_DATA(bridge[IFLA_BRIDGE_FLAGS]);
> +
> +		fprintf(stderr, "%s: mode %s bridge_flags: %s %s\n",
> +			ll_index_to_name(ifm->ifi_index),
> +			mode ? "VEPA" : "VEB",
> +			flags & BRIDGE_FLAGS_SELF ? "self" : "",
> +			flags & BRIDGE_FLAGS_MASTER ? "master" : "");
> +	}
> +
> +	if (tb[IFLA_PROTINFO]) {
> +		__u8 state = *(__u8*)RTA_DATA(tb[IFLA_PROTINFO]);
> +		char *sstate;
> +
> +		switch (state) {
> +		case 0:
> +			sstate = "DISABLED";
> +			break;
> +		case 1:
> +			sstate = "LISTENING";
> +			break;
> +		case 2:
> +			sstate = "LEARNING";
> +			break;
> +		case 3:
> +			sstate = "FORWARDING";
> +			break;
> +		case 4:
> +			sstate = "BLOCKING";
> +			break;
> +		default:
> +			sstate = "UNKNOWN";
> +			break;
> +		}
> +	
> +
> +		fprintf(stderr, "%s: %s: ifla_protinfo: %s\n",
> +			ll_index_to_name(ifm->ifi_index),
> +			__func__, sstate);
> +	}
> +
> +	fflush(fp);
> +	return 0;
> +}
> +
> +static int bridge_show(int argc, char **argv)
> +{
> +	char *filter_dev = NULL;
> +
> +       
> +	while (argc > 0) {
> +		if (strcmp(*argv, "dev") == 0) {
> +			NEXT_ARG();
> +			if (filter_dev)
> +				duparg("dev", *argv);
> +                       
> +			filter_dev = *argv;
> +		}
> +		argc--; argv++;
> +	}
> +
> +	if (filter_dev) {
> +		if ((filter_index = if_nametoindex(filter_dev)) == 0) {
> +			fprintf(stderr, "Cannot find device \"%s\"\n", filter_dev);
> +			return -1;
> +		}
> +	}
> +
> +	if (rtnl_wilddump_request(&rth, PF_BRIDGE, RTM_GETLINK) < 0) {
> +		perror("Cannot send dump request");
> +		exit(1);
> +	}
> +
> +	if (rtnl_dump_filter(&rth, print_bridge, stdout) < 0) {
> +		fprintf(stderr, "Dump terminated\n");
> +		exit(1);
> +	}
> +
> +	return 0;
> +}
> +
> +static int bridge_state_set(int argc, char **argv)
> +{
> +	struct {
> +		struct nlmsghdr		n;
> +		struct ifinfomsg	ifm;
> +		char			buf[1024];
> +	} req;
> +	struct {
> +		struct nlmsghdr		hdr;
> +		struct nlmsgerr		err;
> +		struct nlmsghdr		rhdr;
> +		struct ifinfomsg	ifm;
> +		char			buf[1024];
> +	} reply;
> +	char *d = NULL;
> +	__u8 state = 0;
> +	__u16 mode = -1, flags = 0;
> +	
> +	memset(&req, 0, sizeof(req));
> +	memset(&reply, 0, sizeof(reply));
> +
> +	req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg));
> +	req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_REPLACE | NLM_F_ACK;
> +	req.n.nlmsg_type = RTM_SETLINK;
> +	req.ifm.ifi_family = PF_BRIDGE;
> +
> +	while (argc > 0) {
> +		if (strcmp(*argv, "dev") == 0) {
> +			NEXT_ARG();
> +			d = *argv;	
> +		} else if (matches(*argv, "state") == 0) {
> +			NEXT_ARG();
> +			if (matches(*argv, "DISABLED") == 0)
> +				state = 0;
> +			else if (matches(*argv, "LISTENING") == 0)
> +				 state = 1;
> +			else if (matches(*argv, "LEARNING") == 0)
> +				 state = 2;
> +			else if (matches(*argv, "FORWARDING") == 0)
> +				 state = 3;
> +			else if (matches(*argv, "BLOCKING") == 0)
> +				 state = 4;
> +			else
> +				invarg("Invalid state value\n", *argv);
> +
> +		} else if (matches(*argv, "mode") == 0) {
> +			NEXT_ARG();
> +			if (matches(*argv, "veb") == 0)
> +				mode = BRIDGE_MODE_VEB;
> +			else if (matches(*argv, "vepa") == 0)
> +				 mode = BRIDGE_MODE_VEPA;
> +			else
> +				invarg("Invalid mode value\n", *argv);
> +
> +		} else if (matches(*argv, "master") == 0) {
> +			flags |= BRIDGE_FLAGS_MASTER;
> +		} else if (matches(*argv, "self") == 0) {
> +			flags |= BRIDGE_FLAGS_SELF;
> +		}
> +
> +		argc--; argv++;
> +	}
> +
> +	if (!d) {
> +		fprintf(stderr, "Device required.\n");
> +		exit(-1);
> +	}
> +
> +       req.ifm.ifi_index = ll_name_to_index(d);
> +       if (req.ifm.ifi_index == 0) {
> +               fprintf(stderr, "Cannot find device \"%s\"\n", d);
> +               return -1;
> +       }
> +
> +	if (state < 4)
> +		addattr8(&req.n, sizeof(req.buf), IFLA_PROTINFO, state);
> +       
> +	printf("%s %s(%u): type %i family %i state 0x%x ", __func__, d, req.ifm.ifi_index,
> +		req.n.nlmsg_type, req.ifm.ifi_family, state);
> +
> +	if (mode < 3 || flags) {
> +		struct rtattr *binfo;
> +		int err = 0;
> +
> +		binfo = addattr_nest(&req.n, sizeof(req), IFLA_AF_SPEC);
> +		if (flags)
> +			err = addattr16(&req.n, sizeof(req), IFLA_BRIDGE_FLAGS, flags);
> +		if (mode < 3)
> +			err = addattr16(&req.n, sizeof(req), IFLA_BRIDGE_MODE, mode);
> +		if (err < 0)
> +			fprintf(stderr, "addattr16 failes\n");
> +		addattr_nest_end(&req.n, binfo);
> +       
> +		printf("mode %s\n", mode == BRIDGE_MODE_VEPA ? "VEPA" : "VEB");
> +	}
> +
> +	printf("%s: %s(%u): rtnl_talk length %u\n", __func__, d, req.ifm.ifi_index, req.n.nlmsg_len);
> +	if (rtnl_talk(&rth, &req.n, 0, 0, &reply.hdr) < 0) {
> +		printf("\nREPLY: error %i\n", reply.err.error);
> +		print_bridge(NULL, &reply.err.msg, stderr);
> +		exit(2);
> +	}
> +
> +	return 0;
> +}
> +
> +int do_bridge(int argc, char **argv)
> +{
> +	ll_init_map(&rth);
> +
> +	if (argc > 0) {
> +		if (matches(*argv, "show") == 0)
> +			return bridge_show(argc-1, argv+1);
> +		else if (matches(*argv, "state") == 0)
> +			return bridge_state_set(argc-1, argv+1);
> +		else if (matches(*argv, "help") == 0)
> +			bridge_usage();
> +	}
> +
> +	exit(0);
> +}
> diff --git a/include/linux/if_link.h b/include/linux/if_link.h
> index 012d95a..1a6c2f1 100644
> --- a/include/linux/if_link.h
> +++ b/include/linux/if_link.h
> @@ -142,6 +142,7 @@ enum {
>  #define IFLA_PROMISCUITY IFLA_PROMISCUITY
>  	IFLA_NUM_TX_QUEUES,
>  	IFLA_NUM_RX_QUEUES,
> +	IFLA_BRIDGE,
>  	__IFLA_MAX
>  };
>  
> @@ -375,6 +376,21 @@ enum {
>  #define PORT_UUID_MAX		16
>  #define PORT_SELF_VF		-1
>  
> +/* Bridge Flags */
> +#define BRIDGE_FLAGS_MASTER	1	/* Bridge command to/from master */
> +#define BRIDGE_FLAGS_SELF	2	/* Bridge command to/from lowerdev */
> +
> +#define BRIDGE_MODE_VEB		0	/* Default loopback mode */
> +#define BRIDGE_MODE_VEPA	1	/* 802.1Qbg defined VEPA mode */
> +
> +/* Bridge management nested attributes */
> +enum {
> +	IFLA_BRIDGE_FLAGS,
> +	IFLA_BRIDGE_MODE,
> +	__IFLA_BRIDGE_MAX,
> +};
> +#define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1)
> +
>  enum {
>  	PORT_REQUEST_PREASSOCIATE = 0,
>  	PORT_REQUEST_PREASSOCIATE_RR,
> 

This looks ok. I will roll it into the resubmit of bridge changes
when I get back from Linuxcon.

^ permalink raw reply

* Re: [PATCH 8/9] isdn: Remove unused variable causing a compile build warning
From: Lee Jones @ 2012-11-05  8:44 UTC (permalink / raw)
  To: David Miller; +Cc: pebolle, linux-kernel, isdn, netdev
In-Reply-To: <20121104.123013.700345271120279281.davem@davemloft.net>

On Sun, 04 Nov 2012, David Miller wrote:

> From: Lee Jones <lee.jones@linaro.org>
> Date: Sun, 4 Nov 2012 11:53:32 +0100
> 
> > On Sun, 04 Nov 2012, Paul Bolle wrote:
> > 
> >> On Sat, 2012-11-03 at 23:48 +0100, Lee Jones wrote:
> >> > On Sat, 03 Nov 2012, Paul Bolle wrote:
> >> > > On Sat, 2012-11-03 at 23:02 +0100, Lee Jones wrote:
> >> > > > This patch fixes:
> >> > > > drivers/isdn/i4l/isdn_common.c: In function ‘isdn_ioctl’:
> >> > > > drivers/isdn/i4l/isdn_common.c:1278:8: warning: unused variable ‘s’ [-Wunused-variable]
> >> > > 
> >> > > Did you have CONFIG_NETDEVICES not set in this build?
> >> > 
> >> > Ah yes, I see it. The function went down further than I thought
> >> > it did. So the real fix is to ensure 's' is defined inside of
> >> > some ifdef CONFIG_NETDEVICES guards. 
> >> 
> >> What puzzles me is that we only find these "#ifdef CONFIG_NETDEVICES"
> >> guards in this file and not in isdn_net.c, were all the ioctl commands
> >> guarded that way seem to be calling into. On first glance that doesn't
> >> make much sense.
> >> 
> >> (Actually the idea of having ISDN without NETDEVICES is a bit puzzling
> >> too. But there are too many parts of the isdn subsystem that I'm
> >> unfamiliar with to say whether that can make sense.)
> > 
> > I'm in the same position as you Paul. I just noticed the warning so
> > fixed it following the current way of doing things. Any, more
> > substantial changes requiring greater knowledge of the subsystem
> > would have to be done by someone else.
> 
> I think the most appropriate thing to do is make CONFIG_ISDN depend
> upon CONFIG_NETDEVICES in the Kconfig file.

... and then remove the CONFIG_NETDEVICES guards in isdn_common.c?

If that's suitable more suitable I can do that instead?

Just need a yay or nay and I'll make it happen.

-- 
Lee Jones
Linaro ST-Ericsson Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply

* Re: [PATCH RFC] pkt_sched: enable QFQ to support TSO/GSO
From: Cong Wang @ 2012-11-05  8:41 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: Paolo Valente, jhs, David Miller, LKML,
	Linux Kernel Network Developers, rizzo, fchecconi
In-Reply-To: <20121030072415.17199f9a@nehalam.linuxnetplumber.net>

On Tue, Oct 30, 2012 at 10:24 PM, Stephen Hemminger
<shemminger@vyatta.com> wrote:
> On Tue, 30 Oct 2012 07:00:56 +0100
> Paolo Valente <paolo.valente@unimore.it> wrote:
>
>> Hi,
>> if the max packet size for some class (configured through tc) is
>> violated by the actual size of the packets of that class, then QFQ
>> would not schedule classes correctly, and the data structures
>> implementing the bucket lists may get corrupted. This problem occurs
>> with TSO/GSO even if the max packet size is set to the MTU, and is,
>> e.g., the cause of the failure reported in [1]. Two patches have been
>> proposed to solve this problem in [2], one of them is a preliminary
>> version of this patch.
>>
>> This patch addresses the above issues by: 1) setting QFQ parameters to
>> proper values for supporting TSO/GSO (in particular, setting the
>> maximum possible packet size to 64KB), 2) automatically increasing the
>> max packet size for a class, lmax, when a packet with a larger size
>> than the current value of lmax arrives.
>>
>> The drawback of the first point is that the maximum weight for a class
>> is now limited to 4096, which is equal to 1/16 of the maximum weight
>> sum.
>>
>> Finally, this patch also forcibly caps the timestamps of a class if
>> they are too high to be stored in the bucket list. This capping, taken
>> from QFQ+ [3], handles the unfrequent case described in the comment to
>> the function slot_insert.
>>
>> [1] http://marc.info/?l=linux-netdev&m=134968777902077&w=2
>> [2] http://marc.info/?l=linux-netdev&m=135096573507936&w=2
>> [3] http://marc.info/?l=linux-netdev&m=134902691421670&w=2
>>
>> Signed-off-by: Paolo Valente <paolo.valente@unimore.it>
>> Tested-by: Cong Wang <amwang@redhat.com>
>
> Acked-by: Stephen Hemminger <shemminger@vyatta.com>


David, could you take this patch? Stephen acked it.

Thanks!

^ permalink raw reply

* RE: [PATCH net-next 0/2] cpsw: fix resource leak for v3.8
From: N, Mugunthan V @ 2012-11-05  8:40 UTC (permalink / raw)
  To: Richard Cochran, netdev@vger.kernel.org
  Cc: linux-arm-kernel@lists.infradead.org, David Miller,
	Chemparathy, Cyril, Hiremath, Vaibhav
In-Reply-To: <cover.1351930782.git.richardcochran@gmail.com>

> -----Original Message-----
> From: Richard Cochran [mailto:richardcochran@gmail.com]
> Sent: Saturday, November 03, 2012 1:55 PM
> To: netdev@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org; David Miller; Chemparathy,
> Cyril; N, Mugunthan V; Hiremath, Vaibhav
> Subject: [PATCH net-next 0/2] cpsw: fix resource leak for v3.8
> 
> While looking at the idea of removing all of the register offsets in
> the CPSW's device tree, I noticed that the driver would be leaking IO
> mappings. Although this is, strictly speaking, a bug fix, still it can
> wait to appear in v3.8, since there is no way to use the driver in
> v3.7 (or earlier) anyhow.
> 
> Thanks,
> Richard
> 
> 
> Richard Cochran (2):
>   cpsw: rename register banks to match the reference manual, part 2
>   cpsw: fix leaking IO mappings
> 
>  drivers/net/ethernet/ti/cpsw.c |   39 +++++++++++++++++++-------------
> -------
>  1 files changed, 19 insertions(+), 20 deletions(-)
> 
> --
> 1.7.2.5

The patches look good to me.

Acked-by: Mugunthan V N <mugunthanvnm@ti.com>

^ permalink raw reply

* Re: [RESEND PATCH net-next] ipv6/multipath: remove flag NLM_F_EXCL after the first nexthop
From: Nicolas Dichtel @ 2012-11-05  8:30 UTC (permalink / raw)
  To: David Miller; +Cc: shemminger, netdev, joe, bernat, eric.dumazet, yoshfuji
In-Reply-To: <20121102.213857.2276553238313329445.davem@davemloft.net>

Le 03/11/2012 02:38, David Miller a écrit :
> From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> Date: Fri,  2 Nov 2012 09:58:22 +0100
>
>> fib6_add_rt2node() will reject the nexthop if this flag is set, so
>> we perform the check only for the first nexthop.
>>
>> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
>
> It seems a bit hackish, but I don't have any better ideas, so
> applied, thanks.
>
Yes, I agree. It's why I didn't include it in the initial patch ... but I also 
didn't find a better way :/

^ 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