Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH] net: ipv6: change %8s to %s for rt->dst.dev->name in seq_printf of rt6_info_route
From: David Miller @ 2012-11-05  5:50 UTC (permalink / raw)
  To: gang.chen; +Cc: shanwei88, kuznet, jmorris, yoshfuji, kaber, netdev
In-Reply-To: <50972C58.4010008@asianux.com>

From: Chen Gang <gang.chen@asianux.com>
Date: Mon, 05 Nov 2012 11:02:48 +0800

>> 
>> 1. not to send same patch triple times. 
> 
>   thanks, I shall notice, next time.
>   (I shall 'believe' another members).
> 
>> 2. config your email client,because tab is changed to space.
>>    you can read Documentation/email-clients.txt.
> 
>   1) thanks. I shall notice, next time.
>   2) now, I get gvim as extention editor for thounderbird
>   3) the patch is generated by `git format-patch -s --summary --stat`
>      it use "' '\t" as head, I do not touch it, maybe it is correct.
> 
> welcome any members to giving additional suggestions and completions.
> 
> thanks
> 
> the modified contents are below,

Post new versions of a patch as fresh postings, not as replies
to other emails.

^ permalink raw reply

* [PATCH] drivers: ethernet: qlogic: netxen_nic_ethtool.c: Fixed a coding style issue
From: Kumar Amit Mehta @ 2012-11-05  5:46 UTC (permalink / raw)
  To: sony.chacko; +Cc: rajesh.borundia, netdev, linux-kernel, kernel-janitors

Fixed some coding style issues.

Signed-off-by: Kumar Amit Mehta <gmate.amit@gmail.com>
---
 .../ethernet/qlogic/netxen/netxen_nic_ethtool.c    |   86 ++++++++++----------
 1 file changed, 43 insertions(+), 43 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
index 6bf73e1..4ca2c19 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_ethtool.c
@@ -218,7 +218,7 @@ skip:
 			check_sfp_module = netif_running(dev) &&
 				adapter->has_link_events;
 		} else {
-			ecmd->supported |= (SUPPORTED_TP |SUPPORTED_Autoneg);
+			ecmd->supported |= (SUPPORTED_TP | SUPPORTED_Autoneg);
 			ecmd->advertising |=
 				(ADVERTISED_TP | ADVERTISED_Autoneg);
 			ecmd->port = PORT_TP;
@@ -381,7 +381,7 @@ static u32 netxen_nic_test_link(struct net_device *dev)
 
 static int
 netxen_nic_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
-		      u8 * bytes)
+		      u8 *bytes)
 {
 	struct netxen_adapter *adapter = netdev_priv(dev);
 	int offset;
@@ -498,19 +498,19 @@ netxen_nic_get_pauseparam(struct net_device *dev,
 		pause->rx_pause = netxen_gb_get_rx_flowctl(val);
 		val = NXRD32(adapter, NETXEN_NIU_GB_PAUSE_CTL);
 		switch (port) {
-			case 0:
-				pause->tx_pause = !(netxen_gb_get_gb0_mask(val));
-				break;
-			case 1:
-				pause->tx_pause = !(netxen_gb_get_gb1_mask(val));
-				break;
-			case 2:
-				pause->tx_pause = !(netxen_gb_get_gb2_mask(val));
-				break;
-			case 3:
-			default:
-				pause->tx_pause = !(netxen_gb_get_gb3_mask(val));
-				break;
+		case 0:
+			pause->tx_pause = !(netxen_gb_get_gb0_mask(val));
+			break;
+		case 1:
+			pause->tx_pause = !(netxen_gb_get_gb1_mask(val));
+			break;
+		case 2:
+			pause->tx_pause = !(netxen_gb_get_gb2_mask(val));
+			break;
+		case 3:
+		default:
+			pause->tx_pause = !(netxen_gb_get_gb3_mask(val));
+			break;
 		}
 	} else if (adapter->ahw.port_type == NETXEN_NIC_XGBE) {
 		if ((port < 0) || (port >= NETXEN_NIU_MAX_XG_PORTS))
@@ -556,31 +556,31 @@ netxen_nic_set_pauseparam(struct net_device *dev,
 		/* set autoneg */
 		val = NXRD32(adapter, NETXEN_NIU_GB_PAUSE_CTL);
 		switch (port) {
-			case 0:
-				if (pause->tx_pause)
-					netxen_gb_unset_gb0_mask(val);
-				else
-					netxen_gb_set_gb0_mask(val);
-				break;
-			case 1:
-				if (pause->tx_pause)
-					netxen_gb_unset_gb1_mask(val);
-				else
-					netxen_gb_set_gb1_mask(val);
-				break;
-			case 2:
-				if (pause->tx_pause)
-					netxen_gb_unset_gb2_mask(val);
-				else
-					netxen_gb_set_gb2_mask(val);
-				break;
-			case 3:
-			default:
-				if (pause->tx_pause)
-					netxen_gb_unset_gb3_mask(val);
-				else
-					netxen_gb_set_gb3_mask(val);
-				break;
+		case 0:
+			if (pause->tx_pause)
+				netxen_gb_unset_gb0_mask(val);
+			else
+				netxen_gb_set_gb0_mask(val);
+			break;
+		case 1:
+			if (pause->tx_pause)
+				netxen_gb_unset_gb1_mask(val);
+			else
+				netxen_gb_set_gb1_mask(val);
+			break;
+		case 2:
+			if (pause->tx_pause)
+				netxen_gb_unset_gb2_mask(val);
+			else
+				netxen_gb_set_gb2_mask(val);
+			break;
+		case 3:
+		default:
+			if (pause->tx_pause)
+				netxen_gb_unset_gb3_mask(val);
+			else
+				netxen_gb_set_gb3_mask(val);
+			break;
 		}
 		NXWR32(adapter, NETXEN_NIU_GB_PAUSE_CTL, val);
 	} else if (adapter->ahw.port_type == NETXEN_NIC_XGBE) {
@@ -643,7 +643,7 @@ static int netxen_get_sset_count(struct net_device *dev, int sset)
 
 static void
 netxen_nic_diag_test(struct net_device *dev, struct ethtool_test *eth_test,
-		     u64 * data)
+		     u64 *data)
 {
 	memset(data, 0, sizeof(uint64_t) * NETXEN_NIC_TEST_LEN);
 	if ((data[0] = netxen_nic_reg_test(dev)))
@@ -654,7 +654,7 @@ netxen_nic_diag_test(struct net_device *dev, struct ethtool_test *eth_test,
 }
 
 static void
-netxen_nic_get_strings(struct net_device *dev, u32 stringset, u8 * data)
+netxen_nic_get_strings(struct net_device *dev, u32 stringset, u8 *data)
 {
 	int index;
 
@@ -675,7 +675,7 @@ netxen_nic_get_strings(struct net_device *dev, u32 stringset, u8 * data)
 
 static void
 netxen_nic_get_ethtool_stats(struct net_device *dev,
-			     struct ethtool_stats *stats, u64 * data)
+			     struct ethtool_stats *stats, u64 *data)
 {
 	struct netxen_adapter *adapter = netdev_priv(dev);
 	int index;
-- 
1.7.9.5

^ permalink raw reply related

* Re: [PATCH] vlan: set sysfs device_type to 'vlan'
From: Doug Goldstein @ 2012-11-05  5:45 UTC (permalink / raw)
  To: David Miller; +Cc: kaber, netdev, systemd-devel, linux-kernel
In-Reply-To: <20121023.023647.2164665243829038911.davem@davemloft.net>

On Tue, Oct 23, 2012 at 1:36 AM, David Miller <davem@davemloft.net> wrote:
> From: Doug Goldstein <cardoe@cardoe.com>
> Date: Mon, 22 Oct 2012 00:53:57 -0500
>
>> Sets the sysfs device_type to 'vlan' for udev. This makes it easier for
>> applications that query network information via udev to identify vlans
>> instead of using strrchr().
>>
>> Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
>
> You're extremely misguided.  This change, in fact, makes it ten times
> harder for such applications to query such devices.
>
> Because now the application has to decide whether it wants to support
> EVERY EXISTING SYSTEM OUT THERE or not.  Hundreds of millions of Linux
> systems do not provide this attribute.
>
> Applications have to handle the case of not having the 'vlan' device
> type available attribute essentially forever.
>
> So providing it in new kernels provides zero value whatsoever.
>
> I'm not applying this patch, sorry.

Dave,

As others on this thread have discussed there are other merits to the
patch as well. Yes you are correct that netlink is the preferred
method to gather information about network devices but the point was
really to make the sysfs layout more correct a matter of completeness.
As Ben Greear pointed out this would allow shell scripts and other
scripting languages to better detect vlans. Kay pointed out that this
would allow better uevent filters in the future as well. So there are
some merits to this patch. If you'd prefer I can resubmit with a
better commit message entailing the reasons behind it.

Thanks.
-- 
Doug Goldstein

^ permalink raw reply

* [PATCH] drivers: ethernet: qlogic: qlge_dbg.c: Fixed a coding style issue
From: Kumar Amit Mehta @ 2012-11-05  5:11 UTC (permalink / raw)
  To: jitendra.kalsaria
  Cc: ron.mercer, linux-driver, netdev, linux-kernel, kernel-janitors

checkpatch.pl throws error message for the current code. This patch fixes
this coding style issue.

Signed-off-by: Kumar Amit Mehta <gmate.amit@gmail.com>
---
 drivers/net/ethernet/qlogic/qlge/qlge_dbg.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_dbg.c b/drivers/net/ethernet/qlogic/qlge/qlge_dbg.c
index 58185b6..10093f0 100644
--- a/drivers/net/ethernet/qlogic/qlge/qlge_dbg.c
+++ b/drivers/net/ethernet/qlogic/qlge/qlge_dbg.c
@@ -86,7 +86,7 @@ exit:
 }
 
 /* Read out the SERDES registers */
-static int ql_read_serdes_reg(struct ql_adapter *qdev, u32 reg, u32 * data)
+static int ql_read_serdes_reg(struct ql_adapter *qdev, u32 reg, u32 *data)
 {
 	int status;
 
@@ -364,7 +364,7 @@ exit:
 /* Read the 400 xgmac control/statistics registers
  * skipping unused locations.
  */
-static int ql_get_xgmac_regs(struct ql_adapter *qdev, u32 * buf,
+static int ql_get_xgmac_regs(struct ql_adapter *qdev, u32 *buf,
 					unsigned int other_function)
 {
 	int status = 0;
@@ -405,7 +405,7 @@ static int ql_get_xgmac_regs(struct ql_adapter *qdev, u32 * buf,
 	return status;
 }
 
-static int ql_get_ets_regs(struct ql_adapter *qdev, u32 * buf)
+static int ql_get_ets_regs(struct ql_adapter *qdev, u32 *buf)
 {
 	int status = 0;
 	int i;
@@ -423,7 +423,7 @@ static int ql_get_ets_regs(struct ql_adapter *qdev, u32 * buf)
 	return status;
 }
 
-static void ql_get_intr_states(struct ql_adapter *qdev, u32 * buf)
+static void ql_get_intr_states(struct ql_adapter *qdev, u32 *buf)
 {
 	int i;
 
@@ -434,7 +434,7 @@ static void ql_get_intr_states(struct ql_adapter *qdev, u32 * buf)
 	}
 }
 
-static int ql_get_cam_entries(struct ql_adapter *qdev, u32 * buf)
+static int ql_get_cam_entries(struct ql_adapter *qdev, u32 *buf)
 {
 	int i, status;
 	u32 value[3];
@@ -471,7 +471,7 @@ err:
 	return status;
 }
 
-static int ql_get_routing_entries(struct ql_adapter *qdev, u32 * buf)
+static int ql_get_routing_entries(struct ql_adapter *qdev, u32 *buf)
 {
 	int status;
 	u32 value, i;
@@ -496,7 +496,7 @@ err:
 }
 
 /* Read the MPI Processor shadow registers */
-static int ql_get_mpi_shadow_regs(struct ql_adapter *qdev, u32 * buf)
+static int ql_get_mpi_shadow_regs(struct ql_adapter *qdev, u32 *buf)
 {
 	u32 i;
 	int status;
@@ -515,7 +515,7 @@ end:
 }
 
 /* Read the MPI Processor core registers */
-static int ql_get_mpi_regs(struct ql_adapter *qdev, u32 * buf,
+static int ql_get_mpi_regs(struct ql_adapter *qdev, u32 *buf,
 				u32 offset, u32 count)
 {
 	int i, status = 0;
-- 
1.7.9.5

^ permalink raw reply related

* Re: [PATCH] net: ipv6: change %8s to %s for rt->dst.dev->name in seq_printf of rt6_info_route
From: Chen Gang @ 2012-11-05  3:02 UTC (permalink / raw)
  To: Shan Wei; +Cc: davem, kuznet, jmorris, yoshfuji, kaber, netdev
In-Reply-To: <5093E953.5020709@gmail.com>

> 
> 1. not to send same patch triple times. 

  thanks, I shall notice, next time.
  (I shall 'believe' another members).

> 2. config your email client,because tab is changed to space.
>    you can read Documentation/email-clients.txt.

  1) thanks. I shall notice, next time.
  2) now, I get gvim as extention editor for thounderbird
  3) the patch is generated by `git format-patch -s --summary --stat`
     it use "' '\t" as head, I do not touch it, maybe it is correct.

welcome any members to giving additional suggestions and completions.

thanks

the modified contents are below,
-----------------------------------------------------------------------------------

  the length of rt->dst.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.

  additional information:

    %8s  limit the width, not for the original string output length
         if name length is more than 8, it still can be fully displayed.
         if name length is less than 8, the ' ' will be filled before name.

    %.8s truly limit the original string output length (precision)

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

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index c42650c..b60bc52 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2835,7 +2835,7 @@ static int rt6_info_route(struct rt6_info *rt, void *p_arg)
 	} else {
 		seq_puts(m, "00000000000000000000000000000000");
 	}
-	seq_printf(m, " %08x %08x %08x %08x %8s\n",
+	seq_printf(m, " %08x %08x %08x %08x %s\n",
 		   rt->rt6i_metric, atomic_read(&rt->dst.__refcnt),
 		   rt->dst.__use, rt->rt6i_flags,
 		   rt->dst.dev ? rt->dst.dev->name : "");
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH net-next] sparc: bpf_jit_comp: add VLAN instructions for BPF JIT
From: Daniel Borkmann @ 2012-11-05  2:59 UTC (permalink / raw)
  To: davem; +Cc: netdev

This patch is a follow-up for patch "net: filter: add vlan tag access"
to support the new VLAN_TAG/VLAN_TAG_PRESENT accessors in BPF JIT.

Signed-off-by: Daniel Borkmann <daniel.borkmann@tik.ee.ethz.ch>
---
 Disclaimer: uncompiled and untested, since I don't have a SPARC machine,
 but it should (hopefully) integrate cleanly. ;)

 arch/sparc/net/bpf_jit_comp.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/arch/sparc/net/bpf_jit_comp.c b/arch/sparc/net/bpf_jit_comp.c
index 2836870..3109ca6 100644
--- a/arch/sparc/net/bpf_jit_comp.c
+++ b/arch/sparc/net/bpf_jit_comp.c
@@ -3,6 +3,7 @@
 #include <linux/netdevice.h>
 #include <linux/filter.h>
 #include <linux/cache.h>
+#include <linux/if_vlan.h>
 
 #include <asm/cacheflush.h>
 #include <asm/ptrace.h>
@@ -312,6 +313,12 @@ do {	*prog++ = BR_OPC | WDISP22(OFF);		\
 #define emit_addi(R1, IMM, R3) \
 	*prog++ = (ADD | IMMED | RS1(R1) | S13(IMM) | RD(R3))
 
+#define emit_and(R1, R2, R3) \
+	*prog++ = (AND | RS1(R1) | RS2(R2) | RD(R3))
+
+#define emit_andi(R1, IMM, R3) \
+	*prog++ = (AND | IMMED | RS1(R1) | S13(IMM) | RD(R3))
+
 #define emit_alloc_stack(SZ) \
 	*prog++ = (SUB | IMMED | RS1(SP) | S13(SZ) | RD(SP))
 
@@ -415,6 +422,8 @@ void bpf_jit_compile(struct sk_filter *fp)
 		case BPF_S_ANC_IFINDEX:
 		case BPF_S_ANC_MARK:
 		case BPF_S_ANC_RXHASH:
+		case BPF_S_ANC_VLAN_TAG:
+		case BPF_S_ANC_VLAN_TAG_PRESENT:
 		case BPF_S_ANC_CPU:
 		case BPF_S_ANC_QUEUE:
 		case BPF_S_LD_W_ABS:
@@ -600,6 +609,16 @@ void bpf_jit_compile(struct sk_filter *fp)
 			case BPF_S_ANC_RXHASH:
 				emit_skb_load32(rxhash, r_A);
 				break;
+			case BPF_S_ANC_VLAN_TAG:
+			case BPF_S_ANC_VLAN_TAG_PRESENT:
+				emit_skb_load16(vlan_tci, r_A);
+				if (filter[i].code == BPF_S_ANC_VLAN_TAG) {
+					emit_andi(r_A, VLAN_VID_MASK, r_A);
+				} else {
+					emit_loadimm(VLAN_TAG_PRESENT, r_TMP);
+					emit_and(r_A, r_TMP, r_A);
+				}
+				break;
 
 			case BPF_S_LD_IMM:
 				emit_loadimm(K, r_A);

^ permalink raw reply related

* Re: [rfc net-next v6 2/3] virtio_net: multiqueue support
From: Rusty Russell @ 2012-11-05  1:08 UTC (permalink / raw)
  To: Jason Wang, mst, davem, virtualization, linux-kernel, netdev,
	krkumar2; +Cc: kvm
In-Reply-To: <1351591403-23065-3-git-send-email-jasowang@redhat.com>

Jason Wang <jasowang@redhat.com> writes:
> +struct virtnet_info {
> +	u16 num_queue_pairs;		/* # of RX/TX vq pairs */
> +	u16 total_queue_pairs;
> +
> +	struct send_queue *sq;
> +	struct receive_queue *rq;
> +	struct virtqueue *cvq;
> +
> +	struct virtio_device *vdev;
> +	struct net_device *dev;
> +	unsigned int status;

status seems unused?

> +static const struct ethtool_ops virtnet_ethtool_ops;

Strange hoist, but I can't tell from the patch if this is necessary.
Assume it is.

> +static inline int vq2txq(struct virtqueue *vq)
> +{
> +	int index = virtqueue_get_queue_index(vq);
> +	return index == 1 ? 0 : (index - 3) / 2;
> +}
> +
> +static inline int txq2vq(int txq)
> +{
> +	return txq ? 2 * txq + 3 : 1;
> +}
> +
> +static inline int vq2rxq(struct virtqueue *vq)
> +{
> +	int index = virtqueue_get_queue_index(vq);
> +	return index ? (index - 2) / 2 : 0;
> +}
> +
> +static inline int rxq2vq(int rxq)
> +{
> +	return rxq ? 2 * rxq + 2 : 0;
> +}
> +
>  static inline struct skb_vnet_hdr *skb_vnet_hdr(struct sk_buff *skb)

I know skb_vnet_hdr() does it, but I generally dislike inline in C
files; gcc is generally smart enough these days, and inline suppresses
unused function warnings.

I guess these mappings have to work even when we're switching from mq to
single queue mode; otherwise we could simplify them using a 'bool mq'
flag.

> +static int virtnet_set_queues(struct virtnet_info *vi)
> +{
> +	struct scatterlist sg;
> +	struct virtio_net_ctrl_steering s;
> +	struct net_device *dev = vi->dev;
> +
> +	if (vi->num_queue_pairs == 1) {
> +		s.current_steering_rule = VIRTIO_NET_CTRL_STEERING_SINGLE;
> +		s.current_steering_param = 1;
> +	} else {
> +		s.current_steering_rule =
> +			VIRTIO_NET_CTRL_STEERING_RX_FOLLOWS_TX;
> +		s.current_steering_param = vi->num_queue_pairs;
> +	}

(BTW, VIRTIO_NET_CTRL_STEERING_RX_FOLLOWS_TX etc not defined anywhere?)

Hmm, it's not clear that anything other than RX_FOLLOWS_TX will ever
make sense, so this is really just turning mq on and off.

Unfortunately, we can't turn feature bits on and off after startup, so
if we want this level of control (and I think we do), there does need to
be a mechanism.

Michael?  I'd prefer this to be further simplfied, to just
disable/enable.  We can extend it later, but for now the second
parameter is redundant, ie.:

        struct virtio_net_ctrl_steering {
                u8 mode; /* 0 == off, 1 == on */
        } __attribute__((packed));


> @@ -924,11 +1032,10 @@ static void virtnet_get_ringparam(struct net_device *dev,
>  {
>  	struct virtnet_info *vi = netdev_priv(dev);
>  
> -	ring->rx_max_pending = virtqueue_get_vring_size(vi->rvq);
> -	ring->tx_max_pending = virtqueue_get_vring_size(vi->svq);
> +	ring->rx_max_pending = virtqueue_get_vring_size(vi->rq[0].vq);
> +	ring->tx_max_pending = virtqueue_get_vring_size(vi->sq[0].vq);
>  	ring->rx_pending = ring->rx_max_pending;
>  	ring->tx_pending = ring->tx_max_pending;
> -
>  }

This assumes all vqs are the same size.  I think this should probably
check: for mq mode, use the first vq, otherewise use the 0th.

For bonus points, check this assertion at probe time.

> +	/*
> +	 * We expect 1 RX virtqueue followed by 1 TX virtqueue, followd by
> +	 * possible control virtqueue, followed by 1 reserved vq, followed
> +	 * by RX/TX queue pairs used in multiqueue mode.
> +	 */
> +	if (vi->total_queue_pairs == 1)
> +		total_vqs = 2 + virtio_has_feature(vi->vdev,
> +						   VIRTIO_NET_F_CTRL_VQ);
> +	else
> +		total_vqs = 2 * vi->total_queue_pairs + 2;

What's the allergy to odd numbers?  Why the reserved queue?

> +	if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_VQ))
> +		vi->has_cvq = true;
> +
> +	/* Use single tx/rx queue pair as default */
> +	vi->num_queue_pairs = 1;
> +	vi->total_queue_pairs = num_queue_pairs;
> +
> +	/* Allocate/initialize the rx/tx queues, and invoke find_vqs */
> +	err = virtnet_setup_vqs(vi);
>  	if (err)
>  		goto free_stats;
>  
> +	if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ) &&
> +	    virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VLAN))
> +		dev->features |= NETIF_F_HW_VLAN_FILTER;

We should be using has_cvq here...

> -#ifdef CONFIG_PM
> -static int virtnet_freeze(struct virtio_device *vdev)
> +static void virtnet_stop(struct virtnet_info *vi)

I think you still want this under CONFIG_PM, right?  Doesn't seem used
elsewhere.

Cheers,
Rusty.

^ permalink raw reply

* Re: [rfc net-next v6 3/3] virtio-net: change the number of queues through ethtool
From: Rusty Russell @ 2012-11-04 23:46 UTC (permalink / raw)
  To: Jason Wang, mst, davem, virtualization, linux-kernel, netdev,
	krkumar2; +Cc: kvm
In-Reply-To: <1351591403-23065-4-git-send-email-jasowang@redhat.com>

Jason Wang <jasowang@redhat.com> writes:
> This patch implement the {set|get}_channels method of ethool to allow user to
> change the number of queues dymaically when the device is running. This would
> let the user to tune the device for specific applications.
...
> +	/* Only two modes were support currently */
> +	if (queue_pairs == 0)
> +		return -EINVAL;
> +	if (queue_pairs != vi->total_queue_pairs - 1 && queue_pairs != 1)
> +		return -EINVAL;

OK, so you let them do all or nothing, but this three-way test is
pretty unclear.

In fact, the whole total_queue_pairs/num_queue_pairs thing is weird (and
uncommented).  I think for "total" you mean "max"; the maximum possible
queue pair number.

Let me go back and review the previous patch again...

Cheers,
Rusty.

^ permalink raw reply

* Re: [rfc net-next v6 2/3] virtio_net: multiqueue support
From: Rusty Russell @ 2012-11-04 23:16 UTC (permalink / raw)
  To: Jason Wang, mst, davem, virtualization, linux-kernel, netdev,
	krkumar2; +Cc: kvm
In-Reply-To: <1351591403-23065-3-git-send-email-jasowang@redhat.com>

Jason Wang <jasowang@redhat.com> writes:
> This addes multiqueue support to virtio_net driver. There's two mode supported:
> single queue pair mode and multiple queue pairs mode. An obvious
> difference compared with a physical mq card is that virtio-net reserve
> first two virtqueues when it is working in multiqueue mode, this is
> used for implementing adaptive mode switching in the future. The
> virtqueues that were in both mq and sq mode were initialized and only
> one queue pair (single queue mode) were used at default. User could
> use ethtool -L to switch to multiqueue mode withe the next patch.

Hi Jason,

        This first patch looks good, but conflates three things
together:
(1) Separate per-queue structures from struct virtnet_info to allow
    multiple queues.  This is the mechanical part of the patch.
(2) An annotation bugfix, see below.
(3) Enabling mq using a new feature and negotiation.

> @@ -700,7 +767,8 @@ static struct rtnl_link_stats64 *virtnet_stats(struct net_device *dev,
>  	unsigned int start;
>  
>  	for_each_possible_cpu(cpu) {
> -		struct virtnet_stats *stats = per_cpu_ptr(vi->stats, cpu);
> +		struct virtnet_stats __percpu *stats
> +			= per_cpu_ptr(vi->stats, cpu);
>  		u64 tpackets, tbytes, rpackets, rbytes;
>  
>  		do {

Cheers,
Rusty.

^ permalink raw reply

* Re: [PATCH] net/at91_ether: fix the use of macb structure
From: Nicolas Ferre @ 2012-11-04 23:02 UTC (permalink / raw)
  To: David Miller
  Cc: netdev, manabian, patrice.vilchez, linux-kernel, havard,
	bhutchings, plagnioj, linux-arm-kernel
In-Reply-To: <20121103.150414.707741347606909244.davem@davemloft.net>

On 11/03/2012 08:04 PM, David Miller :
> From: Nicolas Ferre <nicolas.ferre@atmel.com>
> Date: Tue, 30 Oct 2012 12:30:28 +0100
> 
>> Due to the use of common structure in at91_ether and macb drivers,
>> change the name of DMA descriptor structures in at91_ether as well:
>> dma_desc => macb_dma_desc
>>
>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> 
> This does not apply to net-next, respin it if this change is
> still relevant.

This one is not relevant anymore.

Best regards,
-- 
Nicolas Ferre

^ permalink raw reply

* Re: [PATCH 1/2] net: at91_ether: add dt support
From: Joachim Eastwood @ 2012-11-04 22:21 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD
  Cc: linux-arm-kernel, devicetree-discuss, Nicolas Ferre, netdev
In-Reply-To: <1352052637-5154-1-git-send-email-plagnioj@jcrosoft.com>

Hi Jean-Christophe,

Some minor comments below.

On 4 November 2012 19:10, Jean-Christophe PLAGNIOL-VILLARD
<plagnioj@jcrosoft.com> wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
> Cc: Joachim Eastwood <manabian@gmail.com>
> Cc: netdev@vger.kernel.org
> ---
>  .../devicetree/bindings/net/cdns-emac.txt          |   23 +++++++
>  drivers/net/ethernet/cadence/at91_ether.c          |   72 ++++++++++++++++++--
>  2 files changed, 88 insertions(+), 7 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/net/cdns-emac.txt
>
> diff --git a/Documentation/devicetree/bindings/net/cdns-emac.txt b/Documentation/devicetree/bindings/net/cdns-emac.txt
> new file mode 100644
> index 0000000..45b8760
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/cdns-emac.txt
> @@ -0,0 +1,23 @@
> +* Cadence EMAC Ethernet controller
> +
> +Required properties:
> +- compatible: Should be "cdns,[<chip>-]{emac}"
> +  Use "cdns,at91rm9200-emac" Atmel at91rm9200 SoC.
> +  or the generic form: "cdns,emac".
> +- reg: Address and length of the register set for the device
> +- interrupts: Should contain macb interrupt
> +- phy-mode: String, operation mode of the PHY interface.
> +  Supported values are: "mii", "rmii".
> +
> +Optional properties:
> +- local-mac-address: 6 bytes, mac address
> +
> +Examples:
> +
> +       macb0: ethernet@fffc4000 {
> +               compatible = "cdns,atrm9200-emac";

Typo in the compatible string. Should be "cdns,at91rm9200-emac"

> +               reg = <0xfffc4000 0x4000>;
> +               interrupts = <21>;
> +               phy-mode = "rmii";
> +               local-mac-address = [3a 0e 03 04 05 06];
> +       };
> diff --git a/drivers/net/ethernet/cadence/at91_ether.c b/drivers/net/ethernet/cadence/at91_ether.c
> index 0d6392d..3e843b4 100644
> --- a/drivers/net/ethernet/cadence/at91_ether.c
> +++ b/drivers/net/ethernet/cadence/at91_ether.c
> @@ -31,6 +31,9 @@
>  #include <linux/gfp.h>
>  #include <linux/phy.h>
>  #include <linux/io.h>
> +#include <linux/of.h>
> +#include <linux/of_device.h>
> +#include <linux/of_net.h>
>
>  #include "macb.h"
>
> @@ -443,6 +446,49 @@ static const struct net_device_ops at91ether_netdev_ops = {
>  #endif
>  };
>
> +#if defined(CONFIG_OF)
> +static const struct of_device_id at91ether_dt_ids[] = {
> +       { .compatible = "cdns,at91rm9200-emac" },
> +       { .compatible = "cdns,emac" },
> +       { /* sentinel */ }
> +};
> +
> +MODULE_DEVICE_TABLE(of, at91ether_dt_ids);
> +
> +static int at91ether_get_phy_mode_dt(struct platform_device *pdev)
> +{
> +       struct device_node *np = pdev->dev.of_node;
> +
> +       if (np)
> +               return of_get_phy_mode(np);
> +
> +       return -ENODEV;
> +}
> +
> +static int at91ether_get_hwaddr_dt(struct macb *bp)
> +{
> +       struct device_node *np = bp->pdev->dev.of_node;

Space between variables and code, please.

> +       if (np) {
> +               const char *mac = of_get_mac_address(np);
> +               if (mac) {
> +                       memcpy(bp->dev->dev_addr, mac, ETH_ALEN);
> +                       return 0;
> +               }
> +       }
> +
> +       return -ENODEV;
> +}
> +#else
> +static int at91ether_get_phy_mode_dt(struct platform_device *pdev)
> +{
> +       return -ENODEV;
> +}
> +static int at91ether_get_hwaddr_dt(struct macb *bp)
> +{
> +       return -ENODEV;
> +}
> +#endif
> +
>  /*
>   * Detect MAC & PHY and perform ethernet interface initialization
>   */
> @@ -466,7 +512,8 @@ static int __init at91ether_probe(struct platform_device *pdev)
>         lp = netdev_priv(dev);
>         lp->pdev = pdev;
>         lp->dev = dev;
> -       lp->board_data = *board_data;
> +       if (board_data)
> +               lp->board_data = *board_data;
>         spin_lock_init(&lp->lock);
>
>         dev->base_addr = regs->start;           /* physical base address */
> @@ -496,18 +543,28 @@ static int __init at91ether_probe(struct platform_device *pdev)
>         platform_set_drvdata(pdev, dev);
>         SET_NETDEV_DEV(dev, &pdev->dev);
>
> -       get_mac_address(dev);           /* Get ethernet address and store it in dev->dev_addr */
> +       res = at91ether_get_hwaddr_dt(lp);
> +       if (res < 0)
> +               get_mac_address(dev);           /* Get ethernet address and store it in dev->dev_addr */
> +
>         update_mac_address(dev);        /* Program ethernet address into MAC */
>
> +       res = at91ether_get_phy_mode_dt(pdev);
> +       if (res < 0) {
> +               if (board_data && board_data->is_rmii)
> +                       lp->phy_interface = PHY_INTERFACE_MODE_RMII;
> +               else
> +                       lp->phy_interface = PHY_INTERFACE_MODE_MII;
> +       } else {
> +               lp->phy_interface = res;
> +       }
> +
>         macb_writel(lp, NCR, 0);
>
> -       if (board_data->is_rmii) {
> +       if (lp->phy_interface == PHY_INTERFACE_MODE_RMII)
>                 macb_writel(lp, NCFGR, MACB_BF(CLK, MACB_CLK_DIV32) | MACB_BIT(BIG) | MACB_BIT(RM9200_RMII));
> -               lp->phy_interface = PHY_INTERFACE_MODE_RMII;
> -       } else {
> +       else
>                 macb_writel(lp, NCFGR, MACB_BF(CLK, MACB_CLK_DIV32) | MACB_BIT(BIG));
> -               lp->phy_interface = PHY_INTERFACE_MODE_MII;
> -       }
>
>         /* Register the network interface */
>         res = register_netdev(dev);
> @@ -602,6 +659,7 @@ static struct platform_driver at91ether_driver = {
>         .driver         = {
>                 .name   = DRV_NAME,
>                 .owner  = THIS_MODULE,
> +               .of_match_table = of_match_ptr(at91ether_dt_ids),
>         },
>  };
>

Tested-by: Joachim Eastwood <manabian@gmail.com>

regards
Joachim Eastwood

^ permalink raw reply

* Re: [PATCH net-next 3/3] eth: Rename and properly align br_reserved_address array
From: Stephen Hemminger @ 2012-11-04 20:42 UTC (permalink / raw)
  To: John Fastabend; +Cc: Ben Hutchings, David Miller, netdev, linux-net-drivers
In-Reply-To: <509314F3.6030206@intel.com>

On Thu, 01 Nov 2012 17:33:55 -0700
John Fastabend <john.r.fastabend@intel.com> wrote:

> On 11/1/2012 12:12 PM, Ben Hutchings wrote:
> > Since this array is no longer part of the bridge driver, it should
> > have an 'eth' prefix not 'br'.
> >
> > We also assume that either it's 16-bit-aligned or the architecture has
> > efficient unaligned access.  Ensure the first of these is true by
> > explicitly aligning it.
> >
> > Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
> > ---
> 
> Thanks.
> 
> Acked-by: John Fastabend <john.r.fastabend@intel.com>
> 

I wonder if aligning to 64 bit and doing 64 bit read
and mask would be trivially more efficient for this.

^ permalink raw reply

* merging printk and WARN
From: Julia Lawall @ 2012-11-04 20:25 UTC (permalink / raw)
  To: linux-kernel, airlied, netdev, arnd, joern, chris.mason, m, jejb,
	faisal.latif, neilb, gregkh, JBottomley, swise, achim_leubner,
	swise, tytso
  Cc: 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

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.

Sorry for the noise.

julia

^ permalink raw reply

* [PATCH 2/2] net: at91_ether: add pinctrl support
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-04 18:10 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Nicolas Ferre, devicetree-discuss,
	Jean-Christophe PLAGNIOL-VILLARD, Joachim Eastwood, netdev
In-Reply-To: <1352052637-5154-1-git-send-email-plagnioj@jcrosoft.com>

If no pinctrl available just report a warning as some architecture may not
need to do anything.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Joachim Eastwood <manabian@gmail.com>
Cc: netdev@vger.kernel.org
---
 drivers/net/ethernet/cadence/at91_ether.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/ethernet/cadence/at91_ether.c b/drivers/net/ethernet/cadence/at91_ether.c
index 3e843b4..ffcdbc3 100644
--- a/drivers/net/ethernet/cadence/at91_ether.c
+++ b/drivers/net/ethernet/cadence/at91_ether.c
@@ -34,6 +34,7 @@
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/of_net.h>
+#include <linux/pinctrl/consumer.h>
 
 #include "macb.h"
 
@@ -500,11 +501,21 @@ static int __init at91ether_probe(struct platform_device *pdev)
 	struct phy_device *phydev;
 	struct macb *lp;
 	int res;
+	struct pinctrl *pinctrl;
 
 	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!regs)
 		return -ENOENT;
 
+	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
+	if (IS_ERR(pinctrl)) {
+		res = PTR_ERR(pinctrl);
+		if (res == -EPROBE_DEFER)
+			return res;
+
+		dev_warn(&pdev->dev, "No pinctrl provided\n");
+	}
+
 	dev = alloc_etherdev(sizeof(struct macb));
 	if (!dev)
 		return -ENOMEM;
-- 
1.7.10.4

^ permalink raw reply related

* [PATCH 1/2] net: at91_ether: add dt support
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-04 18:10 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Nicolas Ferre, devicetree-discuss,
	Jean-Christophe PLAGNIOL-VILLARD, Joachim Eastwood, netdev
In-Reply-To: <20121104154954.GJ19021@game.jcrosoft.org>

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Joachim Eastwood <manabian@gmail.com>
Cc: netdev@vger.kernel.org
---
 .../devicetree/bindings/net/cdns-emac.txt          |   23 +++++++
 drivers/net/ethernet/cadence/at91_ether.c          |   72 ++++++++++++++++++--
 2 files changed, 88 insertions(+), 7 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/cdns-emac.txt

diff --git a/Documentation/devicetree/bindings/net/cdns-emac.txt b/Documentation/devicetree/bindings/net/cdns-emac.txt
new file mode 100644
index 0000000..45b8760
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/cdns-emac.txt
@@ -0,0 +1,23 @@
+* Cadence EMAC Ethernet controller
+
+Required properties:
+- compatible: Should be "cdns,[<chip>-]{emac}"
+  Use "cdns,at91rm9200-emac" Atmel at91rm9200 SoC.
+  or the generic form: "cdns,emac".
+- reg: Address and length of the register set for the device
+- interrupts: Should contain macb interrupt
+- phy-mode: String, operation mode of the PHY interface.
+  Supported values are: "mii", "rmii".
+
+Optional properties:
+- local-mac-address: 6 bytes, mac address
+
+Examples:
+
+	macb0: ethernet@fffc4000 {
+		compatible = "cdns,atrm9200-emac";
+		reg = <0xfffc4000 0x4000>;
+		interrupts = <21>;
+		phy-mode = "rmii";
+		local-mac-address = [3a 0e 03 04 05 06];
+	};
diff --git a/drivers/net/ethernet/cadence/at91_ether.c b/drivers/net/ethernet/cadence/at91_ether.c
index 0d6392d..3e843b4 100644
--- a/drivers/net/ethernet/cadence/at91_ether.c
+++ b/drivers/net/ethernet/cadence/at91_ether.c
@@ -31,6 +31,9 @@
 #include <linux/gfp.h>
 #include <linux/phy.h>
 #include <linux/io.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/of_net.h>
 
 #include "macb.h"
 
@@ -443,6 +446,49 @@ static const struct net_device_ops at91ether_netdev_ops = {
 #endif
 };
 
+#if defined(CONFIG_OF)
+static const struct of_device_id at91ether_dt_ids[] = {
+	{ .compatible = "cdns,at91rm9200-emac" },
+	{ .compatible = "cdns,emac" },
+	{ /* sentinel */ }
+};
+
+MODULE_DEVICE_TABLE(of, at91ether_dt_ids);
+
+static int at91ether_get_phy_mode_dt(struct platform_device *pdev)
+{
+	struct device_node *np = pdev->dev.of_node;
+
+	if (np)
+		return of_get_phy_mode(np);
+
+	return -ENODEV;
+}
+
+static int at91ether_get_hwaddr_dt(struct macb *bp)
+{
+	struct device_node *np = bp->pdev->dev.of_node;
+	if (np) {
+		const char *mac = of_get_mac_address(np);
+		if (mac) {
+			memcpy(bp->dev->dev_addr, mac, ETH_ALEN);
+			return 0;
+		}
+	}
+
+	return -ENODEV;
+}
+#else
+static int at91ether_get_phy_mode_dt(struct platform_device *pdev)
+{
+	return -ENODEV;
+}
+static int at91ether_get_hwaddr_dt(struct macb *bp)
+{
+	return -ENODEV;
+}
+#endif
+
 /*
  * Detect MAC & PHY and perform ethernet interface initialization
  */
@@ -466,7 +512,8 @@ static int __init at91ether_probe(struct platform_device *pdev)
 	lp = netdev_priv(dev);
 	lp->pdev = pdev;
 	lp->dev = dev;
-	lp->board_data = *board_data;
+	if (board_data)
+		lp->board_data = *board_data;
 	spin_lock_init(&lp->lock);
 
 	dev->base_addr = regs->start;		/* physical base address */
@@ -496,18 +543,28 @@ static int __init at91ether_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, dev);
 	SET_NETDEV_DEV(dev, &pdev->dev);
 
-	get_mac_address(dev);		/* Get ethernet address and store it in dev->dev_addr */
+	res = at91ether_get_hwaddr_dt(lp);
+	if (res < 0)
+		get_mac_address(dev);		/* Get ethernet address and store it in dev->dev_addr */
+
 	update_mac_address(dev);	/* Program ethernet address into MAC */
 
+	res = at91ether_get_phy_mode_dt(pdev);
+	if (res < 0) {
+		if (board_data && board_data->is_rmii)
+			lp->phy_interface = PHY_INTERFACE_MODE_RMII;
+		else
+			lp->phy_interface = PHY_INTERFACE_MODE_MII;
+	} else {
+		lp->phy_interface = res;
+	}
+
 	macb_writel(lp, NCR, 0);
 
-	if (board_data->is_rmii) {
+	if (lp->phy_interface == PHY_INTERFACE_MODE_RMII)
 		macb_writel(lp, NCFGR, MACB_BF(CLK, MACB_CLK_DIV32) | MACB_BIT(BIG) | MACB_BIT(RM9200_RMII));
-		lp->phy_interface = PHY_INTERFACE_MODE_RMII;
-	} else {
+	else
 		macb_writel(lp, NCFGR, MACB_BF(CLK, MACB_CLK_DIV32) | MACB_BIT(BIG));
-		lp->phy_interface = PHY_INTERFACE_MODE_MII;
-	}
 
 	/* Register the network interface */
 	res = register_netdev(dev);
@@ -602,6 +659,7 @@ static struct platform_driver at91ether_driver = {
 	.driver		= {
 		.name	= DRV_NAME,
 		.owner	= THIS_MODULE,
+		.of_match_table	= of_match_ptr(at91ether_dt_ids),
 	},
 };
 
-- 
1.7.10.4

^ permalink raw reply related

* Re: [PATCH 1/9] batman-adv: add UNICAST_4ADDR packet type
From: David Miller @ 2012-11-04 17:30 UTC (permalink / raw)
  To: sven-KaDOiPu9UxWEi8DpZVb4nw
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r
In-Reply-To: <5244128.ID77evUSAJ-S/pmIDWWJIwhrEaHGRlFQnOel7F/LzPIcbWoRP8EXgk@public.gmane.org>

From: Sven Eckelmann <sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
Date: Sun, 04 Nov 2012 12:20:13 +0100

> To push this question in a direction: May I assume that the driver always 
> ensures that the ethernet header is 4 byte boundary - NET_IP_ALIGN (2) 
> aligned?

Yes.

> When yes, this would result in a slight variations of your suggestion: 
> unicast/bcast headers have to end at 4 bytes boundary + 2 bytes. The reason is 
> easy to explain. batman-adv unicast/bcast headers are used to encapsulate the 
> important parts of an ethernet frame:
> 
> Ethernet Header for P2P | batman-adv header stuff | ethernet header | payload.
> 
> Would you aggree?

Then you can get rid of the packed crap.

^ permalink raw reply

* Re: [PATCH 8/9] isdn: Remove unused variable causing a compile build warning
From: David Miller @ 2012-11-04 17:30 UTC (permalink / raw)
  To: lee.jones; +Cc: pebolle, linux-kernel, isdn, netdev
In-Reply-To: <20121104105332.GC27124@gmail.com>

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.

^ permalink raw reply

* Re: [B.A.T.M.A.N.] [PATCH 1/9] batman-adv: add UNICAST_4ADDR packet type
From: David Miller @ 2012-11-04 17:26 UTC (permalink / raw)
  To: sven; +Cc: b.a.t.m.a.n, ordex, netdev
In-Reply-To: <12758662.vFhVQet4vg@sven-laptop.home.narfation.org>

From: Sven Eckelmann <sven@narfation.org>
Date: Sun, 04 Nov 2012 11:29:29 +0100

> Now also assume following really unusual situation: We get our data from a 
> ethernet driver and the skb stores the ethernet header. The start of the 
> ethernet header is perfectly aligned (4 or even 16 byte boundary aligned). The 
> the header is 14/18 byte long (6 byte src, 6 byte dst, 2 byte ethertype and 
> maybe 4 byte vlan). Now the payload starts only on a 2 byte boundary -> it is 
> never 4 byte boundary aligned. A 32 bit read now causes different variations 
> of problems (reminder: bus error).

Every ethernet driver must provide the networking stack with a modulo 2
aligned ethernet header, which makes sure that everything after the
ethernet header is at least 4 byte aligned.

^ permalink raw reply

* Re: [PATCH v2 net-next] r8169: enable internal ASPM and clock request settings
From: David Miller @ 2012-11-04 17:24 UTC (permalink / raw)
  To: romieu; +Cc: hayeswang, netdev, linux-kernel, agnescheng
In-Reply-To: <20121104091752.GA14093@electric-eye.fr.zoreil.com>

From: Francois Romieu <romieu@fr.zoreil.com>
Date: Sun, 4 Nov 2012 10:17:52 +0100

> David Miller <davem@davemloft.net> :
> [...]
>> Francois?
> 
> Please apply.

Done, thanks.

^ permalink raw reply

* [PATCH 0/2] net: at91_ether add dt and pinctrl support
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-04 15:49 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: netdev, devicetree-discuss, Nicolas Ferre, Joachim Eastwood

Hi,

	This patch serie add dt and pinctrl support to the at91 ether

	this is need to use the network on at91rm9200 as we now have dt
	support on it

Jean-Christophe PLAGNIOL-VILLARD (2):
      net: at91_ether: add dt support
      net: at91_ether: add pinctrl support

 Documentation/devicetree/bindings/net/cdns-emac.txt |   23 +++++++++++++++++++++++
 drivers/net/ethernet/cadence/at91_ether.c           |   83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------
 2 files changed, 99 insertions(+), 7 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/cdns-emac.txt

Best Regards,
J.

^ permalink raw reply

* Re: [PATCH net-next 2/2] cpsw: fix leaking IO mappings
From: Richard Cochran @ 2012-11-04 15:16 UTC (permalink / raw)
  To: Cyril Chemparathy
  Cc: netdev, linux-arm-kernel, David Miller, Mugunthan V N,
	Vaibhav Hiremath
In-Reply-To: <50966C6E.1000507@ti.com>

On Sun, Nov 04, 2012 at 02:23:58PM +0100, Cyril Chemparathy wrote:
> On 11/03/2012 09:25 AM, Richard Cochran wrote:
> >The CPSW driver remaps two different IO regions, but fails to unmap them
> >both. This patch fixes the issue by calling iounmap in the appropriate
> >places.
> 
> Any thoughts on using devres helpers to keep the bail out path simpler?

I wasn't aware of devres before, but I just read through the doc. It
looks interesting, and if I were writting a new driver, then I might
use it.

But for this driver, it really isn't very complex. It only looks that
way, but I think this just accidental. I guess that the code was
adapted from the davinci emac driver.

Thanks,
Richard

^ permalink raw reply

* Re: [PATCH v2 5/5] usbnet: make device out of suspend before calling usbnet_read[write]_cmd
From: Sergei Shtylyov @ 2012-11-04 13:55 UTC (permalink / raw)
  To: Ming Lei
  Cc: David S. Miller, Greg Kroah-Hartman, Oliver Neukum, netdev,
	linux-usb
In-Reply-To: <1352027793-6608-6-git-send-email-ming.lei@canonical.com>

Hello.

On 04-11-2012 15:16, Ming Lei wrote:

    s/make/wake/ in the subject?

> This patche gets the runtime PM reference count before calling

    s/patche/patch/

> usbnet_read[write]_cmd, and puts it after completion of the
> usbnet_read[write]_cmd, so that the usb control message can always

    You probably meant usbnet_{read|write}_cmd() here and in the subject?

> be sent to one active device in the non-PM context.

> Signed-off-by: Ming Lei <ming.lei@canonical.com>
> ---
>   drivers/net/usb/usbnet.c |   18 ++++++++++++++----
>   1 file changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
> index a7fb074..74caa67 100644
> --- a/drivers/net/usb/usbnet.c
> +++ b/drivers/net/usb/usbnet.c
> @@ -1673,8 +1673,13 @@ out:
>   int usbnet_read_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
>   		    u16 value, u16 index, void *data, u16 size)
>   {
> -	return __usbnet_read_cmd(dev, cmd, reqtype, value, index,
> -				 data, size);
> +	int ret;

    Empty line wouldn't hurt here, after declaration block.

> +	if (usb_autopm_get_interface(dev->intf) < 0)
> +		return -ENODEV;
> +	ret = __usbnet_read_cmd(dev, cmd, reqtype, value, index,
> +				data, size);
> +	usb_autopm_put_interface(dev->intf);
> +	return ret;
>   }
>   EXPORT_SYMBOL_GPL(usbnet_read_cmd);
>
> @@ -1685,8 +1690,13 @@ EXPORT_SYMBOL_GPL(usbnet_read_cmd);
>   int usbnet_write_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
>   		     u16 value, u16 index, const void *data, u16 size)
>   {
> -	return __usbnet_write_cmd(dev, cmd, reqtype, value, index,
> -				  data, size);
> +	int ret;

    And here too...

> +	if (usb_autopm_get_interface(dev->intf) < 0)
> +		return -ENODEV;
> +	ret = __usbnet_write_cmd(dev, cmd, reqtype, value, index,
> +				 data, size);
> +	usb_autopm_put_interface(dev->intf);
> +	return ret;
>   }
>   EXPORT_SYMBOL_GPL(usbnet_write_cmd);

WBR, Sergei

^ permalink raw reply

* Re: [PATCH net-next 2/2] cpsw: fix leaking IO mappings
From: Cyril Chemparathy @ 2012-11-04 13:23 UTC (permalink / raw)
  To: Richard Cochran
  Cc: netdev, linux-arm-kernel, David Miller, Mugunthan V N,
	Vaibhav Hiremath
In-Reply-To: <1c915a7d0301355342358db8f84560417609a61c.1351930782.git.richardcochran@gmail.com>

On 11/03/2012 09:25 AM, Richard Cochran wrote:
> The CPSW driver remaps two different IO regions, but fails to unmap them
> both. This patch fixes the issue by calling iounmap in the appropriate
> places.

Any thoughts on using devres helpers to keep the bail out path simpler?

> Signed-off-by: Richard Cochran <richardcochran@gmail.com>
> ---
>   drivers/net/ethernet/ti/cpsw.c |   17 ++++++++---------
>   1 files changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
> index 6215246..7654a62 100644
> --- a/drivers/net/ethernet/ti/cpsw.c
> +++ b/drivers/net/ethernet/ti/cpsw.c
> @@ -1252,14 +1252,12 @@ static int __devinit cpsw_probe(struct platform_device *pdev)
>   		ret = -ENOENT;
>   		goto clean_clk_ret;
>   	}
> -
>   	if (!request_mem_region(priv->cpsw_res->start,
>   				resource_size(priv->cpsw_res), ndev->name)) {
>   		dev_err(priv->dev, "failed request i/o region\n");
>   		ret = -ENXIO;
>   		goto clean_clk_ret;
>   	}
> -
>   	regs = ioremap(priv->cpsw_res->start, resource_size(priv->cpsw_res));
>   	if (!regs) {
>   		dev_err(priv->dev, "unable to map i/o region\n");
> @@ -1274,16 +1272,14 @@ static int __devinit cpsw_probe(struct platform_device *pdev)
>   	if (!priv->cpsw_wr_res) {
>   		dev_err(priv->dev, "error getting i/o resource\n");
>   		ret = -ENOENT;
> -		goto clean_clk_ret;
> +		goto clean_iomap_ret;
>   	}
> -
>   	if (!request_mem_region(priv->cpsw_wr_res->start,
>   			resource_size(priv->cpsw_wr_res), ndev->name)) {
>   		dev_err(priv->dev, "failed request i/o region\n");
>   		ret = -ENXIO;
> -		goto clean_clk_ret;
> +		goto clean_iomap_ret;
>   	}
> -
>   	regs = ioremap(priv->cpsw_wr_res->start,
>   				resource_size(priv->cpsw_wr_res));
>   	if (!regs) {
> @@ -1326,7 +1322,7 @@ static int __devinit cpsw_probe(struct platform_device *pdev)
>   	if (!priv->dma) {
>   		dev_err(priv->dev, "error initializing dma\n");
>   		ret = -ENOMEM;
> -		goto clean_iomap_ret;
> +		goto clean_wr_iomap_ret;
>   	}
>   
>   	priv->txch = cpdma_chan_create(priv->dma, tx_chan_num(0),
> @@ -1407,11 +1403,13 @@ clean_dma_ret:
>   	cpdma_chan_destroy(priv->txch);
>   	cpdma_chan_destroy(priv->rxch);
>   	cpdma_ctlr_destroy(priv->dma);
> -clean_iomap_ret:
> -	iounmap(priv->regs);
> +clean_wr_iomap_ret:
> +	iounmap(priv->wr_regs);
>   clean_cpsw_wr_iores_ret:
>   	release_mem_region(priv->cpsw_wr_res->start,
>   			   resource_size(priv->cpsw_wr_res));
> +clean_iomap_ret:
> +	iounmap(priv->regs);
>   clean_cpsw_iores_ret:
>   	release_mem_region(priv->cpsw_res->start,
>   			   resource_size(priv->cpsw_res));
> @@ -1442,6 +1440,7 @@ static int __devexit cpsw_remove(struct platform_device *pdev)
>   	iounmap(priv->regs);
>   	release_mem_region(priv->cpsw_res->start,
>   			   resource_size(priv->cpsw_res));
> +	iounmap(priv->wr_regs);
>   	release_mem_region(priv->cpsw_wr_res->start,
>   			   resource_size(priv->cpsw_wr_res));
>   	pm_runtime_disable(&pdev->dev);

^ permalink raw reply

* Re: [PATCH 1/9] batman-adv: add UNICAST_4ADDR packet type
From: Sven Eckelmann @ 2012-11-04 11:20 UTC (permalink / raw)
  To: b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, David Miller
In-Reply-To: <12758662.vFhVQet4vg-S/pmIDWWJIwhrEaHGRlFQnOel7F/LzPIcbWoRP8EXgk@public.gmane.org>

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

On Sunday 04 November 2012 11:29:29 Sven Eckelmann wrote:
> On Saturday 03 November 2012 15:22:26 David Miller wrote:
> [...]
> 
> > Your packet layouts are very poorly designed and I want you to stop
> > and think seriously about things before extending things further.
> 
> You are right about the packet design/layout. But I also have some problems
> with the following statement. Maybe you can help me to resolve it.
> 
> > All of this __packed stuff is a serious problem.
> > 
> > It means that on RISC system, fields such as your 32-bit sequence
> > number, will be read and written using byte loads and stores.
> > 
> > This is terrible.
> > 
> > Instead, design the structures so that they are full filled out to
> > at least 4 byte boundaries, so that they and the contents after
> > them, are 4 byte aligned too.
> > 
> > Then you won't need to mark all of your packet header structs
> > with __packed, and therefore the compiler can use full 32-bit
> > loads and stores to access 32-bit fields.
> 
> Ok, lets assume batman-adv has everything 4 byte aligned and we are running
> on a machine without unaligned r/w access. The machine may issues bus
> errors and so on.
> 
> Now also assume following really unusual situation: We get our data from a
> ethernet driver and the skb stores the ethernet header. The start of the
> ethernet header is perfectly aligned (4 or even 16 byte boundary aligned).
> The the header is 14/18 byte long (6 byte src, 6 byte dst, 2 byte ethertype
> and maybe 4 byte vlan). Now the payload starts only on a 2 byte boundary ->
> it is never 4 byte boundary aligned. A 32 bit read now causes different
> variations of problems (reminder: bus error).
> 
> This brings me to the question: Why should the "32 bit align everything
> relative to the start of the struct" approach help to resolve the situation
> for the access of 32 bit data structure members? May I am missing some
> information?

To push this question in a direction: May I assume that the driver always 
ensures that the ethernet header is 4 byte boundary - NET_IP_ALIGN (2) 
aligned?

When yes, this would result in a slight variations of your suggestion: 
unicast/bcast headers have to end at 4 bytes boundary + 2 bytes. The reason is 
easy to explain. batman-adv unicast/bcast headers are used to encapsulate the 
important parts of an ethernet frame:

Ethernet Header for P2P | batman-adv header stuff | ethernet header | payload.

Would you aggree?

Thanks,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply

* Re: [PATCH v1 2/5] usbnet: smsc75xx: apply the introduced usbnet_read[write]_cmd_nopm
From: Ming Lei @ 2012-11-04 11:19 UTC (permalink / raw)
  To: David Miller; +Cc: gregkh, oneukum, netdev, linux-usb, steve.glendinning
In-Reply-To: <20121104.015834.655875426096699012.davem@davemloft.net>

On Sun, Nov 4, 2012 at 1:58 PM, David Miller <davem@davemloft.net> wrote:
>
> This gets rejects, you didn't have your net-next tree uptodate
> enough.

Sorry, I just rebased that on 3.7.0-rc3-next-20121102.

The new patchset which is against the latest net-next has been sent out.

Thanks,
--
Ming Lei

^ 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