Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH 3/3] netdma: adding alignment check for NETDMA ops
From: David Miller @ 2012-04-05  0:18 UTC (permalink / raw)
  To: dave.jiang; +Cc: dan.j.williams, linux-kernel, netdev
In-Reply-To: <20120404231046.20605.13918.stgit@djiang5-linux.ch.intel.com>

From: Dave Jiang <dave.jiang@intel.com>
Date: Wed, 04 Apr 2012 16:10:46 -0700

> This is the fallout from adding memcpy alignment workaround for certain
> IOATDMA hardware. NetDMA will only use DMA engine that can handle byte align
> ops.
> 
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply

* Re: [RFC] net/hsr: Add support for IEC 62439-3 High-availability Seamless Redundancy
From: David Miller @ 2012-04-05  0:17 UTC (permalink / raw)
  To: arvid.brodin; +Cc: shemminger, netdev, balferreira, arvid.brodin
In-Reply-To: <4F7CD4BC.4000006@enea.com>

From: Arvid Brodin <arvid.brodin@enea.com>
Date: Thu, 5 Apr 2012 01:09:48 +0200

> -		icmp_param.data.icmph	   = *icmp_hdr(skb);
> +		memcpy(&icmp_param.data.icmph, icmp_hdr(skb),
> +						sizeof(icmp_param.data.icmph));

GCC can and will optimize this into an inline assignment, and thus
have the same unaligned access problems, because it determines
alignment based upon the types involved.

^ permalink raw reply

* Re: [PATCH 0/7] bna: Update driver version to 3.0.23.0 (resubmit)
From: David Miller @ 2012-04-05  0:15 UTC (permalink / raw)
  To: huangj; +Cc: netdev, AdapterLinuxOpenSrcExtTeam
In-Reply-To: <E5313AF6F2BFD14293E5FD0F94750F86B3A74DEE55@HQ1-EXCH01.corp.brocade.com>

From: Jing Huang <huangj@Brocade.COM>
Date: Wed, 4 Apr 2012 16:07:22 -0700

> The ioc init semaphore register is only used by driver. Firmware
> will never touch this register.  It will only be set to 1 when there
> is a driver instance holding it. So in practice, the infinite look
> will happen only if a driver instance grab the semaphore but forgot
> to release it. We add this logic to serialize register access for
> potential case of concurrent PCI function probe, which seems pretty
> rare in Linux.

Thanks for the clarification.

> I agree that this code looks ugly and wrong in theory. We will consider remove it or
> implement some timeout logic for it.

Ok, great.

^ permalink raw reply

* [patch net-next 1/2] team: add binary option type
From: Jiri Pirko @ 2012-04-04 22:16 UTC (permalink / raw)
  To: netdev
  Cc: davem, eric.dumazet, bhutchings, shemminger, raise.sail,
	nuno.martins, matt

For transfering generic binary data (e.g. BPF code), introduce new
binary option type.

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
 drivers/net/team/team.c |   30 ++++++++++++++++++++++++++----
 include/linux/if_team.h |    8 ++++++++
 2 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 0db6e66..ea96f82 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -1145,10 +1145,7 @@ team_nl_option_policy[TEAM_ATTR_OPTION_MAX + 1] = {
 	},
 	[TEAM_ATTR_OPTION_CHANGED]		= { .type = NLA_FLAG },
 	[TEAM_ATTR_OPTION_TYPE]			= { .type = NLA_U8 },
-	[TEAM_ATTR_OPTION_DATA] = {
-		.type = NLA_BINARY,
-		.len = TEAM_STRING_MAX_LEN,
-	},
+	[TEAM_ATTR_OPTION_DATA]			= { .type = NLA_BINARY },
 };
 
 static int team_nl_cmd_noop(struct sk_buff *skb, struct genl_info *info)
@@ -1257,6 +1254,7 @@ static int team_nl_fill_options_get(struct sk_buff *skb,
 	list_for_each_entry(option, &team->option_list, list) {
 		struct nlattr *option_item;
 		long arg;
+		struct team_option_binary tbinary;
 
 		/* Include only changed options if fill all mode is not on */
 		if (!fillall && !option->changed)
@@ -1290,6 +1288,15 @@ static int team_nl_fill_options_get(struct sk_buff *skb,
 					   (char *) arg))
 				goto nla_put_failure;
 			break;
+		case TEAM_OPTION_TYPE_BINARY:
+			if (nla_put_u8(skb, TEAM_ATTR_OPTION_TYPE, NLA_BINARY))
+				goto nla_put_failure;
+			arg = (long) &tbinary;
+			team_option_get(team, option, &arg);
+			if (nla_put(skb, TEAM_ATTR_OPTION_DATA,
+				    tbinary.data_len, tbinary.data))
+				goto nla_put_failure;
+			break;
 		default:
 			BUG();
 		}
@@ -1374,6 +1381,9 @@ static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info)
 		case NLA_STRING:
 			opt_type = TEAM_OPTION_TYPE_STRING;
 			break;
+		case NLA_BINARY:
+			opt_type = TEAM_OPTION_TYPE_BINARY;
+			break;
 		default:
 			goto team_put;
 		}
@@ -1382,19 +1392,31 @@ static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info)
 		list_for_each_entry(option, &team->option_list, list) {
 			long arg;
 			struct nlattr *opt_data_attr;
+			struct team_option_binary tbinary;
+			int data_len;
 
 			if (option->type != opt_type ||
 			    strcmp(option->name, opt_name))
 				continue;
 			opt_found = true;
 			opt_data_attr = mode_attrs[TEAM_ATTR_OPTION_DATA];
+			data_len = nla_len(opt_data_attr);
 			switch (opt_type) {
 			case TEAM_OPTION_TYPE_U32:
 				arg = nla_get_u32(opt_data_attr);
 				break;
 			case TEAM_OPTION_TYPE_STRING:
+				if (data_len > TEAM_STRING_MAX_LEN) {
+					err = -EINVAL;
+					goto team_put;
+				}
 				arg = (long) nla_data(opt_data_attr);
 				break;
+			case TEAM_OPTION_TYPE_BINARY:
+				tbinary.data_len = data_len;
+				tbinary.data = nla_data(opt_data_attr);
+				arg = (long) &tbinary;
+				break;
 			default:
 				BUG();
 			}
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index 58404b0..41163ac 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -68,6 +68,7 @@ struct team_mode_ops {
 enum team_option_type {
 	TEAM_OPTION_TYPE_U32,
 	TEAM_OPTION_TYPE_STRING,
+	TEAM_OPTION_TYPE_BINARY,
 };
 
 struct team_option {
@@ -82,6 +83,13 @@ struct team_option {
 	bool removed;
 };
 
+struct team_option_binary {
+	u32 data_len;
+	void *data;
+};
+
+#define team_optarg_tbinary(arg) (*((struct team_option_binary **) arg))
+
 struct team_mode {
 	struct list_head list;
 	const char *kind;
-- 
1.7.9.1

^ permalink raw reply related

* Re: [RFC] net/hsr: Add support for IEC 62439-3 High-availability Seamless Redundancy
From: Stephen Hemminger @ 2012-04-04 23:55 UTC (permalink / raw)
  To: Arvid Brodin; +Cc: David S. Miller, netdev, Bruno Ferreira, Arvid Brodin
In-Reply-To: <4F7CD4BC.4000006@enea.com>

On Thu, 5 Apr 2012 01:09:48 +0200
Arvid Brodin <arvid.brodin@enea.com> wrote:

> Stephen Hemminger wrote:
> > On Tue, 27 Mar 2012 15:20:45 +0200
> > Arvid Brodin <arvid.brodin@enea.com> wrote:
> > 
> >> +config NONSTANDARD_HSR
> >> +	bool "HSR: Use efficient tag (breaks HSR standard, read help!)"
> >> +	depends on HSR
> >> +	---help---
> >> +	  The HSR standard specifies a 6-byte HSR tag to be inserted into the
> >> +	  transmitted network frames. This breaks the 32-bit alignment that the
> >> +	  Linux network stack relies on, and would cause kernel panics on
> >> +	  certain architectures. To avoid this, the whole frame payload is
> >> +	  memmoved 2 bytes on reception on these architectures - which is very
> >> +	  inefficient!
> > 
> > This option won't fly. Don't do it.
> > If you need to copy/realign packets on some architecture the stack
> > should be changed to handle it.
> 
> Ok. The problems are in net/ipv4/icmp.c. The below patch seems to do
> the trick for me - does it look OK (and if so, should I resend it as
> a normal patch instead of a reply or is this enough)?
> 
> Note that I've only triggered this problem in icmp_echo(), but I
> noticed that icmp_timestamp() does the same thing, so I made the change
> there too.
> 
> 
> [PATCH] net/ipv4/icmp: Fix kernel panic due to unaligned access with HSR on AVR32
> 
> icmp_echo() and icmp_timestamp() requires the icmphdr struct to be
> 32-bit aligned. This causes a kernel panic on AVR32 when HSR is used,
> since the HSR protocol inserts a 6-byte "HSR tag" into Ethernet frame
> headers, thus changing the alignment.
> 
> HSR = IEC 62439-3 High-availability Seamless Redundancy.
> 
> Signed-off-by: Arvid Brodin <arvid.brodin@xdin.com>
> ---
>  net/ipv4/icmp.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
> index 2cb2bf8..fdd8097 100644
> --- a/net/ipv4/icmp.c
> +++ b/net/ipv4/icmp.c
> @@ -818,7 +818,8 @@ static void icmp_echo(struct sk_buff *skb)
>  	if (!net->ipv4.sysctl_icmp_echo_ignore_all) {
>  		struct icmp_bxm icmp_param;
>  
> -		icmp_param.data.icmph	   = *icmp_hdr(skb);
> +		memcpy(&icmp_param.data.icmph, icmp_hdr(skb),
> +						sizeof(icmp_param.data.icmph));
>  		icmp_param.data.icmph.type = ICMP_ECHOREPLY;
>  		icmp_param.skb		   = skb;
>  		icmp_param.offset	   = 0;
> @@ -854,7 +855,8 @@ static void icmp_timestamp(struct sk_buff *skb)
>  	icmp_param.data.times[2] = icmp_param.data.times[1];
>  	if (skb_copy_bits(skb, 0, &icmp_param.data.times[0], 4))
>  		BUG();
> -	icmp_param.data.icmph	   = *icmp_hdr(skb);
> +	memcpy(&icmp_param.data.icmph, icmp_hdr(skb),
> +						sizeof(icmp_param.data.icmph));
>  	icmp_param.data.icmph.type = ICMP_TIMESTAMPREPLY;
>  	icmp_param.data.icmph.code = 0;
>  	icmp_param.skb		   = skb;

That isn't so bad, doing a memcpy versus a structure copy.

^ permalink raw reply

* RE: [PATCH 0/7] bna: Update driver version to 3.0.23.0
From: Jing Huang @ 2012-04-04 23:46 UTC (permalink / raw)
  To: David Miller, shemminger@vyatta.com
  Cc: netdev@vger.kernel.org, Adapter Linux Open SRC Team
In-Reply-To: <20120404.181718.345441045492163774.davem@davemloft.net>

>> When are you going to integrate multi-queue support which is already
>> available in your out of tree driver?
>
>I hope your Brocade folks aren't playing the "try to make the out-of-tree
>driver more desirable than the in-tree one" game.  I would find that really
>irritating.

Hi Stephen & David

We submitted our mutli-TX queue implementation last year but it was not accepted. The concern was mainly on our iSCSI over DCB implementation because we had used select_queue() to map iSCSI pkts to a queue derived from DCB configuration by inspecting the well known TCP port number. The community feedback was to use ndo_setup_tc to setup up priority to queue mapping and use dcb_setapp() routines to program the iscsi TLV and provide priority info to user space applications. 

We are working on the implementation for our next driver release and will plan to submit the upstream patch after it has gone through QA validation later this year.

However, if you are ok with the existing implementation, we would like to resubmit the current implementation to enable feature parity with out of box driver.

Thanks
Jing

^ permalink raw reply

* [PATCH 3/3] netdma: adding alignment check for NETDMA ops
From: Dave Jiang @ 2012-04-04 23:10 UTC (permalink / raw)
  To: dan.j.williams, linux-kernel; +Cc: netdev, davem, Dave Jiang
In-Reply-To: <20120404230749.20605.7000.stgit@djiang5-linux.ch.intel.com>

This is the fallout from adding memcpy alignment workaround for certain
IOATDMA hardware. NetDMA will only use DMA engine that can handle byte align
ops.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---

 drivers/dma/dmaengine.c   |   14 ++++++++++++++
 include/linux/dmaengine.h |    1 +
 net/ipv4/tcp.c            |    4 ++--
 net/ipv4/tcp_input.c      |    2 +-
 net/ipv4/tcp_ipv4.c       |    2 +-
 net/ipv6/tcp_ipv6.c       |    2 +-
 6 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index a6c6051..0f1ca74 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -332,6 +332,20 @@ struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type)
 }
 EXPORT_SYMBOL(dma_find_channel);
 
+/*
+ * net_dma_find_channel - find a channel for net_dma
+ * net_dma has alignment requirements
+ */
+struct dma_chan *net_dma_find_channel(void)
+{
+	struct dma_chan *chan = dma_find_channel(DMA_MEMCPY);
+	if (chan && !is_dma_copy_aligned(chan->device, 1, 1, 1))
+		return NULL;
+
+	return chan;
+}
+EXPORT_SYMBOL(net_dma_find_channel);
+
 /**
  * dma_issue_pending_all - flush all pending operations across all channels
  */
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 679b349..a5bb3ad 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -948,6 +948,7 @@ int dma_async_device_register(struct dma_device *device);
 void dma_async_device_unregister(struct dma_device *device);
 void dma_run_dependencies(struct dma_async_tx_descriptor *tx);
 struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type);
+struct dma_chan *net_dma_find_channel(void);
 #define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y)
 
 /* --- Helper iov-locking functions --- */
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 22ef5f9..8712c5d 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1450,7 +1450,7 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
 		if ((available < target) &&
 		    (len > sysctl_tcp_dma_copybreak) && !(flags & MSG_PEEK) &&
 		    !sysctl_tcp_low_latency &&
-		    dma_find_channel(DMA_MEMCPY)) {
+		    net_dma_find_channel()) {
 			preempt_enable_no_resched();
 			tp->ucopy.pinned_list =
 					dma_pin_iovec_pages(msg->msg_iov, len);
@@ -1665,7 +1665,7 @@ do_prequeue:
 		if (!(flags & MSG_TRUNC)) {
 #ifdef CONFIG_NET_DMA
 			if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list)
-				tp->ucopy.dma_chan = dma_find_channel(DMA_MEMCPY);
+				tp->ucopy.dma_chan = net_dma_find_channel();
 
 			if (tp->ucopy.dma_chan) {
 				tp->ucopy.dma_cookie = dma_skb_copy_datagram_iovec(
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index b5e315f..27c676d 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -5190,7 +5190,7 @@ static int tcp_dma_try_early_copy(struct sock *sk, struct sk_buff *skb,
 		return 0;
 
 	if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list)
-		tp->ucopy.dma_chan = dma_find_channel(DMA_MEMCPY);
+		tp->ucopy.dma_chan = net_dma_find_channel();
 
 	if (tp->ucopy.dma_chan && skb_csum_unnecessary(skb)) {
 
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index fd54c5f..3810b6f 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1727,7 +1727,7 @@ process:
 #ifdef CONFIG_NET_DMA
 		struct tcp_sock *tp = tcp_sk(sk);
 		if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list)
-			tp->ucopy.dma_chan = dma_find_channel(DMA_MEMCPY);
+			tp->ucopy.dma_chan = net_dma_find_channel();
 		if (tp->ucopy.dma_chan)
 			ret = tcp_v4_do_rcv(sk, skb);
 		else
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 3edd05a..fcb3e4f 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1755,7 +1755,7 @@ process:
 #ifdef CONFIG_NET_DMA
 		struct tcp_sock *tp = tcp_sk(sk);
 		if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list)
-			tp->ucopy.dma_chan = dma_find_channel(DMA_MEMCPY);
+			tp->ucopy.dma_chan = net_dma_find_channel();
 		if (tp->ucopy.dma_chan)
 			ret = tcp_v6_do_rcv(sk, skb);
 		else

^ permalink raw reply related

* [PATCH 2/3] ioatdma: DMA copy alignment needed to address IOAT DMA silicon errata
From: Dave Jiang @ 2012-04-04 23:10 UTC (permalink / raw)
  To: dan.j.williams, linux-kernel; +Cc: netdev, davem, Dave Jiang
In-Reply-To: <20120404230749.20605.7000.stgit@djiang5-linux.ch.intel.com>

Silicon errata where when RAID and legacy descriptors are mixed, the legacy
(memcpy and friends) operation must have alignment of 64 bytes to avoid
hanging. This effects Intel Xeon C55xx, C35xx, E5-2600.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---

 drivers/dma/ioat/dma_v3.c |   41 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c
index 2dbf32b..c5cc3ba 100644
--- a/drivers/dma/ioat/dma_v3.c
+++ b/drivers/dma/ioat/dma_v3.c
@@ -1147,6 +1147,44 @@ static int ioat3_reset_hw(struct ioat_chan_common *chan)
 	return ioat2_reset_sync(chan, msecs_to_jiffies(200));
 }
 
+static bool is_jf_ioat(struct pci_dev *pdev)
+{
+	switch (pdev->device) {
+		case PCI_DEVICE_ID_INTEL_IOAT_JSF0:
+		case PCI_DEVICE_ID_INTEL_IOAT_JSF1:
+		case PCI_DEVICE_ID_INTEL_IOAT_JSF2:
+		case PCI_DEVICE_ID_INTEL_IOAT_JSF3:
+		case PCI_DEVICE_ID_INTEL_IOAT_JSF4:
+		case PCI_DEVICE_ID_INTEL_IOAT_JSF5:
+		case PCI_DEVICE_ID_INTEL_IOAT_JSF6:
+		case PCI_DEVICE_ID_INTEL_IOAT_JSF7:
+		case PCI_DEVICE_ID_INTEL_IOAT_JSF8:
+		case PCI_DEVICE_ID_INTEL_IOAT_JSF9:
+			return true;
+		default:
+			return false;
+	}
+}
+
+static bool is_snb_ioat(struct pci_dev *pdev)
+{
+	switch (pdev->device) {
+		case PCI_DEVICE_ID_INTEL_IOAT_SNB0:
+		case PCI_DEVICE_ID_INTEL_IOAT_SNB1:
+		case PCI_DEVICE_ID_INTEL_IOAT_SNB2:
+		case PCI_DEVICE_ID_INTEL_IOAT_SNB3:
+		case PCI_DEVICE_ID_INTEL_IOAT_SNB4:
+		case PCI_DEVICE_ID_INTEL_IOAT_SNB5:
+		case PCI_DEVICE_ID_INTEL_IOAT_SNB6:
+		case PCI_DEVICE_ID_INTEL_IOAT_SNB7:
+		case PCI_DEVICE_ID_INTEL_IOAT_SNB8:
+		case PCI_DEVICE_ID_INTEL_IOAT_SNB9:
+			return true;
+		default:
+			return false;
+	}
+}
+
 int __devinit ioat3_dma_probe(struct ioatdma_device *device, int dca)
 {
 	struct pci_dev *pdev = device->pdev;
@@ -1167,6 +1205,9 @@ int __devinit ioat3_dma_probe(struct ioatdma_device *device, int dca)
 	dma->device_alloc_chan_resources = ioat2_alloc_chan_resources;
 	dma->device_free_chan_resources = ioat2_free_chan_resources;
 
+	if (is_jf_ioat(pdev) || is_snb_ioat(pdev))
+		dma->copy_align = 6;
+
 	dma_cap_set(DMA_INTERRUPT, dma->cap_mask);
 	dma->device_prep_dma_interrupt = ioat3_prep_interrupt_lock;
 

^ permalink raw reply related

* [PATCH 0/3] Series short description
From: Dave Jiang @ 2012-04-04 23:10 UTC (permalink / raw)
  To: dan.j.williams, linux-kernel; +Cc: netdev, davem

The following series address issues with the ioatdma driver. The first
patch fixes a potential ring size overflow. The next two patches put
in alignment requirement for silicon errata on the ioatdma hardware related to
M2M ops and impacts NETDMA. The last patch will probably need to be
ack'd by David Miller as it touches the network subsystem.
---

Dave Jiang (3):
      netdma: adding alignment check for NETDMA ops
      ioatdma: DMA copy alignment needed to address IOAT DMA silicon errata
      ioat: ring size variables need to be 32bit to avoid overflow


 drivers/dma/dmaengine.c   |   14 ++++++++++++++
 drivers/dma/ioat/dma_v2.c |    4 ++--
 drivers/dma/ioat/dma_v2.h |    4 ++--
 drivers/dma/ioat/dma_v3.c |   41 +++++++++++++++++++++++++++++++++++++++++
 include/linux/dmaengine.h |    1 +
 net/ipv4/tcp.c            |    4 ++--
 net/ipv4/tcp_input.c      |    2 +-
 net/ipv4/tcp_ipv4.c       |    2 +-
 net/ipv6/tcp_ipv6.c       |    2 +-
 9 files changed, 65 insertions(+), 9 deletions(-)

-- 

^ permalink raw reply

* Re: [RFC] net/hsr: Add support for IEC 62439-3 High-availability Seamless Redundancy
From: Arvid Brodin @ 2012-04-04 23:09 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David S. Miller, netdev, Bruno Ferreira, Arvid Brodin
In-Reply-To: <20120403113751.21fd0b17@s6510.linuxnetplumber.net>

Stephen Hemminger wrote:
> On Tue, 27 Mar 2012 15:20:45 +0200
> Arvid Brodin <arvid.brodin@enea.com> wrote:
> 
>> +config NONSTANDARD_HSR
>> +	bool "HSR: Use efficient tag (breaks HSR standard, read help!)"
>> +	depends on HSR
>> +	---help---
>> +	  The HSR standard specifies a 6-byte HSR tag to be inserted into the
>> +	  transmitted network frames. This breaks the 32-bit alignment that the
>> +	  Linux network stack relies on, and would cause kernel panics on
>> +	  certain architectures. To avoid this, the whole frame payload is
>> +	  memmoved 2 bytes on reception on these architectures - which is very
>> +	  inefficient!
> 
> This option won't fly. Don't do it.
> If you need to copy/realign packets on some architecture the stack
> should be changed to handle it.

Ok. The problems are in net/ipv4/icmp.c. The below patch seems to do
the trick for me - does it look OK (and if so, should I resend it as
a normal patch instead of a reply or is this enough)?

Note that I've only triggered this problem in icmp_echo(), but I
noticed that icmp_timestamp() does the same thing, so I made the change
there too.


[PATCH] net/ipv4/icmp: Fix kernel panic due to unaligned access with HSR on AVR32

icmp_echo() and icmp_timestamp() requires the icmphdr struct to be
32-bit aligned. This causes a kernel panic on AVR32 when HSR is used,
since the HSR protocol inserts a 6-byte "HSR tag" into Ethernet frame
headers, thus changing the alignment.

HSR = IEC 62439-3 High-availability Seamless Redundancy.

Signed-off-by: Arvid Brodin <arvid.brodin@xdin.com>
---
 net/ipv4/icmp.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 2cb2bf8..fdd8097 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -818,7 +818,8 @@ static void icmp_echo(struct sk_buff *skb)
 	if (!net->ipv4.sysctl_icmp_echo_ignore_all) {
 		struct icmp_bxm icmp_param;
 
-		icmp_param.data.icmph	   = *icmp_hdr(skb);
+		memcpy(&icmp_param.data.icmph, icmp_hdr(skb),
+						sizeof(icmp_param.data.icmph));
 		icmp_param.data.icmph.type = ICMP_ECHOREPLY;
 		icmp_param.skb		   = skb;
 		icmp_param.offset	   = 0;
@@ -854,7 +855,8 @@ static void icmp_timestamp(struct sk_buff *skb)
 	icmp_param.data.times[2] = icmp_param.data.times[1];
 	if (skb_copy_bits(skb, 0, &icmp_param.data.times[0], 4))
 		BUG();
-	icmp_param.data.icmph	   = *icmp_hdr(skb);
+	memcpy(&icmp_param.data.icmph, icmp_hdr(skb),
+						sizeof(icmp_param.data.icmph));
 	icmp_param.data.icmph.type = ICMP_TIMESTAMPREPLY;
 	icmp_param.data.icmph.code = 0;
 	icmp_param.skb		   = skb;
-- 
1.6.3.3


-- 
Arvid Brodin
Enea Services Stockholm AB - since February 16 a part of Xdin in the Alten
Group. Soon we will be working under the common brand Xdin. Read more at
www.xdin.com.

^ permalink raw reply related

* [PATCH 1/3] ioat: ring size variables need to be 32bit to avoid overflow
From: Dave Jiang @ 2012-04-04 23:10 UTC (permalink / raw)
  To: dan.j.williams, linux-kernel; +Cc: netdev, davem, Dave Jiang
In-Reply-To: <20120404230749.20605.7000.stgit@djiang5-linux.ch.intel.com>

The alloc order can be up to 16 and 1 << 16 will over flow the 16bit
integer. Change the appropriate variables to 16bit to avoid overflow.

Reported-by: Jim Harris <james.r.harris@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---

 drivers/dma/ioat/dma_v2.c |    4 ++--
 drivers/dma/ioat/dma_v2.h |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c
index cb8864d..143cb1b 100644
--- a/drivers/dma/ioat/dma_v2.c
+++ b/drivers/dma/ioat/dma_v2.c
@@ -575,9 +575,9 @@ bool reshape_ring(struct ioat2_dma_chan *ioat, int order)
 	 */
 	struct ioat_chan_common *chan = &ioat->base;
 	struct dma_chan *c = &chan->common;
-	const u16 curr_size = ioat2_ring_size(ioat);
+	const u32 curr_size = ioat2_ring_size(ioat);
 	const u16 active = ioat2_ring_active(ioat);
-	const u16 new_size = 1 << order;
+	const u32 new_size = 1 << order;
 	struct ioat_ring_ent **ring;
 	u16 i;
 
diff --git a/drivers/dma/ioat/dma_v2.h b/drivers/dma/ioat/dma_v2.h
index a2c413b..be2a55b 100644
--- a/drivers/dma/ioat/dma_v2.h
+++ b/drivers/dma/ioat/dma_v2.h
@@ -74,7 +74,7 @@ static inline struct ioat2_dma_chan *to_ioat2_chan(struct dma_chan *c)
 	return container_of(chan, struct ioat2_dma_chan, base);
 }
 
-static inline u16 ioat2_ring_size(struct ioat2_dma_chan *ioat)
+static inline u32 ioat2_ring_size(struct ioat2_dma_chan *ioat)
 {
 	return 1 << ioat->alloc_order;
 }
@@ -91,7 +91,7 @@ static inline u16 ioat2_ring_pending(struct ioat2_dma_chan *ioat)
 	return CIRC_CNT(ioat->head, ioat->issued, ioat2_ring_size(ioat));
 }
 
-static inline u16 ioat2_ring_space(struct ioat2_dma_chan *ioat)
+static inline u32 ioat2_ring_space(struct ioat2_dma_chan *ioat)
 {
 	return ioat2_ring_size(ioat) - ioat2_ring_active(ioat);
 }

^ permalink raw reply related

* RE: [PATCH 0/7] bna: Update driver version to 3.0.23.0 (resubmit)
From: Jing Huang @ 2012-04-04 23:07 UTC (permalink / raw)
  To: David Miller; +Cc: netdev@vger.kernel.org, Adapter Linux Open Src Ext Team
In-Reply-To: <20120404.182105.1576892492865932011.davem@davemloft.net>

>But I would suggest modifying how the driver spins waiting for the
>firmware to release semaphore bits in registers.
>
>You have no timeouts or limits in these loops.
>
>So if the firmware crashes or gets stuck, this will take out the
>entire computer which is very undesirable.
>
>Change these loops to have a limit and signal an error and fail the
>top-level operation if the limit is hit.

Thanks David.

The ioc init semaphore register is only used by driver. Firmware will never touch this
register.  It will only be set to 1 when there is a driver instance holding it. So in practice, 
the infinite look will happen only if a driver instance grab the semaphore but forgot to
release it. We add this logic to serialize register access for potential case of concurrent PCI
function probe, which seems pretty rare in Linux.

I agree that this code looks ugly and wrong in theory. We will consider remove it or
implement some timeout logic for it.

Jing

^ permalink raw reply

* Re: [PATCH 00/10] stmmac update: March 2012 (v2)
From: David Miller @ 2012-04-04 22:40 UTC (permalink / raw)
  To: peppe.cavallaro
  Cc: netdev, deepak.sikri, spear-devel, shiraz.hashim, viresh.kumar,
	srinivas.kandagatla
In-Reply-To: <1333550008-16500-1-git-send-email-peppe.cavallaro@st.com>

From: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
Date: Wed,  4 Apr 2012 16:33:18 +0200

> This patches  update the stmmac and add all the work made
> by Deepak, Srinivas and myself.
> 
> This is the version two of these patch series where I reviewed
> some part of the code after some comments and advice, for example
> the IPC setting and the broken 250MHz define... Thx Deepak and David.
> 
> On-Top of these patches (for net-next) I'll resend the EEE support
> reviewed by Ben.

All applied, thanks.

^ permalink raw reply

* Re: [PATCH v2] stmmac: re-add IFF_UNICAST_FLT for dwmac1000
From: David Miller @ 2012-04-04 22:38 UTC (permalink / raw)
  To: mkl; +Cc: peppe.cavallaro, rayagond, netdev, eric.dumazet
In-Reply-To: <1333527181-17279-1-git-send-email-mkl@pengutronix.de>

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Wed,  4 Apr 2012 10:13:01 +0200

> In commit (bfab27a stmmac: add the experimental PCI support) the
> IFF_UNICAST_FLT flag has been removed from the stmmac_mac_device_setup()
> function. This patch re-adds the flag.
> 
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>

Applied, thanks.

^ permalink raw reply

* Re: [PATCH net-next] vxge: Convert macro to inline function
From: Joe Perches @ 2012-04-04 22:37 UTC (permalink / raw)
  To: David Miller; +Cc: jdmason, netdev, linux-kernel
In-Reply-To: <20120403.181830.799733266830291210.davem@davemloft.net>

On Tue, 2012-04-03 at 18:18 -0400, David Miller wrote:
> From: Joe Perches <joe@perches.com>
> Date: Tue, 03 Apr 2012 15:14:31 -0700
> > Convert the macro to inline function to check the arguments.
> > Signed-off-by: Joe Perches <joe@perches.com>
> > ---
> >> Longer term I'd much rather see this turned into an inline
> >> function with proper type checking etc.
> > Something like this?
> Yep.

I did sign the patch.
I was intending that you could apply it.
Do you want a resend?

^ permalink raw reply

* Re: [PATCH net-next V6 7/8] net/dcb: Add an optional max rate attribute
From: Or Gerlitz @ 2012-04-04 22:30 UTC (permalink / raw)
  To: David Miller; +Cc: amirv, netdev, yevgenyp, john.r.fastabend
In-Reply-To: <20120404.182838.86622924907738367.davem@davemloft.net>

> Yep, they seem mostly fine to me.  So please resubmit with the comment fix

Will do

Or.

^ permalink raw reply

* Re: [PATCH net-next V6 7/8] net/dcb: Add an optional max rate attribute
From: David Miller @ 2012-04-04 22:28 UTC (permalink / raw)
  To: or.gerlitz; +Cc: amirv, netdev, yevgenyp, john.r.fastabend
In-Reply-To: <CAJZOPZKDBECDx0_Yy7N12d8we92N-=0PAOryqOYmmiJ7n7Z1dQ@mail.gmail.com>

From: Or Gerlitz <or.gerlitz@gmail.com>
Date: Thu, 5 Apr 2012 01:27:29 +0300

> Or Gerlitz <or.gerlitz@gmail.com> wrote:
>> John Fastabend <john.r.fastabend@intel.com> wrote:
>>> And I think the last comment. We really should have a comment here describing
>>> what the tc_maxrate field is. Its described in the commit log but its much
>>> harder for implementers to get it wrong when the struct is annotated.
> 
>> Okay, John, sure, we can add that, so just to make sure, from your
>> side the series is okay once this comment is added, correct?
> 
> Also, Dave, any further comments from you on this series, or with
> adding that comment John was asking for - the patches are all fine?

Yep, they seem mostly fine to me.  So please resubmit with the comment
fix.

^ permalink raw reply

* Re: [patch net-next 2/2] team: add loadbalance mode
From: David Miller @ 2012-04-04 22:26 UTC (permalink / raw)
  To: jpirko
  Cc: netdev, eric.dumazet, bhutchings, shemminger, raise.sail,
	nuno.martins, matt
In-Reply-To: <1333577787-878-2-git-send-email-jpirko@redhat.com>


Hmmm, is the first patch stuck in a mail server queue somewhere?

I didn't see it.

^ permalink raw reply

* Re: [PATCH net-next V6 7/8] net/dcb: Add an optional max rate attribute
From: Or Gerlitz @ 2012-04-04 22:27 UTC (permalink / raw)
  To: David S. Miller; +Cc: Amir Vadai, netdev, Yevgeny Petrilin, John Fastabend
In-Reply-To: <CAJZOPZKLtvtfD+o81V0Ezs7NSeTnmp-dBtHPhmziypHkpyOWtw@mail.gmail.com>

Or Gerlitz <or.gerlitz@gmail.com> wrote:
> John Fastabend <john.r.fastabend@intel.com> wrote:
>> And I think the last comment. We really should have a comment here describing
>> what the tc_maxrate field is. Its described in the commit log but its much
>> harder for implementers to get it wrong when the struct is annotated.

> Okay, John, sure, we can add that, so just to make sure, from your
> side the series is okay once this comment is added, correct?

Also, Dave, any further comments from you on this series, or with
adding that comment John was asking for - the patches are all fine?

thanks,

Or.

^ permalink raw reply

* Re: [net 00/10] bnx2x: Link fixes
From: David Miller @ 2012-04-04 22:25 UTC (permalink / raw)
  To: yanivr; +Cc: netdev
In-Reply-To: <1333538942-9904-1-git-send-email-yanivr@broadcom.com>

From: "Yaniv Rosner" <yanivr@broadcom.com>
Date: Wed, 4 Apr 2012 14:28:53 +0300

> The following patch series describe some link fixes.
> These changes were held back a while until testing was completed to insure the
> issues are really fixed. And though they are minor issues, we still prefer to
> push those fixes to net and not just net-next as they improve the usability.
> Please consider applying it to net.

I understand how you might have held these back for internal testing,
but letting so many fixes queue up at one time creates a review burdon
for myself and other developers on this list.

Please try to submit smaller sets at a time in the future.

Anyways, all applied, thanks.

^ permalink raw reply

* Re: [PATCH 0/7] bna: Update driver version to 3.0.23.0 (resubmit)
From: David Miller @ 2012-04-04 22:21 UTC (permalink / raw)
  To: huangj; +Cc: netdev, AdapterLinuxOpenSrcExtTeam
In-Reply-To: <1333554102-21973-1-git-send-email-huangj@brocade.com>

From: Jing Huang <huangj@Brocade.COM>
Date: Wed, 4 Apr 2012 08:41:42 -0700

> I am resubmit this patch set since it seems that the net-next merge window is
> over. 
> 
> This patch set contains fixes in adapter initialization and tx/rx cleanup path.
> It also include code cleanups by removing and renaming some functions.
> 
> The driver version has been updated to 3.0.23.0 to reflect the changes.

All applied.

But I would suggest modifying how the driver spins waiting for the
firmware to release semaphore bits in registers.

You have no timeouts or limits in these loops.

So if the firmware crashes or gets stuck, this will take out the
entire computer which is very undesirable.

Change these loops to have a limit and signal an error and fail the
top-level operation if the limit is hit.

^ permalink raw reply

* Re: [PATCH 0/7] bna: Update driver version to 3.0.23.0
From: David Miller @ 2012-04-04 22:17 UTC (permalink / raw)
  To: shemminger; +Cc: huangj, netdev, adapter_linux_open_src_team
In-Reply-To: <20120404101535.0b739155@s6510.linuxnetplumber.net>

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Wed, 4 Apr 2012 10:15:35 -0700

> On Mon, 26 Mar 2012 12:37:53 -0700
> Jing Huang <huangj@brocade.com> wrote:
> 
>> This patch set contains fixes in adapter initialization and tx/rx cleanup path.
>> It also include code cleanups by removing and renaming some functions.
>> 
>> The driver version has been updated to 3.0.23.0 to reflect the changes.
>> 
>> Jing Huang (7):
>>   bna: Serialize smem access during adapter initialization
>>   bna: Flash controller ioc pll init fixes
>>   bna: ioc cleanups
>>   bfa: tx rx cleanup fix
>>   bna: Remove tx tasklet
>>   bfa: Function name changes and cleanups
>>   bfa: Update driver version to 3.0.23.0
>> 
>>  drivers/net/ethernet/brocade/bna/bfa_ioc.c      |   61 +++--
>>  drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c   |  142 +++++++----
>>  drivers/net/ethernet/brocade/bna/bfi_reg.h      |    6 +
>>  drivers/net/ethernet/brocade/bna/bnad.c         |  316 +++++++++++------------
>>  drivers/net/ethernet/brocade/bna/bnad.h         |   11 +-
>>  drivers/net/ethernet/brocade/bna/bnad_ethtool.c |    6 +-
>>  6 files changed, 300 insertions(+), 242 deletions(-)
>> 
> 
> When are you going to integrate multi-queue support which is already
> available in your out of tree driver?

I hope your Brocade folks aren't playing the "try to make the out-of-tree
driver more desirable than the in-tree one" game.  I would find that really
irritating.

^ permalink raw reply

* [patch net-next 2/2] team: add loadbalance mode
From: Jiri Pirko @ 2012-04-04 22:16 UTC (permalink / raw)
  To: netdev
  Cc: davem, eric.dumazet, bhutchings, shemminger, raise.sail,
	nuno.martins, matt
In-Reply-To: <1333577787-878-1-git-send-email-jpirko@redhat.com>

This patch introduces new team mode. It's TX port is selected by
user-set BPF hash function.

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
 drivers/net/team/Kconfig                 |   11 ++
 drivers/net/team/Makefile                |    1 +
 drivers/net/team/team_mode_loadbalance.c |  188 ++++++++++++++++++++++++++++++
 3 files changed, 200 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/team/team_mode_loadbalance.c

diff --git a/drivers/net/team/Kconfig b/drivers/net/team/Kconfig
index 248a144..89024d5 100644
--- a/drivers/net/team/Kconfig
+++ b/drivers/net/team/Kconfig
@@ -40,4 +40,15 @@ config NET_TEAM_MODE_ACTIVEBACKUP
 	  To compile this team mode as a module, choose M here: the module
 	  will be called team_mode_activebackup.
 
+config NET_TEAM_MODE_LOADBALANCE
+	tristate "Load-balance mode support"
+	depends on NET_TEAM
+	---help---
+	  This mode provides load balancing functionality. Tx port selection
+	  is done using BPF function set up from userspace (bpf_hash_func
+	  option)
+
+	  To compile this team mode as a module, choose M here: the module
+	  will be called team_mode_loadbalance.
+
 endif # NET_TEAM
diff --git a/drivers/net/team/Makefile b/drivers/net/team/Makefile
index 85f2028..fb9f4c1 100644
--- a/drivers/net/team/Makefile
+++ b/drivers/net/team/Makefile
@@ -5,3 +5,4 @@
 obj-$(CONFIG_NET_TEAM) += team.o
 obj-$(CONFIG_NET_TEAM_MODE_ROUNDROBIN) += team_mode_roundrobin.o
 obj-$(CONFIG_NET_TEAM_MODE_ACTIVEBACKUP) += team_mode_activebackup.o
+obj-$(CONFIG_NET_TEAM_MODE_LOADBALANCE) += team_mode_loadbalance.o
diff --git a/drivers/net/team/team_mode_loadbalance.c b/drivers/net/team/team_mode_loadbalance.c
new file mode 100644
index 0000000..ed20f39
--- /dev/null
+++ b/drivers/net/team/team_mode_loadbalance.c
@@ -0,0 +1,188 @@
+/*
+ * drivers/net/team/team_mode_loadbalance.c - Load-balancing mode for team
+ * Copyright (c) 2012 Jiri Pirko <jpirko@redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/errno.h>
+#include <linux/netdevice.h>
+#include <linux/filter.h>
+#include <linux/if_team.h>
+
+struct lb_priv {
+	struct sk_filter __rcu *fp;
+	struct sock_fprog *orig_fprog;
+};
+
+static struct lb_priv *lb_priv(struct team *team)
+{
+	return (struct lb_priv *) &team->mode_priv;
+}
+
+static bool lb_transmit(struct team *team, struct sk_buff *skb)
+{
+	struct sk_filter *fp;
+	struct team_port *port;
+	unsigned int hash;
+	int port_index;
+
+	fp = rcu_dereference(lb_priv(team)->fp);
+	if (unlikely(!fp))
+		goto drop;
+	hash = SK_RUN_FILTER(fp, skb);
+	port_index = hash % team->port_count;
+	port = team_get_port_by_index_rcu(team, port_index);
+	if (unlikely(!port))
+		goto drop;
+	skb->dev = port->dev;
+	if (dev_queue_xmit(skb))
+		return false;
+	return true;
+
+drop:
+	dev_kfree_skb_any(skb);
+	return false;
+}
+
+static int lb_bpf_func_get(struct team *team, void *arg)
+{
+	struct team_option_binary *tbinary = team_optarg_tbinary(arg);
+
+	memset(tbinary, 0, sizeof(*tbinary));
+	if (!lb_priv(team)->orig_fprog)
+		return 0;
+
+	tbinary->data_len = lb_priv(team)->orig_fprog->len *
+			    sizeof(struct sock_filter);
+	tbinary->data = lb_priv(team)->orig_fprog->filter;
+	return 0;
+}
+
+static int __fprog_create(struct sock_fprog **pfprog, u32 data_len,
+			  void *data)
+{
+	struct sock_fprog *fprog;
+	struct sock_filter *filter = (struct sock_filter *) data;
+
+	if (data_len % sizeof(struct sock_filter))
+		return -EINVAL;
+	fprog = kmalloc(sizeof(struct sock_fprog), GFP_KERNEL);
+	if (!fprog)
+		return -ENOMEM;
+	fprog->filter = kmemdup(filter, data_len, GFP_KERNEL);
+	if (!fprog->filter) {
+		kfree(fprog);
+		return -ENOMEM;
+	}
+	fprog->len = data_len / sizeof(struct sock_filter);
+	*pfprog = fprog;
+	return 0;
+}
+
+static void __fprog_destroy(struct sock_fprog *fprog)
+{
+	kfree(fprog->filter);
+	kfree(fprog);
+}
+
+static int lb_bpf_func_set(struct team *team, void *arg)
+{
+	struct team_option_binary *tbinary = team_optarg_tbinary(arg);
+	struct sk_filter *fp = NULL;
+	struct sock_fprog *fprog = NULL;
+	int err;
+
+	if (tbinary->data_len) {
+		err = __fprog_create(&fprog, tbinary->data_len,
+				     tbinary->data);
+		if (err)
+			return err;
+		err = sk_unattached_filter_create(&fp, fprog);
+		if (err) {
+			__fprog_destroy(fprog);
+			return err;
+		}
+	}
+
+	if (lb_priv(team)->orig_fprog) {
+		/* Clear old filter data */
+		__fprog_destroy(lb_priv(team)->orig_fprog);
+		sk_unattached_filter_destroy(lb_priv(team)->fp);
+	}
+
+	rcu_assign_pointer(lb_priv(team)->fp, fp);
+	lb_priv(team)->orig_fprog = fprog;
+	return 0;
+}
+
+static const struct team_option lb_options[] = {
+	{
+		.name = "bpf_hash_func",
+		.type = TEAM_OPTION_TYPE_BINARY,
+		.getter = lb_bpf_func_get,
+		.setter = lb_bpf_func_set,
+	},
+};
+
+int lb_init(struct team *team)
+{
+	return team_options_register(team, lb_options,
+				     ARRAY_SIZE(lb_options));
+}
+
+void lb_exit(struct team *team)
+{
+	team_options_unregister(team, lb_options,
+				ARRAY_SIZE(lb_options));
+}
+
+static int lb_port_enter(struct team *team, struct team_port *port)
+{
+	return team_port_set_team_mac(port);
+}
+
+static void lb_port_change_mac(struct team *team, struct team_port *port)
+{
+	team_port_set_team_mac(port);
+}
+
+static const struct team_mode_ops lb_mode_ops = {
+	.init			= lb_init,
+	.exit			= lb_exit,
+	.transmit		= lb_transmit,
+	.port_enter		= lb_port_enter,
+	.port_change_mac	= lb_port_change_mac,
+};
+
+static struct team_mode lb_mode = {
+	.kind		= "loadbalance",
+	.owner		= THIS_MODULE,
+	.priv_size	= sizeof(struct lb_priv),
+	.ops		= &lb_mode_ops,
+};
+
+static int __init lb_init_module(void)
+{
+	return team_mode_register(&lb_mode);
+}
+
+static void __exit lb_cleanup_module(void)
+{
+	team_mode_unregister(&lb_mode);
+}
+
+module_init(lb_init_module);
+module_exit(lb_cleanup_module);
+
+MODULE_LICENSE("GPL v2");
+MODULE_AUTHOR("Jiri Pirko <jpirko@redhat.com>");
+MODULE_DESCRIPTION("Load-balancing mode for team");
+MODULE_ALIAS("team-mode-loadbalance");
-- 
1.7.9.1

^ permalink raw reply related

* Re: [patch net-next 3/4] team: add binary option type
From: Jiri Pirko @ 2012-04-04 22:14 UTC (permalink / raw)
  To: David Miller
  Cc: netdev, eric.dumazet, bhutchings, shemminger, raise.sail,
	nuno.martins, matt
In-Reply-To: <20120404.174547.1002799463139854012.davem@davemloft.net>

Wed, Apr 04, 2012 at 11:45:47PM CEST, davem@davemloft.net wrote:
>From: Jiri Pirko <jpirko@redhat.com>
>Date: Wed, 4 Apr 2012 14:29:31 +0200
>
>> Wed, Apr 04, 2012 at 12:38:16AM CEST, davem@davemloft.net wrote:
>>>From: Jiri Pirko <jpirko@redhat.com>
>>>Date: Sat, 31 Mar 2012 23:01:21 +0200
>>>
>>>> For transfering generic binary data (e.g. BPF code), introduce new
>>>> binary option type.
>>>> 
>>>> Signed-off-by: Jiri Pirko <jpirko@redhat.com>
>>>
>>>Several issues:
>>>
>>>> +		struct team_option_binary tbinary;
>>>
>>>You put this into a netlink attribute, it has a non-fixed
>>>type size because it uses pointer.  A compat task will do
>>>the wrong thing and you won't interpret it's attribute
>>>correctly.
>> 
>> I'm not nla_putting struct team_option_binary tbinary. I'm putting only
>> the data on what the pointer stored into that points (tbinary.data):
>> 
>> nla_put(skb, TEAM_ATTR_OPTION_DATA, tbinary.data_len, tbinary.data));
>
>Aha, I misread, thanks for explaining.

Going to repost 3/4 and 4/4.

^ permalink raw reply

* Re: [PATCH v3] sky2: copy received packets on inefficient unaligned architecture
From: David Miller @ 2012-04-04 22:14 UTC (permalink / raw)
  To: shemminger; +Cc: cmetcalf, netdev, linux-kernel
In-Reply-To: <20120404151027.047c183b@s6510.linuxnetplumber.net>

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Wed, 4 Apr 2012 15:10:27 -0700

> Modified from original patch from Chris.
> 
> The sky2 driver has to have 8 byte alignment of receive buffer
> on some chip versions. On architectures which don't support efficient
> unaligned access this doesn't work very well. The solution is to
> just copy all received packets which is what the driver already
> does for small packets.
> 
> This allows the driver to be used on the Tilera TILEmpower-Gx, since
> the tile architecture doesn't currently handle kernel unaligned accesses,
> just userspace.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> Acked-by: Chris Metcalf <cmetcalf@tilera.com>

Applied.

^ 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