* Re: [PATCH net-next 0/2] sctp: some small clean ups
From: Wang Weidong @ 2014-01-20 12:32 UTC (permalink / raw)
To: Neil Horman, Daniel Borkmann; +Cc: davem, vyasevich, netdev, linux-sctp
In-Reply-To: <20140120122055.GA22690@hmsreliant.think-freely.org>
On 2014/1/20 20:20, Neil Horman wrote:
> On Mon, Jan 20, 2014 at 12:37:06PM +0100, Daniel Borkmann wrote:
>> On 01/20/2014 12:27 PM, Wang Weidong wrote:
>>> We have the macros in sctp.h, so use them for coding accordance
>>> in sctp.
>>
>> Thanks for doing this Wang.
>>
>> I am actually wondering why we have these macro locking wrappers
>> and not use these functions directly? Hm, any reasons? Maybe we
>> should rather go in the other direction with this?
>>
> Its because in the origional implementation of the sctp protocol, there was a
> user space test harness which built the kernel module for userspace execution to
> cary our some unit testing on the code. It did so by redefining some of those
> locking macros to user space friendly code. IIRC we haven't use those unit
> tests in years, and so should be removing them, not adding them to other
> locations.
>
Thanks for your answers.
I will send the patches with removing these macros soon.
Regards,
Wang
> Neil
>
>>> Wang Weidong (2):
>>> sctp: use sctp_local_bh_{disable|enable} instead
>>> local_bh_{disable|enable}
>>> sctp: use sctp_read_[un]lock instead of read_[un]lock
>>>
>>> net/sctp/endpointola.c | 4 ++--
>>> net/sctp/input.c | 10 +++++-----
>>> net/sctp/proc.c | 12 ++++++------
>>> net/sctp/sm_make_chunk.c | 8 ++++----
>>> net/sctp/socket.c | 8 ++++----
>>> 5 files changed, 21 insertions(+), 21 deletions(-)
>>>
>>
>
> .
>
^ permalink raw reply
* Re: [Patch net-next 2/6] net_sched: act: export tcf_hash_search() instead of tcf_hash_lookup()
From: Jamal Hadi Salim @ 2014-01-20 12:28 UTC (permalink / raw)
To: Cong Wang, netdev; +Cc: David S. Miller
In-Reply-To: <1389987427-14085-3-git-send-email-xiyou.wangcong@gmail.com>
On 01/17/14 14:37, Cong Wang wrote:
> So that we will not expose struct tcf_common to modules.
>
> Cc: Jamal Hadi Salim <jhs@mojatatu.com>
> Cc: David S. Miller <davem@davemloft.net>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
cheers,
jamal
^ permalink raw reply
* RE: [PATCH net-next 3/4] ethtool: Support for configurable RSS hash key.
From: Venkata Duvvuru @ 2014-01-20 12:23 UTC (permalink / raw)
To: Ben Hutchings; +Cc: netdev@vger.kernel.org
In-Reply-To: <1390156048.16433.114.camel@deadeye.wl.decadent.org.uk>
> -----Original Message-----
> From: Ben Hutchings [mailto:ben@decadent.org.uk]
> Sent: Sunday, January 19, 2014 11:57 PM
> To: Venkata Duvvuru
> Cc: netdev@vger.kernel.org
> Subject: Re: [PATCH net-next 3/4] ethtool: Support for configurable RSS hash
> key.
>
> On Fri, 2014-01-17 at 13:02 +0000, Venkata Duvvuru wrote:
> > This ethtool patch primarily copies the ioctl command data structures
> from/to the User space and invokes the driver hook.
> [...]
> > --- a/include/uapi/linux/ethtool.h
> > +++ b/include/uapi/linux/ethtool.h
> > @@ -678,6 +678,22 @@ struct ethtool_rx_ntuple {
> > struct ethtool_rx_ntuple_flow_spec fs;
> > };
> >
> > +
> > +/**
> > + * struct ethtool_rss_hkey - command to set/get RSS hash key of the
> device.
> > + * @cmd: Command number -
> %ETHTOOL_SET_RSS_HKEY/ETHTOOL_GET_RSS_HKEY
> > + * @data: 40 or 16 byte rss hash key
> > + * @data_len: rss hash key length
> > + */
> > +
> > +#define RSS_HASH_KEY_LEN 40
>
> This should have an 'ETHTOOL_' or 'ETH_' prefix. But I wonder whether there
> should actually be a static maximum length.
>
> > +/* RSS Hash key */
> > +struct ethtool_rss_hkey {
> > + __u32 cmd; /* ETHTOOL_SET/GET_RSS_HKEY */
> > + __u8 data[RSS_HASH_KEY_LEN];
> > + __u32 data_len;
> > +};
> [...]
>
> How about putting data after the data_len and giving it a length of 0, so this is
> extensible to an arbitrary length key?
>
> If we're extending the RSS configuration interface, there are a few other
> things that might be worth doing at the same time:
>
> - Single commands to get/set both the key and the indirection table at the
> same time
> - Add a field to distinguish multiple RSS contexts (some hardware can use RSS
> contexts together with filters, though RX NFC does not support that yet)
Are you referring to the filter-id that is created at the time of config-nfc? Pls clarify.
>
> Ben.
>
> --
> Ben Hutchings
> friends: People who know you well, but like you anyway.
^ permalink raw reply
* Re: [PATCH net-next v2] xen-netback: Rework rx_work_todo
From: Zoltan Kiss @ 2014-01-20 12:23 UTC (permalink / raw)
To: ian.campbell, wei.liu2, xen-devel, netdev, linux-kernel,
jonathan.davies
Cc: Paul Durrant
In-Reply-To: <1389805867-22409-1-git-send-email-zoltan.kiss@citrix.com>
Any reviews on this one? It fixes an important lockup situation, so
either this or some other fix should go in soon.
On 15/01/14 17:11, Zoltan Kiss wrote:
> The recent patch to fix receive side flow control (11b57f) solved the spinning
> thread problem, however caused an another one. The receive side can stall, if:
> - [THREAD] xenvif_rx_action sets rx_queue_stopped to true
> - [INTERRUPT] interrupt happens, and sets rx_event to true
> - [THREAD] then xenvif_kthread sets rx_event to false
> - [THREAD] rx_work_todo doesn't return true anymore
>
> Also, if interrupt sent but there is still no room in the ring, it take quite a
> long time until xenvif_rx_action realize it. This patch ditch that two variable,
> and rework rx_work_todo. If the thread finds it can't fit more skb's into the
> ring, it saves the last slot estimation into rx_last_skb_slots, otherwise it's
> kept as 0. Then rx_work_todo will check if:
> - there is something to send to the ring (like before)
> - there is space for the topmost packet in the queue
>
> I think that's more natural and optimal thing to test than two bool which are
> set somewhere else.
>
> Signed-off-by: Zoltan Kiss <zoltan.kiss@citrix.com>
> ---
> drivers/net/xen-netback/common.h | 6 +-----
> drivers/net/xen-netback/interface.c | 1 -
> drivers/net/xen-netback/netback.c | 16 ++++++----------
> 3 files changed, 7 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h
> index 4c76bcb..ae413a2 100644
> --- a/drivers/net/xen-netback/common.h
> +++ b/drivers/net/xen-netback/common.h
> @@ -143,11 +143,7 @@ struct xenvif {
> char rx_irq_name[IFNAMSIZ+4]; /* DEVNAME-rx */
> struct xen_netif_rx_back_ring rx;
> struct sk_buff_head rx_queue;
> - bool rx_queue_stopped;
> - /* Set when the RX interrupt is triggered by the frontend.
> - * The worker thread may need to wake the queue.
> - */
> - bool rx_event;
> + RING_IDX rx_last_skb_slots;
>
> /* This array is allocated seperately as it is large */
> struct gnttab_copy *grant_copy_op;
> diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
> index b9de31e..7669d49 100644
> --- a/drivers/net/xen-netback/interface.c
> +++ b/drivers/net/xen-netback/interface.c
> @@ -100,7 +100,6 @@ static irqreturn_t xenvif_rx_interrupt(int irq, void *dev_id)
> {
> struct xenvif *vif = dev_id;
>
> - vif->rx_event = true;
> xenvif_kick_thread(vif);
>
> return IRQ_HANDLED;
> diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
> index 2738563..bb241d0 100644
> --- a/drivers/net/xen-netback/netback.c
> +++ b/drivers/net/xen-netback/netback.c
> @@ -477,7 +477,6 @@ static void xenvif_rx_action(struct xenvif *vif)
> unsigned long offset;
> struct skb_cb_overlay *sco;
> bool need_to_notify = false;
> - bool ring_full = false;
>
> struct netrx_pending_operations npo = {
> .copy = vif->grant_copy_op,
> @@ -487,7 +486,7 @@ static void xenvif_rx_action(struct xenvif *vif)
> skb_queue_head_init(&rxq);
>
> while ((skb = skb_dequeue(&vif->rx_queue)) != NULL) {
> - int max_slots_needed;
> + RING_IDX max_slots_needed;
> int i;
>
> /* We need a cheap worse case estimate for the number of
> @@ -510,9 +509,10 @@ static void xenvif_rx_action(struct xenvif *vif)
> if (!xenvif_rx_ring_slots_available(vif, max_slots_needed)) {
> skb_queue_head(&vif->rx_queue, skb);
> need_to_notify = true;
> - ring_full = true;
> + vif->rx_last_skb_slots = max_slots_needed;
> break;
> - }
> + } else
> + vif->rx_last_skb_slots = 0;
>
> sco = (struct skb_cb_overlay *)skb->cb;
> sco->meta_slots_used = xenvif_gop_skb(skb, &npo);
> @@ -523,8 +523,6 @@ static void xenvif_rx_action(struct xenvif *vif)
>
> BUG_ON(npo.meta_prod > ARRAY_SIZE(vif->meta));
>
> - vif->rx_queue_stopped = !npo.copy_prod && ring_full;
> -
> if (!npo.copy_prod)
> goto done;
>
> @@ -1727,8 +1725,8 @@ static struct xen_netif_rx_response *make_rx_response(struct xenvif *vif,
>
> static inline int rx_work_todo(struct xenvif *vif)
> {
> - return (!skb_queue_empty(&vif->rx_queue) && !vif->rx_queue_stopped) ||
> - vif->rx_event;
> + return !skb_queue_empty(&vif->rx_queue) &&
> + xenvif_rx_ring_slots_available(vif, vif->rx_last_skb_slots);
> }
>
> static inline int tx_work_todo(struct xenvif *vif)
> @@ -1814,8 +1812,6 @@ int xenvif_kthread(void *data)
> if (!skb_queue_empty(&vif->rx_queue))
> xenvif_rx_action(vif);
>
> - vif->rx_event = false;
> -
> if (skb_queue_empty(&vif->rx_queue) &&
> netif_queue_stopped(vif->dev))
> xenvif_start_queue(vif);
>
^ permalink raw reply
* Re: [PATCH net-next 0/2] sctp: some small clean ups
From: Neil Horman @ 2014-01-20 12:20 UTC (permalink / raw)
To: Daniel Borkmann; +Cc: Wang Weidong, davem, vyasevich, netdev, linux-sctp
In-Reply-To: <52DD0A62.9050807@redhat.com>
On Mon, Jan 20, 2014 at 12:37:06PM +0100, Daniel Borkmann wrote:
> On 01/20/2014 12:27 PM, Wang Weidong wrote:
> >We have the macros in sctp.h, so use them for coding accordance
> >in sctp.
>
> Thanks for doing this Wang.
>
> I am actually wondering why we have these macro locking wrappers
> and not use these functions directly? Hm, any reasons? Maybe we
> should rather go in the other direction with this?
>
Its because in the origional implementation of the sctp protocol, there was a
user space test harness which built the kernel module for userspace execution to
cary our some unit testing on the code. It did so by redefining some of those
locking macros to user space friendly code. IIRC we haven't use those unit
tests in years, and so should be removing them, not adding them to other
locations.
Neil
> >Wang Weidong (2):
> > sctp: use sctp_local_bh_{disable|enable} instead
> > local_bh_{disable|enable}
> > sctp: use sctp_read_[un]lock instead of read_[un]lock
> >
> > net/sctp/endpointola.c | 4 ++--
> > net/sctp/input.c | 10 +++++-----
> > net/sctp/proc.c | 12 ++++++------
> > net/sctp/sm_make_chunk.c | 8 ++++----
> > net/sctp/socket.c | 8 ++++----
> > 5 files changed, 21 insertions(+), 21 deletions(-)
> >
>
^ permalink raw reply
* Re: [Patch net-next 1/6] net_sched: act: fetch hinfo from a->ops->hinfo
From: Jamal Hadi Salim @ 2014-01-20 12:16 UTC (permalink / raw)
To: Cong Wang, netdev; +Cc: David S. Miller
In-Reply-To: <1389987427-14085-2-git-send-email-xiyou.wangcong@gmail.com>
On 01/17/14 14:37, Cong Wang wrote:
> Every action ops has a pointer to hash info, so we don't need to
> hard-code it in each module.
>
> Cc: Jamal Hadi Salim <jhs@mojatatu.com>
> Cc: David S. Miller <davem@davemloft.net>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Although changes like the one below (which are in a few places)
are necessary i.e it was more readable before.
> diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c
> index ee28e1c..a9a3185 100644
> --- a/net/sched/act_csum.c
> +++ b/net/sched/act_csum.c
> - tcf_hash_release(pc, bind, &csum_hash_info);
> + tcf_hash_release(pc, bind, a->ops->hinfo);
> if (!ovr)
cheers,
jamal
^ permalink raw reply
* RE: [PATCH v5] can: add Renesas R-Car CAN driver
From: David Laight @ 2014-01-20 12:13 UTC (permalink / raw)
To: 'Ben Dooks', Marc Kleine-Budde
Cc: Geert Uytterhoeven, Sergei Shtylyov, netdev@vger.kernel.org,
wg@grandegger.com, linux-can@vger.kernel.org, Linux-sh list,
vksavl@gmail.com
In-Reply-To: <52DD1058.4090205@codethink.co.uk>
From:
> On 20/01/14 11:58, Marc Kleine-Budde wrote:
> > On 01/20/2014 12:52 PM, Geert Uytterhoeven wrote:
> >> On Mon, Jan 20, 2014 at 12:47 PM, Marc Kleine-Budde <mkl@pengutronix.de> wrote:
> >>> On 01/20/2014 12:43 PM, Geert Uytterhoeven wrote:
> >>>> On Thu, Dec 26, 2013 at 10:37 PM, Sergei Shtylyov
> >>>> <sergei.shtylyov@cogentembedded.com> wrote:
> >>>>> Changes in version 3:
> >>>>
> >>>>> - added '__packed' to 'struct rcar_can_mbox_regs' and 'struct rcar_can_regs';
> >>>>> - removed unneeded type cast in the probe() method.
> >>>>
> >>>>> +/* Mailbox registers structure */
> >>>>> +struct rcar_can_mbox_regs {
> >>>>> + u32 id; /* IDE and RTR bits, SID and EID */
> >>>>> + u8 stub; /* Not used */
> >>>>> + u8 dlc; /* Data Length Code - bits [0..3] */
> >>>>> + u8 data[8]; /* Data Bytes */
> >>>>> + u8 tsh; /* Time Stamp Higher Byte */
> >>>>> + u8 tsl; /* Time Stamp Lower Byte */
> >>>>> +} __packed;
> >>>>
> >>>> Sorry, I missed the earlier discussion, but why the _packed?
> >>>> One u32 and 12 bytes makes a nice multiple of 4.
> >>>
> >>> Better safe than sorry, it's the layout of the registers in hardware,
> >>> don't let the compiler optimize here.
Why not just add a compile time check against the size of the
structure - that will ensure that no padding is accidentally added.
> >> Actually __packed makes it less safe, as the compiler now assumes
> >> the u32 id member is unaligned, and thus may turn 32-bit accesses into 4
> >> byte accesses.
> >>
> >> Fortunately it won't happen in this case as the code uses writel/readl to
> >> acces the id member.
Which means that it will be aligned (and must be aligned).
So the packed is completely useless and pointless.
> > Yes, as this are registers they must not be accessed directly. However
> > we can use "__attribute__ ((packed, aligned(4)))" to tell the compiler
> > that the base address of this struct is always aligned to 4 bytes.
>
> I thought we'd gotten past the stage of ever writing register
> definitions as structures?
Any other way is likely to be more error prone since nothing
ties the offsets with the correct base address.
IMHO it is best to only specify packed if the structure is expected
to be misaligned. Misaligned members can be 'fixed' by marking them
aligned().
Even then you might want to define the structure itself without
the 'packed' and the define a second packed structure containing
a single member.
eg: you might have:
struct a {
u32 a_1;
u64 a_2 __attribute__((aligned(4)));
u32 a_3;
};
struct a_packed {
struct a p;
} __attribute__((packed));
You might even need a union of the two types!
David
^ permalink raw reply
* Re: [PATCH v5] can: add Renesas R-Car CAN driver
From: Sergei Shtylyov @ 2014-01-20 12:12 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: netdev@vger.kernel.org, wg, mkl, linux-can, Linux-sh list, vksavl
In-Reply-To: <CAMuHMdWZJUvcW9OzM39aB2m+VdKqmZ6EOGR_rZcAdV7Cmwx3kg@mail.gmail.com>
Hello.
On 20-01-2014 15:43, Geert Uytterhoeven wrote:
>> Changes in version 3:
>> - added '__packed' to 'struct rcar_can_mbox_regs' and 'struct rcar_can_regs';
>> - removed unneeded type cast in the probe() method.
>> +/* Mailbox registers structure */
>> +struct rcar_can_mbox_regs {
>> + u32 id; /* IDE and RTR bits, SID and EID */
>> + u8 stub; /* Not used */
>> + u8 dlc; /* Data Length Code - bits [0..3] */
>> + u8 data[8]; /* Data Bytes */
>> + u8 tsh; /* Time Stamp Higher Byte */
>> + u8 tsl; /* Time Stamp Lower Byte */
>> +} __packed;
> Sorry, I missed the earlier discussion, but why the _packed?
> One u32 and 12 bytes makes a nice multiple of 4.
Mainly for consistency as this is a structure representing the hardware
registers.
> Gr{oetje,eeting}s,
> Geert
WBR, Sergei
^ permalink raw reply
* [net-next PATCH 1/1] drivers: net: cpsw: enable promiscuous mode support
From: Mugunthan V N @ 2014-01-20 12:08 UTC (permalink / raw)
To: netdev; +Cc: davem, linux-omap, Mugunthan V N
Enable promiscuous mode support for CPSW.
Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
drivers/net/ethernet/ti/cpsw.c | 101 ++++++++++++++++++++++++++++---------
drivers/net/ethernet/ti/cpsw_ale.c | 16 ++++++
drivers/net/ethernet/ti/cpsw_ale.h | 2 +
3 files changed, 94 insertions(+), 25 deletions(-)
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index e8bb77d..21bbdcb 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -541,14 +541,89 @@ static inline int cpsw_get_slave_port(struct cpsw_priv *priv, u32 slave_num)
return slave_num;
}
+static void cpsw_set_promiscious(struct net_device *ndev, bool enable)
+{
+ struct cpsw_priv *priv = netdev_priv(ndev);
+ struct cpsw_ale *ale = priv->ale;
+
+ if (priv->data.dual_emac) {
+ /* Enabling promiscuous mode for one interface will be
+ * common for both the interface as the interface shares
+ * the same hardware resource.
+ */
+ if (!enable && ((priv->slaves[0].ndev->flags & IFF_PROMISC) ||
+ (priv->slaves[1].ndev->flags & IFF_PROMISC))) {
+ enable = true;
+ dev_err(&ndev->dev, "promiscuity not disabled as the other interface is still in promiscuity mode\n");
+ }
+
+ if (enable) {
+ /* Enable Bypass */
+ cpsw_ale_control_set(ale, 0, ALE_BYPASS, 1);
+
+ dev_dbg(&ndev->dev, "promiscuity enabled\n");
+ } else {
+ /* Disable Bypass */
+ cpsw_ale_control_set(ale, 0, ALE_BYPASS, 0);
+ dev_dbg(&ndev->dev, "promiscuity disabled\n");
+ }
+ } else {
+ int i;
+
+ if (enable) {
+ unsigned long timeout = jiffies + HZ;
+
+ /* Disable Learn for all ports */
+ for (i = 0; i <= priv->data.slaves; i++) {
+ cpsw_ale_control_set(ale, i,
+ ALE_PORT_NOLEARN, 1);
+ cpsw_ale_control_set(ale, i,
+ ALE_PORT_NO_SA_UPDATE, 1);
+ }
+
+ /* Clear All Untouched entries */
+ cpsw_ale_control_set(ale, 0, ALE_AGEOUT, 1);
+ do {
+ cpu_relax();
+ if (cpsw_ale_control_get(ale, 0, ALE_AGEOUT))
+ break;
+ } while (time_after(timeout, jiffies));
+ cpsw_ale_control_set(ale, 0, ALE_AGEOUT, 1);
+
+ /* Clear all mcast from ALE */
+ cpsw_ale_flush_multicast(ale, ALE_ALL_PORTS <<
+ priv->host_port);
+
+ /* Flood All Unicast Packets to Host port */
+ cpsw_ale_control_set(ale, 0, ALE_P0_UNI_FLOOD, 1);
+ dev_dbg(&ndev->dev, "promiscuity enabled\n");
+ } else {
+ /* Flood All Unicast Packets to Host port */
+ cpsw_ale_control_set(ale, 0, ALE_P0_UNI_FLOOD, 0);
+
+ /* Enable Learn for all ports */
+ for (i = 0; i <= priv->data.slaves; i++) {
+ cpsw_ale_control_set(ale, i,
+ ALE_PORT_NOLEARN, 0);
+ cpsw_ale_control_set(ale, i,
+ ALE_PORT_NO_SA_UPDATE, 0);
+ }
+ dev_dbg(&ndev->dev, "promiscuity disabled\n");
+ }
+ }
+}
+
static void cpsw_ndo_set_rx_mode(struct net_device *ndev)
{
struct cpsw_priv *priv = netdev_priv(ndev);
if (ndev->flags & IFF_PROMISC) {
/* Enable promiscuous mode */
- dev_err(priv->dev, "Ignoring Promiscuous mode\n");
+ cpsw_set_promiscious(ndev, true);
return;
+ } else {
+ /* Disable promiscuous mode */
+ cpsw_set_promiscious(ndev, false);
}
/* Clear all mcast from ALE */
@@ -1257,29 +1332,6 @@ fail:
return NETDEV_TX_BUSY;
}
-static void cpsw_ndo_change_rx_flags(struct net_device *ndev, int flags)
-{
- /*
- * The switch cannot operate in promiscuous mode without substantial
- * headache. For promiscuous mode to work, we would need to put the
- * ALE in bypass mode and route all traffic to the host port.
- * Subsequently, the host will need to operate as a "bridge", learn,
- * and flood as needed. For now, we simply complain here and
- * do nothing about it :-)
- */
- if ((flags & IFF_PROMISC) && (ndev->flags & IFF_PROMISC))
- dev_err(&ndev->dev, "promiscuity ignored!\n");
-
- /*
- * The switch cannot filter multicast traffic unless it is configured
- * in "VLAN Aware" mode. Unfortunately, VLAN awareness requires a
- * whole bunch of additional logic that this driver does not implement
- * at present.
- */
- if ((flags & IFF_ALLMULTI) && !(ndev->flags & IFF_ALLMULTI))
- dev_err(&ndev->dev, "multicast traffic cannot be filtered!\n");
-}
-
#ifdef CONFIG_TI_CPTS
static void cpsw_hwtstamp_v1(struct cpsw_priv *priv)
@@ -1575,7 +1627,6 @@ static const struct net_device_ops cpsw_netdev_ops = {
.ndo_open = cpsw_ndo_open,
.ndo_stop = cpsw_ndo_stop,
.ndo_start_xmit = cpsw_ndo_start_xmit,
- .ndo_change_rx_flags = cpsw_ndo_change_rx_flags,
.ndo_set_mac_address = cpsw_ndo_set_mac_address,
.ndo_do_ioctl = cpsw_ndo_ioctl,
.ndo_validate_addr = eth_validate_addr,
diff --git a/drivers/net/ethernet/ti/cpsw_ale.c b/drivers/net/ethernet/ti/cpsw_ale.c
index 63e9819..7f89306 100644
--- a/drivers/net/ethernet/ti/cpsw_ale.c
+++ b/drivers/net/ethernet/ti/cpsw_ale.c
@@ -477,6 +477,14 @@ static const struct ale_control_info ale_controls[ALE_NUM_CONTROLS] = {
.port_shift = 0,
.bits = 1,
},
+ [ALE_P0_UNI_FLOOD] = {
+ .name = "port0_unicast_flood",
+ .offset = ALE_CONTROL,
+ .port_offset = 0,
+ .shift = 8,
+ .port_shift = 0,
+ .bits = 1,
+ },
[ALE_VLAN_NOLEARN] = {
.name = "vlan_nolearn",
.offset = ALE_CONTROL,
@@ -573,6 +581,14 @@ static const struct ale_control_info ale_controls[ALE_NUM_CONTROLS] = {
.port_shift = 0,
.bits = 1,
},
+ [ALE_PORT_NO_SA_UPDATE] = {
+ .name = "no_source_update",
+ .offset = ALE_PORTCTL,
+ .port_offset = 4,
+ .shift = 5,
+ .port_shift = 0,
+ .bits = 1,
+ },
[ALE_PORT_MCAST_LIMIT] = {
.name = "mcast_limit",
.offset = ALE_PORTCTL,
diff --git a/drivers/net/ethernet/ti/cpsw_ale.h b/drivers/net/ethernet/ti/cpsw_ale.h
index 30daa12..de409c3 100644
--- a/drivers/net/ethernet/ti/cpsw_ale.h
+++ b/drivers/net/ethernet/ti/cpsw_ale.h
@@ -34,6 +34,7 @@ enum cpsw_ale_control {
ALE_ENABLE,
ALE_CLEAR,
ALE_AGEOUT,
+ ALE_P0_UNI_FLOOD,
ALE_VLAN_NOLEARN,
ALE_NO_PORT_VLAN,
ALE_OUI_DENY,
@@ -47,6 +48,7 @@ enum cpsw_ale_control {
ALE_PORT_DROP_UNTAGGED,
ALE_PORT_DROP_UNKNOWN_VLAN,
ALE_PORT_NOLEARN,
+ ALE_PORT_NO_SA_UPDATE,
ALE_PORT_UNKNOWN_VLAN_MEMBER,
ALE_PORT_UNKNOWN_MCAST_FLOOD,
ALE_PORT_UNKNOWN_REG_MCAST_FLOOD,
--
1.8.5.2.233.g932f7e4
^ permalink raw reply related
* Re: [PATCH v5] can: add Renesas R-Car CAN driver
From: Marc Kleine-Budde @ 2014-01-20 12:08 UTC (permalink / raw)
To: Geert Uytterhoeven, Ben Dooks
Cc: Sergei Shtylyov, netdev@vger.kernel.org, wg, linux-can,
Linux-sh list, Pavel Kiryukhin
In-Reply-To: <CAMuHMdUYcGRRg_XWQKVJMqcUHBLGCRJvtqXH1Uvz0odgoYydOg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2702 bytes --]
On 01/20/2014 01:05 PM, Geert Uytterhoeven wrote:
> On Mon, Jan 20, 2014 at 1:02 PM, Ben Dooks <ben.dooks@codethink.co.uk> wrote:
>> On 20/01/14 11:58, Marc Kleine-Budde wrote:
>>>
>>> On 01/20/2014 12:52 PM, Geert Uytterhoeven wrote:
>>>>
>>>> On Mon, Jan 20, 2014 at 12:47 PM, Marc Kleine-Budde <mkl@pengutronix.de>
>>>> wrote:
>>>>>
>>>>> On 01/20/2014 12:43 PM, Geert Uytterhoeven wrote:
>>>>>>
>>>>>> On Thu, Dec 26, 2013 at 10:37 PM, Sergei Shtylyov
>>>>>> <sergei.shtylyov@cogentembedded.com> wrote:
>>>>>>>
>>>>>>> Changes in version 3:
>>>>>>
>>>>>>
>>>>>>> - added '__packed' to 'struct rcar_can_mbox_regs' and 'struct
>>>>>>> rcar_can_regs';
>>>>>>> - removed unneeded type cast in the probe() method.
>>>>>>
>>>>>>
>>>>>>> +/* Mailbox registers structure */
>>>>>>> +struct rcar_can_mbox_regs {
>>>>>>> + u32 id; /* IDE and RTR bits, SID and EID */
>>>>>>> + u8 stub; /* Not used */
>>>>>>> + u8 dlc; /* Data Length Code - bits [0..3] */
>>>>>>> + u8 data[8]; /* Data Bytes */
>>>>>>> + u8 tsh; /* Time Stamp Higher Byte */
>>>>>>> + u8 tsl; /* Time Stamp Lower Byte */
>>>>>>> +} __packed;
>>>>>>
>>>>>>
>>>>>> Sorry, I missed the earlier discussion, but why the _packed?
>>>>>> One u32 and 12 bytes makes a nice multiple of 4.
>>>>>
>>>>>
>>>>> Better safe than sorry, it's the layout of the registers in hardware,
>>>>> don't let the compiler optimize here.
>>>>
>>>>
>>>> Actually __packed makes it less safe, as the compiler now assumes
>>>> the u32 id member is unaligned, and thus may turn 32-bit accesses into 4
>>>> byte accesses.
>>>>
>>>> Fortunately it won't happen in this case as the code uses writel/readl to
>>>> acces the id member.
>>>
>>>
>>> Yes, as this are registers they must not be accessed directly. However
>>> we can use "__attribute__ ((packed, aligned(4)))" to tell the compiler
>>> that the base address of this struct is always aligned to 4 bytes.
>>
>> I thought we'd gotten past the stage of ever writing register
>> definitions as structures?
>
> It allows to use e.g. "readl(&base->field)", which is used all over the place.
>
> And sparse will inform you (read: the person who runs it) if you access
> it directly.
I'm doing this (however just started using additional -D__CHECK_FOO___),
before applying patches to my tree.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 242 bytes --]
^ permalink raw reply
* Re: [PATCH net-next 0/2] sctp: some small clean ups
From: Wang Weidong @ 2014-01-20 12:06 UTC (permalink / raw)
To: Daniel Borkmann; +Cc: nhorman, davem, vyasevich, netdev, linux-sctp
In-Reply-To: <52DD0A62.9050807@redhat.com>
On 2014/1/20 19:37, Daniel Borkmann wrote:
> On 01/20/2014 12:27 PM, Wang Weidong wrote:
>> We have the macros in sctp.h, so use them for coding accordance
>> in sctp.
>
> Thanks for doing this Wang.
>
> I am actually wondering why we have these macro locking wrappers
Here, I didn't found any description about it. In v2.6.12-rc2, the sctp
use these macros.
> and not use these functions directly? Hm, any reasons? Maybe we
> should rather go in the other direction with this?
>
Yeah.
Should I do the other direction for clean ups now?
Regards,
Wang
>> Wang Weidong (2):
>> sctp: use sctp_local_bh_{disable|enable} instead
>> local_bh_{disable|enable}
>> sctp: use sctp_read_[un]lock instead of read_[un]lock
>>
>> net/sctp/endpointola.c | 4 ++--
>> net/sctp/input.c | 10 +++++-----
>> net/sctp/proc.c | 12 ++++++------
>> net/sctp/sm_make_chunk.c | 8 ++++----
>> net/sctp/socket.c | 8 ++++----
>> 5 files changed, 21 insertions(+), 21 deletions(-)
>>
>
>
^ permalink raw reply
* Re: [PATCH v5] can: add Renesas R-Car CAN driver
From: Marc Kleine-Budde @ 2014-01-20 12:05 UTC (permalink / raw)
To: Ben Dooks
Cc: Geert Uytterhoeven, Sergei Shtylyov, netdev@vger.kernel.org, wg,
linux-can, Linux-sh list, vksavl
In-Reply-To: <52DD1058.4090205@codethink.co.uk>
[-- Attachment #1: Type: text/plain, Size: 2352 bytes --]
On 01/20/2014 01:02 PM, Ben Dooks wrote:
> On 20/01/14 11:58, Marc Kleine-Budde wrote:
>> On 01/20/2014 12:52 PM, Geert Uytterhoeven wrote:
>>> On Mon, Jan 20, 2014 at 12:47 PM, Marc Kleine-Budde
>>> <mkl@pengutronix.de> wrote:
>>>> On 01/20/2014 12:43 PM, Geert Uytterhoeven wrote:
>>>>> On Thu, Dec 26, 2013 at 10:37 PM, Sergei Shtylyov
>>>>> <sergei.shtylyov@cogentembedded.com> wrote:
>>>>>> Changes in version 3:
>>>>>
>>>>>> - added '__packed' to 'struct rcar_can_mbox_regs' and 'struct
>>>>>> rcar_can_regs';
>>>>>> - removed unneeded type cast in the probe() method.
>>>>>
>>>>>> +/* Mailbox registers structure */
>>>>>> +struct rcar_can_mbox_regs {
>>>>>> + u32 id; /* IDE and RTR bits, SID and EID */
>>>>>> + u8 stub; /* Not used */
>>>>>> + u8 dlc; /* Data Length Code - bits [0..3] */
>>>>>> + u8 data[8]; /* Data Bytes */
>>>>>> + u8 tsh; /* Time Stamp Higher Byte */
>>>>>> + u8 tsl; /* Time Stamp Lower Byte */
>>>>>> +} __packed;
>>>>>
>>>>> Sorry, I missed the earlier discussion, but why the _packed?
>>>>> One u32 and 12 bytes makes a nice multiple of 4.
>>>>
>>>> Better safe than sorry, it's the layout of the registers in hardware,
>>>> don't let the compiler optimize here.
>>>
>>> Actually __packed makes it less safe, as the compiler now assumes
>>> the u32 id member is unaligned, and thus may turn 32-bit accesses into 4
>>> byte accesses.
>>>
>>> Fortunately it won't happen in this case as the code uses
>>> writel/readl to
>>> acces the id member.
>>
>> Yes, as this are registers they must not be accessed directly. However
>> we can use "__attribute__ ((packed, aligned(4)))" to tell the compiler
>> that the base address of this struct is always aligned to 4 bytes.
>
> I thought we'd gotten past the stage of ever writing register
> definitions as structures?
I don't care whether to use offsets defined by a #define or an enum or a
struct. What's the "official" preference? Is it documented somewhere?
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 242 bytes --]
^ permalink raw reply
* Re: [PATCH v5] can: add Renesas R-Car CAN driver
From: Geert Uytterhoeven @ 2014-01-20 12:05 UTC (permalink / raw)
To: Ben Dooks
Cc: Marc Kleine-Budde, Sergei Shtylyov, netdev@vger.kernel.org, wg,
linux-can, Linux-sh list, Pavel Kiryukhin
In-Reply-To: <52DD1058.4090205@codethink.co.uk>
On Mon, Jan 20, 2014 at 1:02 PM, Ben Dooks <ben.dooks@codethink.co.uk> wrote:
> On 20/01/14 11:58, Marc Kleine-Budde wrote:
>>
>> On 01/20/2014 12:52 PM, Geert Uytterhoeven wrote:
>>>
>>> On Mon, Jan 20, 2014 at 12:47 PM, Marc Kleine-Budde <mkl@pengutronix.de>
>>> wrote:
>>>>
>>>> On 01/20/2014 12:43 PM, Geert Uytterhoeven wrote:
>>>>>
>>>>> On Thu, Dec 26, 2013 at 10:37 PM, Sergei Shtylyov
>>>>> <sergei.shtylyov@cogentembedded.com> wrote:
>>>>>>
>>>>>> Changes in version 3:
>>>>>
>>>>>
>>>>>> - added '__packed' to 'struct rcar_can_mbox_regs' and 'struct
>>>>>> rcar_can_regs';
>>>>>> - removed unneeded type cast in the probe() method.
>>>>>
>>>>>
>>>>>> +/* Mailbox registers structure */
>>>>>> +struct rcar_can_mbox_regs {
>>>>>> + u32 id; /* IDE and RTR bits, SID and EID */
>>>>>> + u8 stub; /* Not used */
>>>>>> + u8 dlc; /* Data Length Code - bits [0..3] */
>>>>>> + u8 data[8]; /* Data Bytes */
>>>>>> + u8 tsh; /* Time Stamp Higher Byte */
>>>>>> + u8 tsl; /* Time Stamp Lower Byte */
>>>>>> +} __packed;
>>>>>
>>>>>
>>>>> Sorry, I missed the earlier discussion, but why the _packed?
>>>>> One u32 and 12 bytes makes a nice multiple of 4.
>>>>
>>>>
>>>> Better safe than sorry, it's the layout of the registers in hardware,
>>>> don't let the compiler optimize here.
>>>
>>>
>>> Actually __packed makes it less safe, as the compiler now assumes
>>> the u32 id member is unaligned, and thus may turn 32-bit accesses into 4
>>> byte accesses.
>>>
>>> Fortunately it won't happen in this case as the code uses writel/readl to
>>> acces the id member.
>>
>>
>> Yes, as this are registers they must not be accessed directly. However
>> we can use "__attribute__ ((packed, aligned(4)))" to tell the compiler
>> that the base address of this struct is always aligned to 4 bytes.
>
> I thought we'd gotten past the stage of ever writing register
> definitions as structures?
It allows to use e.g. "readl(&base->field)", which is used all over the place.
And sparse will inform you (read: the person who runs it) if you access
it directly.
Note that this driver does not use direct accesses.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply
* Re: [PATCH v5] can: add Renesas R-Car CAN driver
From: Ben Dooks @ 2014-01-20 12:02 UTC (permalink / raw)
To: Marc Kleine-Budde
Cc: Geert Uytterhoeven, Sergei Shtylyov, netdev@vger.kernel.org, wg,
linux-can, Linux-sh list, vksavl
In-Reply-To: <52DD0F72.1000005@pengutronix.de>
On 20/01/14 11:58, Marc Kleine-Budde wrote:
> On 01/20/2014 12:52 PM, Geert Uytterhoeven wrote:
>> On Mon, Jan 20, 2014 at 12:47 PM, Marc Kleine-Budde <mkl@pengutronix.de> wrote:
>>> On 01/20/2014 12:43 PM, Geert Uytterhoeven wrote:
>>>> On Thu, Dec 26, 2013 at 10:37 PM, Sergei Shtylyov
>>>> <sergei.shtylyov@cogentembedded.com> wrote:
>>>>> Changes in version 3:
>>>>
>>>>> - added '__packed' to 'struct rcar_can_mbox_regs' and 'struct rcar_can_regs';
>>>>> - removed unneeded type cast in the probe() method.
>>>>
>>>>> +/* Mailbox registers structure */
>>>>> +struct rcar_can_mbox_regs {
>>>>> + u32 id; /* IDE and RTR bits, SID and EID */
>>>>> + u8 stub; /* Not used */
>>>>> + u8 dlc; /* Data Length Code - bits [0..3] */
>>>>> + u8 data[8]; /* Data Bytes */
>>>>> + u8 tsh; /* Time Stamp Higher Byte */
>>>>> + u8 tsl; /* Time Stamp Lower Byte */
>>>>> +} __packed;
>>>>
>>>> Sorry, I missed the earlier discussion, but why the _packed?
>>>> One u32 and 12 bytes makes a nice multiple of 4.
>>>
>>> Better safe than sorry, it's the layout of the registers in hardware,
>>> don't let the compiler optimize here.
>>
>> Actually __packed makes it less safe, as the compiler now assumes
>> the u32 id member is unaligned, and thus may turn 32-bit accesses into 4
>> byte accesses.
>>
>> Fortunately it won't happen in this case as the code uses writel/readl to
>> acces the id member.
>
> Yes, as this are registers they must not be accessed directly. However
> we can use "__attribute__ ((packed, aligned(4)))" to tell the compiler
> that the base address of this struct is always aligned to 4 bytes.
I thought we'd gotten past the stage of ever writing register
definitions as structures?
--
Ben Dooks http://www.codethink.co.uk/
Senior Engineer Codethink - Providing Genius
^ permalink raw reply
* [PATCH V5 net-next 3/3] net: Add GRO support for vxlan traffic
From: Or Gerlitz @ 2014-01-20 11:59 UTC (permalink / raw)
To: davem; +Cc: netdev, hkchu, edumazet, herbert, yanb, shlomop, therbert,
Or Gerlitz
In-Reply-To: <1390219161-9881-1-git-send-email-ogerlitz@mellanox.com>
Add GRO handlers for vxlann, by using the UDP GRO infrastructure.
For single TCP session that goes through vxlan tunneling I got nice
improvement from 6.8Gbs to 11.5Gbs
--> UDP/VXLAN GRO disabled
$ netperf -H 192.168.52.147 -c -C
$ netperf -t TCP_STREAM -H 192.168.52.147 -c -C
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.52.147 () port 0 AF_INET
Recv Send Send Utilization Service Demand
Socket Socket Message Elapsed Send Recv Send Recv
Size Size Size Time Throughput local remote local remote
bytes bytes bytes secs. 10^6bits/s % S % S us/KB us/KB
87380 65536 65536 10.00 6799.75 12.54 24.79 0.604 1.195
--> UDP/VXLAN GRO enabled
$ netperf -t TCP_STREAM -H 192.168.52.147 -c -C
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.52.147 () port 0 AF_INET
Recv Send Send Utilization Service Demand
Socket Socket Message Elapsed Send Recv Send Recv
Size Size Size Time Throughput local remote local remote
bytes bytes bytes secs. 10^6bits/s % S % S us/KB us/KB
87380 65536 65536 10.00 11562.72 24.90 20.34 0.706 0.577
Signed-off-by: Shlomo Pongratz <shlomop@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
drivers/net/vxlan.c | 117 +++++++++++++++++++++++++++++++++++++++++++++++---
include/net/vxlan.h | 1 +
2 files changed, 111 insertions(+), 7 deletions(-)
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index d6ec71f..2e731f1 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -40,6 +40,7 @@
#include <net/net_namespace.h>
#include <net/netns/generic.h>
#include <net/vxlan.h>
+#include <net/protocol.h>
#if IS_ENABLED(CONFIG_IPV6)
#include <net/ipv6.h>
#include <net/addrconf.h>
@@ -554,13 +555,106 @@ static int vxlan_fdb_append(struct vxlan_fdb *f,
return 1;
}
+static struct sk_buff **vxlan_gro_receive(struct sk_buff **head, struct sk_buff *skb)
+{
+ struct sk_buff *p, **pp = NULL;
+ struct vxlanhdr *vh, *vh2;
+ struct ethhdr *eh, *eh2;
+ unsigned int hlen, off_vx, off_eth;
+ const struct packet_offload *ptype;
+ __be16 type;
+ int flush = 1;
+
+ off_vx = skb_gro_offset(skb);
+ hlen = off_vx + sizeof(*vh);
+ vh = skb_gro_header_fast(skb, off_vx);
+ if (skb_gro_header_hard(skb, hlen)) {
+ vh = skb_gro_header_slow(skb, hlen, off_vx);
+ if (unlikely(!vh))
+ goto out;
+ }
+ skb_gro_pull(skb, sizeof(struct vxlanhdr)); /* pull vxlan header */
+
+ off_eth = skb_gro_offset(skb);
+ hlen = off_eth + sizeof(*eh);
+ eh = skb_gro_header_fast(skb, off_eth);
+ if (skb_gro_header_hard(skb, hlen)) {
+ eh = skb_gro_header_slow(skb, hlen, off_eth);
+ if (unlikely(!eh))
+ goto out;
+ }
+
+ flush = 0;
+
+ for (p = *head; p; p = p->next) {
+ if (!NAPI_GRO_CB(p)->same_flow)
+ continue;
+
+ vh2 = (struct vxlanhdr *)(p->data + off_vx);
+ eh2 = (struct ethhdr *)(p->data + off_eth);
+ if (vh->vx_vni != vh2->vx_vni || compare_ether_header(eh, eh2)) {
+ NAPI_GRO_CB(p)->same_flow = 0;
+ continue;
+ }
+ goto found;
+ }
+
+found:
+ type = eh->h_proto;
+
+ rcu_read_lock();
+ ptype = gro_find_receive_by_type(type);
+ if (ptype == NULL) {
+ flush = 1;
+ goto out_unlock;
+ }
+
+ skb_gro_pull(skb, sizeof(*eh)); /* pull inner eth header */
+ pp = ptype->callbacks.gro_receive(head, skb);
+
+out_unlock:
+ rcu_read_unlock();
+out:
+ NAPI_GRO_CB(skb)->flush |= flush;
+
+ return pp;
+}
+
+static int vxlan_gro_complete(struct sk_buff *skb, int nhoff)
+{
+ struct ethhdr *eh;
+ struct packet_offload *ptype;
+ __be16 type;
+ int vxlan_len = sizeof(struct vxlanhdr) + sizeof(struct ethhdr);
+ int err = -ENOSYS;
+
+ eh = (struct ethhdr *)(skb->data + nhoff + sizeof(struct vxlanhdr));
+ type = eh->h_proto;
+
+ rcu_read_lock();
+ ptype = gro_find_complete_by_type(type);
+ if (ptype != NULL)
+ err = ptype->callbacks.gro_complete(skb, nhoff + vxlan_len);
+
+ rcu_read_unlock();
+ return err;
+}
+
/* Notify netdevs that UDP port started listening */
-static void vxlan_notify_add_rx_port(struct sock *sk)
+static void vxlan_notify_add_rx_port(struct vxlan_sock *vs)
{
struct net_device *dev;
+ struct sock *sk = vs->sock->sk;
struct net *net = sock_net(sk);
sa_family_t sa_family = sk->sk_family;
__be16 port = inet_sk(sk)->inet_sport;
+ int err;
+
+ if (sa_family == AF_INET) {
+ err = udp_add_offload(&vs->udp_offloads);
+ if (err)
+ pr_warn("vxlan: udp_add_offload failed with status %d\n", err);
+ }
rcu_read_lock();
for_each_netdev_rcu(net, dev) {
@@ -572,9 +666,10 @@ static void vxlan_notify_add_rx_port(struct sock *sk)
}
/* Notify netdevs that UDP port is no more listening */
-static void vxlan_notify_del_rx_port(struct sock *sk)
+static void vxlan_notify_del_rx_port(struct vxlan_sock *vs)
{
struct net_device *dev;
+ struct sock *sk = vs->sock->sk;
struct net *net = sock_net(sk);
sa_family_t sa_family = sk->sk_family;
__be16 port = inet_sk(sk)->inet_sport;
@@ -586,6 +681,9 @@ static void vxlan_notify_del_rx_port(struct sock *sk)
port);
}
rcu_read_unlock();
+
+ if (sa_family == AF_INET)
+ udp_del_offload(&vs->udp_offloads);
}
/* Add new entry to forwarding table -- assumes lock held */
@@ -963,7 +1061,7 @@ void vxlan_sock_release(struct vxlan_sock *vs)
spin_lock(&vn->sock_lock);
hlist_del_rcu(&vs->hlist);
rcu_assign_sk_user_data(vs->sock->sk, NULL);
- vxlan_notify_del_rx_port(sk);
+ vxlan_notify_del_rx_port(vs);
spin_unlock(&vn->sock_lock);
queue_work(vxlan_wq, &vs->del_work);
@@ -1124,8 +1222,8 @@ static void vxlan_rcv(struct vxlan_sock *vs,
* leave the CHECKSUM_UNNECESSARY, the device checksummed it
* for us. Otherwise force the upper layers to verify it.
*/
- if (skb->ip_summed != CHECKSUM_UNNECESSARY || !skb->encapsulation ||
- !(vxlan->dev->features & NETIF_F_RXCSUM))
+ if ((skb->ip_summed != CHECKSUM_UNNECESSARY && skb->ip_summed != CHECKSUM_PARTIAL) ||
+ !skb->encapsulation || !(vxlan->dev->features & NETIF_F_RXCSUM))
skb->ip_summed = CHECKSUM_NONE;
skb->encapsulation = 0;
@@ -2303,7 +2401,7 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, __be16 port,
struct sock *sk;
unsigned int h;
- vs = kmalloc(sizeof(*vs), GFP_KERNEL);
+ vs = kzalloc(sizeof(*vs), GFP_KERNEL);
if (!vs)
return ERR_PTR(-ENOMEM);
@@ -2328,9 +2426,14 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, __be16 port,
vs->data = data;
rcu_assign_sk_user_data(vs->sock->sk, vs);
+ /* Initialize the vxlan udp offloads structure */
+ vs->udp_offloads.port = port;
+ vs->udp_offloads.callbacks.gro_receive = vxlan_gro_receive;
+ vs->udp_offloads.callbacks.gro_complete = vxlan_gro_complete;
+
spin_lock(&vn->sock_lock);
hlist_add_head_rcu(&vs->hlist, vs_head(net, port));
- vxlan_notify_add_rx_port(sk);
+ vxlan_notify_add_rx_port(vs);
spin_unlock(&vn->sock_lock);
/* Mark socket as an encapsulation socket. */
diff --git a/include/net/vxlan.h b/include/net/vxlan.h
index 6b6d180..5deef1a 100644
--- a/include/net/vxlan.h
+++ b/include/net/vxlan.h
@@ -21,6 +21,7 @@ struct vxlan_sock {
struct rcu_head rcu;
struct hlist_head vni_list[VNI_HASH_SIZE];
atomic_t refcnt;
+ struct udp_offload udp_offloads;
};
struct vxlan_sock *vxlan_sock_add(struct net *net, __be16 port,
--
1.7.1
^ permalink raw reply related
* [PATCH V5 net-next 1/3] net: Add GRO support for UDP encapsulating protocols
From: Or Gerlitz @ 2014-01-20 11:59 UTC (permalink / raw)
To: davem; +Cc: netdev, hkchu, edumazet, herbert, yanb, shlomop, therbert,
Or Gerlitz
In-Reply-To: <1390219161-9881-1-git-send-email-ogerlitz@mellanox.com>
Add GRO handlers for protocols that do UDP encapsulation, with the intent of
being able to coalesce packets which encapsulate packets belonging to
the same TCP session.
For GRO purposes, the destination UDP port takes the role of the ether type
field in the ethernet header or the next protocol in the IP header.
The UDP GRO handler will only attempt to coalesce packets whose destination
port is registered to have gro handler.
Use a mark on the skb GRO CB data to disallow (flush) running the udp gro receive
code twice on a packet. This solves the problem of udp encapsulated packets whose
inner VM packet is udp and happen to carry a port which has registered offloads.
Signed-off-by: Shlomo Pongratz <shlomop@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
include/linux/netdevice.h | 10 +++-
include/net/protocol.h | 3 +
net/core/dev.c | 1 +
net/ipv4/udp_offload.c | 143 +++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 156 insertions(+), 1 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 83ce2ae..c310229 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1675,7 +1675,10 @@ struct napi_gro_cb {
unsigned long age;
/* Used in ipv6_gro_receive() */
- int proto;
+ u16 proto;
+
+ /* Used in udp_gro_receive */
+ u16 udp_mark;
/* used to support CHECKSUM_COMPLETE for tunneling protocols */
__wsum csum;
@@ -1714,6 +1717,11 @@ struct packet_offload {
struct list_head list;
};
+struct udp_offload {
+ __be16 port;
+ struct offload_callbacks callbacks;
+};
+
/* often modified stats are per cpu, other are shared (netdev->stats) */
struct pcpu_sw_netstats {
u64 rx_packets;
diff --git a/include/net/protocol.h b/include/net/protocol.h
index 0e5f866..a7e986b 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -108,6 +108,9 @@ int inet_del_offload(const struct net_offload *prot, unsigned char num);
void inet_register_protosw(struct inet_protosw *p);
void inet_unregister_protosw(struct inet_protosw *p);
+int udp_add_offload(struct udp_offload *prot);
+void udp_del_offload(struct udp_offload *prot);
+
#if IS_ENABLED(CONFIG_IPV6)
int inet6_add_protocol(const struct inet6_protocol *prot, unsigned char num);
int inet6_del_protocol(const struct inet6_protocol *prot, unsigned char num);
diff --git a/net/core/dev.c b/net/core/dev.c
index fb99f64..1578fd7 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3893,6 +3893,7 @@ static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff
NAPI_GRO_CB(skb)->same_flow = 0;
NAPI_GRO_CB(skb)->flush = 0;
NAPI_GRO_CB(skb)->free = 0;
+ NAPI_GRO_CB(skb)->udp_mark = 0;
pp = ptype->callbacks.gro_receive(&napi->gro_list, skb);
break;
diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c
index 79c62bd..ee853c5 100644
--- a/net/ipv4/udp_offload.c
+++ b/net/ipv4/udp_offload.c
@@ -14,6 +14,15 @@
#include <net/udp.h>
#include <net/protocol.h>
+static DEFINE_SPINLOCK(udp_offload_lock);
+static struct udp_offload_priv *udp_offload_base __read_mostly;
+
+struct udp_offload_priv {
+ struct udp_offload *offload;
+ struct rcu_head rcu;
+ struct udp_offload_priv __rcu *next;
+};
+
static int udp4_ufo_send_check(struct sk_buff *skb)
{
if (!pskb_may_pull(skb, sizeof(struct udphdr)))
@@ -89,10 +98,144 @@ out:
return segs;
}
+int udp_add_offload(struct udp_offload *uo)
+{
+ struct udp_offload_priv **head = &udp_offload_base;
+ struct udp_offload_priv *new_offload = kzalloc(sizeof(*new_offload), GFP_KERNEL);
+
+ if (!new_offload)
+ return -ENOMEM;
+
+ new_offload->offload = uo;
+
+ spin_lock(&udp_offload_lock);
+ rcu_assign_pointer(new_offload->next, rcu_dereference(*head));
+ rcu_assign_pointer(*head, rcu_dereference(new_offload));
+ spin_unlock(&udp_offload_lock);
+
+ return 0;
+}
+EXPORT_SYMBOL(udp_add_offload);
+
+static void udp_offload_free_routine(struct rcu_head *head)
+{
+ struct udp_offload_priv *ou_priv = container_of(head, struct udp_offload_priv, rcu);
+ kfree(ou_priv);
+}
+
+void udp_del_offload(struct udp_offload *uo)
+{
+ struct udp_offload_priv __rcu **head = &udp_offload_base;
+ struct udp_offload_priv *uo_priv;
+
+ spin_lock(&udp_offload_lock);
+
+ uo_priv = rcu_dereference(*head);
+ for (; uo_priv != NULL;
+ uo_priv = rcu_dereference(*head)) {
+
+ if (uo_priv->offload == uo) {
+ rcu_assign_pointer(*head, rcu_dereference(uo_priv->next));
+ goto unlock;
+ }
+ head = &uo_priv->next;
+ }
+ pr_warn("udp_del_offload: didn't find offload for port %d\n", htons(uo->port));
+unlock:
+ spin_unlock(&udp_offload_lock);
+ if (uo_priv != NULL)
+ call_rcu(&uo_priv->rcu, udp_offload_free_routine);
+}
+EXPORT_SYMBOL(udp_del_offload);
+
+static struct sk_buff **udp_gro_receive(struct sk_buff **head, struct sk_buff *skb)
+{
+ struct udp_offload_priv *uo_priv;
+ struct sk_buff *p, **pp = NULL;
+ struct udphdr *uh, *uh2;
+ unsigned int hlen, off;
+ int flush = 1;
+
+ if (NAPI_GRO_CB(skb)->udp_mark ||
+ (!skb->encapsulation && skb->ip_summed != CHECKSUM_COMPLETE))
+ goto out;
+
+ /* mark that this skb passed once through the udp gro layer */
+ NAPI_GRO_CB(skb)->udp_mark = 1;
+
+ off = skb_gro_offset(skb);
+ hlen = off + sizeof(*uh);
+ uh = skb_gro_header_fast(skb, off);
+ if (skb_gro_header_hard(skb, hlen)) {
+ uh = skb_gro_header_slow(skb, hlen, off);
+ if (unlikely(!uh))
+ goto out;
+ }
+
+ rcu_read_lock();
+ uo_priv = rcu_dereference(udp_offload_base);
+ for (; uo_priv != NULL; uo_priv = rcu_dereference(uo_priv->next)) {
+ if (uo_priv->offload->port == uh->dest &&
+ uo_priv->offload->callbacks.gro_receive)
+ goto unflush;
+ }
+ goto out_unlock;
+
+unflush:
+ flush = 0;
+
+ for (p = *head; p; p = p->next) {
+ if (!NAPI_GRO_CB(p)->same_flow)
+ continue;
+
+ uh2 = (struct udphdr *)(p->data + off);
+ if ((*(u32 *)&uh->source != *(u32 *)&uh2->source)) {
+ NAPI_GRO_CB(p)->same_flow = 0;
+ continue;
+ }
+ }
+
+ skb_gro_pull(skb, sizeof(struct udphdr)); /* pull encapsulating udp header */
+ pp = uo_priv->offload->callbacks.gro_receive(head, skb);
+
+out_unlock:
+ rcu_read_unlock();
+out:
+ NAPI_GRO_CB(skb)->flush |= flush;
+ return pp;
+}
+
+static int udp_gro_complete(struct sk_buff *skb, int nhoff)
+{
+ struct udp_offload_priv *uo_priv;
+ __be16 newlen = htons(skb->len - nhoff);
+ struct udphdr *uh = (struct udphdr *)(skb->data + nhoff);
+ int err = -ENOSYS;
+
+ uh->len = newlen;
+
+ rcu_read_lock();
+
+ uo_priv = rcu_dereference(udp_offload_base);
+ for (; uo_priv != NULL; uo_priv = rcu_dereference(uo_priv->next)) {
+ if (uo_priv->offload->port == uh->dest &&
+ uo_priv->offload->callbacks.gro_complete)
+ break;
+ }
+
+ if (uo_priv != NULL)
+ err = uo_priv->offload->callbacks.gro_complete(skb, nhoff + sizeof(struct udphdr));
+
+ rcu_read_unlock();
+ return err;
+}
+
static const struct net_offload udpv4_offload = {
.callbacks = {
.gso_send_check = udp4_ufo_send_check,
.gso_segment = udp4_ufo_fragment,
+ .gro_receive = udp_gro_receive,
+ .gro_complete = udp_gro_complete,
},
};
--
1.7.1
^ permalink raw reply related
* [PATCH V5 net-next 2/3] net: Export gro_find_by_type helpers
From: Or Gerlitz @ 2014-01-20 11:59 UTC (permalink / raw)
To: davem; +Cc: netdev, hkchu, edumazet, herbert, yanb, shlomop, therbert,
Or Gerlitz
In-Reply-To: <1390219161-9881-1-git-send-email-ogerlitz@mellanox.com>
Export the gro_find_receive/complete_by_type helpers to they can be invoked
by the gro callbacks of encapsulation protocols such as vxlan.
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
net/core/dev.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 1578fd7..ed8af53 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3984,6 +3984,7 @@ struct packet_offload *gro_find_receive_by_type(__be16 type)
}
return NULL;
}
+EXPORT_SYMBOL(gro_find_receive_by_type);
struct packet_offload *gro_find_complete_by_type(__be16 type)
{
@@ -3997,6 +3998,7 @@ struct packet_offload *gro_find_complete_by_type(__be16 type)
}
return NULL;
}
+EXPORT_SYMBOL(gro_find_complete_by_type);
static gro_result_t napi_skb_finish(gro_result_t ret, struct sk_buff *skb)
{
--
1.7.1
^ permalink raw reply related
* [PATCH net-next V5 0/3] net: Add GRO support for UDP encapsulating protocols
From: Or Gerlitz @ 2014-01-20 11:59 UTC (permalink / raw)
To: davem; +Cc: netdev, hkchu, edumazet, herbert, yanb, shlomop, therbert,
Or Gerlitz
This series adds GRO handlers for protocols that do UDP encapsulation, with the
intent of being able to coalesce packets which encapsulate packets belonging to
the same TCP session.
For GRO purposes, the destination UDP port takes the role of the ether type
field in the ethernet header or the next protocol in the IP header.
The UDP GRO handler will only attempt to coalesce packets whose destination
port is registered to have gro handler.
The patches done against net-next 75e4364f67 "net: stmmac: fix NULL pointer
dereference in stmmac_get_tx_hwtstamp"
Or.
v4 --> v5 changes:
- followed Eric's directives to avoid using atomic get/put ops on the
udp gro receive and complete callbacks and instead keep the rcu_read_lock
when calling the next handler on the chain.
v3 --> v4 changes:
- applied feedback from Tom on some micro-optimizations that save
branches and goto directives in the udp gro logic
- applied feedback from Eric on correct RCU programming for the
add/remove flow of the upper protocols udp gro handlers
v2 --> v3 changes:
- moved to use linked list to store the udp gro handlers, this solves the
problem of consuming 512KB of memory for the handlers.
- use a mark on the skb GRO CB data to disallow running the udp gro_receive twice
on a packet, this solves the problem of udp encapsulated packets whose inner VM
packet is udp and happen to carry a port which has registered offloads - and flush it.
- invoke the udp offload protocol registration and de-registration from the vxlan driver
in a sleepable context
Or Gerlitz (3):
net: Add GRO support for UDP encapsulating protocols
net: Export gro_find_by_type helpers
net: Add GRO support for vxlan traffic
drivers/net/vxlan.c | 117 ++++++++++++++++++++++++++++++++++--
include/linux/netdevice.h | 10 +++-
include/net/protocol.h | 3 +
include/net/vxlan.h | 1 +
net/core/dev.c | 3 +
net/ipv4/udp_offload.c | 143 +++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 269 insertions(+), 8 deletions(-)
^ permalink raw reply
* Re: [PATCH v5] can: add Renesas R-Car CAN driver
From: Marc Kleine-Budde @ 2014-01-20 11:58 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Sergei Shtylyov, netdev@vger.kernel.org, wg, linux-can,
Linux-sh list, vksavl
In-Reply-To: <CAMuHMdV5sMUnXb1Z1HeRk9+_dCGWrbD-DS62S7T4Be-77HvsvA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1925 bytes --]
On 01/20/2014 12:52 PM, Geert Uytterhoeven wrote:
> On Mon, Jan 20, 2014 at 12:47 PM, Marc Kleine-Budde <mkl@pengutronix.de> wrote:
>> On 01/20/2014 12:43 PM, Geert Uytterhoeven wrote:
>>> On Thu, Dec 26, 2013 at 10:37 PM, Sergei Shtylyov
>>> <sergei.shtylyov@cogentembedded.com> wrote:
>>>> Changes in version 3:
>>>
>>>> - added '__packed' to 'struct rcar_can_mbox_regs' and 'struct rcar_can_regs';
>>>> - removed unneeded type cast in the probe() method.
>>>
>>>> +/* Mailbox registers structure */
>>>> +struct rcar_can_mbox_regs {
>>>> + u32 id; /* IDE and RTR bits, SID and EID */
>>>> + u8 stub; /* Not used */
>>>> + u8 dlc; /* Data Length Code - bits [0..3] */
>>>> + u8 data[8]; /* Data Bytes */
>>>> + u8 tsh; /* Time Stamp Higher Byte */
>>>> + u8 tsl; /* Time Stamp Lower Byte */
>>>> +} __packed;
>>>
>>> Sorry, I missed the earlier discussion, but why the _packed?
>>> One u32 and 12 bytes makes a nice multiple of 4.
>>
>> Better safe than sorry, it's the layout of the registers in hardware,
>> don't let the compiler optimize here.
>
> Actually __packed makes it less safe, as the compiler now assumes
> the u32 id member is unaligned, and thus may turn 32-bit accesses into 4
> byte accesses.
>
> Fortunately it won't happen in this case as the code uses writel/readl to
> acces the id member.
Yes, as this are registers they must not be accessed directly. However
we can use "__attribute__ ((packed, aligned(4)))" to tell the compiler
that the base address of this struct is always aligned to 4 bytes.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 242 bytes --]
^ permalink raw reply
* Re: [PATCH v5] can: add Renesas R-Car CAN driver
From: Geert Uytterhoeven @ 2014-01-20 11:52 UTC (permalink / raw)
To: Marc Kleine-Budde
Cc: Sergei Shtylyov, netdev@vger.kernel.org, wg, linux-can,
Linux-sh list, vksavl
In-Reply-To: <52DD0CC1.70205@pengutronix.de>
On Mon, Jan 20, 2014 at 12:47 PM, Marc Kleine-Budde <mkl@pengutronix.de> wrote:
> On 01/20/2014 12:43 PM, Geert Uytterhoeven wrote:
>> On Thu, Dec 26, 2013 at 10:37 PM, Sergei Shtylyov
>> <sergei.shtylyov@cogentembedded.com> wrote:
>>> Changes in version 3:
>>
>>> - added '__packed' to 'struct rcar_can_mbox_regs' and 'struct rcar_can_regs';
>>> - removed unneeded type cast in the probe() method.
>>
>>> +/* Mailbox registers structure */
>>> +struct rcar_can_mbox_regs {
>>> + u32 id; /* IDE and RTR bits, SID and EID */
>>> + u8 stub; /* Not used */
>>> + u8 dlc; /* Data Length Code - bits [0..3] */
>>> + u8 data[8]; /* Data Bytes */
>>> + u8 tsh; /* Time Stamp Higher Byte */
>>> + u8 tsl; /* Time Stamp Lower Byte */
>>> +} __packed;
>>
>> Sorry, I missed the earlier discussion, but why the _packed?
>> One u32 and 12 bytes makes a nice multiple of 4.
>
> Better safe than sorry, it's the layout of the registers in hardware,
> don't let the compiler optimize here.
Actually __packed makes it less safe, as the compiler now assumes
the u32 id member is unaligned, and thus may turn 32-bit accesses into 4
byte accesses.
Fortunately it won't happen in this case as the code uses writel/readl to
acces the id member.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply
* Re: [PATCH v5] can: add Renesas R-Car CAN driver
From: Marc Kleine-Budde @ 2014-01-20 11:47 UTC (permalink / raw)
To: Geert Uytterhoeven, Sergei Shtylyov
Cc: netdev@vger.kernel.org, wg, linux-can, Linux-sh list, vksavl
In-Reply-To: <CAMuHMdWZJUvcW9OzM39aB2m+VdKqmZ6EOGR_rZcAdV7Cmwx3kg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1277 bytes --]
On 01/20/2014 12:43 PM, Geert Uytterhoeven wrote:
> Hi Sergei,
>
> On Thu, Dec 26, 2013 at 10:37 PM, Sergei Shtylyov
> <sergei.shtylyov@cogentembedded.com> wrote:
>> Changes in version 3:
>
>> - added '__packed' to 'struct rcar_can_mbox_regs' and 'struct rcar_can_regs';
>> - removed unneeded type cast in the probe() method.
>
>> +/* Mailbox registers structure */
>> +struct rcar_can_mbox_regs {
>> + u32 id; /* IDE and RTR bits, SID and EID */
>> + u8 stub; /* Not used */
>> + u8 dlc; /* Data Length Code - bits [0..3] */
>> + u8 data[8]; /* Data Bytes */
>> + u8 tsh; /* Time Stamp Higher Byte */
>> + u8 tsl; /* Time Stamp Lower Byte */
>> +} __packed;
>
> Sorry, I missed the earlier discussion, but why the _packed?
> One u32 and 12 bytes makes a nice multiple of 4.
Better safe than sorry, it's the layout of the registers in hardware,
don't let the compiler optimize here.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 242 bytes --]
^ permalink raw reply
* [PATCH net-next v6 2/2] stmmac: Fix kernel crashes for jumbo frames
From: Vince Bridgers @ 2014-01-20 11:39 UTC (permalink / raw)
To: devicetree, netdev
Cc: peppe.cavallaro, robh+dt, pawel.moll, mark.rutland,
ijc+devicetree, galak, dinguyen, rayagond, vbridgers2013
In-Reply-To: <1390217941-22967-1-git-send-email-vbridgers2013@gmail.com>
These changes correct the following issues with jumbo frames on the
stmmac driver:
1) The Synopsys EMAC can be configured to support different FIFO
sizes at core configuration time. There's no way to query the
controller and know the FIFO size, so the driver needs to get this
information from the device tree in order to know how to correctly
handle MTU changes and setting up dma buffers. The default
max-frame-size is as currently used, which is the size of a jumbo
frame.
2) The driver was enabling Jumbo frames by default, but was not allocating
dma buffers of sufficient size to handle the maximum possible packet
size that could be received. This led to memory corruption since DMAs were
occurring beyond the extent of the allocated receive buffers for certain types
of network traffic.
kernel BUG at net/core/skbuff.c:126!
Internal error: Oops - BUG: 0 [#1] SMP ARM
Modules linked in:
CPU: 0 PID: 563 Comm: sockperf Not tainted 3.13.0-rc6-01523-gf7111b9 #31
task: ef35e580 ti: ef252000 task.ti: ef252000
PC is at skb_panic+0x60/0x64
LR is at skb_panic+0x60/0x64
pc : [<c03c7c3c>] lr : [<c03c7c3c>] psr: 60000113
sp : ef253c18 ip : 60000113 fp : 00000000
r10: ef3a5400 r9 : 00000ebc r8 : ef3a546c
r7 : ee59f000 r6 : ee59f084 r5 : ee59ff40 r4 : ee59f140
r3 : 000003e2 r2 : 00000007 r1 : c0b9c420 r0 : 0000007d
Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
Control: 10c5387d Table: 2e8ac04a DAC: 00000015
Process sockperf (pid: 563, stack limit = 0xef252248)
Stack: (0xef253c18 to 0xef254000)
3c00: 00000ebc ee59f000
3c20: ee59f084 ee59ff40 ee59f140 c04a9cd8 ee8c50c0 00000ebc ee59ff40 00000000
3c40: ee59f140 c02d0ef0 00000056 ef1eda80 ee8c50c0 00000ebc 22bbef29 c0318f8c
3c60: 00000056 ef3a547c ffe2c716 c02c9c90 c0ba1298 ef3a5838 ef3a5838 ef3a5400
3c80: 000020c0 ee573840 000055cb ef3f2050 c053f0e0 c0319214 22b9b085 22d92813
3ca0: 00001c80 004b8e00 ef3a5400 ee573840 ef3f2064 22d92813 ef3f2064 000055cb
3cc0: ef3f2050 c031a19c ef252000 00000000 00000000 c0561bc0 00000000 ff00ffff
3ce0: c05621c0 ef3a5400 ef3f2064 ee573840 00000020 ef3f2064 000055cb ef3f2050
3d00: c053f0e0 c031cad0 c053e740 00000e60 00000000 00000000 ee573840 ef3a5400
3d20: ef0a6e00 00000000 ef3f2064 c032507c 00010000 00000020 c0561bc0 c0561bc0
3d40: ee599850 c032799c 00000000 ee573840 c055a380 ef3a5400 00000000 ef3f2064
3d60: ef3f2050 c032799c 0101c7c0 2b6755cb c059a280 c030e4d8 000055cb ffffffff
3d80: ee574fc0 c055a380 ee574000 ee573840 00002b67 ee573840 c03fe9c4 c053fa68
3da0: c055a380 00001f6f 00000000 ee573840 c053f0e0 c0304fdc ef0a6e01 ef3f2050
3dc0: ee573858 ef031000 ee573840 c03055d8 c0ba0c40 ef000f40 00100100 c053f0dc
3de0: c053ffdc c053f0f0 00000008 00000000 ef031000 c02da948 00001140 00000000
3e00: c0563c78 ef253e5f 00000020 ee573840 00000020 c053f0f0 ef313400 ee573840
3e20: c053f0e0 00000000 00000000 c05380c0 ef313400 00001000 00000015 c02df280
3e40: ee574000 ef001e00 00000000 00001080 00000042 005cd980 ef031500 ef031500
3e60: 00000000 c02df824 ef031500 c053e390 c0541084 f00b1e00 c05925e8 c02df864
3e80: 00001f5c ef031440 c053e390 c0278524 00000002 00000000 c0b9eb48 c02df280
3ea0: ee8c7180 00000100 c0542ca8 00000015 00000040 ef031500 ef031500 ef031500
3ec0: c027803c ef252000 00000040 000000ec c05380c0 c0b9eb40 c0b9eb48 c02df940
3ee0: ef060780 ffffa4dd c0564a9c c056343c 002e80a8 00000080 ef031500 00000001
3f00: c053808c ef252000 fffec100 00000003 00000004 002e80a8 0000000c c00258f0
3f20: 002e80a8 c005e704 00000005 00000100 c05634d0 c0538080 c05333e0 00000000
3f40: 0000000a c0565580 c05380c0 ffffa4dc c05434f4 00400100 00000004 c0534cd4
3f60: 00000098 00000000 fffec100 002e80a8 00000004 002e80a8 002a20e0 c0025da8
3f80: c0534cd4 c000f020 fffec10c c053ea60 ef253fb0 c0008530 0000ffe2 b6ef67f4
3fa0: 40000010 ffffffff 00000124 c0012f3c 0000ffe2 002e80f0 0000ffe2 00004000
3fc0: becb6338 becb6334 00000004 00000124 002e80a8 00000004 002e80a8 002a20e0
3fe0: becb6300 becb62f4 002773bb b6ef67f4 40000010 ffffffff 00000000 00000000
[<c03c7c3c>] (skb_panic+0x60/0x64) from [<c02d0ef0>] (skb_put+0x4c/0x50)
[<c02d0ef0>] (skb_put+0x4c/0x50) from [<c0318f8c>] (tcp_collapse+0x314/0x3ec)
[<c0318f8c>] (tcp_collapse+0x314/0x3ec) from [<c0319214>]
(tcp_try_rmem_schedule+0x1b0/0x3c4)
[<c0319214>] (tcp_try_rmem_schedule+0x1b0/0x3c4) from [<c031a19c>]
(tcp_data_queue+0x480/0xe6c)
[<c031a19c>] (tcp_data_queue+0x480/0xe6c) from [<c031cad0>]
(tcp_rcv_established+0x180/0x62c)
[<c031cad0>] (tcp_rcv_established+0x180/0x62c) from [<c032507c>]
(tcp_v4_do_rcv+0x13c/0x31c)
[<c032507c>] (tcp_v4_do_rcv+0x13c/0x31c) from [<c032799c>]
(tcp_v4_rcv+0x718/0x73c)
[<c032799c>] (tcp_v4_rcv+0x718/0x73c) from [<c0304fdc>]
(ip_local_deliver+0x98/0x274)
[<c0304fdc>] (ip_local_deliver+0x98/0x274) from [<c03055d8>]
(ip_rcv+0x420/0x758)
[<c03055d8>] (ip_rcv+0x420/0x758) from [<c02da948>]
(__netif_receive_skb_core+0x44c/0x5bc)
[<c02da948>] (__netif_receive_skb_core+0x44c/0x5bc) from [<c02df280>]
(netif_receive_skb+0x48/0xb4)
[<c02df280>] (netif_receive_skb+0x48/0xb4) from [<c02df824>]
(napi_gro_flush+0x70/0x94)
[<c02df824>] (napi_gro_flush+0x70/0x94) from [<c02df864>]
(napi_complete+0x1c/0x34)
[<c02df864>] (napi_complete+0x1c/0x34) from [<c0278524>]
(stmmac_poll+0x4e8/0x5c8)
[<c0278524>] (stmmac_poll+0x4e8/0x5c8) from [<c02df940>]
(net_rx_action+0xc4/0x1e4)
[<c02df940>] (net_rx_action+0xc4/0x1e4) from [<c00258f0>]
(__do_softirq+0x12c/0x2e8)
[<c00258f0>] (__do_softirq+0x12c/0x2e8) from [<c0025da8>] (irq_exit+0x78/0xac)
[<c0025da8>] (irq_exit+0x78/0xac) from [<c000f020>] (handle_IRQ+0x44/0x90)
[<c000f020>] (handle_IRQ+0x44/0x90) from [<c0008530>]
(gic_handle_irq+0x2c/0x5c)
[<c0008530>] (gic_handle_irq+0x2c/0x5c) from [<c0012f3c>]
(__irq_usr+0x3c/0x60)
3) The driver was setting the dma buffer size after allocating dma buffers,
which caused a system panic when changing the MTU.
BUG: Bad page state in process ifconfig pfn:2e850
page:c0b72a00 count:0 mapcount:0 mapping: (null) index:0x0
page flags: 0x200(arch_1)
Modules linked in:
CPU: 0 PID: 566 Comm: ifconfig Not tainted 3.13.0-rc6-01523-gf7111b9 #29
[<c001547c>] (unwind_backtrace+0x0/0xf8) from [<c00122dc>]
(show_stack+0x10/0x14)
[<c00122dc>] (show_stack+0x10/0x14) from [<c03c793c>] (dump_stack+0x70/0x88)
[<c03c793c>] (dump_stack+0x70/0x88) from [<c00b2620>] (bad_page+0xc8/0x118)
[<c00b2620>] (bad_page+0xc8/0x118) from [<c00b302c>]
(get_page_from_freelist+0x744/0x870)
[<c00b302c>] (get_page_from_freelist+0x744/0x870) from [<c00b40f4>]
(__alloc_pages_nodemask+0x118/0x86c)
[<c00b40f4>] (__alloc_pages_nodemask+0x118/0x86c) from [<c00b4858>]
(__get_free_pages+0x10/0x54)
[<c00b4858>] (__get_free_pages+0x10/0x54) from [<c00cba1c>]
(kmalloc_order_trace+0x24/0xa0)
[<c00cba1c>] (kmalloc_order_trace+0x24/0xa0) from [<c02d199c>]
(__kmalloc_reserve.isra.21+0x24/0x70)
[<c02d199c>] (__kmalloc_reserve.isra.21+0x24/0x70) from [<c02d240c>]
(__alloc_skb+0x68/0x13c)
[<c02d240c>] (__alloc_skb+0x68/0x13c) from [<c02d3930>]
(__netdev_alloc_skb+0x3c/0xe8)
[<c02d3930>] (__netdev_alloc_skb+0x3c/0xe8) from [<c0279378>]
(stmmac_open+0x63c/0x1024)
[<c0279378>] (stmmac_open+0x63c/0x1024) from [<c02e18cc>]
(__dev_open+0xa0/0xfc)
[<c02e18cc>] (__dev_open+0xa0/0xfc) from [<c02e1b40>]
(__dev_change_flags+0x94/0x158)
[<c02e1b40>] (__dev_change_flags+0x94/0x158) from [<c02e1c24>]
(dev_change_flags+0x18/0x48)
[<c02e1c24>] (dev_change_flags+0x18/0x48) from [<c0337bc0>]
(devinet_ioctl+0x638/0x700)
[<c0337bc0>] (devinet_ioctl+0x638/0x700) from [<c02c7aec>]
(sock_ioctl+0x64/0x290)
[<c02c7aec>] (sock_ioctl+0x64/0x290) from [<c0100890>]
(do_vfs_ioctl+0x78/0x5b8)
[<c0100890>] (do_vfs_ioctl+0x78/0x5b8) from [<c0100e0c>] (SyS_ioctl+0x3c/0x5c)
[<c0100e0c>] (SyS_ioctl+0x3c/0x5c) from [<c000e760>]
The fixes have been verified using reproducible, automated testing.
Signed-off-by: Vince Bridgers <vbridgers2013@gmail.com>
---
V6: respin for updated net-next
V5: no change for this patch, change was in devicetree patch
V4: address inconsistency in comment, add comments explaining inconsistent
use of max-frame-size when reading device tree max-frame-size
V3: change snps,max-frame-size to max-frame-size
V2: change snps,max-mtu to snps,max-frame-size
---
drivers/net/ethernet/stmicro/stmmac/common.h | 4 +++-
drivers/net/ethernet/stmicro/stmmac/dwmac1000.h | 7 ++-----
.../net/ethernet/stmicro/stmmac/dwmac1000_core.c | 7 ++++++-
.../net/ethernet/stmicro/stmmac/dwmac100_core.c | 2 +-
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 11 +++++++----
.../net/ethernet/stmicro/stmmac/stmmac_platform.c | 13 +++++++++++++
include/linux/stmmac.h | 1 +
7 files changed, 33 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index 5a60b3f..7834a39 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -292,6 +292,8 @@ struct dma_features {
#define STMMAC_CHAIN_MODE 0x1
#define STMMAC_RING_MODE 0x2
+#define JUMBO_LEN 9000
+
struct stmmac_desc_ops {
/* DMA RX descriptor ring initialization */
void (*init_rx_desc) (struct dma_desc *p, int disable_rx_ic, int mode,
@@ -368,7 +370,7 @@ struct stmmac_dma_ops {
struct stmmac_ops {
/* MAC core initialization */
- void (*core_init) (void __iomem *ioaddr);
+ void (*core_init) (void __iomem *ioaddr, int mtu);
/* Enable and verify that the IPC module is supported */
int (*rx_ipc) (void __iomem *ioaddr);
/* Dump MAC registers */
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
index c12aabb..f37d90f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
@@ -126,11 +126,8 @@ enum power_event {
#define GMAC_ANE_PSE (3 << 7)
#define GMAC_ANE_PSE_SHIFT 7
- /* GMAC Configuration defines */
-#define GMAC_CONTROL_TC 0x01000000 /* Transmit Conf. in RGMII/SGMII */
-#define GMAC_CONTROL_WD 0x00800000 /* Disable Watchdog on receive */
-
/* GMAC Configuration defines */
+#define GMAC_CONTROL_2K 0x08000000 /* IEEE 802.3as 2K packets */
#define GMAC_CONTROL_TC 0x01000000 /* Transmit Conf. in RGMII/SGMII */
#define GMAC_CONTROL_WD 0x00800000 /* Disable Watchdog on receive */
#define GMAC_CONTROL_JD 0x00400000 /* Jabber disable */
@@ -156,7 +153,7 @@ enum inter_frame_gap {
#define GMAC_CONTROL_RE 0x00000004 /* Receiver Enable */
#define GMAC_CORE_INIT (GMAC_CONTROL_JD | GMAC_CONTROL_PS | GMAC_CONTROL_ACS | \
- GMAC_CONTROL_JE | GMAC_CONTROL_BE)
+ GMAC_CONTROL_BE)
/* GMAC Frame Filter defines */
#define GMAC_FRAME_FILTER_PR 0x00000001 /* Promiscuous Mode */
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
index cdd9268..b3e148e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
@@ -32,10 +32,15 @@
#include <asm/io.h>
#include "dwmac1000.h"
-static void dwmac1000_core_init(void __iomem *ioaddr)
+static void dwmac1000_core_init(void __iomem *ioaddr, int mtu)
{
u32 value = readl(ioaddr + GMAC_CONTROL);
value |= GMAC_CORE_INIT;
+ if (mtu > 1500)
+ value |= GMAC_CONTROL_2K;
+ if (mtu > 2000)
+ value |= GMAC_CONTROL_JE;
+
writel(value, ioaddr + GMAC_CONTROL);
/* Mask GMAC interrupts */
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c
index 5857d67..2ff767b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c
@@ -32,7 +32,7 @@
#include <asm/io.h>
#include "dwmac100.h"
-static void dwmac100_core_init(void __iomem *ioaddr)
+static void dwmac100_core_init(void __iomem *ioaddr, int mtu)
{
u32 value = readl(ioaddr + MAC_CONTROL);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 5db91be..d93aa87 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -54,7 +54,6 @@
#include <linux/reset.h>
#define STMMAC_ALIGN(x) L1_CACHE_ALIGN(x)
-#define JUMBO_LEN 9000
/* Module parameters */
#define TX_TIMEO 5000
@@ -93,7 +92,7 @@ static int tc = TC_DEFAULT;
module_param(tc, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(tc, "DMA threshold control value");
-#define DMA_BUFFER_SIZE BUF_SIZE_2KiB
+#define DMA_BUFFER_SIZE BUF_SIZE_4KiB
static int buf_sz = DMA_BUFFER_SIZE;
module_param(buf_sz, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(buf_sz, "DMA buffer size");
@@ -994,6 +993,8 @@ static int init_dma_desc_rings(struct net_device *dev)
if (bfsize < BUF_SIZE_16KiB)
bfsize = stmmac_set_bfsize(dev->mtu, priv->dma_buf_sz);
+ priv->dma_buf_sz = bfsize;
+
if (netif_msg_probe(priv))
pr_debug("%s: txsize %d, rxsize %d, bfsize %d\n", __func__,
txsize, rxsize, bfsize);
@@ -1023,7 +1024,6 @@ static int init_dma_desc_rings(struct net_device *dev)
}
priv->cur_rx = 0;
priv->dirty_rx = (unsigned int)(i - rxsize);
- priv->dma_buf_sz = bfsize;
buf_sz = bfsize;
/* Setup the chained descriptor addresses */
@@ -1624,7 +1624,7 @@ static int stmmac_hw_setup(struct net_device *dev)
priv->plat->bus_setup(priv->ioaddr);
/* Initialize the MAC Core */
- priv->hw->mac->core_init(priv->ioaddr);
+ priv->hw->mac->core_init(priv->ioaddr, dev->mtu);
/* Enable the MAC Rx/Tx */
stmmac_set_mac(priv->ioaddr, true);
@@ -2274,6 +2274,9 @@ static int stmmac_change_mtu(struct net_device *dev, int new_mtu)
else
max_mtu = SKB_MAX_HEAD(NET_SKB_PAD + NET_IP_ALIGN);
+ if (priv->plat->maxmtu < max_mtu)
+ max_mtu = priv->plat->maxmtu;
+
if ((new_mtu < 46) || (new_mtu > max_mtu)) {
pr_err("%s: invalid MTU, max MTU is: %d\n", dev->name, max_mtu);
return -EINVAL;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 9d4baa8..5884a7d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -102,6 +102,11 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
plat->force_sf_dma_mode = of_property_read_bool(np, "snps,force_sf_dma_mode");
+ /* Set the maxmtu to a default of JUMBO_LEN in case the
+ * parameter is not present in the device tree.
+ */
+ plat->maxmtu = JUMBO_LEN;
+
/*
* Currently only the properties needed on SPEAr600
* are provided. All other properties should be added
@@ -110,6 +115,14 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
if (of_device_is_compatible(np, "st,spear600-gmac") ||
of_device_is_compatible(np, "snps,dwmac-3.70a") ||
of_device_is_compatible(np, "snps,dwmac")) {
+ /* Note that the max-frame-size parameter as defined in the
+ * ePAPR v1.1 spec is defined as max-frame-size, it's
+ * actually used as the IEEE definition of MAC Client
+ * data, or MTU. The ePAPR specification is confusing as
+ * the definition is max-frame-size, but usage examples
+ * are clearly MTUs
+ */
+ of_property_read_u32(np, "max-frame-size", &plat->maxmtu);
plat->has_gmac = 1;
plat->pmt = 1;
}
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 1367974..6f27d4f 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -111,6 +111,7 @@ struct plat_stmmacenet_data {
int force_thresh_dma_mode;
int riwt_off;
int max_speed;
+ int maxmtu;
void (*fix_mac_speed)(void *priv, unsigned int speed);
void (*bus_setup)(void __iomem *ioaddr);
void *(*setup)(struct platform_device *pdev);
--
1.7.9.5
^ permalink raw reply related
* [PATCH net-next v6 1/2] dts: Add a binding for Synopsys emac max-frame-size
From: Vince Bridgers @ 2014-01-20 11:39 UTC (permalink / raw)
To: devicetree, netdev
Cc: peppe.cavallaro, robh+dt, pawel.moll, mark.rutland,
ijc+devicetree, galak, dinguyen, rayagond, vbridgers2013
In-Reply-To: <1390217941-22967-1-git-send-email-vbridgers2013@gmail.com>
This change adds a parameter for the Synopsys 10/100/1000
stmmac Ethernet driver to configure the maximum frame
size supported by the EMAC driver. Synopsys allows the FIFO
sizes to be configured when the cores are built for a particular
device, but do not provide a way for the driver to read
information from the device about the maximum MTU size
supported as limited by the device's FIFO size.
Signed-off-by: Vince Bridgers <vbridgers2013@gmail.com>
---
V6: respin for updated net-next
V5: simplify comment on use of max-frame-size
V4: add comments to explain use of max-frame-size with respect
to inconsistent definition and use in the ePAPR v1.1 spec
V3: change snps,max-frame-size to max-frame-size
V2: change snps,max-mtu to snps,max-frame-size
---
Documentation/devicetree/bindings/net/stmmac.txt | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Documentation/devicetree/bindings/net/stmmac.txt b/Documentation/devicetree/bindings/net/stmmac.txt
index aefb639..9d92d42 100644
--- a/Documentation/devicetree/bindings/net/stmmac.txt
+++ b/Documentation/devicetree/bindings/net/stmmac.txt
@@ -32,6 +32,8 @@ Optional properties:
- resets: Should contain a phandle to the STMMAC reset signal, if any
- reset-names: Should contain the reset signal name "stmmaceth", if a
reset phandle is given
+- max-frame-size: Maximum Transfer Unit (IEEE defined MTU), rather
+ than the maximum frame size.
Examples:
@@ -42,5 +44,6 @@ Examples:
interrupts = <24 23>;
interrupt-names = "macirq", "eth_wake_irq";
mac-address = [000000000000]; /* Filled in by U-Boot */
+ max-frame-size = <3800>;
phy-mode = "gmii";
};
--
1.7.9.5
^ permalink raw reply related
* [PATCH net-next v6 0/2] stmmac: fix kernel crashes for jumbo frames
From: Vince Bridgers @ 2014-01-20 11:38 UTC (permalink / raw)
To: devicetree, netdev
Cc: peppe.cavallaro, robh+dt, pawel.moll, mark.rutland,
ijc+devicetree, galak, dinguyen, rayagond, vbridgers2013
v6:
* no changes since v5, respin for updated net-next
v5:
* Simplify use notes for max-frame-size in stmmac.txt, in the
devicetree patch. No change to the stmmac driver patch
from v4.
v4:
* Address inconsistent comment with use, add comments about inconsistency
of max-frame-size definition and use in the ePAPR v1.1 specification.
v3:
* change snps,max-frame-size to max-frame-size
v2:
* change snps,max-mtu to snps,max-frame-size
These patches address two kernel crashes seen when using jumbo frames on
the Synopsys stmmac driver, and adds device tree configurability for the
maximum mtu. The Synopsys emac fifo sizes can be configured when a logic
design is synthesized, but does not provide a way for a driver to query the
exact fifo size.
The crashes seen were due to two issues.
1) The dma buffer size was being set after the dma buffers were allocated.
This caused a crash when changing the mtu since it was possible the buffers
would subsequently be freed using an incorrect dma buffer size. This could
also cause kernel panics due to memory corruption since a large mtu size could
have been configured, but the dma buffers were not sized accordingly.
2) Jumbo frames were being enabled by default, but the dma buffers were not
sized accordingly. This caused memory corruption in the context of certain
types of network traffic, leading to kernel panics.
I've tested these changes using automated, reproducible testware. I can
demonstrate the panics described before the fixes and show that the fixes
address the problems described.
Testing and improvements continue through the use of the mentioned automated
and reproducible testware.
Vince Bridgers
Vince Bridgers (2):
dts: Add a binding for Synopsys emac max-frame-size
stmmac: Fix kernel crashes for jumbo frames
Documentation/devicetree/bindings/net/stmmac.txt | 3 +++
drivers/net/ethernet/stmicro/stmmac/common.h | 4 +++-
drivers/net/ethernet/stmicro/stmmac/dwmac1000.h | 7 ++-----
.../net/ethernet/stmicro/stmmac/dwmac1000_core.c | 7 ++++++-
.../net/ethernet/stmicro/stmmac/dwmac100_core.c | 2 +-
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 11 +++++++----
.../net/ethernet/stmicro/stmmac/stmmac_platform.c | 13 +++++++++++++
include/linux/stmmac.h | 1 +
8 files changed, 36 insertions(+), 12 deletions(-)
--
1.7.9.5
^ permalink raw reply
* Re: [PATCH v5] can: add Renesas R-Car CAN driver
From: Geert Uytterhoeven @ 2014-01-20 11:43 UTC (permalink / raw)
To: Sergei Shtylyov
Cc: netdev@vger.kernel.org, wg, mkl, linux-can, Linux-sh list, vksavl
In-Reply-To: <201312270037.15822.sergei.shtylyov@cogentembedded.com>
Hi Sergei,
On Thu, Dec 26, 2013 at 10:37 PM, Sergei Shtylyov
<sergei.shtylyov@cogentembedded.com> wrote:
> Changes in version 3:
> - added '__packed' to 'struct rcar_can_mbox_regs' and 'struct rcar_can_regs';
> - removed unneeded type cast in the probe() method.
> +/* Mailbox registers structure */
> +struct rcar_can_mbox_regs {
> + u32 id; /* IDE and RTR bits, SID and EID */
> + u8 stub; /* Not used */
> + u8 dlc; /* Data Length Code - bits [0..3] */
> + u8 data[8]; /* Data Bytes */
> + u8 tsh; /* Time Stamp Higher Byte */
> + u8 tsl; /* Time Stamp Lower Byte */
> +} __packed;
Sorry, I missed the earlier discussion, but why the _packed?
One u32 and 12 bytes makes a nice multiple of 4.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox