* Re: [PATCH 3/5] HID: roccat: declaring meaning of pack pragma usage in driver headers
From: Greg KH @ 2010-12-02 15:16 UTC (permalink / raw)
To: Jiri Kosina
Cc: Greg KH, Ben Hutchings, erazor_de, Randy Dunlap, linux-doc,
linux-kernel, linux-input, netdev
In-Reply-To: <alpine.LNX.2.00.1012021604110.14806@pobox.suse.cz>
On Thu, Dec 02, 2010 at 04:04:35PM +0100, Jiri Kosina wrote:
> On Tue, 30 Nov 2010, Greg KH wrote:
>
> > > > Using pack pragma to prevent padding bytes in binary data structures
> > > > used for hardware communication. Explanation of these pragmas was requested.
> > > [...]
> > >
> > > It would be clearer to use the '__packed' macro after each structure
> > > definition instead of using this awful Microsoft extension.
> >
> > I agree, that's the "normal" Linux way of doing things.
> >
> > Other than that, this patch set looks good to me. Jiri, if the packed
> > change is made, do you want me to take these through my tree, or do you
> > want to take them through yours? Whatever is easier for you is fine
> > with me.
>
> Hi Greg,
>
> as this is part of larger roccat patchset, I will be processing it through
> my tree once completely reviewed.
Great, feel free to add my:
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
to the driver core changes.
thanks,
greg k-h
^ permalink raw reply
* TCP: big bursts due to undos resulting from reordering
From: Lennart Schulte @ 2010-12-02 15:36 UTC (permalink / raw)
To: netdev@vger.kernel.org; +Cc: Ilpo Järvinen, John Heffner
Hi John, hi Ilpo,
at the moment I look on many TCP plots with reordering. When reordering
occurs there are some spurious retransmissions which are later undone by
e.g. DSACKs. This undo results in a very big burst of packets when
tp->reordering is high, since the function tcp_max_burst() returns
tp->reordering.
This behavior was introduced because of a bug when using SACK instead of
Reno. The thread concerning this fix can be found at [1].
Before the patch, which results from this thread, Linux has done a burst
of 3 packets and then slow started to the undone ssthresh value, which
is a much better way of handling an undo then it is after the patch.
Also I patched a kernel to use the old max_burst value of 3 again to see
if it has any effect. Then I set up some virtual nodes and emulated a
network with netem as it was done in the thread.
The settings are:
- RTT 40ms
- no congestion, application sending rate 20 Mbps
- forward path: reordering rate 20%, reordering delay 20ms
- timestamps on
Until now I have not found any evidence that the problem occurs (perhaps
because I don't get the settings right, since in the thread there is no
information concerning the settings for reordering and also the ones of
the sysctls).
My problem is to understand why the patch was necessary and under what
circumstances SACK has a lower throughput so that it may be possible for
me to find another way of fixing this without introducing and old bug.
Since I can't figure it out on my own I hope to get some insights this
way :)
Thanks,
Lennart Schulte
[1] http://marc.info/?t=120728958000004&r=2&w=2
^ permalink raw reply
* kernel panic with time-stamping in phy devices (monitor mode)
From: Andrew Watts @ 2010-12-02 16:05 UTC (permalink / raw)
To: netdev
Hi.
The 'time stamping in phy devices' code introduced in 2.6.36
(c1f19b51d1d87f3e3bb7e6648f43f7d57ed2da6b et al.) triggers
kernel panics when wireless devices are placed in monitor mode
(tested with b43 and ath5k devices on a 32-bit system).
To reproduce, set CONFIG_NETWORK_PHY_TIMESTAMPING=y and put a
wireless device into monitor mode:
# ifconfig wlan0 down
# iwconfig wlan0 mode monitor
# ifconfig wlan0 up
~ Andy
==============
[<c14455ad>] ? __alloc_skb+0x53/0xf8
[<f92fdd57>] ? b43_dma_rx+0x18a/0x342 [b43]
[<f92e8475>] ? b43_do_interrupt_thread+0x420/0x92e [b43]
[<c1027731>] ? __dequeue_entity+0x31/0x35
[<c1027a44>] ? set_next_entity+0xad/0xbb
[<f92e899b>] ? b43_interrupt_thread_handler+0x18/0x2b [b43]
[<c107c378>] ? irq_thread+0xb6/0x19e
[<c15625a0>] ? schedule+0x254/0x566
[<c107c2c2>] ? irq_thread+0x0/0x19e
[<c10448b1>] ? kthread+0x67/0x69
[<c104484a>] ? kthread+0x0/0x69
[<c100323e>] ? kernel_thread_helper+0x6/0x18
Code: 4c 24 14 8b 88 a8 00 00 00 89 4c 24 10 89 54 24 0c 8b
40 50 89 44 24 08 8b 45 04 89 44 24 04 c7 04 24 30 74 7a c1
e8 b5 d2 11 00 <0f> 0b eb fe 55 89 e5 56 53 83 ec 24 8b 88
a0 00 00 00 8b 58 54
EIP: [<c1444ea0>] skb_push+0x7d/0x81 SS:ESP 0068:cee01d78
---[ end trace af1c99818e62b195 ]---
Kernel panic - not syncing: Fatal exception in interrupt
Pid: 6674, comm: irq/18-b43 Tainted: G D 2.6.36.1
Call Trace:
[<c156217d>] ? printk+0x28/0x2a
[<c156205c>] panic+0x57/0x150
[<c1564adf>] oops_begin+0x0/0x40
[<c1004e36>] die+0x49/0x5d
[<c1564304>] do_trap+0x84/0xad
[<c10037e5>] ? do_invalid_op+0x0/0x93
[<c100386b>] do_invalid_op+0x86/0x93
[<c1444ea0>] ? skb_push+0x7d/0x81
[<c15640b9>] error_code+0x65/0x6c
[<c1444ea0>] ? skb_push+0x7d/0x81
[<c145f721>] ? skb_defer_rx_timestamp+0x12/0x5a
[<c145f721>] skb_defer_rx_timestamp+0x12/0x5a
[<c144d23c>] netif_receive_skb+0x1f/0x47
[<c153a6e8>] ieee80211_rx+0x661/0x8e1
[<f85daca2>] ? ssb_pci_read32+0x19/0x31 [ssb]
[<f92e54cf>] ? b43_tsf_read+0x2a/0x47 [b43]
[<f92f8d42>] b43_rx+0x24c/0x5eb [b43]
[<c14455ad>] ? __alloc_skb+0x53/0xf8
[<f92fdd57>] b43_dma_rx+0x18a/0x342 [b43]
[<f92e8475>] b43_do_interrupt_thread+0x420/0x92e [b43]
[<c1027731>] ? __dequeue_entity+0x31/0x35
[<c1027a44>] ? set_next_entity+0xad/0xbb
[<f92e899b>] b43_interrupt_thread_handler+0x18/0x2b [b43]
[<c107c378>] irq_thread+0xb6/0x19e
[<c15625a0>] ? schedule+0x254/0x566
[<c107c2c2>] ? irq_thread+0x0/0x19e
[<c10448b1>] kthread+0x67/0x69
[<c104484a>] ? kthread+0x0/0x69
[<c100323e>] kernel_thread_helper+0x6/0x18
^ permalink raw reply
* Re: PCI: make pci_restore_state return void
From: Bjorn Helgaas @ 2010-12-02 16:15 UTC (permalink / raw)
To: Jon Mason
Cc: Jesse Barnes, linux-pci, Jonathan Corbet, linux-media,
Andrew Gallatin, Brice Goglin, netdev,
Solarflare linux maintainers, Steve Hodgson, Ben Hutchings,
Stephen Hemminger, Ivo van Doorn, Gertjan van Wingerde,
linux-wireless, Brian King, Anil Ravindranath, linux-scsi,
Jaya Kumar, boyod.yang
In-Reply-To: <1291160606-31494-1-git-send-email-jon.mason@exar.com>
On Tuesday, November 30, 2010 04:43:26 pm Jon Mason wrote:
> pci_restore_state only ever returns 0, thus there is no benefit in
> having it return any value. Also, a large majority of the callers do
> not check the return code of pci_restore_state. Make the
> pci_restore_state a void return and avoid the overhead.
>
> Signed-off-by: Jon Mason <jon.mason@exar.com>
Looks reasonable to me, but doesn't appear to be a regression fix or
anything urgent that needs to be in .37, so I'll wait and let Jesse
handle this when he returns from vacation. OK?
Bjorn
> ---
> drivers/media/video/cafe_ccic.c | 4 +---
> drivers/net/myri10ge/myri10ge.c | 4 +---
> drivers/net/sfc/falcon.c | 25 +++++--------------------
> drivers/net/skge.c | 4 +---
> drivers/net/sky2.c | 5 +----
> drivers/net/wireless/rt2x00/rt2x00pci.c | 4 ++--
> drivers/pci/pci-driver.c | 3 ++-
> drivers/pci/pci.c | 7 ++-----
> drivers/scsi/ipr.c | 8 +-------
> drivers/scsi/pmcraid.c | 7 +------
> drivers/staging/sm7xx/smtcfb.c | 2 +-
> include/linux/pci.h | 8 +++-----
> sound/pci/cs5535audio/cs5535audio_pm.c | 7 +------
> 13 files changed, 22 insertions(+), 66 deletions(-)
>
> diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c
> index 2934770..3e653f3 100644
> --- a/drivers/media/video/cafe_ccic.c
> +++ b/drivers/media/video/cafe_ccic.c
> @@ -2186,9 +2186,7 @@ static int cafe_pci_resume(struct pci_dev *pdev)
> struct cafe_camera *cam = to_cam(v4l2_dev);
> int ret = 0;
>
> - ret = pci_restore_state(pdev);
> - if (ret)
> - return ret;
> + pci_restore_state(pdev);
> ret = pci_enable_device(pdev);
>
> if (ret) {
> diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
> index 8524cc4..d3c4a37 100644
> --- a/drivers/net/myri10ge/myri10ge.c
> +++ b/drivers/net/myri10ge/myri10ge.c
> @@ -3403,9 +3403,7 @@ static int myri10ge_resume(struct pci_dev *pdev)
> return -EIO;
> }
>
> - status = pci_restore_state(pdev);
> - if (status)
> - return status;
> + pci_restore_state(pdev);
>
> status = pci_enable_device(pdev);
> if (status) {
> diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c
> index 267019b..1763b9a 100644
> --- a/drivers/net/sfc/falcon.c
> +++ b/drivers/net/sfc/falcon.c
> @@ -1066,22 +1066,9 @@ static int falcon_reset_hw(struct efx_nic *efx, enum reset_type method)
>
> /* Restore PCI configuration if needed */
> if (method == RESET_TYPE_WORLD) {
> - if (efx_nic_is_dual_func(efx)) {
> - rc = pci_restore_state(nic_data->pci_dev2);
> - if (rc) {
> - netif_err(efx, drv, efx->net_dev,
> - "failed to restore PCI config for "
> - "the secondary function\n");
> - goto fail3;
> - }
> - }
> - rc = pci_restore_state(efx->pci_dev);
> - if (rc) {
> - netif_err(efx, drv, efx->net_dev,
> - "failed to restore PCI config for the "
> - "primary function\n");
> - goto fail4;
> - }
> + if (efx_nic_is_dual_func(efx))
> + pci_restore_state(nic_data->pci_dev2);
> + pci_restore_state(efx->pci_dev);
> netif_dbg(efx, drv, efx->net_dev,
> "successfully restored PCI config\n");
> }
> @@ -1092,7 +1079,7 @@ static int falcon_reset_hw(struct efx_nic *efx, enum reset_type method)
> rc = -ETIMEDOUT;
> netif_err(efx, hw, efx->net_dev,
> "timed out waiting for hardware reset\n");
> - goto fail5;
> + goto fail3;
> }
> netif_dbg(efx, hw, efx->net_dev, "hardware reset complete\n");
>
> @@ -1100,11 +1087,9 @@ static int falcon_reset_hw(struct efx_nic *efx, enum reset_type method)
>
> /* pci_save_state() and pci_restore_state() MUST be called in pairs */
> fail2:
> -fail3:
> pci_restore_state(efx->pci_dev);
> fail1:
> -fail4:
> -fail5:
> +fail3:
> return rc;
> }
>
> diff --git a/drivers/net/skge.c b/drivers/net/skge.c
> index 220e039..61553af 100644
> --- a/drivers/net/skge.c
> +++ b/drivers/net/skge.c
> @@ -4087,9 +4087,7 @@ static int skge_resume(struct pci_dev *pdev)
> if (err)
> goto out;
>
> - err = pci_restore_state(pdev);
> - if (err)
> - goto out;
> + pci_restore_state(pdev);
>
> err = skge_reset(hw);
> if (err)
> diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
> index d657708..be3aee7 100644
> --- a/drivers/net/sky2.c
> +++ b/drivers/net/sky2.c
> @@ -4969,10 +4969,7 @@ static int sky2_resume(struct pci_dev *pdev)
> if (err)
> goto out;
>
> - err = pci_restore_state(pdev);
> - if (err)
> - goto out;
> -
> + pci_restore_state(pdev);
> pci_enable_wake(pdev, PCI_D0, 0);
>
> /* Re-enable all clocks */
> diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c
> index 868ca19..5e3c46f 100644
> --- a/drivers/net/wireless/rt2x00/rt2x00pci.c
> +++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
> @@ -356,12 +356,12 @@ int rt2x00pci_resume(struct pci_dev *pci_dev)
> struct rt2x00_dev *rt2x00dev = hw->priv;
>
> if (pci_set_power_state(pci_dev, PCI_D0) ||
> - pci_enable_device(pci_dev) ||
> - pci_restore_state(pci_dev)) {
> + pci_enable_device(pci_dev)) {
> ERROR(rt2x00dev, "Failed to resume device.\n");
> return -EIO;
> }
>
> + pci_restore_state(pci_dev);
> return rt2x00lib_resume(rt2x00dev);
> }
> EXPORT_SYMBOL_GPL(rt2x00pci_resume);
> diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
> index 8a6f797..80e551e 100644
> --- a/drivers/pci/pci-driver.c
> +++ b/drivers/pci/pci-driver.c
> @@ -449,7 +449,8 @@ static int pci_restore_standard_config(struct pci_dev *pci_dev)
> return error;
> }
>
> - return pci_restore_state(pci_dev);
> + pci_restore_state(pci_dev);
> + return 0;
> }
>
> static void pci_pm_default_resume_early(struct pci_dev *pci_dev)
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index e98c810..c711d1b 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -937,14 +937,13 @@ pci_save_state(struct pci_dev *dev)
> * pci_restore_state - Restore the saved state of a PCI device
> * @dev: - PCI device that we're dealing with
> */
> -int
> -pci_restore_state(struct pci_dev *dev)
> +void pci_restore_state(struct pci_dev *dev)
> {
> int i;
> u32 val;
>
> if (!dev->state_saved)
> - return 0;
> + return;
>
> /* PCI Express register must be restored first */
> pci_restore_pcie_state(dev);
> @@ -968,8 +967,6 @@ pci_restore_state(struct pci_dev *dev)
> pci_restore_iov_state(dev);
>
> dev->state_saved = false;
> -
> - return 0;
> }
>
> static int do_pci_enable_device(struct pci_dev *dev, int bars)
> diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
> index fa60d7d..1d7dbe6 100644
> --- a/drivers/scsi/ipr.c
> +++ b/drivers/scsi/ipr.c
> @@ -7485,16 +7485,10 @@ static int ipr_reset_restore_cfg_space(struct ipr_cmnd *ipr_cmd)
> {
> struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
> volatile u32 int_reg;
> - int rc;
>
> ENTER;
> ioa_cfg->pdev->state_saved = true;
> - rc = pci_restore_state(ioa_cfg->pdev);
> -
> - if (rc != PCIBIOS_SUCCESSFUL) {
> - ipr_cmd->s.ioasa.hdr.ioasc = cpu_to_be32(IPR_IOASC_PCI_ACCESS_ERROR);
> - return IPR_RC_JOB_CONTINUE;
> - }
> + pci_restore_state(ioa_cfg->pdev);
>
> if (ipr_set_pcix_cmd_reg(ioa_cfg)) {
> ipr_cmd->s.ioasa.hdr.ioasc = cpu_to_be32(IPR_IOASC_PCI_ACCESS_ERROR);
> diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
> index cf89091..091baf2 100644
> --- a/drivers/scsi/pmcraid.c
> +++ b/drivers/scsi/pmcraid.c
> @@ -2227,12 +2227,7 @@ static void pmcraid_ioa_reset(struct pmcraid_cmd *cmd)
> /* Once either bist or pci reset is done, restore PCI config
> * space. If this fails, proceed with hard reset again
> */
> - if (pci_restore_state(pinstance->pdev)) {
> - pmcraid_info("config-space error resetting again\n");
> - pinstance->ioa_state = IOA_STATE_IN_RESET_ALERT;
> - pmcraid_reset_alert(cmd);
> - break;
> - }
> + pci_restore_state(pinstance->pdev);
>
> /* fail all pending commands */
> pmcraid_fail_outstanding_cmds(pinstance);
> diff --git a/drivers/staging/sm7xx/smtcfb.c b/drivers/staging/sm7xx/smtcfb.c
> index 24f47d6..7162dee 100644
> --- a/drivers/staging/sm7xx/smtcfb.c
> +++ b/drivers/staging/sm7xx/smtcfb.c
> @@ -1071,7 +1071,7 @@ static int __maybe_unused smtcfb_resume(struct pci_dev *pdev)
> /* when resuming, restore pci data and fb cursor */
> if (pdev->dev.power.power_state.event != PM_EVENT_FREEZE) {
> retv = pci_set_power_state(pdev, PCI_D0);
> - retv = pci_restore_state(pdev);
> + pci_restore_state(pdev);
> if (pci_enable_device(pdev))
> return -1;
> pci_set_master(pdev);
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 7454408..63cbadc 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -806,7 +806,7 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size);
>
> /* Power management related routines */
> int pci_save_state(struct pci_dev *dev);
> -int pci_restore_state(struct pci_dev *dev);
> +void pci_restore_state(struct pci_dev *dev);
> int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state);
> int pci_set_power_state(struct pci_dev *dev, pci_power_t state);
> pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state);
> @@ -1168,10 +1168,8 @@ static inline int pci_save_state(struct pci_dev *dev)
> return 0;
> }
>
> -static inline int pci_restore_state(struct pci_dev *dev)
> -{
> - return 0;
> -}
> +static inline void pci_restore_state(struct pci_dev *dev)
> +{ }
>
> static inline int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
> {
> diff --git a/sound/pci/cs5535audio/cs5535audio_pm.c b/sound/pci/cs5535audio/cs5535audio_pm.c
> index a3301cc..185b000 100644
> --- a/sound/pci/cs5535audio/cs5535audio_pm.c
> +++ b/sound/pci/cs5535audio/cs5535audio_pm.c
> @@ -90,12 +90,7 @@ int snd_cs5535audio_resume(struct pci_dev *pci)
> int i;
>
> pci_set_power_state(pci, PCI_D0);
> - if (pci_restore_state(pci) < 0) {
> - printk(KERN_ERR "cs5535audio: pci_restore_state failed, "
> - "disabling device\n");
> - snd_card_disconnect(card);
> - return -EIO;
> - }
> + pci_restore_state(pci);
> if (pci_enable_device(pci) < 0) {
> printk(KERN_ERR "cs5535audio: pci_enable_device failed, "
> "disabling device\n");
>
^ permalink raw reply
* Re: kernel panic with time-stamping in phy devices (monitor mode)
From: Eric Dumazet @ 2010-12-02 16:38 UTC (permalink / raw)
To: Andrew Watts; +Cc: netdev
In-Reply-To: <252997.92320.qm@web111013.mail.gq1.yahoo.com>
Le jeudi 02 décembre 2010 à 08:05 -0800, Andrew Watts a écrit :
> Hi.
>
> The 'time stamping in phy devices' code introduced in 2.6.36
> (c1f19b51d1d87f3e3bb7e6648f43f7d57ed2da6b et al.) triggers
> kernel panics when wireless devices are placed in monitor mode
> (tested with b43 and ath5k devices on a 32-bit system).
>
> To reproduce, set CONFIG_NETWORK_PHY_TIMESTAMPING=y and put a
> wireless device into monitor mode:
>
> # ifconfig wlan0 down
> # iwconfig wlan0 mode monitor
> # ifconfig wlan0 up
>
> ~ Andy
>
> ==============
>
> [<c14455ad>] ? __alloc_skb+0x53/0xf8
> [<f92fdd57>] ? b43_dma_rx+0x18a/0x342 [b43]
> [<f92e8475>] ? b43_do_interrupt_thread+0x420/0x92e [b43]
> [<c1027731>] ? __dequeue_entity+0x31/0x35
> [<c1027a44>] ? set_next_entity+0xad/0xbb
> [<f92e899b>] ? b43_interrupt_thread_handler+0x18/0x2b [b43]
> [<c107c378>] ? irq_thread+0xb6/0x19e
> [<c15625a0>] ? schedule+0x254/0x566
> [<c107c2c2>] ? irq_thread+0x0/0x19e
> [<c10448b1>] ? kthread+0x67/0x69
> [<c104484a>] ? kthread+0x0/0x69
> [<c100323e>] ? kernel_thread_helper+0x6/0x18
> Code: 4c 24 14 8b 88 a8 00 00 00 89 4c 24 10 89 54 24 0c 8b
> 40 50 89 44 24 08 8b 45 04 89 44 24 04 c7 04 24 30 74 7a c1
> e8 b5 d2 11 00 <0f> 0b eb fe 55 89 e5 56 53 83 ec 24 8b 88
> a0 00 00 00 8b 58 54
> EIP: [<c1444ea0>] skb_push+0x7d/0x81 SS:ESP 0068:cee01d78
> ---[ end trace af1c99818e62b195 ]---
> Kernel panic - not syncing: Fatal exception in interrupt
> Pid: 6674, comm: irq/18-b43 Tainted: G D 2.6.36.1
> Call Trace:
> [<c156217d>] ? printk+0x28/0x2a
> [<c156205c>] panic+0x57/0x150
> [<c1564adf>] oops_begin+0x0/0x40
> [<c1004e36>] die+0x49/0x5d
> [<c1564304>] do_trap+0x84/0xad
> [<c10037e5>] ? do_invalid_op+0x0/0x93
> [<c100386b>] do_invalid_op+0x86/0x93
> [<c1444ea0>] ? skb_push+0x7d/0x81
> [<c15640b9>] error_code+0x65/0x6c
> [<c1444ea0>] ? skb_push+0x7d/0x81
> [<c145f721>] ? skb_defer_rx_timestamp+0x12/0x5a
> [<c145f721>] skb_defer_rx_timestamp+0x12/0x5a
> [<c144d23c>] netif_receive_skb+0x1f/0x47
> [<c153a6e8>] ieee80211_rx+0x661/0x8e1
> [<f85daca2>] ? ssb_pci_read32+0x19/0x31 [ssb]
> [<f92e54cf>] ? b43_tsf_read+0x2a/0x47 [b43]
> [<f92f8d42>] b43_rx+0x24c/0x5eb [b43]
> [<c14455ad>] ? __alloc_skb+0x53/0xf8
> [<f92fdd57>] b43_dma_rx+0x18a/0x342 [b43]
> [<f92e8475>] b43_do_interrupt_thread+0x420/0x92e [b43]
> [<c1027731>] ? __dequeue_entity+0x31/0x35
> [<c1027a44>] ? set_next_entity+0xad/0xbb
> [<f92e899b>] b43_interrupt_thread_handler+0x18/0x2b [b43]
> [<c107c378>] irq_thread+0xb6/0x19e
> [<c15625a0>] ? schedule+0x254/0x566
> [<c107c2c2>] ? irq_thread+0x0/0x19e
> [<c10448b1>] kthread+0x67/0x69
> [<c104484a>] ? kthread+0x0/0x69
> [<c100323e>] kernel_thread_helper+0x6/0x18
>
>
Thanks for the report
Please try following patch.
diff --git a/net/core/timestamping.c b/net/core/timestamping.c
index dac7ed6..a710ab0 100644
--- a/net/core/timestamping.c
+++ b/net/core/timestamping.c
@@ -96,7 +96,10 @@ bool skb_defer_rx_timestamp(struct sk_buff *skb)
struct phy_device *phydev;
unsigned int type;
- skb_push(skb, ETH_HLEN);
+ if (skb->data - ETH_HLEN < skb->head)
+ return false;
+
+ __skb_push(skb, ETH_HLEN);
type = classify(skb);
^ permalink raw reply related
* [PATCH] net: emaclite: Omit private ndo_get_stats function
From: Tobias Klauser @ 2010-12-02 17:20 UTC (permalink / raw)
To: David S. Miller, netdev
xemaclite_get_stats() just returns dev->stats so we can leave it out
alltogether and let dev_get_stats() do the job.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
drivers/net/xilinx_emaclite.c | 16 ----------------
1 files changed, 0 insertions(+), 16 deletions(-)
diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c
index 2de52d1..de6c308 100644
--- a/drivers/net/xilinx_emaclite.c
+++ b/drivers/net/xilinx_emaclite.c
@@ -1001,21 +1001,6 @@ static int xemaclite_close(struct net_device *dev)
}
/**
- * xemaclite_get_stats - Get the stats for the net_device
- * @dev: Pointer to the network device
- *
- * This function returns the address of the 'net_device_stats' structure for the
- * given network device. This structure holds usage statistics for the network
- * device.
- *
- * Return: Pointer to the net_device_stats structure.
- */
-static struct net_device_stats *xemaclite_get_stats(struct net_device *dev)
-{
- return &dev->stats;
-}
-
-/**
* xemaclite_send - Transmit a frame
* @orig_skb: Pointer to the socket buffer to be transmitted
* @dev: Pointer to the network device
@@ -1285,7 +1270,6 @@ static struct net_device_ops xemaclite_netdev_ops = {
.ndo_start_xmit = xemaclite_send,
.ndo_set_mac_address = xemaclite_set_mac_address,
.ndo_tx_timeout = xemaclite_tx_timeout,
- .ndo_get_stats = xemaclite_get_stats,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = xemaclite_poll_controller,
#endif
--
1.7.0.4
^ permalink raw reply related
* [PATCH] net: am79c961a: Omit private ndo_get_stats function
From: Tobias Klauser @ 2010-12-02 17:20 UTC (permalink / raw)
To: Russell King, David S. Miller, netdev
am79c961_getstats() just returns dev->stats so we can leave it out
alltogether and let dev_get_stats() do the job.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
drivers/net/arm/am79c961a.c | 9 ---------
1 files changed, 0 insertions(+), 9 deletions(-)
diff --git a/drivers/net/arm/am79c961a.c b/drivers/net/arm/am79c961a.c
index 62f2110..0c9217f 100644
--- a/drivers/net/arm/am79c961a.c
+++ b/drivers/net/arm/am79c961a.c
@@ -340,14 +340,6 @@ am79c961_close(struct net_device *dev)
return 0;
}
-/*
- * Get the current statistics.
- */
-static struct net_device_stats *am79c961_getstats (struct net_device *dev)
-{
- return &dev->stats;
-}
-
static void am79c961_mc_hash(char *addr, unsigned short *hash)
{
if (addr[0] & 0x01) {
@@ -665,7 +657,6 @@ static const struct net_device_ops am79c961_netdev_ops = {
.ndo_open = am79c961_open,
.ndo_stop = am79c961_close,
.ndo_start_xmit = am79c961_sendpacket,
- .ndo_get_stats = am79c961_getstats,
.ndo_set_multicast_list = am79c961_setmulticastlist,
.ndo_tx_timeout = am79c961_timeout,
.ndo_validate_addr = eth_validate_addr,
--
1.7.0.4
^ permalink raw reply related
* RE: [net-next-2.6 PATCH] ixgbe: fix for link failure on SFP+ DA cables
From: Skidmore, Donald C @ 2010-12-02 17:28 UTC (permalink / raw)
To: Joe Perches, Kirsher, Jeffrey T
Cc: davem@davemloft.net, netdev@vger.kernel.org, gospo@redhat.com,
bphilips@novell.com
In-Reply-To: <1291275701.1761.40.camel@Joe-Laptop>
>-----Original Message-----
>From: Joe Perches [mailto:joe@perches.com]
>Sent: Wednesday, December 01, 2010 11:42 PM
>To: Kirsher, Jeffrey T
>Cc: davem@davemloft.net; netdev@vger.kernel.org; gospo@redhat.com;
>bphilips@novell.com; Skidmore, Donald C
>Subject: Re: [net-next-2.6 PATCH] ixgbe: fix for link failure on SFP+ DA
>cables
>
>On Wed, 2010-12-01 at 22:59 -0800, Jeff Kirsher wrote:
>> This patch helps prevent FW/SW semaphore collision from leading
>> to link establishment failure. The collision might mess up the
>> PHY registers so we reset the PHY. However there are SFI/KR areas
>> in the PHY that are not reset with a Reset_AN so we need to change
>> LMS to reset it. Also wait until AN state machine is AN_GOOD
>[]
>> drivers/net/ixgbe/ixgbe_82599.c | 28 +++++++++++++++++++++++++---
>> diff --git a/drivers/net/ixgbe/ixgbe_82599.c
>b/drivers/net/ixgbe/ixgbe_82599.c
>[]
>> @@ -116,14 +118,34 @@ static s32 ixgbe_setup_sfp_modules_82599(struct
>ixgbe_hw *hw)
>> IXGBE_WRITE_FLUSH(hw);
>> hw->eeprom.ops.read(hw, ++data_offset, &data_value);
>> }
>> - /* Now restart DSP by setting Restart_AN */
>> - IXGBE_WRITE_REG(hw, IXGBE_AUTOC,
>> - (IXGBE_READ_REG(hw, IXGBE_AUTOC) |
>IXGBE_AUTOC_AN_RESTART));
>>
>> /* Release the semaphore */
>> ixgbe_release_swfw_sync(hw, IXGBE_GSSR_MAC_CSR_SM);
>> /* Delay obtaining semaphore again to allow FW access */
>> msleep(hw->eeprom.semaphore_delay);
>
>might these msleeps be usleep_range?
>
>[]
>
>> + /* Wait for AN to leave state 0 */
>> + for (i = 0; i < 10; i++) {
>> + msleep(4);
>
>Perhaps usleep_range?
>
>Maybe all the msleep uses < 20ms in the intel drivers?
>
>$ grep -nPr --include=*.[ch] "msleep\s*\(\s*1?\d\s*\)" drivers/net/ig*
>drivers/net/ixg* drivers/net/e100* | wc -l
>123
>
>Maybe something like doubling the sleep value
>for the upper bound range?
>
>Here's a little script that does that.
>
>$ grep -nPrl --include=*.[ch] "msleep\s*\(\s*1?\d\s*\)" \
> drivers/net/ig* drivers/net/ixg* drivers/net/e100* | \
>xargs perl -p -i -e 's/msleep\s*\(\s*(1?\d)\s*\)/"usleep_range\(${1}000, "
>. scalar($1) * 2 . "000\)"/ge'
>
Good point about the msleeps. We do have a plan to change all the <20 ones to usleep_range I just haven't gotten around to make the patch yet. I just wasn't positive on what our upper range would need to be for each case and wanted to look at each individually to make sure. Your suggestion may well end up being what we end up trying (doubling the upper bound). :)
I kept msleeps in this patch as I wanted to be consistent when doing the usleep_range changeover and the longer delay really doesn't hurt here as the sleep value is really only the minimum needed. I do promises that the other patch is coming soon. :)
Thanks,
-Don
^ permalink raw reply
* [PATCH] net: cris/eth_v10: Use net_device_stats from struct net_device_stats
From: Tobias Klauser @ 2010-12-02 17:22 UTC (permalink / raw)
To: David S. Miller, netdev; +Cc: Mikael Starvik, Jesper Nilsson
struct net_device has its own struct net_device_stats member, so use
this one instead of a private copy in struct net_local.
Note: This patch was not even compile tested.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
drivers/net/cris/eth_v10.c | 34 +++++++++++++++-------------------
1 files changed, 15 insertions(+), 19 deletions(-)
diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c
index 81475cc..80c2fee 100644
--- a/drivers/net/cris/eth_v10.c
+++ b/drivers/net/cris/eth_v10.c
@@ -59,7 +59,6 @@ static struct sockaddr default_mac = {
/* Information that need to be kept for each board. */
struct net_local {
- struct net_device_stats stats;
struct mii_if_info mii_if;
/* Tx control lock. This protects the transmit buffer ring
@@ -1059,7 +1058,7 @@ e100_tx_timeout(struct net_device *dev)
/* remember we got an error */
- np->stats.tx_errors++;
+ dev->stats.tx_errors++;
/* reset the TX DMA in case it has hung on something */
@@ -1157,7 +1156,7 @@ e100rxtx_interrupt(int irq, void *dev_id)
* allocate a new buffer to put a packet in.
*/
e100_rx(dev);
- np->stats.rx_packets++;
+ dev->stats.rx_packets++;
/* restart/continue on the channel, for safety */
*R_DMA_CH1_CMD = IO_STATE(R_DMA_CH1_CMD, cmd, restart);
/* clear dma channel 1 eop/descr irq bits */
@@ -1173,8 +1172,8 @@ e100rxtx_interrupt(int irq, void *dev_id)
/* Report any packets that have been sent */
while (virt_to_phys(myFirstTxDesc) != *R_DMA_CH0_FIRST &&
(netif_queue_stopped(dev) || myFirstTxDesc != myNextTxDesc)) {
- np->stats.tx_bytes += myFirstTxDesc->skb->len;
- np->stats.tx_packets++;
+ dev->stats.tx_bytes += myFirstTxDesc->skb->len;
+ dev->stats.tx_packets++;
/* dma is ready with the transmission of the data in tx_skb, so now
we can release the skb memory */
@@ -1197,7 +1196,6 @@ static irqreturn_t
e100nw_interrupt(int irq, void *dev_id)
{
struct net_device *dev = (struct net_device *)dev_id;
- struct net_local *np = netdev_priv(dev);
unsigned long irqbits = *R_IRQ_MASK0_RD;
/* check for underrun irq */
@@ -1205,13 +1203,13 @@ e100nw_interrupt(int irq, void *dev_id)
SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, clr_error, clr);
*R_NETWORK_TR_CTRL = network_tr_ctrl_shadow;
SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, clr_error, nop);
- np->stats.tx_errors++;
+ dev->stats.tx_errors++;
D(printk("ethernet receiver underrun!\n"));
}
/* check for overrun irq */
if (irqbits & IO_STATE(R_IRQ_MASK0_RD, overrun, active)) {
- update_rx_stats(&np->stats); /* this will ack the irq */
+ update_rx_stats(&dev->stats); /* this will ack the irq */
D(printk("ethernet receiver overrun!\n"));
}
/* check for excessive collision irq */
@@ -1219,7 +1217,7 @@ e100nw_interrupt(int irq, void *dev_id)
SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, clr_error, clr);
*R_NETWORK_TR_CTRL = network_tr_ctrl_shadow;
SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, clr_error, nop);
- np->stats.tx_errors++;
+ dev->stats.tx_errors++;
D(printk("ethernet excessive collisions!\n"));
}
return IRQ_HANDLED;
@@ -1250,7 +1248,7 @@ e100_rx(struct net_device *dev)
spin_unlock(&np->led_lock);
length = myNextRxDesc->descr.hw_len - 4;
- np->stats.rx_bytes += length;
+ dev->stats.rx_bytes += length;
#ifdef ETHDEBUG
printk("Got a packet of length %d:\n", length);
@@ -1268,7 +1266,7 @@ e100_rx(struct net_device *dev)
/* Small packet, copy data */
skb = dev_alloc_skb(length - ETHER_HEAD_LEN);
if (!skb) {
- np->stats.rx_errors++;
+ dev->stats.rx_errors++;
printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", dev->name);
goto update_nextrxdesc;
}
@@ -1294,7 +1292,7 @@ e100_rx(struct net_device *dev)
int align;
struct sk_buff *new_skb = dev_alloc_skb(MAX_MEDIA_DATA_SIZE + 2 * L1_CACHE_BYTES);
if (!new_skb) {
- np->stats.rx_errors++;
+ dev->stats.rx_errors++;
printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", dev->name);
goto update_nextrxdesc;
}
@@ -1333,8 +1331,6 @@ e100_rx(struct net_device *dev)
static int
e100_close(struct net_device *dev)
{
- struct net_local *np = netdev_priv(dev);
-
printk(KERN_INFO "Closing %s.\n", dev->name);
netif_stop_queue(dev);
@@ -1366,8 +1362,8 @@ e100_close(struct net_device *dev)
/* Update the statistics here. */
- update_rx_stats(&np->stats);
- update_tx_stats(&np->stats);
+ update_rx_stats(&dev->stats);
+ update_tx_stats(&dev->stats);
/* Stop speed/duplex timers */
del_timer(&speed_timer);
@@ -1545,11 +1541,11 @@ e100_get_stats(struct net_device *dev)
spin_lock_irqsave(&lp->lock, flags);
- update_rx_stats(&lp->stats);
- update_tx_stats(&lp->stats);
+ update_rx_stats(&dev->stats);
+ update_tx_stats(&dev->stats);
spin_unlock_irqrestore(&lp->lock, flags);
- return &lp->stats;
+ return &dev->stats;
}
/*
--
1.7.0.4
^ permalink raw reply related
* Re: [PATCH v2 1/4] net: snmp: fix the wrong ICMP_MIB_MAX value
From: David Miller @ 2010-12-02 17:38 UTC (permalink / raw)
To: tgraf; +Cc: shanwei, netdev
In-Reply-To: <20101202095753.GA10221@canuck.infradead.org>
From: Thomas Graf <tgraf@infradead.org>
Date: Thu, 2 Dec 2010 04:57:53 -0500
> Looks like the +1 is there to account for ICMP_MIB_DUMMY. It is
> unused though but you have to remove it as well if you want to
> kill that extra +1.
He does in patch #4
ICMP_MIB_DUMMY was used in pre-GIT times, as a throw away ICMP counter
that gets bumped when we have no specific counter that should be
bumped for an ICMP code type. There was a table, per ICMP code,
that listed the counter to bump amongst other things, and this
dummy value was used in that table.
^ permalink raw reply
* Re: bridge netpoll support: mismatch between net core and bridge headers
From: David Miller @ 2010-12-02 17:51 UTC (permalink / raw)
To: vapier.adi; +Cc: herbert, netdev
In-Reply-To: <AANLkTimO79DLyCb5vXQ04keX6Mjwv32wNQLRZcfyPNF2@mail.gmail.com>
From: Mike Frysinger <vapier.adi@gmail.com>
Date: Thu, 2 Dec 2010 03:29:17 -0500
> On Wed, Dec 1, 2010 at 19:33, David Miller wrote:
>> Attached. Also please provide one of the failing ".config" files,
>> and please test if simply going "make oldconfig" unbreaks things.
>> It may be that randconfig allows configurations that the config
>> system normally does not allow.
>
> hrm, so your patch does fix things. the downside is that it might be
> caused by kgdboe (which isnt in mainline yet). that's the only
> randconfig i can find so far to cause the issue.
If that's the case you just need to check and make sure that kgdboe
handles dependencies properly in it's Kconfig changes.
I suspect that simply adding kgdboe as a new "or" case to the
"def_bool" statement of NETPOLL in driver/net/Kconfig will fix the
problem.
If kgdboe is using "select" to handle these dependencies, that's the
bug.
^ permalink raw reply
* Re: TCP: big bursts due to undos resulting from reordering
From: John Heffner @ 2010-12-02 17:55 UTC (permalink / raw)
To: Lennart Schulte; +Cc: netdev@vger.kernel.org, Ilpo Järvinen
In-Reply-To: <4CF7BCF1.7000505@nets.rwth-aachen.de>
Do you have some tests showing that the larger busts hurt? The
problem that occurred, prior to this patch, was that cwnd was not able
to effectively grow under persistent reordering.
You can see my justification for using the reordering threshold in the
archives here: <http://marc.info/?l=linux-netdev&m=120835698002118&w=2>.
Thanks,
-John
On Thu, Dec 2, 2010 at 10:36 AM, Lennart Schulte
<lennart.schulte@nets.rwth-aachen.de> wrote:
> Hi John, hi Ilpo,
>
> at the moment I look on many TCP plots with reordering. When reordering
> occurs there are some spurious retransmissions which are later undone by
> e.g. DSACKs. This undo results in a very big burst of packets when
> tp->reordering is high, since the function tcp_max_burst() returns
> tp->reordering.
>
> This behavior was introduced because of a bug when using SACK instead of
> Reno. The thread concerning this fix can be found at [1].
>
> Before the patch, which results from this thread, Linux has done a burst
> of 3 packets and then slow started to the undone ssthresh value, which
> is a much better way of handling an undo then it is after the patch.
>
> Also I patched a kernel to use the old max_burst value of 3 again to see
> if it has any effect. Then I set up some virtual nodes and emulated a
> network with netem as it was done in the thread.
> The settings are:
> - RTT 40ms
> - no congestion, application sending rate 20 Mbps
> - forward path: reordering rate 20%, reordering delay 20ms
> - timestamps on
>
> Until now I have not found any evidence that the problem occurs (perhaps
> because I don't get the settings right, since in the thread there is no
> information concerning the settings for reordering and also the ones of
> the sysctls).
>
> My problem is to understand why the patch was necessary and under what
> circumstances SACK has a lower throughput so that it may be possible for
> me to find another way of fixing this without introducing and old bug.
> Since I can't figure it out on my own I hope to get some insights this
> way :)
>
> Thanks,
> Lennart Schulte
>
> [1] http://marc.info/?t=120728958000004&r=2&w=2
>
^ permalink raw reply
* Re: kernel panic with time-stamping in phy devices (monitor mode)
From: Andrew Watts @ 2010-12-02 18:21 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev
In-Reply-To: <1291307884.2871.69.camel@edumazet-laptop>
--- On Thu, 12/2/10, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> Le jeudi 02 décembre 2010 à 08:05
> -0800, Andrew Watts a écrit :
> > Hi.
> >
> > The 'time stamping in phy devices' code introduced in
> 2.6.36
> > (c1f19b51d1d87f3e3bb7e6648f43f7d57ed2da6b et al.)
> triggers
> > kernel panics when wireless devices are placed in
> monitor mode
> > (tested with b43 and ath5k devices on a 32-bit
> system).
> >
> > To reproduce, set CONFIG_NETWORK_PHY_TIMESTAMPING=y
> and put a
> > wireless device into monitor mode:
> >
> > # ifconfig wlan0 down
> > # iwconfig wlan0 mode monitor
> > # ifconfig wlan0 up
> >
> > ~ Andy
> >
> > ==============
> >
> > [<c14455ad>] ? __alloc_skb+0x53/0xf8
> > [<f92fdd57>] ? b43_dma_rx+0x18a/0x342
> [b43]
> > [<f92e8475>] ?
> b43_do_interrupt_thread+0x420/0x92e [b43]
> > [<c1027731>] ? __dequeue_entity+0x31/0x35
> > [<c1027a44>] ? set_next_entity+0xad/0xbb
> > [<f92e899b>] ?
> b43_interrupt_thread_handler+0x18/0x2b [b43]
> > [<c107c378>] ? irq_thread+0xb6/0x19e
> > [<c15625a0>] ? schedule+0x254/0x566
> > [<c107c2c2>] ? irq_thread+0x0/0x19e
> > [<c10448b1>] ? kthread+0x67/0x69
> > [<c104484a>] ? kthread+0x0/0x69
> > [<c100323e>] ?
> kernel_thread_helper+0x6/0x18
> > Code: 4c 24 14 8b 88 a8 00 00 00 89 4c 24 10 89 54 24
> 0c 8b
> > 40 50 89 44 24 08 8b 45 04 89 44 24 04 c7 04 24 30 74
> 7a c1
> > e8 b5 d2 11 00 <0f> 0b eb fe 55 89 e5 56 53 83
> ec 24 8b 88
> > a0 00 00 00 8b 58 54
> > EIP: [<c1444ea0>] skb_push+0x7d/0x81 SS:ESP
> 0068:cee01d78
> > ---[ end trace af1c99818e62b195 ]---
> > Kernel panic - not syncing: Fatal exception in
> interrupt
> > Pid: 6674, comm: irq/18-b43 Tainted: G
> D 2.6.36.1
> > Call Trace:
> > [<c156217d>] ? printk+0x28/0x2a
> > [<c156205c>] panic+0x57/0x150
> > [<c1564adf>] oops_begin+0x0/0x40
> > [<c1004e36>] die+0x49/0x5d
> > [<c1564304>] do_trap+0x84/0xad
> > [<c10037e5>] ? do_invalid_op+0x0/0x93
> > [<c100386b>] do_invalid_op+0x86/0x93
> > [<c1444ea0>] ? skb_push+0x7d/0x81
> > [<c15640b9>] error_code+0x65/0x6c
> > [<c1444ea0>] ? skb_push+0x7d/0x81
> > [<c145f721>] ?
> skb_defer_rx_timestamp+0x12/0x5a
> > [<c145f721>]
> skb_defer_rx_timestamp+0x12/0x5a
> > [<c144d23c>] netif_receive_skb+0x1f/0x47
> > [<c153a6e8>] ieee80211_rx+0x661/0x8e1
> > [<f85daca2>] ? ssb_pci_read32+0x19/0x31
> [ssb]
> > [<f92e54cf>] ? b43_tsf_read+0x2a/0x47
> [b43]
> > [<f92f8d42>] b43_rx+0x24c/0x5eb [b43]
> > [<c14455ad>] ? __alloc_skb+0x53/0xf8
> > [<f92fdd57>] b43_dma_rx+0x18a/0x342 [b43]
> > [<f92e8475>]
> b43_do_interrupt_thread+0x420/0x92e [b43]
> > [<c1027731>] ? __dequeue_entity+0x31/0x35
> > [<c1027a44>] ? set_next_entity+0xad/0xbb
> > [<f92e899b>]
> b43_interrupt_thread_handler+0x18/0x2b [b43]
> > [<c107c378>] irq_thread+0xb6/0x19e
> > [<c15625a0>] ? schedule+0x254/0x566
> > [<c107c2c2>] ? irq_thread+0x0/0x19e
> > [<c10448b1>] kthread+0x67/0x69
> > [<c104484a>] ? kthread+0x0/0x69
> > [<c100323e>]
> kernel_thread_helper+0x6/0x18
> >
> >
>
> Thanks for the report
>
> Please try following patch.
>
> diff --git a/net/core/timestamping.c
> b/net/core/timestamping.c
> index dac7ed6..a710ab0 100644
> --- a/net/core/timestamping.c
> +++ b/net/core/timestamping.c
> @@ -96,7 +96,10 @@ bool skb_defer_rx_timestamp(struct
> sk_buff *skb)
> struct phy_device *phydev;
> unsigned int type;
>
> - skb_push(skb, ETH_HLEN);
> + if (skb->data - ETH_HLEN <
> skb->head)
> + return false;
> +
> + __skb_push(skb, ETH_HLEN);
>
> type = classify(skb);
>
I can confirm that I get no kernel panics after
applying that patch.
~ Andy
^ permalink raw reply
* Re: [v2 PATCH 1/2] bonding: sync netpoll code with bridge
From: Stephen Hemminger @ 2010-12-02 18:36 UTC (permalink / raw)
To: Amerigo Wang
Cc: linux-kernel, Jiri Pirko, Neil Horman, netdev, David S. Miller,
Eric W. Biederman, Herbert Xu, bonding-devel, Jay Vosburgh
In-Reply-To: <20101202134041.6073.5201.sendpatchset@localhost.localdomain>
On Thu, 2 Dec 2010 08:35:42 -0500
Amerigo Wang <amwang@redhat.com> wrote:
> #ifdef CONFIG_NET_POLL_CONTROLLER
> - if (unlikely(bond->dev->priv_flags & IFF_IN_NETPOLL)) {
> - struct netpoll *np = bond->dev->npinfo->netpoll;
> - slave_dev->npinfo = bond->dev->npinfo;
> + if (unlikely(netpoll_tx_running(slave_dev))) {
> slave_dev->priv_flags |= IFF_IN_NETPOLL;
> - netpoll_send_skb_on_dev(np, skb, slave_dev);
> + bond_netpoll_send_skb(bond_get_slave_by_dev(bond, slave_dev), skb);
> slave_dev->priv_flags &= ~IFF_IN_NETPOLL;
> } else
> #endif
Couldn't you eliminate #ifdef by putting the following into header file.
#ifdef CONFIG_NET_POLL_CONTROLLER
static inline netpoll_tx_running
...
#else
#define netpoll_tx_running(dev) (0)
#endif
--
^ permalink raw reply
* Re: [net-next PATCH V2] ehea: Use the standard logging functions
From: Breno Leitao @ 2010-12-02 18:54 UTC (permalink / raw)
To: davem; +Cc: Joe Perches, netdev
In-Reply-To: <1291141124.18026.254.camel@Joe-Laptop>
On 11/30/2010 04:18 PM, Joe Perches wrote:
> Remove ehea_error, ehea_info and ehea_debug macros.
> Use pr_fmt, pr_<level>, netdev_<level> and netif_<level> as appropriate.
> Fix messages to use trailing "\n", some messages had an extra one
> as the old ehea_<level> macros added a trailing "\n".
> Coalesced long format strings.
>
> Uncompiled/untested.
>
> Signed-off-by: Joe Perches<joe@perches.com>
Signed-off-by: Breno Leitao<leitao@linux.vnet.ibm.com>
^ permalink raw reply
* [PATCH net-next-2.6] [Resend] Fix a typo in datagram.c and sctp/socket.c.
From: David Shwatrz @ 2010-12-02 19:01 UTC (permalink / raw)
To: David S. Miller, netdev
[-- Attachment #1: Type: text/plain, Size: 152 bytes --]
Hi,
This patch fixes a typo in net/core/datagram.c and in net/sctp/socket.c
Regards,
David Shwartz
Signed-off-by: David Shwartz <dshwatrz@gmail.com>
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1007 bytes --]
diff --git a/net/core/datagram.c b/net/core/datagram.c
index cd1e039..18ac112 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -177,7 +177,7 @@ struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags,
* interrupt level will suddenly eat the receive_queue.
*
* Look at current nfs client by the way...
- * However, this function was corrent in any case. 8)
+ * However, this function was correct in any case. 8)
*/
unsigned long cpu_flags;
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 6bd5543..842c7f3 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -6047,7 +6047,7 @@ static struct sk_buff *sctp_skb_recv_datagram(struct sock *sk, int flags,
* will suddenly eat the receive_queue.
*
* Look at current nfs client by the way...
- * However, this function was corrent in any case. 8)
+ * However, this function was correct in any case. 8)
*/
if (flags & MSG_PEEK) {
spin_lock_bh(&sk->sk_receive_queue.lock);
^ permalink raw reply related
* Re: [PATCH 1/2] ath: Fix ath_dbg uses missing newlines and access beyond array bound
From: Luis R. Rodriguez @ 2010-12-02 19:02 UTC (permalink / raw)
To: Joe Perches
Cc: Luis Rodriguez, Jouni Malinen, Vasanth Thiagarajan,
Senthilkumar Balasubramanian, John W. Linville,
linux-wireless@vger.kernel.org, ath9k-devel@lists.ath9k.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <276469c602c402565b49f99521ea19757429e81e.1291266731.git.joe@perches.com>
On Wed, Dec 01, 2010 at 09:13:32PM -0800, Joe Perches wrote:
> Add missing newlines to ath_dbg uses
> ar9300RateSize is not a power of 4, fix to print array line by line.
>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 29 ++---------------------
> drivers/net/wireless/ath/ath9k/calib.c | 4 +-
> drivers/net/wireless/ath/ath9k/gpio.c | 6 ++--
> drivers/net/wireless/ath/ath9k/htc_drv_gpio.c | 7 ++---
> drivers/net/wireless/ath/ath9k/htc_drv_main.c | 2 +-
> 5 files changed, 12 insertions(+), 36 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
> index e6ae62b..beb3e87 100644
> --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
> +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
> @@ -3342,7 +3342,7 @@ static int ar9300_eeprom_restore_internal(struct ath_hw *ah,
> goto fail;
>
> found:
> - ath_dbg(common, ATH_DBG_EEPROM, "Found valid EEPROM data");
> + ath_dbg(common, ATH_DBG_EEPROM, "Found valid EEPROM data\n");
>
> for (it = 0; it < MSTATE; it++) {
> if (!read(ah, cptr, word, COMP_HDR_LEN))
> @@ -4084,22 +4084,9 @@ static void ar9003_hw_set_target_power_eeprom(struct ath_hw *ah, u16 freq,
> ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_23, freq,
> is2GHz) + ht40PowerIncForPdadc;
>
> - while (i < ar9300RateSize) {
> - ath_dbg(common, ATH_DBG_EEPROM,
> - "TPC[%02d] 0x%08x ", i, targetPowerValT2[i]);
> - i++;
> -
> - ath_dbg(common, ATH_DBG_EEPROM,
> - "TPC[%02d] 0x%08x ", i, targetPowerValT2[i]);
> - i++;
> -
> - ath_dbg(common, ATH_DBG_EEPROM,
> - "TPC[%02d] 0x%08x ", i, targetPowerValT2[i]);
> - i++;
> -
> + for (i = 0; i < ar9300RateSize; i++) {
> ath_dbg(common, ATH_DBG_EEPROM,
> "TPC[%02d] 0x%08x\n", i, targetPowerValT2[i]);
> - i++;
> }
> }
Please send this hunk on a separate patch.
Luis
^ permalink raw reply
* Re: [RFC PATCH v1] iproute2: add IFLA_TC support to 'ip link'
From: John Fastabend @ 2010-12-02 19:51 UTC (permalink / raw)
To: hadi@cyberus.ca
Cc: shemminger@vyatta.com, netdev@vger.kernel.org,
tgraf@infradead.org, eric.dumazet@gmail.com, davem@davemloft.net
In-Reply-To: <1291286428.2183.494.camel@mojatatu>
On 12/2/2010 2:40 AM, jamal wrote:
> On Wed, 2010-12-01 at 10:27 -0800, John Fastabend wrote:
>> Add support to return IFLA_TC qos settings to the 'ip link'
>> command. The following sets the number of traffic classes
>> supported in HW and builds a priority map.
>>
>> #ip link set eth3 tc num 8 map 0 1 2 3 4 5 6 7 0 0 0 0 0 0 0 0
>>
>> With the output from 'ip link' showing maps for interfaces with
>> the ability to use HW traffic classes.
>
> 2 comments apply to the kernel patches as well - but easier to point
> out here.
>
> 1) IMO, this looks like the wrong interface to use.
> Was there any reason not to use tc and instead having it show
> itself embedded within "ip" abstraction?
> Example, this would suit your intent:
> tc qdisc add dev eth3 hware-kinda-8021q-sched num 8 map blah bleh
>
I viewed the HW QOS as L2 link attributes more than a queuing discipline per se. Plus 'ip link' is already used to set things outside of ip. For example 'txqueuelen' and 'vf x'.
> You can then modify individual classes of traffic with "tc class".
>
> [There are plenty of other chips (switching chips for example) that
> implement a variety different hardware schedulers, hence the
> "hardware-kinda-8021q-sched" above]
However thinking about this a bit more qdisc support seems cleaner. For one we can configure QOS policies per class with Qdisc_class_ops. And then also aggregate statistics with dump_stats. I would avoid the "hardware-kinda-8021q-sched" name though to account for schedulers that may not be 802.1Q compliant maybe 'mclass-sched' for multi-class scheduler. I'll look into this. Thanks for the suggestion!
>
> 2) How does this mapping in hardware correlate to the software side
> mapping? When packets of class X make it off the hardware and hit
> the stack are they still going to get the same treatment as they
> would have in h/ware?
>
On egress the skb priority is mapped to a class which is associated with a range of queues (qoffset:qoffset + qcount). In the 802.1Q case this queue range is mapped to the 802.1Qp traffic class in hardware. So the hardware traffic class is mapped 1-1 with the software class. Additionally in software the VLAN egress mapping is used to map the skb priority to the 802.1Q priority. Here I expect user policies to configure this to get a consistent mapping. On ingress the skb priority is set using the 802.1Q ingress mapping. This case is something a userspace policy could configure if egress/ingress mappings should be symmetric.
In the simpler case of hardware rate limiting (not 802.1Q) this is not really a concern at all. With this mechanism we can identify traffic and push it to the correct queues that are grouped into a rate limited class. If there are egress/ingress mappings then those will apply skb priority tags on egress and the correct skb priority on ingress.
Currently everything works reasonably well with this scheme and the mq qdisc. The mq qdisc uses pfifo and the driver then pauses the queues as needed. Using the enhanced transmission selection algorithm (ETS - 802.1Qaz pre-standard) in hardware we see variations from expected bandwidth around +-5% with TCP/UDP. Instrumenting HW rate limiters gives similar variations. I tested this is with ixgbe and the 82599 device.
Bit long winded but hopefully that answers your question.
>
> cheers,
> jamal
>
^ permalink raw reply
* Re: [RFC PATCH v2 2/3] netlink: implement nla_policy for HW QOS
From: John Fastabend @ 2010-12-02 19:53 UTC (permalink / raw)
To: davem, netdev, eric.dumazet
In-Reply-To: <20101202102037.GB10221@canuck.infradead.org>
On 12/2/2010 2:20 AM, Thomas Graf wrote:
> On Wed, Dec 01, 2010 at 10:22:58AM -0800, John Fastabend wrote:
>> +
>> + NLA_PUT_U8(skb, IFLA_TC_TXMAX, dev->max_tcs);
>> + NLA_PUT_U8(skb, IFLA_TC_TXNUM, dev->num_tcs);
>> +
>> + tc_txq = nla_nest_start(skb, IFLA_TC_TXQS);
>
> You have to check the return value here.
>
>> + for (i = 0; i < dev->num_tcs; i++) {
>> + tcq = netdev_get_tc_queue(dev, i);
>> + ifla_tcq.tc = i;
>> + ifla_tcq.count = tcq->count;
>> + ifla_tcq.offset = tcq->offset;
>> +
>> + NLA_PUT(skb, IFLA_TC_TXQ, sizeof(ifla_tcq), &ifla_tcq);
>> + }
>> + nla_nest_end(skb, tc_txq);
>> +
>> + tc_map = nla_nest_start(skb, IFLA_TC_MAPS);
>
> Same here
>
>> + for (i = 0; i < 16; i++) {
>> + ifla_map.prio = i;
>> + ifla_map.tc = netdev_get_prio_tc_map(dev, i);
>> + NLA_PUT(skb, IFLA_TC_MAP, sizeof(ifla_map), &ifla_map);
>> + }
>>
>> +
>> +static const struct nla_policy ifla_tc_txq[IFLA_TC_TXQS_MAX+1] = {
>> + [IFLA_TC_TXQ] = { .type = NLA_BINARY,
>> + .len = sizeof(struct ifla_tc_txq)},
>
> This is probably not what you want. NLA_BINARY only enforces a maximum
> payload length but no minimum payload length.
>
> Omit the .type and let it fall back to NLA_UNSPEC and only specify a
> .len. This enforces that the attribute payload is at least .len in
> length. You should not worry about payload that exceeds your size
> expectations. This allows to extend ifla_tc_txq in the future.
>
>> +static const struct nla_policy ifla_tc_map[IFLA_TC_MAPS_MAX+1] = {
>> + [IFLA_TC_MAP] = { .type = NLA_BINARY,
>> + .len = sizeof(struct ifla_tc_map)},
>> +};
>
> Same here
errors noted. Thanks for the clarification I'll fix this up. Also I'll look into Jamal's comment regarding moving this to use 'tc'.
-- John
^ permalink raw reply
* [PATCH 0/7] Ipv6 TCP timewait recycling support
From: David Miller @ 2010-12-02 20:41 UTC (permalink / raw)
To: netdev
First we start with two simple cleanups, un-typedef'ification
and a comment fixup.
Then we add the infrastructure to allow the tcp_minisocks.c
timewait recycling code able to be generic and use various
->ops
Sadly, the ipv6 timewait ops are used even for v4-mapped
addresses so we need a special check in the ipv6 timewait
getpeer implementation. This is similar to the situation
we have in tcp_v6_hash().
Doing these changes also pointed out that our listening socket
incoming connection policy in the non-syncookies case as
being handled differently for ipv4 vs. ipv6. This has been
rectified. The issue is that for ipv4 we were reserving the
final 1/4 of the backlog queue to validated destinations.
In the final patch we throw the switch and implement the two
getpeer operations for ipv6, which fully enables timewait
recyling for ipv6.
^ permalink raw reply
* [PATCH 1/7] inetpeer: Kill use of inet_peer_address_t typedef.
From: David Miller @ 2010-12-02 20:42 UTC (permalink / raw)
To: netdev
They are verboten these days.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
include/net/inetpeer.h | 12 ++++++------
net/ipv4/inetpeer.c | 8 ++++----
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index fb8aeb1..5161bfd 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -14,18 +14,18 @@
#include <net/ipv6.h>
#include <asm/atomic.h>
-typedef struct {
+struct inetpeer_addr {
union {
__be32 a4;
__be32 a6[4];
};
__u16 family;
-} inet_peer_address_t;
+};
struct inet_peer {
/* group together avl_left,avl_right,v4daddr to speedup lookups */
struct inet_peer __rcu *avl_left, *avl_right;
- inet_peer_address_t daddr;
+ struct inetpeer_addr daddr;
__u32 avl_height;
struct list_head unused;
__u32 dtime; /* the time of last use of not
@@ -51,11 +51,11 @@ struct inet_peer {
void inet_initpeers(void) __init;
/* can be called with or without local BH being disabled */
-struct inet_peer *inet_getpeer(inet_peer_address_t *daddr, int create);
+struct inet_peer *inet_getpeer(struct inetpeer_addr *daddr, int create);
static inline struct inet_peer *inet_getpeer_v4(__be32 v4daddr, int create)
{
- inet_peer_address_t daddr;
+ struct inetpeer_addr daddr;
daddr.a4 = v4daddr;
daddr.family = AF_INET;
@@ -64,7 +64,7 @@ static inline struct inet_peer *inet_getpeer_v4(__be32 v4daddr, int create)
static inline struct inet_peer *inet_getpeer_v6(struct in6_addr *v6daddr, int create)
{
- inet_peer_address_t daddr;
+ struct inetpeer_addr daddr;
ipv6_addr_copy((struct in6_addr *)daddr.a6, v6daddr);
daddr.family = AF_INET6;
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c
index f95b89f..d9bc857 100644
--- a/net/ipv4/inetpeer.c
+++ b/net/ipv4/inetpeer.c
@@ -161,8 +161,8 @@ static void unlink_from_unused(struct inet_peer *p)
}
}
-static int addr_compare(const inet_peer_address_t *a,
- const inet_peer_address_t *b)
+static int addr_compare(const struct inetpeer_addr *a,
+ const struct inetpeer_addr *b)
{
int i, n = (a->family == AF_INET ? 1 : 4);
@@ -211,7 +211,7 @@ static int addr_compare(const inet_peer_address_t *a,
* But every pointer we follow is guaranteed to be valid thanks to RCU.
* We exit from this function if number of links exceeds PEER_MAXDEPTH
*/
-static struct inet_peer *lookup_rcu_bh(const inet_peer_address_t *daddr,
+static struct inet_peer *lookup_rcu_bh(const struct inetpeer_addr *daddr,
struct inet_peer_base *base)
{
struct inet_peer *u = rcu_dereference_bh(base->root);
@@ -472,7 +472,7 @@ static int cleanup_once(unsigned long ttl)
}
/* Called with or without local BH being disabled. */
-struct inet_peer *inet_getpeer(inet_peer_address_t *daddr, int create)
+struct inet_peer *inet_getpeer(struct inetpeer_addr *daddr, int create)
{
struct inet_peer __rcu **stack[PEER_MAXDEPTH], ***stackptr;
struct inet_peer_base *base = family_to_base(AF_INET);
--
1.7.3.2
^ permalink raw reply related
* [PATCH 2/7] inetpeer: Fix incorrect comment about inetpeer struct size.
From: David Miller @ 2010-12-02 20:42 UTC (permalink / raw)
To: netdev
Now with ipv6 support it is no longer less than 64 bytes.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
include/net/inetpeer.h | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index 5161bfd..599d96e 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -35,7 +35,6 @@ struct inet_peer {
* Once inet_peer is queued for deletion (refcnt == -1), following fields
* are not available: rid, ip_id_count, tcp_ts, tcp_ts_stamp
* We can share memory with rcu_head to keep inet_peer small
- * (less then 64 bytes)
*/
union {
struct {
--
1.7.3.2
^ permalink raw reply related
* [PATCH 3/7] timewait_sock: Create and use getpeer op.
From: David Miller @ 2010-12-02 20:42 UTC (permalink / raw)
To: netdev
The only thing AF-specific about remembering the timestamp
for a time-wait TCP socket is getting the peer.
Abstract that behind a new timewait_sock_ops vector.
Support for real IPV6 sockets is not filled in yet, but
curiously this makes timewait recycling start to work
for v4-mapped ipv6 sockets.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
include/net/tcp.h | 1 +
include/net/timewait_sock.h | 8 ++++++++
net/ipv4/tcp_ipv4.c | 33 +++++++++++----------------------
net/ipv4/tcp_minisocks.c | 32 ++++++++++++++++++++++++--------
net/ipv6/tcp_ipv6.c | 26 +++++++++++++++++++-------
5 files changed, 63 insertions(+), 37 deletions(-)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 3e23964..4097320 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -313,6 +313,7 @@ extern void tcp_shutdown (struct sock *sk, int how);
extern int tcp_v4_rcv(struct sk_buff *skb);
extern struct inet_peer *tcp_v4_get_peer(struct sock *sk, bool *release_it);
+extern void *tcp_v4_tw_get_peer(struct sock *sk);
extern int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw);
extern int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
size_t size);
diff --git a/include/net/timewait_sock.h b/include/net/timewait_sock.h
index 97c3b14..053b3cf 100644
--- a/include/net/timewait_sock.h
+++ b/include/net/timewait_sock.h
@@ -21,6 +21,7 @@ struct timewait_sock_ops {
int (*twsk_unique)(struct sock *sk,
struct sock *sktw, void *twp);
void (*twsk_destructor)(struct sock *sk);
+ void *(*twsk_getpeer)(struct sock *sk);
};
static inline int twsk_unique(struct sock *sk, struct sock *sktw, void *twp)
@@ -39,4 +40,11 @@ static inline void twsk_destructor(struct sock *sk)
sk->sk_prot->twsk_prot->twsk_destructor(sk);
}
+static inline void *twsk_getpeer(struct sock *sk)
+{
+ if (sk->sk_prot->twsk_prot->twsk_getpeer)
+ return sk->sk_prot->twsk_prot->twsk_getpeer(sk);
+ return NULL;
+}
+
#endif /* _TIMEWAIT_SOCK_H */
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 0ddf819..dd55505 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1210,12 +1210,6 @@ static const struct tcp_request_sock_ops tcp_request_sock_ipv4_ops = {
};
#endif
-static struct timewait_sock_ops tcp_timewait_sock_ops = {
- .twsk_obj_size = sizeof(struct tcp_timewait_sock),
- .twsk_unique = tcp_twsk_unique,
- .twsk_destructor= tcp_twsk_destructor,
-};
-
int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
{
struct tcp_extend_values tmp_ext;
@@ -1783,25 +1777,20 @@ struct inet_peer *tcp_v4_get_peer(struct sock *sk, bool *release_it)
}
EXPORT_SYMBOL(tcp_v4_get_peer);
-int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw)
+void *tcp_v4_tw_get_peer(struct sock *sk)
{
- struct inet_peer *peer = inet_getpeer_v4(tw->tw_daddr, 1);
-
- if (peer) {
- const struct tcp_timewait_sock *tcptw = tcp_twsk((struct sock *)tw);
-
- if ((s32)(peer->tcp_ts - tcptw->tw_ts_recent) <= 0 ||
- ((u32)get_seconds() - peer->tcp_ts_stamp > TCP_PAWS_MSL &&
- peer->tcp_ts_stamp <= (u32)tcptw->tw_ts_recent_stamp)) {
- peer->tcp_ts_stamp = (u32)tcptw->tw_ts_recent_stamp;
- peer->tcp_ts = tcptw->tw_ts_recent;
- }
- inet_putpeer(peer);
- return 1;
- }
+ struct inet_timewait_sock *tw = inet_twsk(sk);
- return 0;
+ return inet_getpeer_v4(tw->tw_daddr, 1);
}
+EXPORT_SYMBOL(tcp_v4_tw_get_peer);
+
+static struct timewait_sock_ops tcp_timewait_sock_ops = {
+ .twsk_obj_size = sizeof(struct tcp_timewait_sock),
+ .twsk_unique = tcp_twsk_unique,
+ .twsk_destructor= tcp_twsk_destructor,
+ .twsk_getpeer = tcp_v4_tw_get_peer,
+};
const struct inet_connection_sock_af_ops ipv4_specific = {
.queue_xmit = ip_queue_xmit,
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 059082c..3527b51 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -78,6 +78,27 @@ static int tcp_remember_stamp(struct sock *sk)
return 0;
}
+static int tcp_tw_remember_stamp(struct inet_timewait_sock *tw)
+{
+ struct sock *sk = (struct sock *) tw;
+ struct inet_peer *peer;
+
+ peer = twsk_getpeer(sk);
+ if (peer) {
+ const struct tcp_timewait_sock *tcptw = tcp_twsk(sk);
+
+ if ((s32)(peer->tcp_ts - tcptw->tw_ts_recent) <= 0 ||
+ ((u32)get_seconds() - peer->tcp_ts_stamp > TCP_PAWS_MSL &&
+ peer->tcp_ts_stamp <= (u32)tcptw->tw_ts_recent_stamp)) {
+ peer->tcp_ts_stamp = (u32)tcptw->tw_ts_recent_stamp;
+ peer->tcp_ts = tcptw->tw_ts_recent;
+ }
+ inet_putpeer(peer);
+ return 1;
+ }
+ return 0;
+}
+
static __inline__ int tcp_in_window(u32 seq, u32 end_seq, u32 s_win, u32 e_win)
{
if (seq == s_win)
@@ -178,14 +199,9 @@ kill_with_rst:
tcptw->tw_ts_recent = tmp_opt.rcv_tsval;
}
- /* I am shamed, but failed to make it more elegant.
- * Yes, it is direct reference to IP, which is impossible
- * to generalize to IPv6. Taking into account that IPv6
- * do not understand recycling in any case, it not
- * a big problem in practice. --ANK */
- if (tw->tw_family == AF_INET &&
- tcp_death_row.sysctl_tw_recycle && tcptw->tw_ts_recent_stamp &&
- tcp_v4_tw_remember_stamp(tw))
+ if (tcp_death_row.sysctl_tw_recycle &&
+ tcptw->tw_ts_recent_stamp &&
+ tcp_tw_remember_stamp(tw))
inet_twsk_schedule(tw, &tcp_death_row, tw->tw_timeout,
TCP_TIMEWAIT_LEN);
else
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index e394d00..5f73a18 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -906,12 +906,6 @@ static const struct tcp_request_sock_ops tcp_request_sock_ipv6_ops = {
};
#endif
-static struct timewait_sock_ops tcp6_timewait_sock_ops = {
- .twsk_obj_size = sizeof(struct tcp6_timewait_sock),
- .twsk_unique = tcp_twsk_unique,
- .twsk_destructor= tcp_twsk_destructor,
-};
-
static void __tcp_v6_send_check(struct sk_buff *skb,
struct in6_addr *saddr, struct in6_addr *daddr)
{
@@ -1818,12 +1812,30 @@ do_time_wait:
goto discard_it;
}
-struct inet_peer *tcp_v6_get_peer(struct sock *sk, bool *release_it)
+static struct inet_peer *tcp_v6_get_peer(struct sock *sk, bool *release_it)
+{
+ /* Alas, not yet... */
+ return NULL;
+}
+
+static void *tcp_v6_tw_get_peer(struct sock *sk)
{
+ struct inet_timewait_sock *tw = inet_twsk(sk);
+
+ if (tw->tw_family == AF_INET)
+ return tcp_v4_tw_get_peer(sk);
+
/* Alas, not yet... */
return NULL;
}
+static struct timewait_sock_ops tcp6_timewait_sock_ops = {
+ .twsk_obj_size = sizeof(struct tcp6_timewait_sock),
+ .twsk_unique = tcp_twsk_unique,
+ .twsk_destructor= tcp_twsk_destructor,
+ .twsk_getpeer = tcp_v6_tw_get_peer,
+};
+
static const struct inet_connection_sock_af_ops ipv6_specific = {
.queue_xmit = inet6_csk_xmit,
.send_check = tcp_v6_send_check,
--
1.7.3.2
^ permalink raw reply related
* [PATCH 4/7] ipv6: Add rt6_get_peer() helper.
From: David Miller @ 2010-12-02 20:42 UTC (permalink / raw)
To: netdev
To go along side ipv4's rt_get_peer().
Signed-off-by: David S. Miller <davem@davemloft.net>
---
include/net/ip6_route.h | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 23fed28..67d154a 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -59,6 +59,15 @@ static inline unsigned int rt6_flags2srcprefs(int flags)
extern void rt6_bind_peer(struct rt6_info *rt,
int create);
+static inline struct inet_peer *rt6_get_peer(struct rt6_info *rt)
+{
+ if (rt->rt6i_peer)
+ return rt->rt6i_peer;
+
+ rt6_bind_peer(rt, 0);
+ return rt->rt6i_peer;
+}
+
extern void ip6_route_input(struct sk_buff *skb);
extern struct dst_entry * ip6_route_output(struct net *net,
--
1.7.3.2
^ permalink raw reply related
* [PATCH 5/7] ipv6: Create inet6_csk_route_req().
From: David Miller @ 2010-12-02 20:42 UTC (permalink / raw)
To: netdev
Brother of ipv4's inet_csk_route_req().
Signed-off-by: David S. Miller <davem@davemloft.net>
---
include/net/inet6_connection_sock.h | 3 +++
net/ipv6/inet6_connection_sock.c | 32 ++++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/include/net/inet6_connection_sock.h b/include/net/inet6_connection_sock.h
index aae08f6..ff01350 100644
--- a/include/net/inet6_connection_sock.h
+++ b/include/net/inet6_connection_sock.h
@@ -25,6 +25,9 @@ struct sockaddr;
extern int inet6_csk_bind_conflict(const struct sock *sk,
const struct inet_bind_bucket *tb);
+extern struct dst_entry* inet6_csk_route_req(struct sock *sk,
+ const struct request_sock *req);
+
extern struct request_sock *inet6_csk_search_req(const struct sock *sk,
struct request_sock ***prevp,
const __be16 rport,
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c
index 861d252..e46305d 100644
--- a/net/ipv6/inet6_connection_sock.c
+++ b/net/ipv6/inet6_connection_sock.c
@@ -54,6 +54,38 @@ int inet6_csk_bind_conflict(const struct sock *sk,
EXPORT_SYMBOL_GPL(inet6_csk_bind_conflict);
+struct dst_entry *inet6_csk_route_req(struct sock *sk,
+ const struct request_sock *req)
+{
+ struct inet6_request_sock *treq = inet6_rsk(req);
+ struct ipv6_pinfo *np = inet6_sk(sk);
+ struct in6_addr *final_p, final;
+ struct dst_entry *dst;
+ struct flowi fl;
+
+ memset(&fl, 0, sizeof(fl));
+ fl.proto = IPPROTO_TCP;
+ ipv6_addr_copy(&fl.fl6_dst, &treq->rmt_addr);
+ final_p = fl6_update_dst(&fl, np->opt, &final);
+ ipv6_addr_copy(&fl.fl6_src, &treq->loc_addr);
+ fl.oif = sk->sk_bound_dev_if;
+ fl.mark = sk->sk_mark;
+ fl.fl_ip_dport = inet_rsk(req)->rmt_port;
+ fl.fl_ip_sport = inet_rsk(req)->loc_port;
+ security_req_classify_flow(req, &fl);
+
+ if (ip6_dst_lookup(sk, &dst, &fl))
+ return NULL;
+
+ if (final_p)
+ ipv6_addr_copy(&fl.fl6_dst, final_p);
+
+ if ((xfrm_lookup(sock_net(sk), &dst, &fl, sk, 0)) < 0)
+ return NULL;
+
+ return dst;
+}
+
/*
* request_sock (formerly open request) hash tables.
*/
--
1.7.3.2
^ permalink raw reply related
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