Netdev List
 help / color / mirror / Atom feed
* Re: [net-next 11/13] igb: Make Tx budget for NAPI user adjustable
From: Neil Horman @ 2011-09-28 11:00 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: Andy Gospodarek, Stephen Hemminger, jeffrey t kirsher,
	David Miller, netdev, gospo, Alexander H Duyck
In-Reply-To: <1317167146.2845.48.camel@bwh-desktop>

On Wed, Sep 28, 2011 at 12:45:46AM +0100, Ben Hutchings wrote:
> On Tue, 2011-09-20 at 16:23 -0400, Neil Horman wrote:
> [...]
> > This is the work Andy is referring to for those interested:
> > http://marc.info/?l=linux-kernel&m=131644727521409&w=2
> > 
> > This version has Gregs Ack, and is waiting for an Ack from Jesse Barnes at the
> > moment.
> 
> While I think it's useful to be able to list all IRQs assigned to a PCI
> device, this doesn't tell us anything about the way they're associated
> with queues.
> 
I never claimed that it did.  This just lets us definitavely correlate msi irq
instances to pci devices, and their device class.  Preveously we were limited to
guessing what kind device an irq belonged to by doing hopeful string matches on
device names from proc/interrupts, something which was easily broken by a change
in driver naming practice, or an administrative device name change.

> > I think Andy's probably right, theres room here for expansion to create
> > a relationship between a given interrupt and a napi wieght.  I expect what would
> > be most direct would be adding a napi_weight attribute that was conditional on
> > the class of the pci device allocating the irqs (make it visible for class 0x200
> > devs, invisible for others).
> 
> That's a terrible idea; what has NAPI got to do with PCI devices?
> 
Nothing directly, but stop making up an implementation, and deciding based on
that the whole notion is stupid.  There are a few ways to do this, some of which
make sense.

I was thinking of something along the lines of two more attributes in
/sys/class/net/<if>/queues:
napi_weight
irq

The former is the napi weight of a given napi instance associated with a queue,
while the latter is a symlink either to ../device/irq or ../device/msi_irqs/<n>/
(or perhaps to ../devices/msi_irqs/<n>/irq if we want more consistency).   This
lets us tune the napi weight of a queue and know what interrupt is associated
with it.  That seems fairly sane to me.
Neil

^ permalink raw reply

* Possible NULL dereference caused by -stable commit ef81bb40bf15f350fe865f31fa42f1082772a576
From: Jason Wang @ 2011-09-28 10:51 UTC (permalink / raw)
  To: netdev, eric.dumazet, David S. Miller, linux-kernel, Greg KH,
	stable
  Cc: Michael S. Tsirkin, Amos Kong

Hi all:

A possible NULL dereference were noticed by the stable commit 
ef81bb40bf15f350fe865f31fa42f1082772a576 (which is a backport of 
87c48fa3b4630905f98268dde838ee43626a060c). The case happens when bridge 
froward a packet from guest to a physical nic, at this time no route is 
attached to the skb which may lead a NULL dereference in 
ipv6_select_ident(). -Next version have this check so it is fine. The 
following patch may be used to avoid this but may also lead the ip 
identification predicable, and this defect is also exist -next version 
when no route because we still depends on a global variable to generate 
the identification.  Any thought on this?

Thanks.

diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 4ea6e21..414e2f4 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -622,7 +622,9 @@ static u32 __ipv6_select_ident(const struct in6_addr 
*addr)

  void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt)
  {
-       fhdr->identification = 
htonl(__ipv6_select_ident(&rt->rt6i_dst.addr));
+       const struct in6_addr addr = IN6ADDR_ANY_INIT;
+       fhdr->identification =
+               htonl(__ipv6_select_ident(rt ? &rt->rt6i_dst.addr : &addr));
  }

  int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))

^ permalink raw reply related

* Re: [PATCH] tcp: properly update lost_cnt_hint during shifting
From: Yan, Zheng @ 2011-09-28 10:45 UTC (permalink / raw)
  To: Ilpo Järvinen; +Cc: netdev@vger.kernel.org, Nandita Dukkipati
In-Reply-To: <alpine.DEB.2.00.1109281226480.21709@wel-95.cs.helsinki.fi>

On 09/28/2011 05:50 PM, Ilpo Järvinen wrote:
> On Wed, 28 Sep 2011, Yan, Zheng wrote:
> 
>> On 09/28/2011 04:55 PM, Yan, Zheng wrote:
>>> On 09/28/2011 04:17 PM, Ilpo Järvinen wrote:
>>>> On Wed, 28 Sep 2011, Yan, Zheng wrote:
>>>>
>>>>> lost_skb_hint is used by tcp_mark_head_lost() to mark the first
>>>>> unhandled skb. lost_cnt_hint is the number of sacked packets before
>>>>> the lost_skb_hint. tcp_shifted_skb() shouldn't increase lost_cnt_hint
>>>>> when shifting a sacked skb that is before the lost_skb_hint, because
>>>>> packets in it are already counted.
>>>>>
>>>>> Signed-off-by: Zheng Yan <zheng.z.yan@intel.com>
>>>>> ---
>>>>> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
>>>>> index 21fab3e..f712ace 100644
>>>>> --- a/net/ipv4/tcp_input.c
>>>>> +++ b/net/ipv4/tcp_input.c
>>>>> @@ -1390,9 +1390,14 @@ static int tcp_shifted_skb(struct sock *sk, struct sk_buff *skb,
>>>>>  	BUG_ON(!pcount);
>>>>>  
>>>>>  	/* Tweak before seqno plays */
>>>>> -	if (!tcp_is_fack(tp) && tcp_is_sack(tp) && tp->lost_skb_hint &&
>>>>> -	    !before(TCP_SKB_CB(tp->lost_skb_hint)->seq, TCP_SKB_CB(skb)->seq))
>>>>> -		tp->lost_cnt_hint += pcount;
>>>>> +	if (!tcp_is_fack(tp) && tcp_is_sack(tp) && tp->lost_skb_hint) {
>>>>> +		if (skb == tp->lost_skb_hint)
>>>>> +			tp->lost_cnt_hint += pcount;
>>>>> +		else if (!(TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED) &&
>>>>> +			 before(TCP_SKB_CB(skb)->seq,
>>>>> +				TCP_SKB_CB(tp->lost_skb_hint)->seq))
>>>>> +			tp->lost_cnt_hint += pcount;
>>>>> +	}
>>>>
>>>> Ah right, the hole filled case which shifts not only the newly SACKed 
>>>> skb but also the next, already SACKed skb?
>>>>
>>>> I fail to see why you needed to change !before into two checks though:
>>>>  skb == tp->lost_skb_hint and before(params reversed) ? Shouldn't the 
>>>> equality that is provided by the negation cover for the == check (and the 
>>>> params reversion isn't necessary in any case)? In fact, isn't the skb == 
>>>> tp->lost_skb_hint check strictly wrong without the same TCPCB_SACKED_ACKED 
>>>> guard (though I'm not sure, I didn't check, if the hint can ever point to 
>>>> such a segment in the first place)?
>>>
>>> Thanks you for your reply.
>>>
>>> skb == tp->lost_skb_hint is special.
>>>
>>> If the skb is sacked and we shift 'pcount' packets to previous skb,
>>> these packets will not be counted by future tcp_mark_head_lost() call.
>>> So we should increase lost_cnt_hint.
>>>
>>> If the skb is not sacked, the skb will be sacked soon by tcp_sacktag_one(),
>>> So we should not increase lost_cnt_hint.
>>>
>>> I didn't think out the second case. I think the correct patch should be:
>>> ---
>>>
>>> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
>>> index 21fab3e..dcc2411 100644
>>> --- a/net/ipv4/tcp_input.c
>>> +++ b/net/ipv4/tcp_input.c
>>> @@ -1390,9 +1390,15 @@ static int tcp_shifted_skb(struct sock *sk, struct sk_buff *skb,
>>>  	BUG_ON(!pcount);
>>>  
>>>  	/* Tweak before seqno plays */
>>> -	if (!tcp_is_fack(tp) && tcp_is_sack(tp) && tp->lost_skb_hint &&
>>> -	    !before(TCP_SKB_CB(tp->lost_skb_hint)->seq, TCP_SKB_CB(skb)->seq))
>>> -		tp->lost_cnt_hint += pcount;
>>> +	if (!tcp_is_fack(tp) && tcp_is_sack(tp) && tp->lost_skb_hint) {
>>> +		if ((TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED) &&
>>> +		    skb == tp->lost_skb_hint)
>>> +			tp->lost_cnt_hint += pcount;
>>> +		else if (!(TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED) &&
>>> +			 before(TCP_SKB_CB(skb)->seq,
>>> +				TCP_SKB_CB(tp->lost_skb_hint)->seq))
>>> +			tp->lost_cnt_hint += pcount;
>>> +	}
>>>  
>>>  	TCP_SKB_CB(prev)->end_seq += shifted;
>>>  	TCP_SKB_CB(skb)->seq += shifted;
>>> ---
>>
>> Sorry, I didn't think out the "skb before lost_skb_hint" case neither.
>> If the skb isn't sacked, tcp_sacktag_one() will increase the lost_cnt_hint.
>> So tcp_shifted_skb() shouldn't adjust the the lost_cnt_hint.
>>
>> I hope my patch is correct this time.
>>
>> ---
>> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
>> index 21fab3e..697ce5f 100644
>> --- a/net/ipv4/tcp_input.c
>> +++ b/net/ipv4/tcp_input.c
>> @@ -1390,8 +1390,8 @@ static int tcp_shifted_skb(struct sock *sk, struct sk_buff *skb,
>>  	BUG_ON(!pcount);
>>  
>>  	/* Tweak before seqno plays */
>> -	if (!tcp_is_fack(tp) && tcp_is_sack(tp) && tp->lost_skb_hint &&
>> -	    !before(TCP_SKB_CB(tp->lost_skb_hint)->seq, TCP_SKB_CB(skb)->seq))
>> +	if (!tcp_is_fack(tp) && tcp_is_sack(tp) && tp->lost_skb_hint == skb &&
>> +	    (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED))
>>  		tp->lost_cnt_hint += pcount;
>>  
>>  	TCP_SKB_CB(prev)->end_seq += shifted;
> 
> Hehe, besides not spotting all this, I also made another mistake in my 
> last post. It seems that this code has been quite broken from the 
> beginning or we still lack some detail. ...But the latest change certainly 
> seems more reasonable than the previous code of mine if I've successfully 
> understood enough pieces. These hints, although providing significant 
> performance benefits, are really pain to get right :-).
> 
> But is the non-SACKed case really handled right when hint == skb by the 
> sacktag_one. We move the seqno in between and then before(x->newseq, 
> x->newseq) check returns false?
> 
you are right, thank you.

really hope my patch is correct this time :)
---
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 21fab3e..a04622e 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1390,8 +1390,7 @@ static int tcp_shifted_skb(struct sock *sk, struct sk_buff *skb,
 	BUG_ON(!pcount);
 
 	/* Tweak before seqno plays */
-	if (!tcp_is_fack(tp) && tcp_is_sack(tp) && tp->lost_skb_hint &&
-	    !before(TCP_SKB_CB(tp->lost_skb_hint)->seq, TCP_SKB_CB(skb)->seq))
+	if (!tcp_is_fack(tp) && tcp_is_sack(tp) && tp->lost_skb_hint == skb)
 		tp->lost_cnt_hint += pcount;
 
 	TCP_SKB_CB(prev)->end_seq += shifted;

^ permalink raw reply related

* Re: [PATCH net-next] can/sja1000: add driver for EMS PCMCIA card
From: [EMS] Markus Plessing @ 2011-09-28 10:02 UTC (permalink / raw)
  To: David Miller
  Cc: Oliver Hartkopp, Wolfgang Grandegger, Netdev Mailing List,
	SocketCAN Core Mailing List
In-Reply-To: <4E7CBB04.8070807@hartkopp.net>

Next try, without gmane ...

Am 23.09.2011 18:59, schrieb Oliver Hartkopp:
> This patch adds the driver for the SJA1000 based PCMCIA card 'CPC-Card' from
> EMS Dr. Thomas Wuensche (http://www.ems-wuensche.de).
>
> Signed-off-by: Oliver Hartkopp<socketcan-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org>

Acked-by: Markus Plessing <plessing@ems-wuensche.com>

Thanks Oliver.

> ---
>
> diff -u -r -N a/drivers/net/can/sja1000/Kconfig b/drivers/net/can/sja1000/Kconfig
> --- a/drivers/net/can/sja1000/Kconfig	2011-09-23 18:02:35.711750820 +0200
> +++ b/drivers/net/can/sja1000/Kconfig	2011-09-23 18:02:28.695751113 +0200
> @@ -29,6 +29,13 @@
>   	  OpenFirmware bindings, e.g. if you have a PowerPC based system
>   	  you may want to enable this option.
>
> +config CAN_EMS_PCMCIA
> +	tristate "EMS CPC-CARD Card"
> +	depends on PCMCIA
> +	---help---
> +	  This driver is for the one or two channel CPC-CARD cards from
> +	  EMS Dr. Thomas Wuensche (http://www.ems-wuensche.de).
> +
>   config CAN_EMS_PCI
>   	tristate "EMS CPC-PCI, CPC-PCIe and CPC-104P Card"
>   	depends on PCI
> diff -u -r -N a/drivers/net/can/sja1000/Makefile b/drivers/net/can/sja1000/Makefile
> --- a/drivers/net/can/sja1000/Makefile	2011-09-23 18:02:38.595750534 +0200
> +++ b/drivers/net/can/sja1000/Makefile	2011-09-23 18:02:28.695751113 +0200
> @@ -6,6 +6,7 @@
>   obj-$(CONFIG_CAN_SJA1000_ISA) += sja1000_isa.o
>   obj-$(CONFIG_CAN_SJA1000_PLATFORM) += sja1000_platform.o
>   obj-$(CONFIG_CAN_SJA1000_OF_PLATFORM) += sja1000_of_platform.o
> +obj-$(CONFIG_CAN_EMS_PCMCIA) += ems_pcmcia.o
>   obj-$(CONFIG_CAN_EMS_PCI) += ems_pci.o
>   obj-$(CONFIG_CAN_KVASER_PCI) += kvaser_pci.o
>   obj-$(CONFIG_CAN_PEAK_PCI) += peak_pci.o
> diff -u -r -N a/drivers/net/can/sja1000/ems_pcmcia.c b/drivers/net/can/sja1000/ems_pcmcia.c
> --- a/drivers/net/can/sja1000/ems_pcmcia.c	1970-01-01 01:00:00.000000000 +0100
> +++ b/drivers/net/can/sja1000/ems_pcmcia.c	2011-09-23 18:13:59.227726972 +0200
> @@ -0,0 +1,331 @@
> +/*
> + * Copyright (C) 2008 Sebastian Haas (initial chardev implementation)
> + * Copyright (C) 2010 Markus Plessing<plessing-zsNKPWJ8Pib6hrUXjxyGrA@public.gmane.org>
> + * Rework for mainline by Oliver Hartkopp<socketcan-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the version 2 of the GNU General Public License
> + * as published by the Free Software Foundation
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + */
> +
> +#include<linux/kernel.h>
> +#include<linux/module.h>
> +#include<linux/interrupt.h>
> +#include<linux/netdevice.h>
> +#include<linux/delay.h>
> +#include<linux/io.h>
> +#include<pcmcia/cistpl.h>
> +#include<pcmcia/ds.h>
> +#include<linux/can.h>
> +#include<linux/can/dev.h>
> +#include "sja1000.h"
> +
> +#define DRV_NAME "ems_pcmcia"
> +
> +MODULE_AUTHOR("Markus Plessing<plessing-zsNKPWJ8Pib6hrUXjxyGrA@public.gmane.org>");
> +MODULE_DESCRIPTION("Socket-CAN driver for EMS CPC-CARD cards");
> +MODULE_SUPPORTED_DEVICE("EMS CPC-CARD CAN card");
> +MODULE_LICENSE("GPL v2");
> +
> +#define EMS_PCMCIA_MAX_CHAN 2
> +
> +struct ems_pcmcia_card {
> +	int channels;
> +	struct pcmcia_device *pcmcia_dev;
> +	struct net_device *net_dev[EMS_PCMCIA_MAX_CHAN];
> +	void __iomem *base_addr;
> +};
> +
> +#define EMS_PCMCIA_CAN_CLOCK (16000000 / 2)
> +
> +/*
> + * The board configuration is probably following:
> + * RX1 is connected to ground.
> + * TX1 is not connected.
> + * CLKO is not connected.
> + * Setting the OCR register to 0xDA is a good idea.
> + * This means  normal output mode , push-pull and the correct polarity.
> + */
> +#define EMS_PCMCIA_OCR (OCR_TX0_PUSHPULL | OCR_TX1_PUSHPULL)
> +
> +/*
> + * In the CDR register, you should set CBP to 1.
> + * You will probably also want to set the clock divider value to 7
> + * (meaning direct oscillator output) because the second SJA1000 chip
> + * is driven by the first one CLKOUT output.
> + */
> +#define EMS_PCMCIA_CDR (CDR_CBP | CDR_CLKOUT_MASK)
> +#define EMS_PCMCIA_MEM_SIZE 4096 /* Size of the remapped io-memory */
> +#define EMS_PCMCIA_CAN_BASE_OFFSET 0x100 /* Offset where controllers starts */
> +#define EMS_PCMCIA_CAN_CTRL_SIZE 0x80 /* Memory size for each controller */
> +
> +#define EMS_CMD_RESET 0x00 /* Perform a reset of the card */
> +#define EMS_CMD_MAP   0x03 /* Map CAN controllers into card' memory */
> +#define EMS_CMD_UMAP  0x02 /* Unmap CAN controllers from card' memory */
> +
> +static struct pcmcia_device_id ems_pcmcia_tbl[] = {
> +	PCMCIA_DEVICE_PROD_ID123("EMS_T_W", "CPC-Card", "V2.0", 0xeab1ea23,
> +				 0xa338573f, 0xe4575800),
> +	PCMCIA_DEVICE_NULL,
> +};
> +
> +MODULE_DEVICE_TABLE(pcmcia, ems_pcmcia_tbl);
> +
> +static u8 ems_pcmcia_read_reg(const struct sja1000_priv *priv, int port)
> +{
> +	return readb(priv->reg_base + port);
> +}
> +
> +static void ems_pcmcia_write_reg(const struct sja1000_priv *priv, int port,
> +				 u8 val)
> +{
> +	writeb(val, priv->reg_base + port);
> +}
> +
> +static irqreturn_t ems_pcmcia_interrupt(int irq, void *dev_id)
> +{
> +	struct ems_pcmcia_card *card = dev_id;
> +	struct net_device *dev;
> +	irqreturn_t retval = IRQ_NONE;
> +	int i, again;
> +
> +	/* Card not present */
> +	if (readw(card->base_addr) != 0xAA55)
> +		return IRQ_HANDLED;
> +
> +	do {
> +		again = 0;
> +
> +		/* Check interrupt for each channel */
> +		for (i = 0; i<  card->channels; i++) {
> +			dev = card->net_dev[i];
> +			if (!dev)
> +				continue;
> +
> +			if (sja1000_interrupt(irq, dev) == IRQ_HANDLED)
> +				again = 1;
> +		}
> +		/* At least one channel handled the interrupt */
> +		if (again)
> +			retval = IRQ_HANDLED;
> +
> +	} while (again);
> +
> +	return retval;
> +}
> +
> +/*
> + * Check if a CAN controller is present at the specified location
> + * by trying to set 'em into the PeliCAN mode
> + */
> +static inline int ems_pcmcia_check_chan(struct sja1000_priv *priv)
> +{
> +	/* Make sure SJA1000 is in reset mode */
> +	ems_pcmcia_write_reg(priv, REG_MOD, 1);
> +	ems_pcmcia_write_reg(priv, REG_CDR, CDR_PELICAN);
> +
> +	/* read reset-values */
> +	if (ems_pcmcia_read_reg(priv, REG_CDR) == CDR_PELICAN)
> +		return 1;
> +
> +	return 0;
> +}
> +
> +static void ems_pcmcia_del_card(struct pcmcia_device *pdev)
> +{
> +	struct ems_pcmcia_card *card = pdev->priv;
> +	struct net_device *dev;
> +	int i;
> +
> +	free_irq(pdev->irq, card);
> +
> +	for (i = 0; i<  card->channels; i++) {
> +		dev = card->net_dev[i];
> +		if (!dev)
> +			continue;
> +
> +		printk(KERN_INFO "%s: removing %s on channel #%d\n",
> +		       DRV_NAME, dev->name, i);
> +		unregister_sja1000dev(dev);
> +		free_sja1000dev(dev);
> +	}
> +
> +	writeb(EMS_CMD_UMAP, card->base_addr);
> +	iounmap(card->base_addr);
> +	kfree(card);
> +
> +	pdev->priv = NULL;
> +}
> +
> +/*
> + * Probe PCI device for EMS CAN signature and register each available
> + * CAN channel to SJA1000 Socket-CAN subsystem.
> + */
> +static int __devinit ems_pcmcia_add_card(struct pcmcia_device *pdev,
> +					 unsigned long base)
> +{
> +	struct sja1000_priv *priv;
> +	struct net_device *dev;
> +	struct ems_pcmcia_card *card;
> +	int err, i;
> +
> +	/* Allocating card structures to hold addresses, ... */
> +	card = kzalloc(sizeof(struct ems_pcmcia_card), GFP_KERNEL);
> +	if (!card)
> +		return -ENOMEM;
> +
> +	pdev->priv = card;
> +	card->channels = 0;
> +
> +	card->base_addr = ioremap(base, EMS_PCMCIA_MEM_SIZE);
> +	if (!card->base_addr) {
> +		err = -ENOMEM;
> +		goto failure_cleanup;
> +	}
> +
> +	/* Check for unique EMS CAN signature */
> +	if (readw(card->base_addr) != 0xAA55) {
> +		err = -ENODEV;
> +		goto failure_cleanup;
> +	}
> +
> +	/* Request board reset */
> +	writeb(EMS_CMD_RESET, card->base_addr);
> +
> +	/* Make sure CAN controllers are mapped into card's memory space */
> +	writeb(EMS_CMD_MAP, card->base_addr);
> +
> +	/* Detect available channels */
> +	for (i = 0; i<  EMS_PCMCIA_MAX_CHAN; i++) {
> +		dev = alloc_sja1000dev(0);
> +		if (!dev) {
> +			err = -ENOMEM;
> +			goto failure_cleanup;
> +		}
> +
> +		card->net_dev[i] = dev;
> +		priv = netdev_priv(dev);
> +		priv->priv = card;
> +		SET_NETDEV_DEV(dev,&pdev->dev);
> +
> +		priv->irq_flags = IRQF_SHARED;
> +		dev->irq = pdev->irq;
> +		priv->reg_base = card->base_addr + EMS_PCMCIA_CAN_BASE_OFFSET +
> +			(i * EMS_PCMCIA_CAN_CTRL_SIZE);
> +
> +		/* Check if channel is present */
> +		if (ems_pcmcia_check_chan(priv)) {
> +			priv->read_reg  = ems_pcmcia_read_reg;
> +			priv->write_reg = ems_pcmcia_write_reg;
> +			priv->can.clock.freq = EMS_PCMCIA_CAN_CLOCK;
> +			priv->ocr = EMS_PCMCIA_OCR;
> +			priv->cdr = EMS_PCMCIA_CDR;
> +			priv->flags |= SJA1000_CUSTOM_IRQ_HANDLER;
> +
> +			/* Register SJA1000 device */
> +			err = register_sja1000dev(dev);
> +			if (err) {
> +				free_sja1000dev(dev);
> +				goto failure_cleanup;
> +			}
> +
> +			card->channels++;
> +
> +			printk(KERN_INFO "%s: registered %s on channel "
> +			       "#%d at 0x%p, irq %d\n", DRV_NAME, dev->name,
> +			       i, priv->reg_base, dev->irq);
> +		} else
> +			free_sja1000dev(dev);
> +	}
> +
> +	err = request_irq(dev->irq,&ems_pcmcia_interrupt, IRQF_SHARED,
> +			  DRV_NAME, card);
> +	if (!err)
> +		return 0;
> +
> +failure_cleanup:
> +	ems_pcmcia_del_card(pdev);
> +	return err;
> +}
> +
> +/*
> + * Setup PCMCIA socket and probe for EMS CPC-CARD
> + */
> +static int __devinit ems_pcmcia_probe(struct pcmcia_device *dev)
> +{
> +	int csval;
> +
> +	/* General socket configuration */
> +	dev->config_flags |= CONF_ENABLE_IRQ;
> +	dev->config_index = 1;
> +	dev->config_regs = PRESENT_OPTION;
> +
> +	/* The io structure describes IO port mapping */
> +	dev->resource[0]->end = 16;
> +	dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
> +	dev->resource[1]->end = 16;
> +	dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_16;
> +	dev->io_lines = 5;
> +
> +	/* Allocate a memory window */
> +	dev->resource[2]->flags =
> +		(WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE);
> +	dev->resource[2]->start = dev->resource[2]->end = 0;
> +
> +	csval = pcmcia_request_window(dev, dev->resource[2], 0);
> +	if (csval) {
> +		dev_err(&dev->dev, "pcmcia_request_window failed (err=%d)\n",
> +			csval);
> +		return 0;
> +	}
> +
> +	csval = pcmcia_map_mem_page(dev, dev->resource[2], dev->config_base);
> +	if (csval) {
> +		dev_err(&dev->dev, "pcmcia_map_mem_page failed (err=%d)\n",
> +			csval);
> +		return 0;
> +	}
> +
> +	csval = pcmcia_enable_device(dev);
> +	if (csval) {
> +		dev_err(&dev->dev, "pcmcia_enable_device failed (err=%d)\n",
> +			csval);
> +		return 0;
> +	}
> +
> +	ems_pcmcia_add_card(dev, dev->resource[2]->start);
> +	return 0;
> +}
> +
> +/*
> + * Release claimed resources
> + */
> +static void ems_pcmcia_remove(struct pcmcia_device *dev)
> +{
> +	ems_pcmcia_del_card(dev);
> +	pcmcia_disable_device(dev);
> +}
> +
> +static struct pcmcia_driver ems_pcmcia_driver = {
> +	.name = DRV_NAME,
> +	.probe = ems_pcmcia_probe,
> +	.remove = ems_pcmcia_remove,
> +	.id_table = ems_pcmcia_tbl,
> +};
> +
> +static int __init ems_pcmcia_init(void)
> +{
> +	return pcmcia_register_driver(&ems_pcmcia_driver);
> +}
> +module_init(ems_pcmcia_init);
> +
> +static void __exit ems_pcmcia_exit(void)
> +{
> +	pcmcia_unregister_driver(&ems_pcmcia_driver);
> +}
> +module_exit(ems_pcmcia_exit);

-- 
EMS Dr. Thomas Wuensche e.K.
Sonnenhang 3
85304 Ilmmuenster
HRA Neuburg a.d. Donau, HR-Nr. 70.106
Phone: +49-8441-490260
Fax  : +49-8441-81860
http://www.ems-wuensche.com

^ permalink raw reply

* Re: Introducing open source MSTP daemon
From: Vitalii Demianets @ 2011-09-28  9:56 UTC (permalink / raw)
  To: David Lamparter; +Cc: bridge, netdev, Srinivas M.A., Stephen Hemminger
In-Reply-To: <20110922163939.GB1012103@jupiter.n2.diac24.net>

On Thursday 22 September 2011 19:39:40 David Lamparter wrote:
>
> I assume it works with current Linux kernel bridge code on a RSTP level?
> The code looks considerably more maintainable than rstpd :) - I will try
> running it later!
>

Ok, now it works with kernel bridge code and you can evaluate it.

mstpd sends all the state changes in the CIST to the kernel bridge, so it 
works for the (R)STP cases as expected. Checked it by connecting two bridges: 
one running mstpd and another running rstpd and in-kernel stp. In both cases 
mstpd code behaves reasonably. Not checked in more complex setups though.

Also mstpd translates to the bridge code fdb flushing events and changes 
ageing time (for the rapid ageing case).

-- 
Vitalii Demianets

^ permalink raw reply

* Re: [PATCH] tcp: properly update lost_cnt_hint during shifting
From: Ilpo Järvinen @ 2011-09-28  9:50 UTC (permalink / raw)
  To: Yan, Zheng; +Cc: netdev@vger.kernel.org, Nandita Dukkipati
In-Reply-To: <4E82E5B5.1050206@intel.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 5132 bytes --]

On Wed, 28 Sep 2011, Yan, Zheng wrote:

> On 09/28/2011 04:55 PM, Yan, Zheng wrote:
> > On 09/28/2011 04:17 PM, Ilpo Järvinen wrote:
> >> On Wed, 28 Sep 2011, Yan, Zheng wrote:
> >>
> >>> lost_skb_hint is used by tcp_mark_head_lost() to mark the first
> >>> unhandled skb. lost_cnt_hint is the number of sacked packets before
> >>> the lost_skb_hint. tcp_shifted_skb() shouldn't increase lost_cnt_hint
> >>> when shifting a sacked skb that is before the lost_skb_hint, because
> >>> packets in it are already counted.
> >>>
> >>> Signed-off-by: Zheng Yan <zheng.z.yan@intel.com>
> >>> ---
> >>> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
> >>> index 21fab3e..f712ace 100644
> >>> --- a/net/ipv4/tcp_input.c
> >>> +++ b/net/ipv4/tcp_input.c
> >>> @@ -1390,9 +1390,14 @@ static int tcp_shifted_skb(struct sock *sk, struct sk_buff *skb,
> >>>  	BUG_ON(!pcount);
> >>>  
> >>>  	/* Tweak before seqno plays */
> >>> -	if (!tcp_is_fack(tp) && tcp_is_sack(tp) && tp->lost_skb_hint &&
> >>> -	    !before(TCP_SKB_CB(tp->lost_skb_hint)->seq, TCP_SKB_CB(skb)->seq))
> >>> -		tp->lost_cnt_hint += pcount;
> >>> +	if (!tcp_is_fack(tp) && tcp_is_sack(tp) && tp->lost_skb_hint) {
> >>> +		if (skb == tp->lost_skb_hint)
> >>> +			tp->lost_cnt_hint += pcount;
> >>> +		else if (!(TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED) &&
> >>> +			 before(TCP_SKB_CB(skb)->seq,
> >>> +				TCP_SKB_CB(tp->lost_skb_hint)->seq))
> >>> +			tp->lost_cnt_hint += pcount;
> >>> +	}
> >>
> >> Ah right, the hole filled case which shifts not only the newly SACKed 
> >> skb but also the next, already SACKed skb?
> >>
> >> I fail to see why you needed to change !before into two checks though:
> >>  skb == tp->lost_skb_hint and before(params reversed) ? Shouldn't the 
> >> equality that is provided by the negation cover for the == check (and the 
> >> params reversion isn't necessary in any case)? In fact, isn't the skb == 
> >> tp->lost_skb_hint check strictly wrong without the same TCPCB_SACKED_ACKED 
> >> guard (though I'm not sure, I didn't check, if the hint can ever point to 
> >> such a segment in the first place)?
> > 
> > Thanks you for your reply.
> > 
> > skb == tp->lost_skb_hint is special.
> > 
> > If the skb is sacked and we shift 'pcount' packets to previous skb,
> > these packets will not be counted by future tcp_mark_head_lost() call.
> > So we should increase lost_cnt_hint.
> > 
> > If the skb is not sacked, the skb will be sacked soon by tcp_sacktag_one(),
> > So we should not increase lost_cnt_hint.
> > 
> > I didn't think out the second case. I think the correct patch should be:
> > ---
> > 
> > diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
> > index 21fab3e..dcc2411 100644
> > --- a/net/ipv4/tcp_input.c
> > +++ b/net/ipv4/tcp_input.c
> > @@ -1390,9 +1390,15 @@ static int tcp_shifted_skb(struct sock *sk, struct sk_buff *skb,
> >  	BUG_ON(!pcount);
> >  
> >  	/* Tweak before seqno plays */
> > -	if (!tcp_is_fack(tp) && tcp_is_sack(tp) && tp->lost_skb_hint &&
> > -	    !before(TCP_SKB_CB(tp->lost_skb_hint)->seq, TCP_SKB_CB(skb)->seq))
> > -		tp->lost_cnt_hint += pcount;
> > +	if (!tcp_is_fack(tp) && tcp_is_sack(tp) && tp->lost_skb_hint) {
> > +		if ((TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED) &&
> > +		    skb == tp->lost_skb_hint)
> > +			tp->lost_cnt_hint += pcount;
> > +		else if (!(TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED) &&
> > +			 before(TCP_SKB_CB(skb)->seq,
> > +				TCP_SKB_CB(tp->lost_skb_hint)->seq))
> > +			tp->lost_cnt_hint += pcount;
> > +	}
> >  
> >  	TCP_SKB_CB(prev)->end_seq += shifted;
> >  	TCP_SKB_CB(skb)->seq += shifted;
> > ---
> 
> Sorry, I didn't think out the "skb before lost_skb_hint" case neither.
> If the skb isn't sacked, tcp_sacktag_one() will increase the lost_cnt_hint.
> So tcp_shifted_skb() shouldn't adjust the the lost_cnt_hint.
> 
> I hope my patch is correct this time.
> 
> ---
> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
> index 21fab3e..697ce5f 100644
> --- a/net/ipv4/tcp_input.c
> +++ b/net/ipv4/tcp_input.c
> @@ -1390,8 +1390,8 @@ static int tcp_shifted_skb(struct sock *sk, struct sk_buff *skb,
>  	BUG_ON(!pcount);
>  
>  	/* Tweak before seqno plays */
> -	if (!tcp_is_fack(tp) && tcp_is_sack(tp) && tp->lost_skb_hint &&
> -	    !before(TCP_SKB_CB(tp->lost_skb_hint)->seq, TCP_SKB_CB(skb)->seq))
> +	if (!tcp_is_fack(tp) && tcp_is_sack(tp) && tp->lost_skb_hint == skb &&
> +	    (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED))
>  		tp->lost_cnt_hint += pcount;
>  
>  	TCP_SKB_CB(prev)->end_seq += shifted;

Hehe, besides not spotting all this, I also made another mistake in my 
last post. It seems that this code has been quite broken from the 
beginning or we still lack some detail. ...But the latest change certainly 
seems more reasonable than the previous code of mine if I've successfully 
understood enough pieces. These hints, although providing significant 
performance benefits, are really pain to get right :-).

But is the non-SACKed case really handled right when hint == skb by the 
sacktag_one. We move the seqno in between and then before(x->newseq, 
x->newseq) check returns false?


-- 
 i.

^ permalink raw reply

* Re: [PATCH] tcp: properly update lost_cnt_hint during shifting
From: Yan, Zheng @ 2011-09-28  9:15 UTC (permalink / raw)
  To: Ilpo Järvinen; +Cc: netdev@vger.kernel.org, Nandita Dukkipati
In-Reply-To: <4E82E0EE.1050600@intel.com>

On 09/28/2011 04:55 PM, Yan, Zheng wrote:
> On 09/28/2011 04:17 PM, Ilpo Järvinen wrote:
>> On Wed, 28 Sep 2011, Yan, Zheng wrote:
>>
>>> lost_skb_hint is used by tcp_mark_head_lost() to mark the first
>>> unhandled skb. lost_cnt_hint is the number of sacked packets before
>>> the lost_skb_hint. tcp_shifted_skb() shouldn't increase lost_cnt_hint
>>> when shifting a sacked skb that is before the lost_skb_hint, because
>>> packets in it are already counted.
>>>
>>> Signed-off-by: Zheng Yan <zheng.z.yan@intel.com>
>>> ---
>>> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
>>> index 21fab3e..f712ace 100644
>>> --- a/net/ipv4/tcp_input.c
>>> +++ b/net/ipv4/tcp_input.c
>>> @@ -1390,9 +1390,14 @@ static int tcp_shifted_skb(struct sock *sk, struct sk_buff *skb,
>>>  	BUG_ON(!pcount);
>>>  
>>>  	/* Tweak before seqno plays */
>>> -	if (!tcp_is_fack(tp) && tcp_is_sack(tp) && tp->lost_skb_hint &&
>>> -	    !before(TCP_SKB_CB(tp->lost_skb_hint)->seq, TCP_SKB_CB(skb)->seq))
>>> -		tp->lost_cnt_hint += pcount;
>>> +	if (!tcp_is_fack(tp) && tcp_is_sack(tp) && tp->lost_skb_hint) {
>>> +		if (skb == tp->lost_skb_hint)
>>> +			tp->lost_cnt_hint += pcount;
>>> +		else if (!(TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED) &&
>>> +			 before(TCP_SKB_CB(skb)->seq,
>>> +				TCP_SKB_CB(tp->lost_skb_hint)->seq))
>>> +			tp->lost_cnt_hint += pcount;
>>> +	}
>>
>> Ah right, the hole filled case which shifts not only the newly SACKed 
>> skb but also the next, already SACKed skb?
>>
>> I fail to see why you needed to change !before into two checks though:
>>  skb == tp->lost_skb_hint and before(params reversed) ? Shouldn't the 
>> equality that is provided by the negation cover for the == check (and the 
>> params reversion isn't necessary in any case)? In fact, isn't the skb == 
>> tp->lost_skb_hint check strictly wrong without the same TCPCB_SACKED_ACKED 
>> guard (though I'm not sure, I didn't check, if the hint can ever point to 
>> such a segment in the first place)?
> 
> Thanks you for your reply.
> 
> skb == tp->lost_skb_hint is special.
> 
> If the skb is sacked and we shift 'pcount' packets to previous skb,
> these packets will not be counted by future tcp_mark_head_lost() call.
> So we should increase lost_cnt_hint.
> 
> If the skb is not sacked, the skb will be sacked soon by tcp_sacktag_one(),
> So we should not increase lost_cnt_hint.
> 
> I didn't think out the second case. I think the correct patch should be:
> ---
> 
> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
> index 21fab3e..dcc2411 100644
> --- a/net/ipv4/tcp_input.c
> +++ b/net/ipv4/tcp_input.c
> @@ -1390,9 +1390,15 @@ static int tcp_shifted_skb(struct sock *sk, struct sk_buff *skb,
>  	BUG_ON(!pcount);
>  
>  	/* Tweak before seqno plays */
> -	if (!tcp_is_fack(tp) && tcp_is_sack(tp) && tp->lost_skb_hint &&
> -	    !before(TCP_SKB_CB(tp->lost_skb_hint)->seq, TCP_SKB_CB(skb)->seq))
> -		tp->lost_cnt_hint += pcount;
> +	if (!tcp_is_fack(tp) && tcp_is_sack(tp) && tp->lost_skb_hint) {
> +		if ((TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED) &&
> +		    skb == tp->lost_skb_hint)
> +			tp->lost_cnt_hint += pcount;
> +		else if (!(TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED) &&
> +			 before(TCP_SKB_CB(skb)->seq,
> +				TCP_SKB_CB(tp->lost_skb_hint)->seq))
> +			tp->lost_cnt_hint += pcount;
> +	}
>  
>  	TCP_SKB_CB(prev)->end_seq += shifted;
>  	TCP_SKB_CB(skb)->seq += shifted;
> ---

Sorry, I didn't think out the "skb before lost_skb_hint" case neither.
If the skb isn't sacked, tcp_sacktag_one() will increase the lost_cnt_hint.
So tcp_shifted_skb() shouldn't adjust the the lost_cnt_hint.

I hope my patch is correct this time.

---
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 21fab3e..697ce5f 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1390,8 +1390,8 @@ static int tcp_shifted_skb(struct sock *sk, struct sk_buff *skb,
 	BUG_ON(!pcount);
 
 	/* Tweak before seqno plays */
-	if (!tcp_is_fack(tp) && tcp_is_sack(tp) && tp->lost_skb_hint &&
-	    !before(TCP_SKB_CB(tp->lost_skb_hint)->seq, TCP_SKB_CB(skb)->seq))
+	if (!tcp_is_fack(tp) && tcp_is_sack(tp) && tp->lost_skb_hint == skb &&
+	    (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED))
 		tp->lost_cnt_hint += pcount;
 
 	TCP_SKB_CB(prev)->end_seq += shifted;

^ permalink raw reply related

* HTB TC Problem up 800 - 2000 class
From: Jan Kozel @ 2011-09-28  9:08 UTC (permalink / raw)
  To: netdev
In-Reply-To: <4E82E0AF.1020709@neviol.cz>

     Hi

  I have a problem I use the TC HTB and IFB. Shaper limits absolutely 
without any problems until 1GB/ps throughput, but only for about 750 
clients. At a time when the state tables for TC and  MAMGLE exceeds 1000 
clients thewill be the load average to 0.7 and bandwidth shaper is 
rapidly reduced and drops down to 200Mb. I attach the script for the 
first clients. You do not have anyone experiences that for 2000 and more 
restrictions?

# downlink eth1
/sbin/tc qdisc add dev eth1 handle 1: root htb default 99 r2q 1800
# uplink eth0
/sbin/tc qdisc add dev eth0 handle 1: root htb default 99 r2q 1800
/sbin/tc class add dev eth1 parent 1:0 classid 1:2 htb rate 1240kbit ceil 1240kbit quantum 103 prio 1
/sbin/tc class add dev eth0 parent 1:0 classid 1:2 htb rate 1240kbit ceil 1240kbit quantum 103 prio 1
/sbin/tc class add dev eth1 parent 1:0 classid 1:1 htb rate 999000kbit ceil 999040kbit quantum 83253 prio 1
/sbin/tc class add dev eth0 parent 1:0 classid 1:1 htb rate 999000kbit ceil 999040kbit quantum 83253 prio 1
/sbin/tc class add dev eth1 parent 1:1 classid 1:3 htb rate 2560kbit ceil 2560kbit quantum 213 prio 1
/sbin/tc class add dev eth0 parent 1:1 classid 1:3 htb rate 2560kbit ceil 2560kbit quantum 213 prio 1
/sbin/tc class add dev eth1 parent 1:2 classid 1:4 htb rate 2560kbit ceil 2560kbit quantum 213 prio 1
/sbin/tc class add dev eth0 parent 1:2 classid 1:4 htb rate 2560kbit ceil 2560kbit quantum 213 prio 1
/sbin/tc class add dev eth1 parent 1:1 classid 1:10 htb rate 1000kbit ceil 1001kbit quantum 83 prio 1
/sbin/tc class add dev eth0 parent 1:1 classid 1:10 htb rate 1000kbit ceil 1001kbit quantum 83 prio 1
# Jednolivi klienti -- rychlsoti
echo Aktivuji IP 94.229.95.162
/sbin/tc class add dev eth1 parent 1:1 classid 1:1686 htb rate 800kbit ceil 8000kbit quantum 666 prio 1
/sbin/tc qdisc add dev eth1 parent 1:1686 handle 1686 esfq
/sbin/tc filter add dev eth1 protocol ip parent 1: prio 1 u32 match ip dst 94.229.95.162 flowid 1:1686 action mirred egress redirect dev ifb0

/sbin/tc class add dev eth0 parent 1:1 classid 1:3336 htb rate 204kbit ceil 2048kbit quantum 170 prio 1
/sbin/tc qdisc add dev eth0 parent 1:3336 handle 3336 esfq
/usr/src/iptables-1.4.3.2/iptables -t mangle -A POSTROUTING -s 94.229.95.162 -j MARK --set-mark 3336
/sbin/tc filter add dev eth0 parent 1:0 prio 1 protocol ip handle 3336 fw flowid 1:3336


echo Aktivuji IP 192.168.1.2
/sbin/tc class add dev eth1 parent 1:1 classid 1:107 htb rate 30000kbit ceil 300000kbit quantum 25000 prio 1
/sbin/tc qdisc add dev eth1 parent 1:107 handle 107 esfq
/sbin/tc filter add dev eth1 protocol ip parent 1: prio 1 u32 match ip dst 192.168.1.2 flowid 1:107 action mirred egress redirect dev ifb0

/sbin/tc class add dev eth0 parent 1:1 classid 1:1757 htb rate 30000kbit ceil 300000kbit quantum 25000 prio 1
/sbin/tc qdisc add dev eth0 parent 1:1757 handle 1757 esfq
/usr/src/iptables-1.4.3.2/iptables -t mangle -A POSTROUTING -s 192.168.1.2 -j MARK --set-mark 1757
/sbin/tc filter add dev eth0 parent 1:0 prio 1 protocol ip handle 1757 fw flowid 1:1757

	thank you

		Kozel Jan


-- 

^ permalink raw reply

* Re: [PATCH] tcp: properly update lost_cnt_hint during shifting
From: Yan, Zheng @ 2011-09-28  8:55 UTC (permalink / raw)
  To: Ilpo Järvinen; +Cc: netdev@vger.kernel.org, Nandita Dukkipati
In-Reply-To: <alpine.DEB.2.00.1109281103410.21709@wel-95.cs.helsinki.fi>

On 09/28/2011 04:17 PM, Ilpo Järvinen wrote:
> On Wed, 28 Sep 2011, Yan, Zheng wrote:
> 
>> lost_skb_hint is used by tcp_mark_head_lost() to mark the first
>> unhandled skb. lost_cnt_hint is the number of sacked packets before
>> the lost_skb_hint. tcp_shifted_skb() shouldn't increase lost_cnt_hint
>> when shifting a sacked skb that is before the lost_skb_hint, because
>> packets in it are already counted.
>>
>> Signed-off-by: Zheng Yan <zheng.z.yan@intel.com>
>> ---
>> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
>> index 21fab3e..f712ace 100644
>> --- a/net/ipv4/tcp_input.c
>> +++ b/net/ipv4/tcp_input.c
>> @@ -1390,9 +1390,14 @@ static int tcp_shifted_skb(struct sock *sk, struct sk_buff *skb,
>>  	BUG_ON(!pcount);
>>  
>>  	/* Tweak before seqno plays */
>> -	if (!tcp_is_fack(tp) && tcp_is_sack(tp) && tp->lost_skb_hint &&
>> -	    !before(TCP_SKB_CB(tp->lost_skb_hint)->seq, TCP_SKB_CB(skb)->seq))
>> -		tp->lost_cnt_hint += pcount;
>> +	if (!tcp_is_fack(tp) && tcp_is_sack(tp) && tp->lost_skb_hint) {
>> +		if (skb == tp->lost_skb_hint)
>> +			tp->lost_cnt_hint += pcount;
>> +		else if (!(TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED) &&
>> +			 before(TCP_SKB_CB(skb)->seq,
>> +				TCP_SKB_CB(tp->lost_skb_hint)->seq))
>> +			tp->lost_cnt_hint += pcount;
>> +	}
> 
> Ah right, the hole filled case which shifts not only the newly SACKed 
> skb but also the next, already SACKed skb?
> 
> I fail to see why you needed to change !before into two checks though:
>  skb == tp->lost_skb_hint and before(params reversed) ? Shouldn't the 
> equality that is provided by the negation cover for the == check (and the 
> params reversion isn't necessary in any case)? In fact, isn't the skb == 
> tp->lost_skb_hint check strictly wrong without the same TCPCB_SACKED_ACKED 
> guard (though I'm not sure, I didn't check, if the hint can ever point to 
> such a segment in the first place)?

Thanks you for your reply.

skb == tp->lost_skb_hint is special.

If the skb is sacked and we shift 'pcount' packets to previous skb,
these packets will not be counted by future tcp_mark_head_lost() call.
So we should increase lost_cnt_hint.

If the skb is not sacked, the skb will be sacked soon by tcp_sacktag_one(),
So we should not increase lost_cnt_hint.

I didn't think out the second case. I think the correct patch should be:
---

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 21fab3e..dcc2411 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1390,9 +1390,15 @@ static int tcp_shifted_skb(struct sock *sk, struct sk_buff *skb,
 	BUG_ON(!pcount);
 
 	/* Tweak before seqno plays */
-	if (!tcp_is_fack(tp) && tcp_is_sack(tp) && tp->lost_skb_hint &&
-	    !before(TCP_SKB_CB(tp->lost_skb_hint)->seq, TCP_SKB_CB(skb)->seq))
-		tp->lost_cnt_hint += pcount;
+	if (!tcp_is_fack(tp) && tcp_is_sack(tp) && tp->lost_skb_hint) {
+		if ((TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED) &&
+		    skb == tp->lost_skb_hint)
+			tp->lost_cnt_hint += pcount;
+		else if (!(TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED) &&
+			 before(TCP_SKB_CB(skb)->seq,
+				TCP_SKB_CB(tp->lost_skb_hint)->seq))
+			tp->lost_cnt_hint += pcount;
+	}
 
 	TCP_SKB_CB(prev)->end_seq += shifted;
 	TCP_SKB_CB(skb)->seq += shifted;
---


> 
> Added Cc to Nandita as they're hunting (possibly other) bug in 
> tcp_mark_head_lost.
> 

^ permalink raw reply related

* [PATCH v3] net/flow: Fix potential memory leak
From: Huajun Li @ 2011-09-28  8:51 UTC (permalink / raw)
  To: David Miller; +Cc: Eric Dumazet, netdev, Huajun Li

While preparing net flow caches, once a fail may cause potential
memory leak , fix it.


Signed-off-by: Huajun Li <huajun.li.lee@gmail.com>
---
 net/core/flow.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/net/core/flow.c b/net/core/flow.c
index 555a456..8ae42de 100644
--- a/net/core/flow.c
+++ b/net/core/flow.c
@@ -413,7 +413,7 @@ static int __init flow_cache_init(struct flow_cache *fc)

 	for_each_online_cpu(i) {
 		if (flow_cache_cpu_prepare(fc, i))
-			return -ENOMEM;
+			goto err;
 	}
 	fc->hotcpu_notifier = (struct notifier_block){
 		.notifier_call = flow_cache_cpu,
@@ -426,6 +426,18 @@ static int __init flow_cache_init(struct flow_cache *fc)
 	add_timer(&fc->rnd_timer);

 	return 0;
+
+err:
+	for_each_possible_cpu(i) {
+		struct flow_cache_percpu *fcp = per_cpu_ptr(fc->percpu, i);
+		kfree(fcp->hash_table);
+		fcp->hash_table = NULL;
+	}
+
+	free_percpu(fc->percpu);
+	fc->percpu = NULL;
+
+	return -ENOMEM;
 }

 static int __init flow_cache_init_global(void)
-- 
1.7.4.1

^ permalink raw reply related

* linux-next: build failure after merge of the moduleh tree
From: Stephen Rothwell @ 2011-09-28  8:35 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: linux-next, linux-kernel, Kalle Valo, Vasanthakumar Thiagarajan,
	Raja Mani, Vivek Natarajan, Suraj Sumangala, Joe Perches,
	Jouni Malinen, John W. Linville, David Miller, netdev

Hi Paul,

After merging the moduleh tree, today's linux-next build (x86_64
allmodconfig) failed like this:

drivers/net/wireless/ath/ath6kl/init.c:27:26: error: expected ')' before 'uint'

Caused by commit bdcd81707973 ("Add ath6kl cleaned up driver") from the
net tree interacting with the module.h split up.

I have applied the following patch for today (which sould be applied to
the net or wireless trees).

>From 1875bfc8881cca3064c7d7fad024555fe1652926 Mon Sep 17 00:00:00 2001
From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Wed, 28 Sep 2011 18:32:34 +1000
Subject: [PATCH] wireless/ath6kl: use of module_param requires the inclusion
 of moduleparam.h

Otheriwse the module.h split up fails like this:

drivers/net/wireless/ath/ath6kl/init.c:27:26: error: expected ')' before 'uint'

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 drivers/net/wireless/ath/ath6kl/init.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c
index 9d10322..8552da0 100644
--- a/drivers/net/wireless/ath/ath6kl/init.c
+++ b/drivers/net/wireless/ath/ath6kl/init.c
@@ -15,6 +15,7 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#include <linux/moduleparam.h>
 #include <linux/mmc/sdio_func.h>
 #include "core.h"
 #include "cfg80211.h"
-- 
1.7.6.3

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply related

* linux-next: build failure after merge of the moduleh tree
From: Stephen Rothwell @ 2011-09-28  8:25 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: linux-next, linux-kernel, Stefan Assmann, Larry Finger,
	John W. Linville, David Miller, netdev

Hi Paul,

After merging the moduleh tree, today's linux-next build (x86_64
allmodconfig) failed like this:

drivers/net/wireless/rtlwifi/debug.c:32:21: error: expected ')' before 'uint'
drivers/net/wireless/rtlwifi/debug.c:33:25: error: expected ')' before string constant

Caused by commit b5be7e4c8f7b ("rtlwifi: add module parameter to set
global debug level") from the net tree interacting with the module.h
split up.

I have applied the following patch for today (and it could be applied to
the net or wireless trees).

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Wed, 28 Sep 2011 18:21:47 +1000
Subject: [PATCH] rtlwifi: use of module_param requires the inclusion of
 moduleparam.h

Otherwise the module.h split up will fail like this:

drivers/net/wireless/rtlwifi/debug.c:32:21: error: expected ')' before 'uint'
drivers/net/wireless/rtlwifi/debug.c:33:25: error: expected ')' before string constant

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 drivers/net/wireless/rtlwifi/debug.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/debug.c b/drivers/net/wireless/rtlwifi/debug.c
index b2f897a..e69aba9 100644
--- a/drivers/net/wireless/rtlwifi/debug.c
+++ b/drivers/net/wireless/rtlwifi/debug.c
@@ -26,6 +26,8 @@
  * Larry Finger <Larry.Finger@lwfinger.net>
  *****************************************************************************/
 
+#include <linux/moduleparam.h>
+
 #include "wifi.h"
 
 static unsigned int debug = DBG_EMERG;
-- 
1.7.6.3

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply related

* Re: [PATCH net-next 0/3] ptp: feature enhancements
From: David Miller @ 2011-09-28  8:17 UTC (permalink / raw)
  To: richardcochran; +Cc: netdev
In-Reply-To: <20110928080023.GB6670@netboy.at.omicron.at>

From: Richard Cochran <richardcochran@gmail.com>
Date: Wed, 28 Sep 2011 10:00:24 +0200

> On Mon, Sep 26, 2011 at 04:04:43PM -0400, David Miller wrote:
>> Could you please add a test at the point where we pull in the
>> ->tx_type value from the user, to make sure it is one of the
>> validly defined HWTSTAMP_TX_FOO values?
> 
> Okay, will do. Any chance of getting the bug fixes in for 3.1?

I plan to try to get them into the next round.

^ permalink raw reply

* Re: [PATCH] tcp: properly update lost_cnt_hint during shifting
From: Ilpo Järvinen @ 2011-09-28  8:17 UTC (permalink / raw)
  To: Yan, Zheng; +Cc: netdev@vger.kernel.org, Nandita Dukkipati
In-Reply-To: <4E82C0DD.6010304@intel.com>

On Wed, 28 Sep 2011, Yan, Zheng wrote:

> lost_skb_hint is used by tcp_mark_head_lost() to mark the first
> unhandled skb. lost_cnt_hint is the number of sacked packets before
> the lost_skb_hint. tcp_shifted_skb() shouldn't increase lost_cnt_hint
> when shifting a sacked skb that is before the lost_skb_hint, because
> packets in it are already counted.
> 
> Signed-off-by: Zheng Yan <zheng.z.yan@intel.com>
> ---
> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
> index 21fab3e..f712ace 100644
> --- a/net/ipv4/tcp_input.c
> +++ b/net/ipv4/tcp_input.c
> @@ -1390,9 +1390,14 @@ static int tcp_shifted_skb(struct sock *sk, struct sk_buff *skb,
>  	BUG_ON(!pcount);
>  
>  	/* Tweak before seqno plays */
> -	if (!tcp_is_fack(tp) && tcp_is_sack(tp) && tp->lost_skb_hint &&
> -	    !before(TCP_SKB_CB(tp->lost_skb_hint)->seq, TCP_SKB_CB(skb)->seq))
> -		tp->lost_cnt_hint += pcount;
> +	if (!tcp_is_fack(tp) && tcp_is_sack(tp) && tp->lost_skb_hint) {
> +		if (skb == tp->lost_skb_hint)
> +			tp->lost_cnt_hint += pcount;
> +		else if (!(TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED) &&
> +			 before(TCP_SKB_CB(skb)->seq,
> +				TCP_SKB_CB(tp->lost_skb_hint)->seq))
> +			tp->lost_cnt_hint += pcount;
> +	}

Ah right, the hole filled case which shifts not only the newly SACKed 
skb but also the next, already SACKed skb?

I fail to see why you needed to change !before into two checks though:
 skb == tp->lost_skb_hint and before(params reversed) ? Shouldn't the 
equality that is provided by the negation cover for the == check (and the 
params reversion isn't necessary in any case)? In fact, isn't the skb == 
tp->lost_skb_hint check strictly wrong without the same TCPCB_SACKED_ACKED 
guard (though I'm not sure, I didn't check, if the hint can ever point to 
such a segment in the first place)?

Added Cc to Nandita as they're hunting (possibly other) bug in 
tcp_mark_head_lost.

-- 
 i.

^ permalink raw reply

* Re: [PATCH 1/2] net/fec: replace hardcoded irq num with macro.
From: Xiao Jiang @ 2011-09-28  8:09 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-kernel
In-Reply-To: <20110928.032419.2113734655470772752.davem@davemloft.net>

David Miller wrote:
> Please respin these patches against net-next, where the FEC driver
> lives in a different directory.
>
> Thanks.
>   
Got it.

Thanks,
Xiao Jiang

^ permalink raw reply

* Re: [PATCH net-next 0/3] ptp: feature enhancements
From: Richard Cochran @ 2011-09-28  8:00 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <20110926.160443.1205173553442138535.davem@davemloft.net>

On Mon, Sep 26, 2011 at 04:04:43PM -0400, David Miller wrote:
> Could you please add a test at the point where we pull in the
> ->tx_type value from the user, to make sure it is one of the
> validly defined HWTSTAMP_TX_FOO values?

Okay, will do. Any chance of getting the bug fixes in for 3.1?

Thanks,
Richard

^ permalink raw reply

* [PATCH 3/3] net: sh_eth: move the asm/sh_eth.h to include/linux/
From: Yoshihiro Shimoda @ 2011-09-28  7:49 UTC (permalink / raw)
  To: davem, Paul Mundt; +Cc: netdev, SH-Linux

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 This patch is for net-next.

 arch/sh/include/asm/sh_eth.h          |   25 -------------------------
 drivers/net/ethernet/renesas/sh_eth.c |    1 +
 drivers/net/ethernet/renesas/sh_eth.h |    8 --------
 include/linux/sh_eth.h                |   25 +++++++++++++++++++++++++
 4 files changed, 26 insertions(+), 33 deletions(-)
 delete mode 100644 arch/sh/include/asm/sh_eth.h
 create mode 100644 include/linux/sh_eth.h

diff --git a/arch/sh/include/asm/sh_eth.h b/arch/sh/include/asm/sh_eth.h
deleted file mode 100644
index 2076acf..0000000
--- a/arch/sh/include/asm/sh_eth.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef __ASM_SH_ETH_H__
-#define __ASM_SH_ETH_H__
-
-#include <linux/phy.h>
-
-enum {EDMAC_LITTLE_ENDIAN, EDMAC_BIG_ENDIAN};
-enum {
-	SH_ETH_REG_GIGABIT,
-	SH_ETH_REG_FAST_SH4,
-	SH_ETH_REG_FAST_SH3_SH2
-};
-
-struct sh_eth_plat_data {
-	int phy;
-	int edmac_endian;
-	int register_type;
-	phy_interface_t phy_interface;
-	void (*set_mdio_gate)(void *addr);
-
-	unsigned char mac_addr[6];
-	unsigned no_ether_link:1;
-	unsigned ether_link_active_low:1;
-};
-
-#endif
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 38ccda5..6aa0704 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -35,6 +35,7 @@
 #include <linux/pm_runtime.h>
 #include <linux/slab.h>
 #include <linux/ethtool.h>
+#include <linux/sh_eth.h>

 #include "sh_eth.h"

diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
index 78e586e..47877b1 100644
--- a/drivers/net/ethernet/renesas/sh_eth.h
+++ b/drivers/net/ethernet/renesas/sh_eth.h
@@ -23,14 +23,6 @@
 #ifndef __SH_ETH_H__
 #define __SH_ETH_H__

-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/spinlock.h>
-#include <linux/netdevice.h>
-#include <linux/phy.h>
-
-#include <asm/sh_eth.h>
-
 #define CARDNAME	"sh-eth"
 #define TX_TIMEOUT	(5*HZ)
 #define TX_RING_SIZE	64	/* Tx ring size */
diff --git a/include/linux/sh_eth.h b/include/linux/sh_eth.h
new file mode 100644
index 0000000..2076acf
--- /dev/null
+++ b/include/linux/sh_eth.h
@@ -0,0 +1,25 @@
+#ifndef __ASM_SH_ETH_H__
+#define __ASM_SH_ETH_H__
+
+#include <linux/phy.h>
+
+enum {EDMAC_LITTLE_ENDIAN, EDMAC_BIG_ENDIAN};
+enum {
+	SH_ETH_REG_GIGABIT,
+	SH_ETH_REG_FAST_SH4,
+	SH_ETH_REG_FAST_SH3_SH2
+};
+
+struct sh_eth_plat_data {
+	int phy;
+	int edmac_endian;
+	int register_type;
+	phy_interface_t phy_interface;
+	void (*set_mdio_gate)(void *addr);
+
+	unsigned char mac_addr[6];
+	unsigned no_ether_link:1;
+	unsigned ether_link_active_low:1;
+};
+
+#endif
-- 
1.7.1


^ permalink raw reply related

* [PATCH 2/3] sh: modify prototype in sh_eth.h
From: Yoshihiro Shimoda @ 2011-09-28  7:49 UTC (permalink / raw)
  To: Paul Mundt; +Cc: SH-Linux, netdev

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 arch/sh/include/asm/sh_eth.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/sh/include/asm/sh_eth.h b/arch/sh/include/asm/sh_eth.h
index 0f325da..2076acf 100644
--- a/arch/sh/include/asm/sh_eth.h
+++ b/arch/sh/include/asm/sh_eth.h
@@ -15,7 +15,7 @@ struct sh_eth_plat_data {
 	int edmac_endian;
 	int register_type;
 	phy_interface_t phy_interface;
-	void (*set_mdio_gate)(unsigned long addr);
+	void (*set_mdio_gate)(void *addr);

 	unsigned char mac_addr[6];
 	unsigned no_ether_link:1;
-- 
1.7.1


^ permalink raw reply related

* [PATCH 1/3] net: sh_eth: use ioremap()
From: Yoshihiro Shimoda @ 2011-09-28  7:48 UTC (permalink / raw)
  To: davem; +Cc: netdev, SH-Linux

This patch also changes writel/readl to iowrite32/ioread32.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 This patch is for net-next.

 drivers/net/ethernet/renesas/sh_eth.c |   38 ++++++++++++++++++++------------
 drivers/net/ethernet/renesas/sh_eth.h |    9 ++++---
 2 files changed, 29 insertions(+), 18 deletions(-)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 4479a45..38ccda5 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -155,18 +155,18 @@ static void sh_eth_chip_reset_giga(struct net_device *ndev)

 	/* save MAHR and MALR */
 	for (i = 0; i < 2; i++) {
-		malr[i] = readl(GIGA_MALR(i));
-		mahr[i] = readl(GIGA_MAHR(i));
+		malr[i] = ioread32((void *)GIGA_MALR(i));
+		mahr[i] = ioread32((void *)GIGA_MAHR(i));
 	}

 	/* reset device */
-	writel(ARSTR_ARSTR, SH_GIGA_ETH_BASE + 0x1800);
+	iowrite32(ARSTR_ARSTR, (void *)(SH_GIGA_ETH_BASE + 0x1800));
 	mdelay(1);

 	/* restore MAHR and MALR */
 	for (i = 0; i < 2; i++) {
-		writel(malr[i], GIGA_MALR(i));
-		writel(mahr[i], GIGA_MAHR(i));
+		iowrite32(malr[i], (void *)GIGA_MALR(i));
+		iowrite32(mahr[i], (void *)GIGA_MAHR(i));
 	}
 }

@@ -515,9 +515,9 @@ static unsigned long sh_eth_get_edtrr_trns(struct sh_eth_private *mdp)
 }

 struct bb_info {
-	void (*set_gate)(unsigned long addr);
+	void (*set_gate)(void *addr);
 	struct mdiobb_ctrl ctrl;
-	u32 addr;
+	void *addr;
 	u32 mmd_msk;/* MMD */
 	u32 mdo_msk;
 	u32 mdi_msk;
@@ -525,21 +525,21 @@ struct bb_info {
 };

 /* PHY bit set */
-static void bb_set(u32 addr, u32 msk)
+static void bb_set(void *addr, u32 msk)
 {
-	writel(readl(addr) | msk, addr);
+	iowrite32(ioread32(addr) | msk, addr);
 }

 /* PHY bit clear */
-static void bb_clr(u32 addr, u32 msk)
+static void bb_clr(void *addr, u32 msk)
 {
-	writel((readl(addr) & ~msk), addr);
+	iowrite32((ioread32(addr) & ~msk), addr);
 }

 /* PHY bit read */
-static int bb_read(u32 addr, u32 msk)
+static int bb_read(void *addr, u32 msk)
 {
-	return (readl(addr) & msk) != 0;
+	return (ioread32(addr) & msk) != 0;
 }

 /* Data I/O pin control */
@@ -1680,7 +1680,7 @@ static int sh_mdio_init(struct net_device *ndev, int id,
 	}

 	/* bitbang init */
-	bitbang->addr = ndev->base_addr + mdp->reg_offset[PIR];
+	bitbang->addr = mdp->addr + mdp->reg_offset[PIR];
 	bitbang->set_gate = pd->set_mdio_gate;
 	bitbang->mdi_msk = 0x08;
 	bitbang->mdo_msk = 0x04;
@@ -1812,6 +1812,13 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
 	ether_setup(ndev);

 	mdp = netdev_priv(ndev);
+	mdp->addr = ioremap(res->start, resource_size(res));
+	if (mdp->addr == NULL) {
+		ret = -ENOMEM;
+		dev_err(&pdev->dev, "ioremap failed.\n");
+		goto out_release;
+	}
+
 	spin_lock_init(&mdp->lock);
 	mdp->pdev = pdev;
 	pm_runtime_enable(&pdev->dev);
@@ -1892,6 +1899,8 @@ out_unregister:

 out_release:
 	/* net_dev free */
+	if (mdp && mdp->addr)
+		iounmap(mdp->addr);
 	if (mdp && mdp->tsu_addr)
 		iounmap(mdp->tsu_addr);
 	if (ndev)
@@ -1910,6 +1919,7 @@ static int sh_eth_drv_remove(struct platform_device *pdev)
 	sh_mdio_release(ndev);
 	unregister_netdev(ndev);
 	pm_runtime_disable(&pdev->dev);
+	iounmap(mdp->addr);
 	free_netdev(ndev);
 	platform_set_drvdata(pdev, NULL);

diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
index c3048a6..78e586e 100644
--- a/drivers/net/ethernet/renesas/sh_eth.h
+++ b/drivers/net/ethernet/renesas/sh_eth.h
@@ -762,6 +762,7 @@ struct sh_eth_private {
 	struct platform_device *pdev;
 	struct sh_eth_cpu_data *cd;
 	const u16 *reg_offset;
+	void __iomem *addr;
 	void __iomem *tsu_addr;
 	dma_addr_t rx_desc_dma;
 	dma_addr_t tx_desc_dma;
@@ -811,7 +812,7 @@ static inline void sh_eth_write(struct net_device *ndev, unsigned long data,
 {
 	struct sh_eth_private *mdp = netdev_priv(ndev);

-	writel(data, ndev->base_addr + mdp->reg_offset[enum_index]);
+	iowrite32(data, mdp->addr + mdp->reg_offset[enum_index]);
 }

 static inline unsigned long sh_eth_read(struct net_device *ndev,
@@ -819,19 +820,19 @@ static inline unsigned long sh_eth_read(struct net_device *ndev,
 {
 	struct sh_eth_private *mdp = netdev_priv(ndev);

-	return readl(ndev->base_addr + mdp->reg_offset[enum_index]);
+	return ioread32(mdp->addr + mdp->reg_offset[enum_index]);
 }

 static inline void sh_eth_tsu_write(struct sh_eth_private *mdp,
 				unsigned long data, int enum_index)
 {
-	writel(data, mdp->tsu_addr + mdp->reg_offset[enum_index]);
+	iowrite32(data, mdp->tsu_addr + mdp->reg_offset[enum_index]);
 }

 static inline unsigned long sh_eth_tsu_read(struct sh_eth_private *mdp,
 					int enum_index)
 {
-	return readl(mdp->tsu_addr + mdp->reg_offset[enum_index]);
+	return ioread32(mdp->tsu_addr + mdp->reg_offset[enum_index]);
 }

 #endif	/* #ifndef __SH_ETH_H__ */
-- 
1.7.1

^ permalink raw reply related

* Re: __pskb_pull_tail oops from 2.6.35
From: Julian Anastasov @ 2011-09-28  7:30 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Dave Jones, David Miller, netdev
In-Reply-To: <1317155839.2472.5.camel@edumazet-laptop>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1946 bytes --]


	Hello,

On Tue, 27 Sep 2011, Eric Dumazet wrote:

> Le mardi 27 septembre 2011 à 16:24 -0400, Dave Jones a écrit :
> > On Tue, Sep 27, 2011 at 04:18:48PM -0400, David Miller wrote:
> >  > From: Dave Jones <davej@redhat.com>
> >  > Date: Tue, 27 Sep 2011 16:15:00 -0400
> >  > 
> >  > > It looks like it died in put_page..
> >  > > 
> >  > > <1>[  262.574991] IP: [<ffffffff810dca57>] put_page+0x10/0x7c
> >  > > 
> >  > > which is only called in one place..
> >  > > 
> >  > > 1267         for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
> >  > > 1268                 if (skb_shinfo(skb)->frags[i].size <= eat) {
> >  > > 1269                         put_page(skb_shinfo(skb)->frags[i].page);
> >  > > 1270                         eat -= skb_shinfo(skb)->frags[i].size;
> >  > > 1271                 } else {
> >  > 
> >  > That's a pretty serious corruption, all frag array entries from 0 to
> >  > nr_frags should have valid, non-NULL page pointers.
> >  > 
> >  > Maybe a LRO/GRO bug?  There were a couple of those.
> > 
> > I'll see if I can talk him into trying a self-built kernel, as we're not
> > rebasing f14 at this point in its life-cycle. If it turns out to still affect
> > 3.x, I'll bring it up again.
> > 
> 
> This could be a struct skb_shared_info -> nr_frags corruption
> 
> (Something was overflowing skb head and overflowing very beginning of
> skb_shared_info in rare circumstances)
> 
> We had such bug in the past, I cant remember details right now.

	I remember for similar problem that was fixed
recently (IPVS+nf_reinject), oops is here:

http://marc.info/?l=linux-virtual-server&m=131098073717449&w=2

	Oops points to put_page but not sure for the call trace.
Code auditing pointed out to be a double kfree_skb issue. Still,
it was never confirmed by the original reporter. May be
problem with double kfree_skb is easier to track in all
modules that play with the packet.

Regards

--
Julian Anastasov <ja@ssi.bg>

^ permalink raw reply

* Re: [PATCH v2 2/3] netdev/of/phy: Add MDIO bus multiplexer support.
From: Michał Mirosław @ 2011-09-28  7:25 UTC (permalink / raw)
  To: David Daney; +Cc: devicetree-discuss, grant.likely, linux-kernel, netdev, davem
In-Reply-To: <1317166015-20714-3-git-send-email-david.daney@cavium.com>

2011/9/28 David Daney <david.daney@cavium.com>:
[...]
> +Example :
> +
> +       /* The parent MDIO bus. */
> +       smi1: mdio@1180000001900 {
> +               compatible = "cavium,octeon-3860-mdio";
> +               #address-cells = <1>;
> +               #size-cells = <0>;
> +               reg = <0x11800 0x00001900 0x0 0x40>;
> +       };
> +
> +       /*
> +          An NXP sn74cbtlv3253 dual 1-of-4 switch controlled by a
> +          pair of GPIO lines.  Child busses 2 and 3 populated with 4
> +          PHYs each.
> +        */
> +       mdio-mux {
> +               compatible = "cavium,mdio-mux-sn74cbtlv3253", "cavium,mdio-mux";
> +               gpios = <&gpio1 3 0>, <&gpio1 4 0>;
> +               mdio-parent-bus = <&smi1>;
> +               #address-cells = <1>;
> +               #size-cells = <0>;

This should probably have 'compatible = "nxp,sn74cbtlv3253";' here.

Best Regards,
Michał Mirosław

^ permalink raw reply

* Re: [PATCH 1/2] net/fec: replace hardcoded irq num with macro.
From: David Miller @ 2011-09-28  7:24 UTC (permalink / raw)
  To: jgq516; +Cc: netdev, linux-kernel
In-Reply-To: <1316830784-17108-1-git-send-email-jgq516@gmail.com>


Please respin these patches against net-next, where the FEC driver
lives in a different directory.

Thanks.

^ permalink raw reply

* Re: [patch] usbnet: add timestamping support
From: David Miller @ 2011-09-28  7:20 UTC (permalink / raw)
  To: michael; +Cc: netdev, oneukum
In-Reply-To: <20110921121151.Horde.2_LlPML8999Oebhn0-QlTpA@webmail.df.eu>

From: Michael Riesch <michael@riesch.at>
Date: Wed, 21 Sep 2011 12:11:51 +0200

> @@ -238,6 +238,10 @@ void usbnet_skb_return (struct usbnet *dev,
> struct sk_buff *skb)

Patch is severly corrupted by your email client.

Correct this (see Documentation/email-clients.txt), send a test patch
to yourself, and only resubmit this change when you can successfully
apply a patch you send to youself.

^ permalink raw reply

* about bmac/mace/macmace/mac89x0/cs89x0: Move the Macintosh (Apple) drivers
From: Sascha Hauer @ 2011-09-28  7:04 UTC (permalink / raw)
  To: Jeff Kirsher
  Cc: Paul Mackerras, Russell Nelson, netdev, davem, Jaccon Bastiaansen

Hi,

> commit 8fb6b0908176704a3ea22005e8a9fa3ebf35b5be
> Author: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> Date:   Mon May 16 01:39:01 2011 -0700
>
>    bmac/mace/macmace/mac89x0/cs89x0: Move the Macintosh (Apple) drivers
>
>    Move the Apple drivers into driver/net/ethernet/apple/ and make the
>    necessary Kconfig and Makefile changes.

This commit moves drivers/net/cs89x0.[ch] to drivers/net/ethernet/apple/.

This is wrong. The cs89x0 driver is a general ISA driver and is also
used on some embedded boards. This patch should only move drivers/net/mac89x0.c
which basically is a driver for the same device but used on Macintosh.

I think it should go to drivers/net/ethernet/cirrus instead.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply

* Re: [net-next 0/7] bna: H/W enablement and update driver version to 3.0.2.2
From: David Miller @ 2011-09-28  6:59 UTC (permalink / raw)
  To: rmody; +Cc: netdev, adapter_linux_open_src_team
In-Reply-To: <1317155951-17242-1-git-send-email-rmody@brocade.com>

From: Rasesh Mody <rmody@brocade.com>
Date: Tue, 27 Sep 2011 13:39:04 -0700

> Hi Dave,
> 
>    The following series is re-submitted. These patches add support for
>    Brocade-1860 Fabric Adapter and address the comments received from
>    upstream community.
> 
>    It updates the Brocade BNA driver to v3.0.2.2.
> 
>    The driver has been compiled & tested against net-next-2.6(3.0.0-rc7).

All applied, thanks.

^ 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