* [PATCH 0/3] mv643xx fixes
From: Brent Cook @ 2006-06-27 14:51 UTC (permalink / raw)
To: netdev
This is a series of fixes that for problems that we've found with the Marvell
MV643xx Gigabit MAC.
* Disable interrupts on all ports during initialization
* Increment TX bytes statistics counter
* Support BCM5461 PHY initialization
^ permalink raw reply
* Re: [PATCH 02/21] e1000: rework driver hardware reset locking
From: Auke Kok @ 2006-06-27 14:42 UTC (permalink / raw)
To: Jeff Garzik
Cc: Kok, Auke, netdev, Brandeburg, Jesse, Kok, Auke, Ronciak, John
In-Reply-To: <44A08CEC.1080108@pobox.com>
Jeff Garzik wrote:
> Kok, Auke wrote:
>> @@ -631,6 +627,9 @@ e1000_set_ringparam(struct net_device *n
>> tx_ring_size = sizeof(struct e1000_tx_ring) *
>> adapter->num_tx_queues;
>> rx_ring_size = sizeof(struct e1000_rx_ring) *
>> adapter->num_rx_queues;
>>
>> + while (test_and_set_bit(__E1000_RESETTING, &adapter->flags))
>> + msleep(1);
>
> This is a bit worrying, but no outright objection. We don't want to see
> these accumulate.
Agreed but at least we removed the opportunity to panic the driver as easy as
with 2 commandline commands (in several ways) - we're still looking into
improving this - any comments would be appreciated.
Cheers,
Auke
^ permalink raw reply
* Re: [PATCH 06/21] e1000: add smart power down code
From: Auke Kok @ 2006-06-27 14:40 UTC (permalink / raw)
To: Jeff Garzik
Cc: Kok, Auke, netdev, Brandeburg, Jesse, Kok, Auke, Ronciak, John
In-Reply-To: <44A08D35.7090007@pobox.com>
Jeff Garzik wrote:
> Kok, Auke wrote:
>> Smart Power Down is a power saving feature in newer e1000 hardware. We
>> disable it because it causes time to link to be long, but make it a
>> user choice.
>>
>> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
>> Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
>> ---
>>
>> drivers/net/e1000/e1000.h | 1 +
>> drivers/net/e1000/e1000_main.c | 15 +++++++++++++++
>> drivers/net/e1000/e1000_param.c | 25 +++++++++++++++++++++++++
>> 3 files changed, 41 insertions(+), 0 deletions(-)
>
> Since it's not default, who will actually use this? Particularly since
> it is only a module option, and not supported through ethtool (frown).
laptop users that frequently re-connect their cables might enable this
function since it saves battery life.
Auke
^ permalink raw reply
* Re: [PATCH 10/21] e1000: force register write flushes to circumvent broken platforms
From: Auke Kok @ 2006-06-27 14:36 UTC (permalink / raw)
To: Jeff Garzik
Cc: Kok, Auke, netdev, Brandeburg, Jesse, Kok, Auke, Ronciak, John
In-Reply-To: <44A08E33.3020501@pobox.com>
Jeff Garzik wrote:
> Kok, Auke wrote:
>> A certain AMD64 bridge (8132) has an option to turn on write combining
>> which breaks our adapter. To circumvent this we need to flush every
>> write.
>>
>> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
>> Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
>> ---
>>
>> drivers/net/e1000/e1000_hw.c | 24 ++++++++++++++++++++++--
>> drivers/net/e1000/e1000_main.c | 18 +++++++++++-------
>> 2 files changed, 33 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
>> index 3959039..749d621 100644
>> --- a/drivers/net/e1000/e1000_hw.c
>> +++ b/drivers/net/e1000/e1000_hw.c
>> @@ -705,8 +705,12 @@ e1000_init_hw(struct e1000_hw *hw)
>> /* Zero out the Multicast HASH table */
>> DEBUGOUT("Zeroing the MTA\n");
>> mta_size = E1000_MC_TBL_SIZE;
>> - for(i = 0; i < mta_size; i++)
>> + for(i = 0; i < mta_size; i++) {
>> E1000_WRITE_REG_ARRAY(hw, MTA, i, 0);
>> + /* use write flush to prevent Memory Write Block (MWB) from
>> + * occuring when accessing our register space */
>> + E1000_WRITE_FLUSH(hw);
>> + }
>
> NAK. We can't crap up every driver just for one weird piece of hardware.
>
> If this problem falls outside the grounds of mmiowb() [see
> Documentation/memory-barriers.txt], then other solutions need to be
> looked into... ioremap_nocache() ? Tweaking the MTRR for this region?
> Chipset quirk? ...
If there is an in-kernel fix for this that would make these flushes obsolete I
would certainly prefer it too, unfortunately we can't fix already released
kernels and our driver still needs to work there too, so that's why I queued
it. It can be dropped from this series if that's preferred.
Cheers,
Auke
^ permalink raw reply
* Re: Please pull 'upstream' branch of wireless-2.6
From: Michael Buesch @ 2006-06-27 14:36 UTC (permalink / raw)
To: Jeff Garzik; +Cc: bcm43xx-dev, Larry Finger, John W. Linville, netdev
In-Reply-To: <44A13C81.2050503@garzik.org>
On Tuesday 27 June 2006 16:11, Jeff Garzik wrote:
> Michael Buesch wrote:
> > On Tuesday 27 June 2006 04:27, Larry Finger wrote:
> >> Jeff Garzik wrote:
> >>> John W. Linville wrote:
> >>>> + assert(bcm->mac_suspended >= 0);
> >>>> + if (bcm->mac_suspended == 0) {
> >>>> + bcm43xx_power_saving_ctl_bits(bcm, -1, 1);
> >>>> + bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS_BITFIELD,
> >>>> + bcm43xx_read32(bcm,
> >>>> BCM43xx_MMIO_STATUS_BITFIELD)
> >>>> + & ~BCM43xx_SBF_MAC_ENABLED);
> >>>> + bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON); /* dummy
> >>>> read */
> >>>> + for (i = 100000; i; i--) {
> >>>> + tmp = bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON);
> >>>> + if (tmp & BCM43xx_IRQ_READY)
> >>>> + goto out;
> >>>> + udelay(10);
> >>>> + }
> >>>> + printkl(KERN_ERR PFX "MAC suspend failed\n");
> >>>> }
> >>>
> >>> NAK this super-long delay... should be done in a workqueue, looks like?
> >>>
> >>> ACK everything else.
> >>>
> >> That delay was set to try to accommodate my interface when it refused to suspend the MAC, which
> >> resulted in transmit errors. That problem has since been cured by reworking the periodic work
> >> handlers - thus such a long delay should not be needed. The original spec from the clean-room group
> >> was a delay loop of 1000. I'm currently testing that value now. If it passes the test, would a for
> >> (i=1000; i; i--) be acceptable?
> >
> > Short: Don't touch it. Fullstop.
> >
> > Long: The delay will _never_ be exhausted. Actually the for-counter
> > is only there to not lock up the machine, if there is a Bug in the
> > driver. (__much__ easier debugging).
> > The loop will only iterate a few times, typically.
> > Actually, _if_ we want to change something, we should do this:
> >
> > for (i = 1000000; i; i--) {
> > ...
> > udelay(1);
> > }
> >
> > (max loop multiplied by 10, delay value divided by 10).
> > This will shorten the whole delay by a few usecs (up to 10).
> > I will send a patch for this, if it is desired.
> >
> > But lowering the loop counter value is NACKed by me,
> > because it simply does not make sense.
>
>
> My overriding concern was that this type of loop spins the CPU at 100%
> until the hardware condition is satisfied, which starves all other
> kernel work on that CPU, and is very unfriendly to power consumption
> (though I believe monitor/mwait/cpu_relax helps on x86).
>
> Overall, bcm43xx is _really really bad_ about this sort of thing. Just
> grepping for udelay in bcm43xx_radio.c shows some of the worst
> offenders. bcm43xx_radio_init2060() and bcm43xx_radio_selectchannel()
> both look like candidates for using msleep() rather than udelay().
This is _all_ at initialization time.
select_channel.... How often do you select a channel?
I recently reworked the periodically exectuted workhandlers,
so that they are preemptible.
mac_suspend():
It is always called in atomic context with IRQs disabled.
We need to wait for the device here to signal "OK, MAC is down
now and you can count on it". This takes a few usecs. I guess
it sends out all queued packets, or whatever. We don't know
really.
I can actually measure how long it takes, if you really desire
it.
We _need_ to wait there. It is something like synchronize_irq(), or
whatever. It is a synchronizing function and we need it to be
synchronizing.
And I don't think it is worth the pain to insert a preemption
point there (or doing even fancier things with workqueues and
completions).
Overall, I don't think bcm43xx is still so bad at
wasting CPU. Maybe we should still insert some voluntary
preemption points, if the bcm43xx user does not run a fully
preemptible kernel. But if a fully preemptible kernel is run,
I think it is all OK.
--
Greetings Michael.
^ permalink raw reply
* Re: Please pull 'upstream' branch of wireless-2.6
From: Larry Finger @ 2006-06-27 14:34 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Michael Buesch, bcm43xx-dev, John W. Linville, netdev
In-Reply-To: <44A13C81.2050503@garzik.org>
Jeff Garzik wrote:
> Michael Buesch wrote:
>>
>> Short: Don't touch it. Fullstop.
>>
>> Long: The delay will _never_ be exhausted. Actually the for-counter
>> is only there to not lock up the machine, if there is a Bug in the
>> driver. (__much__ easier debugging).
>> The loop will only iterate a few times, typically.
>> Actually, _if_ we want to change something, we should do this:
>>
>> for (i = 1000000; i; i--) {
>> ...
>> udelay(1);
>> }
>>
>> (max loop multiplied by 10, delay value divided by 10).
>> This will shorten the whole delay by a few usecs (up to 10).
>> I will send a patch for this, if it is desired.
>>
>> But lowering the loop counter value is NACKed by me,
>> because it simply does not make sense.
>
>
> My overriding concern was that this type of loop spins the CPU at 100%
> until the hardware condition is satisfied, which starves all other
> kernel work on that CPU, and is very unfriendly to power consumption
> (though I believe monitor/mwait/cpu_relax helps on x86).
>
> Overall, bcm43xx is _really really bad_ about this sort of thing. Just
> grepping for udelay in bcm43xx_radio.c shows some of the worst
> offenders. bcm43xx_radio_init2060() and bcm43xx_radio_selectchannel()
> both look like candidates for using msleep() rather than udelay().
It is not my place to get into the middle of this discussion; however, my interface has been pinging
my AP for over 12 hours with the loop counter starting at 1000. I get the usual log entries for the
hourly TKIP changes, but no MAC suspend failures.
Larry
^ permalink raw reply
* Re: [PATCH REPOST 0/2][RFC] Network Event Notifier Mechanism
From: Steve Wise @ 2006-06-27 14:31 UTC (permalink / raw)
To: Herbert Xu; +Cc: davem, netdev
In-Reply-To: <E1FvD1V-00043F-00@gondolin.me.apana.org.au>
> I'd like to know more about what the RDMA device is going to do with this
> information. I thought RDMA was for receiving packets? Most of the info
> here pertains to transmission.
>
RDMA Ethernet devices adhere to a set of protocols defined by the IETF.
See the RDDP WG (http://www.ietf.org/html.charters/rddp-charter.html)
for the Internet Drafts that define the protocols.
Steve.
^ permalink raw reply
* Re: [PATCH 11/21] e1000: disable CRC stripping workaround
From: Auke Kok @ 2006-06-27 14:29 UTC (permalink / raw)
To: Jeff Garzik
Cc: Kok, Auke, netdev, Brandeburg, Jesse, Kok, Auke, Ronciak, John
In-Reply-To: <44A08E84.1000902@pobox.com>
Jeff Garzik wrote:
> Kok, Auke wrote:
>> CRC stripping is breaking SMBUS-connected BMC's. We disable this
>> feature to make it work. This fixes related bugs regarding SOL.
>>
>> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
>> Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
>> ---
>>
>> drivers/net/e1000/e1000_main.c | 7 ++++++-
>> 1 files changed, 6 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/net/e1000/e1000_main.c
>> b/drivers/net/e1000/e1000_main.c
>> index c44ed6f..7787299 100644
>> --- a/drivers/net/e1000/e1000_main.c
>> +++ b/drivers/net/e1000/e1000_main.c
>> @@ -1628,8 +1628,11 @@ e1000_setup_rctl(struct e1000_adapter *a
>> E1000_RCTL_LBM_NO | E1000_RCTL_RDMTS_HALF |
>> (adapter->hw.mc_filter_type << E1000_RCTL_MO_SHIFT);
>>
>> + /* disable hardware stripping of CRC because it breaks
>> + * BMC firmware connected over SMBUS
>> if (adapter->hw.mac_type > e1000_82543)
>> rctl |= E1000_RCTL_SECRC;
>> + */
>>
>> if (adapter->hw.tbi_compatibility_on == 1)
>> rctl |= E1000_RCTL_SBP;
>> @@ -1696,7 +1699,9 @@ e1000_setup_rctl(struct e1000_adapter *a
>> rfctl |= E1000_RFCTL_IPV6_DIS;
>> E1000_WRITE_REG(&adapter->hw, RFCTL, rfctl);
>>
>> - rctl |= E1000_RCTL_DTYP_PS | E1000_RCTL_SECRC;
>> + /* disable the stripping of CRC because it breaks
>> + * BMC firmware connected over SMBUS */
>> + rctl |= E1000_RCTL_DTYP_PS /* | E1000_RCTL_SECRC */;
>
> This is quite ugly. You are basically bloating the code with historic,
> dead code, no different than filling the e1000/*.c with '#if 0' regions.
>
> Just delete it, and explain why in the patch description.
Adjusted the patch on our git server to this:
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index c44ed6f..a9e55dc 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -1628,9 +1628,6 @@ e1000_setup_rctl(struct e1000_adapter *a
E1000_RCTL_LBM_NO | E1000_RCTL_RDMTS_HALF |
(adapter->hw.mc_filter_type << E1000_RCTL_MO_SHIFT);
- if (adapter->hw.mac_type > e1000_82543)
- rctl |= E1000_RCTL_SECRC;
-
if (adapter->hw.tbi_compatibility_on == 1)
rctl |= E1000_RCTL_SBP;
else
@@ -1696,7 +1693,7 @@ e1000_setup_rctl(struct e1000_adapter *a
rfctl |= E1000_RFCTL_IPV6_DIS;
E1000_WRITE_REG(&adapter->hw, RFCTL, rfctl);
- rctl |= E1000_RCTL_DTYP_PS | E1000_RCTL_SECRC;
+ rctl |= E1000_RCTL_DTYP_PS;
psrctl |= adapter->rx_ps_bsize0 >>
E1000_PSRCTL_BSIZE0_SHIFT;
Cheers,
Auke
^ permalink raw reply related
* Re: [PATCH 13/21] e1000: add E1000_BIG_ENDIAN symbol
From: Auke Kok @ 2006-06-27 14:25 UTC (permalink / raw)
To: Jeff Garzik
Cc: Kok, Auke, netdev, Brandeburg, Jesse, Kok, Auke, Ronciak, John
In-Reply-To: <44A08EBE.7030104@pobox.com>
Jeff Garzik wrote:
> Kok, Auke wrote:
>> This adds a private symbol to signify endianess in our driver.
>>
>> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
>> Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
>> ---
>>
>> drivers/net/e1000/e1000_hw.h | 2 +-
>> drivers/net/e1000/e1000_osdep.h | 3 +++
>> 2 files changed, 4 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h
>> index 941b47d..376a2ef 100644
>> --- a/drivers/net/e1000/e1000_hw.h
>> +++ b/drivers/net/e1000/e1000_hw.h
>> @@ -351,7 +351,7 @@ struct e1000_host_mng_command_info {
>> struct e1000_host_mng_command_header command_header; /* Command
>> Head/Command Result Head has 4 bytes */
>> uint8_t command_data[E1000_HI_MAX_MNG_DATA_LENGTH]; /* Command
>> data can length 0..0x658*/
>> };
>> -#ifdef __BIG_ENDIAN
>> +#ifdef E1000_BIG_ENDIAN
>> struct e1000_host_mng_dhcp_cookie{
>> uint32_t signature;
>> uint16_t vlan_id;
>> diff --git a/drivers/net/e1000/e1000_osdep.h
>> b/drivers/net/e1000/e1000_osdep.h
>> index 048d052..6130a42 100644
>> --- a/drivers/net/e1000/e1000_osdep.h
>> +++ b/drivers/net/e1000/e1000_osdep.h
>> @@ -83,6 +83,9 @@ typedef enum {
>> #define DEBUGOUT3 DEBUGOUT2
>> #define DEBUGOUT7 DEBUGOUT3
>>
>> +#ifdef __BIG_ENDIAN
>> +#define E1000_BIG_ENDIAN __BIG_ENDIAN
>> +#endif
>
> NAK. This is backwards: We don't need wrappers for symbols that the
> kernel already provides.
Agreed, I deleted it from our git server.
Auke
^ permalink raw reply
* Re: [PATCH 19/21] e1000: allow user to disable ich8 lock loss workaround
From: Auke Kok @ 2006-06-27 14:21 UTC (permalink / raw)
To: Jeff Garzik
Cc: Kok, Auke, netdev, Brandeburg, Jesse, Kok, Auke, Ronciak, John
In-Reply-To: <44A08FFE.2050605@pobox.com>
Jeff Garzik wrote:
> Kok, Auke wrote:
>> The workaround for the ich8 lock loss problem is only needed for
>> a very small amount of systems. This adds an option for the user
>> to disable the workaround.
>
> Does "very small amount" equate to "never in real production machines"?
Unfortunately not.
Cheers,
Auke
^ permalink raw reply
* Re: 2.6.17-mm3
From: Michal Piotrowski @ 2006-06-27 14:12 UTC (permalink / raw)
To: Andrew Morton
Cc: Stephen Hemminger, Ingo Molnar, Arjan van de Ven, linux-kernel,
netdev
In-Reply-To: <20060627015211.ce480da6.akpm@osdl.org>
Hi,
On 27/06/06, Andrew Morton <akpm@osdl.org> wrote:
>
> ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.17/2.6.17-mm3/
>
>
It looks like a skge bug
=========================================================
[ INFO: possible irq lock inversion dependency detected ]
---------------------------------------------------------
swapper/0 just changed the state of lock:
(tasklist_lock){..-?}, at: [<c0128092>] send_group_sig_info+0x16/0x34
but this lock took another, soft-irq-unsafe lock in the past:
(&sig->stats_lock){--..}
and interrupts could create inverse lock ordering between them.
other info that might help us debug this:
no locks held by swapper/0.
the first lock's dependencies:
-> (tasklist_lock){..-?} ops: 13763 {
initial-use at:
[<c01353ab>] lock_acquire+0x60/0x80
[<c02d0ce2>] _write_lock_irq+0x29/0x38
[<c011c4e3>] copy_process+0xea7/0x13c0
[<c011cc6a>] do_fork+0x8d/0x18f
[<c010136c>] kernel_thread+0x6c/0x74
[<c0100518>] rest_init+0x14/0x3c
[<c03b6769>] start_kernel+0x388/0x390
[<c0100210>] 0xc0100210
in-softirq-R at:
[..]
Here is a dmesg log http://www.stardust.webpages.pl/files/mm/2.6.17-mm3/mm-dmesg
Here is a config file
http://www.stardust.webpages.pl/files/mm/2.6.17-mm3/mm-config
Regards,
Michal
--
Michal K. K. Piotrowski
LTG - Linux Testers Group
(http://www.stardust.webpages.pl/ltg/wiki/)
^ permalink raw reply
* Re: Please pull 'upstream' branch of wireless-2.6
From: Jeff Garzik @ 2006-06-27 14:11 UTC (permalink / raw)
To: Michael Buesch; +Cc: bcm43xx-dev, Larry Finger, John W. Linville, netdev
In-Reply-To: <200606271530.06749.mb@bu3sch.de>
Michael Buesch wrote:
> On Tuesday 27 June 2006 04:27, Larry Finger wrote:
>> Jeff Garzik wrote:
>>> John W. Linville wrote:
>>>> + assert(bcm->mac_suspended >= 0);
>>>> + if (bcm->mac_suspended == 0) {
>>>> + bcm43xx_power_saving_ctl_bits(bcm, -1, 1);
>>>> + bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS_BITFIELD,
>>>> + bcm43xx_read32(bcm,
>>>> BCM43xx_MMIO_STATUS_BITFIELD)
>>>> + & ~BCM43xx_SBF_MAC_ENABLED);
>>>> + bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON); /* dummy
>>>> read */
>>>> + for (i = 100000; i; i--) {
>>>> + tmp = bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON);
>>>> + if (tmp & BCM43xx_IRQ_READY)
>>>> + goto out;
>>>> + udelay(10);
>>>> + }
>>>> + printkl(KERN_ERR PFX "MAC suspend failed\n");
>>>> }
>>>
>>> NAK this super-long delay... should be done in a workqueue, looks like?
>>>
>>> ACK everything else.
>>>
>> That delay was set to try to accommodate my interface when it refused to suspend the MAC, which
>> resulted in transmit errors. That problem has since been cured by reworking the periodic work
>> handlers - thus such a long delay should not be needed. The original spec from the clean-room group
>> was a delay loop of 1000. I'm currently testing that value now. If it passes the test, would a for
>> (i=1000; i; i--) be acceptable?
>
> Short: Don't touch it. Fullstop.
>
> Long: The delay will _never_ be exhausted. Actually the for-counter
> is only there to not lock up the machine, if there is a Bug in the
> driver. (__much__ easier debugging).
> The loop will only iterate a few times, typically.
> Actually, _if_ we want to change something, we should do this:
>
> for (i = 1000000; i; i--) {
> ...
> udelay(1);
> }
>
> (max loop multiplied by 10, delay value divided by 10).
> This will shorten the whole delay by a few usecs (up to 10).
> I will send a patch for this, if it is desired.
>
> But lowering the loop counter value is NACKed by me,
> because it simply does not make sense.
My overriding concern was that this type of loop spins the CPU at 100%
until the hardware condition is satisfied, which starves all other
kernel work on that CPU, and is very unfriendly to power consumption
(though I believe monitor/mwait/cpu_relax helps on x86).
Overall, bcm43xx is _really really bad_ about this sort of thing. Just
grepping for udelay in bcm43xx_radio.c shows some of the worst
offenders. bcm43xx_radio_init2060() and bcm43xx_radio_selectchannel()
both look like candidates for using msleep() rather than udelay().
Jeff
^ permalink raw reply
* Re: [Patch 1/1] AF_UNIX Datagram getpeersec [Updated #2]
From: James Morris @ 2006-06-27 13:57 UTC (permalink / raw)
To: Stephen Smalley
Cc: Catherine Zhang, netdev, David S. Miller, jmorris, chrisw,
Herbert Xu, tjaeger, Andrew Morton, latten, sergeh, gcwilson,
czhang.us
In-Reply-To: <1151414069.20419.37.camel@moss-spartans.epoch.ncsc.mil>
On Tue, 27 Jun 2006, Stephen Smalley wrote:
> What about saving the u32 seclen with the secdata, and using it later
> rather than recomputing strlen(secdata)? That also avoids encoding an
> assumption in the af_unix code about the content of the data (i.e.
> NUL-terminated string), leaving that to the security module.
Ok, this and other issues are addressed in the patch below, which is now
back to a single patch.
I also #ifdef'd the security fields in struct unix_skb_parms.
Please review and test.
---
include/asm-alpha/socket.h | 1 +
include/asm-arm/socket.h | 1 +
include/asm-arm26/socket.h | 1 +
include/asm-cris/socket.h | 1 +
include/asm-frv/socket.h | 1 +
include/asm-h8300/socket.h | 1 +
include/asm-i386/socket.h | 1 +
include/asm-ia64/socket.h | 1 +
include/asm-m32r/socket.h | 1 +
include/asm-m68k/socket.h | 1 +
include/asm-mips/socket.h | 1 +
include/asm-parisc/socket.h | 1 +
include/asm-powerpc/socket.h | 1 +
include/asm-s390/socket.h | 1 +
include/asm-sh/socket.h | 1 +
include/asm-sparc/socket.h | 1 +
include/asm-sparc64/socket.h | 1 +
include/asm-v850/socket.h | 1 +
include/asm-x86_64/socket.h | 1 +
include/asm-xtensa/socket.h | 1 +
include/linux/net.h | 1 +
include/linux/selinux.h | 15 +++++++++++++++
include/net/af_unix.h | 7 +++++++
include/net/scm.h | 17 +++++++++++++++++
net/core/sock.c | 11 +++++++++++
net/unix/af_unix.c | 25 +++++++++++++++++++++++++
security/selinux/exports.c | 11 +++++++++++
security/selinux/hooks.c | 8 +++++++-
28 files changed, 114 insertions(+), 1 deletion(-)
diff -purN -X dontdiff linux-2.6.o/include/asm-alpha/socket.h linux-2.6.w/include/asm-alpha/socket.h
--- linux-2.6.o/include/asm-alpha/socket.h 2006-06-21 00:02:08.000000000 -0400
+++ linux-2.6.w/include/asm-alpha/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -51,6 +51,7 @@
#define SCM_TIMESTAMP SO_TIMESTAMP
#define SO_PEERSEC 30
+#define SO_PASSSEC 34
/* Security levels - as per NRL IPv6 - don't actually do anything */
#define SO_SECURITY_AUTHENTICATION 19
diff -purN -X dontdiff linux-2.6.o/include/asm-arm/socket.h linux-2.6.w/include/asm-arm/socket.h
--- linux-2.6.o/include/asm-arm/socket.h 2006-06-21 00:02:10.000000000 -0400
+++ linux-2.6.w/include/asm-arm/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -48,5 +48,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_SOCKET_H */
diff -purN -X dontdiff linux-2.6.o/include/asm-arm26/socket.h linux-2.6.w/include/asm-arm26/socket.h
--- linux-2.6.o/include/asm-arm26/socket.h 2006-06-21 00:02:10.000000000 -0400
+++ linux-2.6.w/include/asm-arm26/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -48,5 +48,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_SOCKET_H */
diff -purN -X dontdiff linux-2.6.o/include/asm-cris/socket.h linux-2.6.w/include/asm-cris/socket.h
--- linux-2.6.o/include/asm-cris/socket.h 2006-06-21 00:02:11.000000000 -0400
+++ linux-2.6.w/include/asm-cris/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -50,6 +50,7 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_SOCKET_H */
diff -purN -X dontdiff linux-2.6.o/include/asm-frv/socket.h linux-2.6.w/include/asm-frv/socket.h
--- linux-2.6.o/include/asm-frv/socket.h 2006-06-21 00:02:11.000000000 -0400
+++ linux-2.6.w/include/asm-frv/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -48,6 +48,7 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_SOCKET_H */
diff -purN -X dontdiff linux-2.6.o/include/asm-h8300/socket.h linux-2.6.w/include/asm-h8300/socket.h
--- linux-2.6.o/include/asm-h8300/socket.h 2006-06-21 00:02:11.000000000 -0400
+++ linux-2.6.w/include/asm-h8300/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -48,5 +48,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_SOCKET_H */
diff -purN -X dontdiff linux-2.6.o/include/asm-i386/socket.h linux-2.6.w/include/asm-i386/socket.h
--- linux-2.6.o/include/asm-i386/socket.h 2006-06-21 00:02:12.000000000 -0400
+++ linux-2.6.w/include/asm-i386/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -48,5 +48,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_SOCKET_H */
diff -purN -X dontdiff linux-2.6.o/include/asm-ia64/socket.h linux-2.6.w/include/asm-ia64/socket.h
--- linux-2.6.o/include/asm-ia64/socket.h 2006-06-21 00:02:12.000000000 -0400
+++ linux-2.6.w/include/asm-ia64/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -57,5 +57,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_IA64_SOCKET_H */
diff -purN -X dontdiff linux-2.6.o/include/asm-m32r/socket.h linux-2.6.w/include/asm-m32r/socket.h
--- linux-2.6.o/include/asm-m32r/socket.h 2006-06-21 00:02:13.000000000 -0400
+++ linux-2.6.w/include/asm-m32r/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -48,5 +48,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_M32R_SOCKET_H */
diff -purN -X dontdiff linux-2.6.o/include/asm-m68k/socket.h linux-2.6.w/include/asm-m68k/socket.h
--- linux-2.6.o/include/asm-m68k/socket.h 2006-06-21 00:02:13.000000000 -0400
+++ linux-2.6.w/include/asm-m68k/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -48,5 +48,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_SOCKET_H */
diff -purN -X dontdiff linux-2.6.o/include/asm-mips/socket.h linux-2.6.w/include/asm-mips/socket.h
--- linux-2.6.o/include/asm-mips/socket.h 2006-06-21 00:02:15.000000000 -0400
+++ linux-2.6.w/include/asm-mips/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -69,6 +69,7 @@ To add: #define SO_REUSEPORT 0x0200 /* A
#define SO_PEERSEC 30
#define SO_SNDBUFFORCE 31
#define SO_RCVBUFFORCE 33
+#define SO_PASSSEC 34
#ifdef __KERNEL__
diff -purN -X dontdiff linux-2.6.o/include/asm-parisc/socket.h linux-2.6.w/include/asm-parisc/socket.h
--- linux-2.6.o/include/asm-parisc/socket.h 2006-06-21 00:02:15.000000000 -0400
+++ linux-2.6.w/include/asm-parisc/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -48,5 +48,6 @@
#define SO_ACCEPTCONN 0x401c
#define SO_PEERSEC 0x401d
+#define SO_PASSSEC 0x401e
#endif /* _ASM_SOCKET_H */
diff -purN -X dontdiff linux-2.6.o/include/asm-powerpc/socket.h linux-2.6.w/include/asm-powerpc/socket.h
--- linux-2.6.o/include/asm-powerpc/socket.h 2006-06-21 00:02:16.000000000 -0400
+++ linux-2.6.w/include/asm-powerpc/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -55,5 +55,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_POWERPC_SOCKET_H */
diff -purN -X dontdiff linux-2.6.o/include/asm-s390/socket.h linux-2.6.w/include/asm-s390/socket.h
--- linux-2.6.o/include/asm-s390/socket.h 2006-06-21 00:02:17.000000000 -0400
+++ linux-2.6.w/include/asm-s390/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -56,5 +56,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_SOCKET_H */
diff -purN -X dontdiff linux-2.6.o/include/asm-sh/socket.h linux-2.6.w/include/asm-sh/socket.h
--- linux-2.6.o/include/asm-sh/socket.h 2006-06-21 00:02:17.000000000 -0400
+++ linux-2.6.w/include/asm-sh/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -48,5 +48,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* __ASM_SH_SOCKET_H */
diff -purN -X dontdiff linux-2.6.o/include/asm-sparc/socket.h linux-2.6.w/include/asm-sparc/socket.h
--- linux-2.6.o/include/asm-sparc/socket.h 2006-06-21 00:02:18.000000000 -0400
+++ linux-2.6.w/include/asm-sparc/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -48,6 +48,7 @@
#define SCM_TIMESTAMP SO_TIMESTAMP
#define SO_PEERSEC 0x001e
+#define SO_PASSSEC 0x001f
/* Security levels - as per NRL IPv6 - don't actually do anything */
#define SO_SECURITY_AUTHENTICATION 0x5001
diff -purN -X dontdiff linux-2.6.o/include/asm-sparc64/socket.h linux-2.6.w/include/asm-sparc64/socket.h
--- linux-2.6.o/include/asm-sparc64/socket.h 2006-06-21 00:02:19.000000000 -0400
+++ linux-2.6.w/include/asm-sparc64/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -48,6 +48,7 @@
#define SCM_TIMESTAMP SO_TIMESTAMP
#define SO_PEERSEC 0x001e
+#define SO_PASSSEC 0x001f
/* Security levels - as per NRL IPv6 - don't actually do anything */
#define SO_SECURITY_AUTHENTICATION 0x5001
diff -purN -X dontdiff linux-2.6.o/include/asm-v850/socket.h linux-2.6.w/include/asm-v850/socket.h
--- linux-2.6.o/include/asm-v850/socket.h 2006-06-21 00:02:20.000000000 -0400
+++ linux-2.6.w/include/asm-v850/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -48,5 +48,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* __V850_SOCKET_H__ */
diff -purN -X dontdiff linux-2.6.o/include/asm-x86_64/socket.h linux-2.6.w/include/asm-x86_64/socket.h
--- linux-2.6.o/include/asm-x86_64/socket.h 2006-06-21 00:02:20.000000000 -0400
+++ linux-2.6.w/include/asm-x86_64/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -48,5 +48,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _ASM_SOCKET_H */
diff -purN -X dontdiff linux-2.6.o/include/asm-xtensa/socket.h linux-2.6.w/include/asm-xtensa/socket.h
--- linux-2.6.o/include/asm-xtensa/socket.h 2006-06-21 00:02:21.000000000 -0400
+++ linux-2.6.w/include/asm-xtensa/socket.h 2006-06-27 02:08:49.000000000 -0400
@@ -59,5 +59,6 @@
#define SO_ACCEPTCONN 30
#define SO_PEERSEC 31
+#define SO_PASSSEC 34
#endif /* _XTENSA_SOCKET_H */
diff -purN -X dontdiff linux-2.6.o/include/linux/net.h linux-2.6.w/include/linux/net.h
--- linux-2.6.o/include/linux/net.h 2006-06-21 00:02:23.000000000 -0400
+++ linux-2.6.w/include/linux/net.h 2006-06-27 02:08:49.000000000 -0400
@@ -61,6 +61,7 @@ typedef enum {
#define SOCK_ASYNC_WAITDATA 1
#define SOCK_NOSPACE 2
#define SOCK_PASSCRED 3
+#define SOCK_PASSSEC 4
#ifndef ARCH_HAS_SOCKET_TYPES
/**
diff -purN -X dontdiff linux-2.6.o/include/linux/selinux.h linux-2.6.w/include/linux/selinux.h
--- linux-2.6.o/include/linux/selinux.h 2006-06-21 00:02:23.000000000 -0400
+++ linux-2.6.w/include/linux/selinux.h 2006-06-27 02:18:47.000000000 -0400
@@ -18,6 +18,7 @@ struct selinux_audit_rule;
struct audit_context;
struct inode;
struct kern_ipc_perm;
+struct socket;
#ifdef CONFIG_SECURITY_SELINUX
@@ -119,6 +120,15 @@ void selinux_get_ipc_sid(const struct ke
void selinux_get_task_sid(struct task_struct *tsk, u32 *sid);
/**
+ * selinux_get_sock_sid - return the SID of socket
+ * @sock: the socket whose SID will be returned
+ * @sid: pointer to security context ID to be filled in.
+ *
+ * Returns nothing
+ */
+void selinux_get_sock_sid(struct socket *sock, u32 *sid);
+
+/**
* selinux_string_to_sid - map a security context string to a security ID
* @str: the security context string to be mapped
* @sid: ID value returned via this.
@@ -193,6 +203,11 @@ static inline void selinux_get_task_sid(
*sid = 0;
}
+static inline void selinux_get_sock_sid(struct socket *sock, u32 *sid)
+{
+ *sid = 0;
+}
+
static inline int selinux_string_to_sid(const char *str, u32 *sid)
{
*sid = 0;
diff -purN -X dontdiff linux-2.6.o/include/net/af_unix.h linux-2.6.w/include/net/af_unix.h
--- linux-2.6.o/include/net/af_unix.h 2006-06-21 00:02:24.000000000 -0400
+++ linux-2.6.w/include/net/af_unix.h 2006-06-27 09:28:04.000000000 -0400
@@ -53,10 +53,17 @@ struct unix_address {
struct unix_skb_parms {
struct ucred creds; /* Skb credentials */
struct scm_fp_list *fp; /* Passed files */
+#ifdef CONFIG_SECURITY_NETWORKING
+ char *secdata; /* Security context */
+ u32 seclen; /* Security length */
+#endif
+
};
#define UNIXCB(skb) (*(struct unix_skb_parms*)&((skb)->cb))
#define UNIXCREDS(skb) (&UNIXCB((skb)).creds)
+#define UNIXSECDATA(skb) (&UNIXCB((skb)).secdata)
+#define UNIXSECLEN(skb) (&UNIXCB((skb)).seclen)
#define unix_state_rlock(s) spin_lock(&unix_sk(s)->lock)
#define unix_state_runlock(s) spin_unlock(&unix_sk(s)->lock)
diff -purN -X dontdiff linux-2.6.o/include/net/scm.h linux-2.6.w/include/net/scm.h
--- linux-2.6.o/include/net/scm.h 2006-06-21 00:02:24.000000000 -0400
+++ linux-2.6.w/include/net/scm.h 2006-06-27 09:32:27.000000000 -0400
@@ -19,6 +19,10 @@ struct scm_cookie
{
struct ucred creds; /* Skb credentials */
struct scm_fp_list *fp; /* Passed files */
+#ifdef CONFIG_SECURITY_NETWORK
+ char *secdata; /* Security context */
+ u32 seclen; /* Security length */
+#endif
unsigned long seq; /* Connection seqno */
};
@@ -48,6 +52,17 @@ static __inline__ int scm_send(struct so
return __scm_send(sock, msg, scm);
}
+#ifdef CONFIG_SECURITY_NETWORK
+static inline void scm_passec(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm)
+{
+ if (test_bit(SOCK_PASSSEC, &sock->flags) && scm->secdata != NULL)
+ put_cmsg(msg, SOL_SOCKET, SCM_SECURITY, scm->seclen, scm->secdata);
+}
+#else
+static inline void scm_passec(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm)
+{ }
+#endif /* CONFIG_SECURITY_NETWORK */
+
static __inline__ void scm_recv(struct socket *sock, struct msghdr *msg,
struct scm_cookie *scm, int flags)
{
@@ -62,6 +77,8 @@ static __inline__ void scm_recv(struct s
if (test_bit(SOCK_PASSCRED, &sock->flags))
put_cmsg(msg, SOL_SOCKET, SCM_CREDENTIALS, sizeof(scm->creds), &scm->creds);
+ scm_passec(sock, msg, scm);
+
if (!scm->fp)
return;
diff -purN -X dontdiff linux-2.6.o/net/core/sock.c linux-2.6.w/net/core/sock.c
--- linux-2.6.o/net/core/sock.c 2006-06-21 00:02:27.000000000 -0400
+++ linux-2.6.w/net/core/sock.c 2006-06-27 02:08:49.000000000 -0400
@@ -565,6 +565,13 @@ set_rcvbuf:
ret = -ENONET;
break;
+ case SO_PASSSEC:
+ if (valbool)
+ set_bit(SOCK_PASSSEC, &sock->flags);
+ else
+ clear_bit(SOCK_PASSSEC, &sock->flags);
+ break;
+
/* We implement the SO_SNDLOWAT etc to
not be settable (1003.1g 5.3) */
default:
@@ -723,6 +730,10 @@ int sock_getsockopt(struct socket *sock,
v.val = sk->sk_state == TCP_LISTEN;
break;
+ case SO_PASSSEC:
+ v.val = test_bit(SOCK_PASSSEC, &sock->flags) ? 1 : 0;
+ break;
+
case SO_PEERSEC:
return security_socket_getpeersec_stream(sock, optval, optlen, len);
diff -purN -X dontdiff linux-2.6.o/net/unix/af_unix.c linux-2.6.w/net/unix/af_unix.c
--- linux-2.6.o/net/unix/af_unix.c 2006-06-21 00:02:30.000000000 -0400
+++ linux-2.6.w/net/unix/af_unix.c 2006-06-27 09:30:12.000000000 -0400
@@ -128,6 +128,28 @@ static atomic_t unix_nr_socks = ATOMIC_I
#define UNIX_ABSTRACT(sk) (unix_sk(sk)->addr->hash != UNIX_HASH_SIZE)
+#ifdef CONFIG_SECURITY_NETWORKING
+static void unix_get_peersec_dgram(struct sk_buff *skb)
+{
+ err = security_socket_getpeersec_dgram(skb, UNIXSECDATA(skb),
+ UNIXSECLEN(skb));
+ if (err)
+ *(UNIXSEC(skb)) = NULL;
+}
+
+static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb)
+{
+ scm->secdata = *UNIXSECDATA(skb);
+ scm->seclen = UNIXSECLEN(skb);
+}
+#else
+static void unix_get_peersec_dgram(struct sk_buff *skb)
+{ }
+
+static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb)
+{ }
+#endif /* CONFIG_SECURITY_NETWORKING */
+
/*
* SMP locking strategy:
* hash table is protected with spinlock unix_table_lock
@@ -1291,6 +1313,8 @@ static int unix_dgram_sendmsg(struct kio
if (siocb->scm->fp)
unix_attach_fds(siocb->scm, skb);
+ unix_get_peersec_dgram(skb);
+
skb->h.raw = skb->data;
err = memcpy_fromiovec(skb_put(skb,len), msg->msg_iov, len);
if (err)
@@ -1570,6 +1594,7 @@ static int unix_dgram_recvmsg(struct kio
memset(&tmp_scm, 0, sizeof(tmp_scm));
}
siocb->scm->creds = *UNIXCREDS(skb);
+ unix_set_secdata(siocb->scm, skb);
if (!(flags & MSG_PEEK))
{
diff -purN -X dontdiff linux-2.6.o/security/selinux/exports.c linux-2.6.w/security/selinux/exports.c
--- linux-2.6.o/security/selinux/exports.c 2006-06-21 00:02:31.000000000 -0400
+++ linux-2.6.w/security/selinux/exports.c 2006-06-27 02:19:16.000000000 -0400
@@ -17,6 +17,7 @@
#include <linux/selinux.h>
#include <linux/fs.h>
#include <linux/ipc.h>
+#include <net/sock.h>
#include "security.h"
#include "objsec.h"
@@ -72,6 +73,16 @@ void selinux_get_task_sid(struct task_st
*sid = 0;
}
+void selinux_get_sock_sid(struct socket *sock, u32 *sid)
+{
+ if (selinux_enabled) {
+ const struct inode *inode = SOCK_INODE(sock);
+ selinux_get_inode_sid(inode, sid);
+ return;
+ }
+ *sid = 0;
+}
+
int selinux_string_to_sid(char *str, u32 *sid)
{
if (selinux_enabled)
diff -purN -X dontdiff linux-2.6.o/security/selinux/hooks.c linux-2.6.w/security/selinux/hooks.c
--- linux-2.6.o/security/selinux/hooks.c 2006-06-26 14:47:31.000000000 -0400
+++ linux-2.6.w/security/selinux/hooks.c 2006-06-27 02:08:49.000000000 -0400
@@ -69,6 +69,7 @@
#include <linux/sysctl.h>
#include <linux/audit.h>
#include <linux/string.h>
+#include <linux/selinux.h>
#include "avc.h"
#include "objsec.h"
@@ -3418,7 +3419,12 @@ out:
static int selinux_socket_getpeersec_dgram(struct sk_buff *skb, char **secdata, u32 *seclen)
{
int err = 0;
- u32 peer_sid = selinux_socket_getpeer_dgram(skb);
+ u32 peer_sid;
+
+ if (skb->sk->sk_family == PF_UNIX)
+ selinux_get_sock_sid(skb->sk->sk_socket, &peer_sid);
+ else
+ peer_sid = selinux_socket_getpeer_dgram(skb);
if (peer_sid == SECSID_NULL)
return -EINVAL;
^ permalink raw reply
* Re: Please pull 'upstream' branch of wireless-2.6
From: Michael Buesch @ 2006-06-27 13:30 UTC (permalink / raw)
To: Jeff Garzik; +Cc: bcm43xx-dev, Larry Finger, John W. Linville, netdev
In-Reply-To: <44A097AA.6080809@lwfinger.net>
On Tuesday 27 June 2006 04:27, Larry Finger wrote:
> Jeff Garzik wrote:
> > John W. Linville wrote:
> >> + assert(bcm->mac_suspended >= 0);
> >> + if (bcm->mac_suspended == 0) {
> >> + bcm43xx_power_saving_ctl_bits(bcm, -1, 1);
> >> + bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS_BITFIELD,
> >> + bcm43xx_read32(bcm,
> >> BCM43xx_MMIO_STATUS_BITFIELD)
> >> + & ~BCM43xx_SBF_MAC_ENABLED);
> >> + bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON); /* dummy
> >> read */
> >> + for (i = 100000; i; i--) {
> >> + tmp = bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON);
> >> + if (tmp & BCM43xx_IRQ_READY)
> >> + goto out;
> >> + udelay(10);
> >> + }
> >> + printkl(KERN_ERR PFX "MAC suspend failed\n");
> >> }
> >
> >
> > NAK this super-long delay... should be done in a workqueue, looks like?
> >
> > ACK everything else.
> >
>
> That delay was set to try to accommodate my interface when it refused to suspend the MAC, which
> resulted in transmit errors. That problem has since been cured by reworking the periodic work
> handlers - thus such a long delay should not be needed. The original spec from the clean-room group
> was a delay loop of 1000. I'm currently testing that value now. If it passes the test, would a for
> (i=1000; i; i--) be acceptable?
Short: Don't touch it. Fullstop.
Long: The delay will _never_ be exhausted. Actually the for-counter
is only there to not lock up the machine, if there is a Bug in the
driver. (__much__ easier debugging).
The loop will only iterate a few times, typically.
Actually, _if_ we want to change something, we should do this:
for (i = 1000000; i; i--) {
...
udelay(1);
}
(max loop multiplied by 10, delay value divided by 10).
This will shorten the whole delay by a few usecs (up to 10).
I will send a patch for this, if it is desired.
But lowering the loop counter value is NACKed by me,
because it simply does not make sense.
--
Greetings Michael.
^ permalink raw reply
* [PATCH] cleanups for Becker-derived drivers
From: Jeff Garzik @ 2006-06-27 13:29 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel
Just checked this into netdev-2.6.git#upstream...
Jeff
commit 5e4860c2f5dd64bdc9dedc657c246129659b5bbe
Author: Jeff Garzik <jeff@garzik.org>
Date: Tue Jun 27 09:25:28 2006 -0400
[netdrvr] via-velocity: remove io_size struct member, it is invariant
Replace io_size struct members with VELOCITY_IO_SIZE constant.
Also, constify chip_info_table[].
Signed-off-by: Jeff Garzik <jeff@garzik.org>
commit 8a8b0fe4ac1cf49e4d1f170de20bc1c91206dc9c
Author: Jeff Garzik <jeff@garzik.org>
Date: Tue Jun 27 09:20:08 2006 -0400
[netdrvr] via-velocity: misc. cleanups
- const-ify pci_device_id table
- clean up pci_device_id table with PCI_DEVICE()
- don't store internal pointer in pci_device_id table,
use pci_device_id::driver_data as an integer index
- use dev_printk() for messages where eth%d prefix is unavailable
- formatting fixes
Signed-off-by: Jeff Garzik <jeff@garzik.org>
commit d573eb578808b9531e50b38222c56cf8792b4d86
Author: Jeff Garzik <jeff@garzik.org>
Date: Tue Jun 27 09:12:38 2006 -0400
[netdrvr] minor cleanups in Becker-derived drivers
- fealnx: convert #define to enum
- fealnx, sundance: mark chip info table __devinitdata
- fealnx: use dev_printk() during probe
- fealnx: formatting cleanups
- starfire: remove obsolete comment
- sundance, via-rhine: add some whitespace where useful, in tables
- sundance: prefer "{ }" table terminator
- via-rhine: mark PCI probe table const
Signed-off-by: Jeff Garzik <jeff@garzik.org>
commit c66fdbba1d9c058ea4a93c2be84c142cd24710ad
Author: Jeff Garzik <jeff@garzik.org>
Date: Tue Jun 27 08:56:23 2006 -0400
[netdrvr] via-velocity: use netdev_priv() where appropriate
Signed-off-by: Jeff Garzik <jeff@garzik.org>
commit 61c874a20369c61840bbe70c77b8703a7e70834b
Author: Jeff Garzik <jeff@garzik.org>
Date: Tue Jun 27 08:54:34 2006 -0400
[netdrvr] Remove Becker-template 'io_size' member, when invariant
Becker-derived drivers often have the 'io_size' member in their chip
info struct, indicating the minimum required size of the I/O resource
(usually a PCI BAR). For many situations, this number is either
constant or irrelevant (due to pci_iomap convenience behavior).
This change removes the io_size invariant member, and replaces it with a
compile-time constant.
Drivers updated: fealnx, gt96100eth, winbond-840, yellowfin
Additionally,
- gt96100eth: unused 'drv_flags' removed from gt96100eth
- winbond-840: unused struct match_info removed
- winbond-840: mark pci_id_tbl[] const, __devinitdata
Signed-off-by: Jeff Garzik <jeff@garzik.org>
commit 5a60e801d0db1421e1f5753e96edd63975023ace
Author: Jeff Garzik <jeff@garzik.org>
Date: Tue Jun 27 07:57:22 2006 -0400
[netdrvr] Remove Linux-specific changelogs from several Becker template drivers
When in-kernel net drivers branched from Donald Becker's vanilla driver
set, in the days before BitKeeper and git, a driver changelog was
maintained in the driver source code. These days, the kernel's
changelog is far superior and much more accurate, so the in-driver
changelogs are removed.
Another relic of the Becker/kernel split was version numbering, using
"foo-LKx.y.z" notation, resulting in weird version numbers like
"1.17b-LK1.1.9". These drivers are for older hardware, and see few
changes these days, so the version numbers were all bumped to something
more simple.
Finally, in xircom_tulip_cb specifically, an additional cleanup removes
the always-enabled CARDBUS cpp macro.
Signed-off-by: Jeff Garzik <jeff@garzik.org>
commit 45d2b49000fa6cd65e2409bf7c121b374c4974cd
Author: Jeff Garzik <jeff@garzik.org>
Date: Tue Jun 27 07:38:33 2006 -0400
[netdrvr] epic100: minor cleanups
- Remove in-source changelog, it's in the global kernel history.
- convert silly and useless version to useful one
- replace invariant pci_id_tbl[]::io_size uses with EPIC_TOTAL_SIZE
- remove now-unused io_size member from pci_id_tbl[]
- current kernel style prefers dev_printk() for the rare ethernet driver
messages that cannot print an 'eth%d' prefix.
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/net/dl2k.c | 43 ------------
drivers/net/epic100.c | 71 ++------------------
drivers/net/fealnx.c | 20 +++--
drivers/net/gt96100eth.c | 3
drivers/net/gt96100eth.h | 2
drivers/net/hamachi.c | 13 ---
drivers/net/natsemi.c | 117 ----------------------------------
drivers/net/starfire.c | 123 ------------------------------------
drivers/net/sundance.c | 106 ++++---------------------------
drivers/net/tulip/winbond-840.c | 29 +++-----
drivers/net/tulip/xircom_tulip_cb.c | 27 +------
drivers/net/via-rhine.c | 121 ++---------------------------------
drivers/net/via-velocity.c | 102 ++++++++++++++---------------
drivers/net/via-velocity.h | 4 -
drivers/net/yellowfin.c | 39 ++---------
15 files changed, 132 insertions(+), 688 deletions(-)
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
index 038447f..be997cb 100644
--- a/drivers/net/dl2k.c
+++ b/drivers/net/dl2k.c
@@ -9,49 +9,10 @@
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
*/
-/*
- Rev Date Description
- ==========================================================================
- 0.01 2001/05/03 Created DL2000-based linux driver
- 0.02 2001/05/21 Added VLAN and hardware checksum support.
- 1.00 2001/06/26 Added jumbo frame support.
- 1.01 2001/08/21 Added two parameters, rx_coalesce and rx_timeout.
- 1.02 2001/10/08 Supported fiber media.
- Added flow control parameters.
- 1.03 2001/10/12 Changed the default media to 1000mbps_fd for
- the fiber devices.
- 1.04 2001/11/08 Fixed Tx stopped when tx very busy.
- 1.05 2001/11/22 Fixed Tx stopped when unidirectional tx busy.
- 1.06 2001/12/13 Fixed disconnect bug at 10Mbps mode.
- Fixed tx_full flag incorrect.
- Added tx_coalesce paramter.
- 1.07 2002/01/03 Fixed miscount of RX frame error.
- 1.08 2002/01/17 Fixed the multicast bug.
- 1.09 2002/03/07 Move rx-poll-now to re-fill loop.
- Added rio_timer() to watch rx buffers.
- 1.10 2002/04/16 Fixed miscount of carrier error.
- 1.11 2002/05/23 Added ISR schedule scheme
- Fixed miscount of rx frame error for DGE-550SX.
- Fixed VLAN bug.
- 1.12 2002/06/13 Lock tx_coalesce=1 on 10/100Mbps mode.
- 1.13 2002/08/13 1. Fix disconnection (many tx:carrier/rx:frame
- errs) with some mainboards.
- 2. Use definition "DRV_NAME" "DRV_VERSION"
- "DRV_RELDATE" for flexibility.
- 1.14 2002/08/14 Support ethtool.
- 1.15 2002/08/27 Changed the default media to Auto-Negotiation
- for the fiber devices.
- 1.16 2002/09/04 More power down time for fiber devices auto-
- negotiation.
- Fix disconnect bug after ifup and ifdown.
- 1.17 2002/10/03 Fix RMON statistics overflow.
- Always use I/O mapping to access eeprom,
- avoid system freezing with some chipsets.
-*/
#define DRV_NAME "D-Link DL2000-based linux driver"
-#define DRV_VERSION "v1.17b"
-#define DRV_RELDATE "2006/03/10"
+#define DRV_VERSION "v1.18"
+#define DRV_RELDATE "2006/06/27"
#include "dl2k.h"
#include <linux/dma-mapping.h>
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c
index ee34a16..8dacd0d 100644
--- a/drivers/net/epic100.c
+++ b/drivers/net/epic100.c
@@ -19,62 +19,15 @@
Information and updates available at
http://www.scyld.com/network/epic100.html
+ [this link no longer provides anything useful -jgarzik]
---------------------------------------------------------------------
- Linux kernel-specific changes:
-
- LK1.1.2 (jgarzik):
- * Merge becker version 1.09 (4/08/2000)
-
- LK1.1.3:
- * Major bugfix to 1.09 driver (Francis Romieu)
-
- LK1.1.4 (jgarzik):
- * Merge becker test version 1.09 (5/29/2000)
-
- LK1.1.5:
- * Fix locking (jgarzik)
- * Limit 83c175 probe to ethernet-class PCI devices (rgooch)
-
- LK1.1.6:
- * Merge becker version 1.11
- * Move pci_enable_device before any PCI BAR len checks
-
- LK1.1.7:
- * { fill me in }
-
- LK1.1.8:
- * ethtool driver info support (jgarzik)
-
- LK1.1.9:
- * ethtool media get/set support (jgarzik)
-
- LK1.1.10:
- * revert MII transceiver init change (jgarzik)
-
- LK1.1.11:
- * implement ETHTOOL_[GS]SET, _NWAY_RST, _[GS]MSGLVL, _GLINK (jgarzik)
- * replace some MII-related magic numbers with constants
-
- LK1.1.12:
- * fix power-up sequence
-
- LK1.1.13:
- * revert version 1.1.12, power-up sequence "fix"
-
- LK1.1.14 (Kryzsztof Halasa):
- * fix spurious bad initializations
- * pound phy a la SMSC's app note on the subject
-
- AC1.1.14ac
- * fix power up/down for ethtool that broke in 1.11
-
*/
#define DRV_NAME "epic100"
-#define DRV_VERSION "1.11+LK1.1.14+AC1.1.14"
-#define DRV_RELDATE "June 2, 2004"
+#define DRV_VERSION "2.0"
+#define DRV_RELDATE "June 27, 2006"
/* The user-configurable values.
These may be modified when a driver module is loaded.*/
@@ -205,19 +158,15 @@ typedef enum {
struct epic_chip_info {
const char *name;
- int io_size; /* Needed for I/O region check or ioremap(). */
int drv_flags; /* Driver use, intended as capability flags. */
};
/* indexed by chip_t */
static const struct epic_chip_info pci_id_tbl[] = {
- { "SMSC EPIC/100 83c170",
- EPIC_TOTAL_SIZE, TYPE2_INTR | NO_MII | MII_PWRDWN },
- { "SMSC EPIC/100 83c170",
- EPIC_TOTAL_SIZE, TYPE2_INTR },
- { "SMSC EPIC/C 83c175",
- EPIC_TOTAL_SIZE, TYPE2_INTR | MII_PWRDWN },
+ { "SMSC EPIC/100 83c170", TYPE2_INTR | NO_MII | MII_PWRDWN },
+ { "SMSC EPIC/100 83c170", TYPE2_INTR },
+ { "SMSC EPIC/C 83c175", TYPE2_INTR | MII_PWRDWN },
};
@@ -386,8 +335,8 @@ #endif
goto out;
irq = pdev->irq;
- if (pci_resource_len(pdev, 0) < pci_id_tbl[chip_idx].io_size) {
- printk (KERN_ERR "card %d: no PCI region space\n", card_idx);
+ if (pci_resource_len(pdev, 0) < EPIC_TOTAL_SIZE) {
+ dev_printk(KERN_ERR, &pdev->dev, "no PCI region space\n");
ret = -ENODEV;
goto err_out_disable;
}
@@ -402,7 +351,7 @@ #endif
dev = alloc_etherdev(sizeof (*ep));
if (!dev) {
- printk (KERN_ERR "card %d: no memory for eth device\n", card_idx);
+ dev_printk(KERN_ERR, &pdev->dev, "no memory for eth device\n");
goto err_out_free_res;
}
SET_MODULE_OWNER(dev);
@@ -414,7 +363,7 @@ #else
ioaddr = pci_resource_start (pdev, 1);
ioaddr = (long) ioremap (ioaddr, pci_resource_len (pdev, 1));
if (!ioaddr) {
- printk (KERN_ERR DRV_NAME " %d: ioremap failed\n", card_idx);
+ dev_printk(KERN_ERR, &pdev->dev, "ioremap failed\n");
goto err_out_free_netdev;
}
#endif
diff --git a/drivers/net/fealnx.c b/drivers/net/fealnx.c
index 13eca7e..958ea51 100644
--- a/drivers/net/fealnx.c
+++ b/drivers/net/fealnx.c
@@ -124,7 +124,9 @@ MODULE_PARM_DESC(multicast_filter_limit,
MODULE_PARM_DESC(options, "fealnx: Bits 0-3: media type, bit 17: full duplex");
MODULE_PARM_DESC(full_duplex, "fealnx full duplex setting(s) (1)");
-#define MIN_REGION_SIZE 136
+enum {
+ MIN_REGION_SIZE = 136,
+};
/* A chip capabilities table, matching the entries in pci_tbl[] above. */
enum chip_capability_flags {
@@ -146,14 +148,13 @@ enum phy_type_flags {
struct chip_info {
char *chip_name;
- int io_size;
int flags;
};
-static const struct chip_info skel_netdrv_tbl[] = {
- {"100/10M Ethernet PCI Adapter", 136, HAS_MII_XCVR},
- {"100/10M Ethernet PCI Adapter", 136, HAS_CHIP_XCVR},
- {"1000/100/10M Ethernet PCI Adapter", 136, HAS_MII_XCVR},
+static const struct chip_info skel_netdrv_tbl[] __devinitdata = {
+ { "100/10M Ethernet PCI Adapter", HAS_MII_XCVR },
+ { "100/10M Ethernet PCI Adapter", HAS_CHIP_XCVR },
+ { "1000/100/10M Ethernet PCI Adapter", HAS_MII_XCVR },
};
/* Offsets to the Command and Status Registers. */
@@ -504,13 +505,14 @@ #endif
len = pci_resource_len(pdev, bar);
if (len < MIN_REGION_SIZE) {
- printk(KERN_ERR "%s: region size %ld too small, aborting\n",
- boardname, len);
+ dev_printk(KERN_ERR, &pdev->dev,
+ "region size %ld too small, aborting\n", len);
return -ENODEV;
}
i = pci_request_regions(pdev, boardname);
- if (i) return i;
+ if (i)
+ return i;
irq = pdev->irq;
diff --git a/drivers/net/gt96100eth.c b/drivers/net/gt96100eth.c
index 2d24354..243c9a5 100644
--- a/drivers/net/gt96100eth.c
+++ b/drivers/net/gt96100eth.c
@@ -699,7 +699,6 @@ static int __init gt96100_probe1(struct
memset(gp, 0, sizeof(*gp)); // clear it
gp->port_num = port_num;
- gp->io_size = GT96100_ETH_IO_SIZE;
gp->port_offset = port_num * GT96100_ETH_IO_SIZE;
gp->phy_addr = phy_addr;
gp->chip_rev = chip_rev;
@@ -1531,7 +1530,7 @@ static void gt96100_cleanup_module(void)
+ sizeof(gt96100_td_t) * TX_RING_SIZE,
gp->rx_ring);
free_netdev(gtif->dev);
- release_region(gtif->iobase, gp->io_size);
+ release_region(gtif->iobase, GT96100_ETH_IO_SIZE);
}
}
}
diff --git a/drivers/net/gt96100eth.h b/drivers/net/gt96100eth.h
index 395869c..cda81c9 100644
--- a/drivers/net/gt96100eth.h
+++ b/drivers/net/gt96100eth.h
@@ -332,7 +332,6 @@ struct gt96100_private {
mib_counters_t mib;
struct net_device_stats stats;
- int io_size;
int port_num; // 0 or 1
int chip_rev;
u32 port_offset;
@@ -341,7 +340,6 @@ struct gt96100_private {
u32 last_psr; // last value of the port status register
int options; /* User-settable misc. driver options. */
- int drv_flags;
struct timer_list timer;
spinlock_t lock; /* Serialise access to device */
};
diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c
index 0ea4cb4..2b91099 100644
--- a/drivers/net/hamachi.c
+++ b/drivers/net/hamachi.c
@@ -20,22 +20,15 @@
Support and updates available at
http://www.scyld.com/network/hamachi.html
+ [link no longer provides useful info -jgarzik]
or
http://www.parl.clemson.edu/~keithu/hamachi.html
-
-
- Linux kernel changelog:
-
- LK1.0.1:
- - fix lack of pci_dev<->dev association
- - ethtool support (jgarzik)
-
*/
#define DRV_NAME "hamachi"
-#define DRV_VERSION "1.01+LK1.0.1"
-#define DRV_RELDATE "5/18/2001"
+#define DRV_VERSION "2.0"
+#define DRV_RELDATE "June 27, 2006"
/* A few user-configurable values. */
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 5657049..963377c 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -20,120 +20,9 @@
Support information and updates available at
http://www.scyld.com/network/netsemi.html
+ [link no longer provides useful info -jgarzik]
- Linux kernel modifications:
-
- Version 1.0.1:
- - Spinlock fixes
- - Bug fixes and better intr performance (Tjeerd)
- Version 1.0.2:
- - Now reads correct MAC address from eeprom
- Version 1.0.3:
- - Eliminate redundant priv->tx_full flag
- - Call netif_start_queue from dev->tx_timeout
- - wmb() in start_tx() to flush data
- - Update Tx locking
- - Clean up PCI enable (davej)
- Version 1.0.4:
- - Merge Donald Becker's natsemi.c version 1.07
- Version 1.0.5:
- - { fill me in }
- Version 1.0.6:
- * ethtool support (jgarzik)
- * Proper initialization of the card (which sometimes
- fails to occur and leaves the card in a non-functional
- state). (uzi)
-
- * Some documented register settings to optimize some
- of the 100Mbit autodetection circuitry in rev C cards. (uzi)
-
- * Polling of the PHY intr for stuff like link state
- change and auto- negotiation to finally work properly. (uzi)
-
- * One-liner removal of a duplicate declaration of
- netdev_error(). (uzi)
-
- Version 1.0.7: (Manfred Spraul)
- * pci dma
- * SMP locking update
- * full reset added into tx_timeout
- * correct multicast hash generation (both big and little endian)
- [copied from a natsemi driver version
- from Myrio Corporation, Greg Smith]
- * suspend/resume
-
- version 1.0.8 (Tim Hockin <thockin@sun.com>)
- * ETHTOOL_* support
- * Wake on lan support (Erik Gilling)
- * MXDMA fixes for serverworks
- * EEPROM reload
-
- version 1.0.9 (Manfred Spraul)
- * Main change: fix lack of synchronize
- netif_close/netif_suspend against a last interrupt
- or packet.
- * do not enable superflous interrupts (e.g. the
- drivers relies on TxDone - TxIntr not needed)
- * wait that the hardware has really stopped in close
- and suspend.
- * workaround for the (at least) gcc-2.95.1 compiler
- problem. Also simplifies the code a bit.
- * disable_irq() in tx_timeout - needed to protect
- against rx interrupts.
- * stop the nic before switching into silent rx mode
- for wol (required according to docu).
-
- version 1.0.10:
- * use long for ee_addr (various)
- * print pointers properly (DaveM)
- * include asm/irq.h (?)
-
- version 1.0.11:
- * check and reset if PHY errors appear (Adrian Sun)
- * WoL cleanup (Tim Hockin)
- * Magic number cleanup (Tim Hockin)
- * Don't reload EEPROM on every reset (Tim Hockin)
- * Save and restore EEPROM state across reset (Tim Hockin)
- * MDIO Cleanup (Tim Hockin)
- * Reformat register offsets/bits (jgarzik)
-
- version 1.0.12:
- * ETHTOOL_* further support (Tim Hockin)
-
- version 1.0.13:
- * ETHTOOL_[G]EEPROM support (Tim Hockin)
-
- version 1.0.13:
- * crc cleanup (Matt Domsch <Matt_Domsch@dell.com>)
-
- version 1.0.14:
- * Cleanup some messages and autoneg in ethtool (Tim Hockin)
-
- version 1.0.15:
- * Get rid of cable_magic flag
- * use new (National provided) solution for cable magic issue
-
- version 1.0.16:
- * call netdev_rx() for RxErrors (Manfred Spraul)
- * formatting and cleanups
- * change options and full_duplex arrays to be zero
- initialized
- * enable only the WoL and PHY interrupts in wol mode
-
- version 1.0.17:
- * only do cable_magic on 83815 and early 83816 (Tim Hockin)
- * create a function for rx refill (Manfred Spraul)
- * combine drain_ring and init_ring (Manfred Spraul)
- * oom handling (Manfred Spraul)
- * hands_off instead of playing with netif_device_{de,a}ttach
- (Manfred Spraul)
- * be sure to write the MAC back to the chip (Manfred Spraul)
- * lengthen EEPROM timeout, and always warn about timeouts
- (Manfred Spraul)
- * comments update (Manfred)
- * do the right thing on a phy-reset (Manfred and Tim)
-
TODO:
* big endian support with CFG:BEM instead of cpu_to_le32
*/
@@ -166,8 +55,8 @@ #include <asm/irq.h>
#include <asm/uaccess.h>
#define DRV_NAME "natsemi"
-#define DRV_VERSION "1.07+LK1.0.17"
-#define DRV_RELDATE "Sep 27, 2002"
+#define DRV_VERSION "2.0"
+#define DRV_RELDATE "June 27, 2006"
#define RX_OFFSET 2
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
index c158eed..e0f1aaf 100644
--- a/drivers/net/starfire.c
+++ b/drivers/net/starfire.c
@@ -22,129 +22,13 @@
Support and updates available at
http://www.scyld.com/network/starfire.html
+ [link no longer provides useful info -jgarzik]
- -----------------------------------------------------------
-
- Linux kernel-specific changes:
-
- LK1.1.1 (jgarzik):
- - Use PCI driver interface
- - Fix MOD_xxx races
- - softnet fixups
-
- LK1.1.2 (jgarzik):
- - Merge Becker version 0.15
-
- LK1.1.3 (Andrew Morton)
- - Timer cleanups
-
- LK1.1.4 (jgarzik):
- - Merge Becker version 1.03
-
- LK1.2.1 (Ion Badulescu <ionut@cs.columbia.edu>)
- - Support hardware Rx/Tx checksumming
- - Use the GFP firmware taken from Adaptec's Netware driver
-
- LK1.2.2 (Ion Badulescu)
- - Backported to 2.2.x
-
- LK1.2.3 (Ion Badulescu)
- - Fix the flaky mdio interface
- - More compat clean-ups
-
- LK1.2.4 (Ion Badulescu)
- - More 2.2.x initialization fixes
-
- LK1.2.5 (Ion Badulescu)
- - Several fixes from Manfred Spraul
-
- LK1.2.6 (Ion Badulescu)
- - Fixed ifup/ifdown/ifup problem in 2.4.x
-
- LK1.2.7 (Ion Badulescu)
- - Removed unused code
- - Made more functions static and __init
-
- LK1.2.8 (Ion Badulescu)
- - Quell bogus error messages, inform about the Tx threshold
- - Removed #ifdef CONFIG_PCI, this driver is PCI only
-
- LK1.2.9 (Ion Badulescu)
- - Merged Jeff Garzik's changes from 2.4.4-pre5
- - Added 2.2.x compatibility stuff required by the above changes
-
- LK1.2.9a (Ion Badulescu)
- - More updates from Jeff Garzik
-
- LK1.3.0 (Ion Badulescu)
- - Merged zerocopy support
-
- LK1.3.1 (Ion Badulescu)
- - Added ethtool support
- - Added GPIO (media change) interrupt support
-
- LK1.3.2 (Ion Badulescu)
- - Fixed 2.2.x compatibility issues introduced in 1.3.1
- - Fixed ethtool ioctl returning uninitialized memory
-
- LK1.3.3 (Ion Badulescu)
- - Initialize the TxMode register properly
- - Don't dereference dev->priv after freeing it
-
- LK1.3.4 (Ion Badulescu)
- - Fixed initialization timing problems
- - Fixed interrupt mask definitions
-
- LK1.3.5 (jgarzik)
- - ethtool NWAY_RST, GLINK, [GS]MSGLVL support
-
- LK1.3.6:
- - Sparc64 support and fixes (Ion Badulescu)
- - Better stats and error handling (Ion Badulescu)
- - Use new pci_set_mwi() PCI API function (jgarzik)
-
- LK1.3.7 (Ion Badulescu)
- - minimal implementation of tx_timeout()
- - correctly shutdown the Rx/Tx engines in netdev_close()
- - added calls to netif_carrier_on/off
- (patch from Stefan Rompf <srompf@isg.de>)
- - VLAN support
-
- LK1.3.8 (Ion Badulescu)
- - adjust DMA burst size on sparc64
- - 64-bit support
- - reworked zerocopy support for 64-bit buffers
- - working and usable interrupt mitigation/latency
- - reduced Tx interrupt frequency for lower interrupt overhead
-
- LK1.3.9 (Ion Badulescu)
- - bugfix for mcast filter
- - enable the right kind of Tx interrupts (TxDMADone, not TxDone)
-
- LK1.4.0 (Ion Badulescu)
- - NAPI support
-
- LK1.4.1 (Ion Badulescu)
- - flush PCI posting buffers after disabling Rx interrupts
- - put the chip to a D3 slumber on driver unload
- - added config option to enable/disable NAPI
-
- LK1.4.2 (Ion Badulescu)
- - finally added firmware (GPL'ed by Adaptec)
- - removed compatibility code for 2.2.x
-
- LK1.4.2.1 (Ion Badulescu)
- - fixed 32/64 bit issues on i386 + CONFIG_HIGHMEM
- - added 32-bit padding to outgoing skb's, removed previous workaround
-
-TODO: - fix forced speed/duplexing code (broken a long time ago, when
- somebody converted the driver to use the generic MII code)
- - fix VLAN support
*/
#define DRV_NAME "starfire"
-#define DRV_VERSION "1.03+LK1.4.2.1"
-#define DRV_RELDATE "October 3, 2005"
+#define DRV_VERSION "2.0"
+#define DRV_RELDATE "June 27, 2006"
#include <linux/config.h>
#include <linux/module.h>
@@ -847,7 +731,6 @@ #endif
goto err_out_free_netdev;
}
- /* ioremap is borken in Linux-2.2.x/sparc64 */
base = ioremap(ioaddr, io_size);
if (!base) {
printk(KERN_ERR DRV_NAME " %d: cannot remap %#x @ %#lx, aborting\n",
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c
index f13b2a1..01ba7f8 100644
--- a/drivers/net/sundance.c
+++ b/drivers/net/sundance.c
@@ -16,91 +16,13 @@
Support and updates available at
http://www.scyld.com/network/sundance.html
+ [link no longer provides useful info -jgarzik]
-
- Version LK1.01a (jgarzik):
- - Replace some MII-related magic numbers with constants
-
- Version LK1.02 (D-Link):
- - Add new board to PCI ID list
- - Fix multicast bug
-
- Version LK1.03 (D-Link):
- - New Rx scheme, reduce Rx congestion
- - Option to disable flow control
-
- Version LK1.04 (D-Link):
- - Tx timeout recovery
- - More support for ethtool.
-
- Version LK1.04a:
- - Remove unused/constant members from struct pci_id_info
- (which then allows removal of 'drv_flags' from private struct)
- (jgarzik)
- - If no phy is found, fail to load that board (jgarzik)
- - Always start phy id scan at id 1 to avoid problems (Donald Becker)
- - Autodetect where mii_preable_required is needed,
- default to not needed. (Donald Becker)
-
- Version LK1.04b:
- - Remove mii_preamble_required module parameter (Donald Becker)
- - Add per-interface mii_preamble_required (setting is autodetected)
- (Donald Becker)
- - Remove unnecessary cast from void pointer (jgarzik)
- - Re-align comments in private struct (jgarzik)
-
- Version LK1.04c (jgarzik):
- - Support bitmapped message levels (NETIF_MSG_xxx), and the
- two ethtool ioctls that get/set them
- - Don't hand-code MII ethtool support, use standard API/lib
-
- Version LK1.04d:
- - Merge from Donald Becker's sundance.c: (Jason Lunz)
- * proper support for variably-sized MTUs
- * default to PIO, to fix chip bugs
- - Add missing unregister_netdev (Jason Lunz)
- - Add CONFIG_SUNDANCE_MMIO config option (jgarzik)
- - Better rx buf size calculation (Donald Becker)
-
- Version LK1.05 (D-Link):
- - Fix DFE-580TX packet drop issue (for DL10050C)
- - Fix reset_tx logic
-
- Version LK1.06 (D-Link):
- - Fix crash while unloading driver
-
- Versin LK1.06b (D-Link):
- - New tx scheme, adaptive tx_coalesce
-
- Version LK1.07 (D-Link):
- - Fix tx bugs in big-endian machines
- - Remove unused max_interrupt_work module parameter, the new
- NAPI-like rx scheme doesn't need it.
- - Remove redundancy get_stats() in intr_handler(), those
- I/O access could affect performance in ARM-based system
- - Add Linux software VLAN support
-
- Version LK1.08 (Philippe De Muyter phdm@macqel.be):
- - Fix bug of custom mac address
- (StationAddr register only accept word write)
-
- Version LK1.09 (D-Link):
- - Fix the flowctrl bug.
- - Set Pause bit in MII ANAR if flow control enabled.
-
- Version LK1.09a (ICPlus):
- - Add the delay time in reading the contents of EEPROM
-
- Version LK1.10 (Philippe De Muyter phdm@macqel.be):
- - Make 'unblock interface after Tx underrun' work
-
- Version LK1.11 (Pedro Alejandro Lopez-Valencia palopezv at gmail.com):
- - Add support for IC Plus Corporation IP100A chipset
*/
#define DRV_NAME "sundance"
-#define DRV_VERSION "1.01+LK1.11"
-#define DRV_RELDATE "14-Jun-2006"
+#define DRV_VERSION "1.1"
+#define DRV_RELDATE "27-Jun-2006"
/* The user-configurable values.
@@ -282,15 +204,15 @@ #ifndef CONFIG_SUNDANCE_MMIO
#define USE_IO_OPS 1
#endif
-static struct pci_device_id sundance_pci_tbl[] = {
- {0x1186, 0x1002, 0x1186, 0x1002, 0, 0, 0},
- {0x1186, 0x1002, 0x1186, 0x1003, 0, 0, 1},
- {0x1186, 0x1002, 0x1186, 0x1012, 0, 0, 2},
- {0x1186, 0x1002, 0x1186, 0x1040, 0, 0, 3},
- {0x1186, 0x1002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4},
- {0x13F0, 0x0201, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 5},
- {0x13F0, 0x0200, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 6},
- {0,}
+static const struct pci_device_id sundance_pci_tbl[] = {
+ { 0x1186, 0x1002, 0x1186, 0x1002, 0, 0, 0 },
+ { 0x1186, 0x1002, 0x1186, 0x1003, 0, 0, 1 },
+ { 0x1186, 0x1002, 0x1186, 0x1012, 0, 0, 2 },
+ { 0x1186, 0x1002, 0x1186, 0x1040, 0, 0, 3 },
+ { 0x1186, 0x1002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4 },
+ { 0x13F0, 0x0201, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 5 },
+ { 0x13F0, 0x0200, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 6 },
+ { }
};
MODULE_DEVICE_TABLE(pci, sundance_pci_tbl);
@@ -301,7 +223,7 @@ enum {
struct pci_id_info {
const char *name;
};
-static const struct pci_id_info pci_id_tbl[] = {
+static const struct pci_id_info pci_id_tbl[] __devinitdata = {
{"D-Link DFE-550TX FAST Ethernet Adapter"},
{"D-Link DFE-550FX 100Mbps Fiber-optics Adapter"},
{"D-Link DFE-580TX 4 port Server Adapter"},
@@ -309,7 +231,7 @@ static const struct pci_id_info pci_id_t
{"D-Link DL10050-based FAST Ethernet Adapter"},
{"Sundance Technology Alta"},
{"IC Plus Corporation IP100A FAST Ethernet Adapter"},
- {NULL,}, /* 0 terminated list. */
+ { } /* terminate list. */
};
/* This driver was written to use PCI memory space, however x86-oriented
diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c
index 602a6e5..a1e3159 100644
--- a/drivers/net/tulip/winbond-840.c
+++ b/drivers/net/tulip/winbond-840.c
@@ -224,24 +224,21 @@ static const struct pci_device_id w840_p
};
MODULE_DEVICE_TABLE(pci, w840_pci_tbl);
+enum {
+ netdev_res_size = 128, /* size of PCI BAR resource */
+};
+
struct pci_id_info {
const char *name;
- struct match_info {
- int pci, pci_mask, subsystem, subsystem_mask;
- int revision, revision_mask; /* Only 8 bits. */
- } id;
- int io_size; /* Needed for I/O region check or ioremap(). */
- int drv_flags; /* Driver use, intended as capability flags. */
+ int drv_flags; /* Driver use, intended as capability flags. */
};
-static struct pci_id_info pci_id_tbl[] = {
- {"Winbond W89c840", /* Sometime a Level-One switch card. */
- { 0x08401050, 0xffffffff, 0x81530000, 0xffff0000 },
- 128, CanHaveMII | HasBrokenTx | FDXOnNoMII},
- {"Winbond W89c840", { 0x08401050, 0xffffffff, },
- 128, CanHaveMII | HasBrokenTx},
- {"Compex RL100-ATX", { 0x201111F6, 0xffffffff,},
- 128, CanHaveMII | HasBrokenTx},
- {NULL,}, /* 0 terminated list. */
+
+static const struct pci_id_info pci_id_tbl[] __devinitdata = {
+ { /* Sometime a Level-One switch card. */
+ "Winbond W89c840", CanHaveMII | HasBrokenTx | FDXOnNoMII},
+ { "Winbond W89c840", CanHaveMII | HasBrokenTx},
+ { "Compex RL100-ATX", CanHaveMII | HasBrokenTx},
+ { } /* terminate list. */
};
/* This driver was written to use PCI memory space, however some x86 systems
@@ -399,7 +396,7 @@ static int __devinit w840_probe1 (struct
#ifdef USE_IO_OPS
bar = 0;
#endif
- ioaddr = pci_iomap(pdev, bar, pci_id_tbl[chip_idx].io_size);
+ ioaddr = pci_iomap(pdev, bar, netdev_res_size);
if (!ioaddr)
goto err_out_free_res;
diff --git a/drivers/net/tulip/xircom_tulip_cb.c b/drivers/net/tulip/xircom_tulip_cb.c
index 887d724..8b5f5d8 100644
--- a/drivers/net/tulip/xircom_tulip_cb.c
+++ b/drivers/net/tulip/xircom_tulip_cb.c
@@ -10,26 +10,11 @@
410 Severn Ave., Suite 210
Annapolis MD 21403
- -----------------------------------------------------------
-
- Linux kernel-specific changes:
-
- LK1.0 (Ion Badulescu)
- - Major cleanup
- - Use 2.4 PCI API
- - Support ethtool
- - Rewrite perfect filter/hash code
- - Use interrupts for media changes
-
- LK1.1 (Ion Badulescu)
- - Disallow negotiation of unsupported full-duplex modes
*/
#define DRV_NAME "xircom_tulip_cb"
-#define DRV_VERSION "0.91+LK1.1"
-#define DRV_RELDATE "October 11, 2001"
-
-#define CARDBUS 1
+#define DRV_VERSION "0.92"
+#define DRV_RELDATE "June 27, 2006"
/* A few user-configurable values. */
@@ -307,10 +292,10 @@ struct xircom_private {
struct xircom_tx_desc tx_ring[TX_RING_SIZE];
/* The saved address of a sent-in-place packet/buffer, for skfree(). */
struct sk_buff* tx_skbuff[TX_RING_SIZE];
-#ifdef CARDBUS
+
/* The X3201-3 requires 4-byte aligned tx bufs */
struct sk_buff* tx_aligned_skbuff[TX_RING_SIZE];
-#endif
+
/* The addresses of receive-in-place skbuffs. */
struct sk_buff* rx_skbuff[RX_RING_SIZE];
u16 setup_frame[PKT_SETUP_SZ / sizeof(u16)]; /* Pseudo-Tx frame to init address table. */
@@ -909,10 +894,8 @@ static void xircom_init_ring(struct net_
tp->tx_skbuff[i] = NULL;
tp->tx_ring[i].status = 0;
tp->tx_ring[i].buffer2 = virt_to_bus(&tp->tx_ring[i+1]);
-#ifdef CARDBUS
if (tp->chip_id == X3201_3)
tp->tx_aligned_skbuff[i] = dev_alloc_skb(PKT_BUF_SZ);
-#endif /* CARDBUS */
}
tp->tx_ring[i-1].buffer2 = virt_to_bus(&tp->tx_ring[0]);
}
@@ -932,12 +915,10 @@ xircom_start_xmit(struct sk_buff *skb, s
entry = tp->cur_tx % TX_RING_SIZE;
tp->tx_skbuff[entry] = skb;
-#ifdef CARDBUS
if (tp->chip_id == X3201_3) {
memcpy(tp->tx_aligned_skbuff[entry]->data,skb->data,skb->len);
tp->tx_ring[entry].buffer1 = virt_to_bus(tp->tx_aligned_skbuff[entry]->data);
} else
-#endif
tp->tx_ring[entry].buffer1 = virt_to_bus(skb->data);
if (tp->cur_tx - tp->dirty_tx < TX_RING_SIZE/2) {/* Typical path */
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
index c80a4f1..a16b0d6 100644
--- a/drivers/net/via-rhine.c
+++ b/drivers/net/via-rhine.c
@@ -25,117 +25,13 @@
version. He may or may not be interested in bug reports on this
code. You can find his versions at:
http://www.scyld.com/network/via-rhine.html
-
-
- Linux kernel version history:
-
- LK1.1.0:
- - Jeff Garzik: softnet 'n stuff
-
- LK1.1.1:
- - Justin Guyett: softnet and locking fixes
- - Jeff Garzik: use PCI interface
-
- LK1.1.2:
- - Urban Widmark: minor cleanups, merges from Becker 1.03a/1.04 versions
-
- LK1.1.3:
- - Urban Widmark: use PCI DMA interface (with thanks to the eepro100.c
- code) update "Theory of Operation" with
- softnet/locking changes
- - Dave Miller: PCI DMA and endian fixups
- - Jeff Garzik: MOD_xxx race fixes, updated PCI resource allocation
-
- LK1.1.4:
- - Urban Widmark: fix gcc 2.95.2 problem and
- remove writel's to fixed address 0x7c
-
- LK1.1.5:
- - Urban Widmark: mdio locking, bounce buffer changes
- merges from Beckers 1.05 version
- added netif_running_on/off support
-
- LK1.1.6:
- - Urban Widmark: merges from Beckers 1.08b version (VT6102 + mdio)
- set netif_running_on/off on startup, del_timer_sync
-
- LK1.1.7:
- - Manfred Spraul: added reset into tx_timeout
-
- LK1.1.9:
- - Urban Widmark: merges from Beckers 1.10 version
- (media selection + eeprom reload)
- - David Vrabel: merges from D-Link "1.11" version
- (disable WOL and PME on startup)
-
- LK1.1.10:
- - Manfred Spraul: use "singlecopy" for unaligned buffers
- don't allocate bounce buffers for !ReqTxAlign cards
-
- LK1.1.11:
- - David Woodhouse: Set dev->base_addr before the first time we call
- wait_for_reset(). It's a lot happier that way.
- Free np->tx_bufs only if we actually allocated it.
-
- LK1.1.12:
- - Martin Eriksson: Allow Memory-Mapped IO to be enabled.
-
- LK1.1.13 (jgarzik):
- - Add ethtool support
- - Replace some MII-related magic numbers with constants
-
- LK1.1.14 (Ivan G.):
- - fixes comments for Rhine-III
- - removes W_MAX_TIMEOUT (unused)
- - adds HasDavicomPhy for Rhine-I (basis: linuxfet driver; my card
- is R-I and has Davicom chip, flag is referenced in kernel driver)
- - sends chip_id as a parameter to wait_for_reset since np is not
- initialized on first call
- - changes mmio "else if (chip_id==VT6102)" to "else" so it will work
- for Rhine-III's (documentation says same bit is correct)
- - transmit frame queue message is off by one - fixed
- - adds IntrNormalSummary to "Something Wicked" exclusion list
- so normal interrupts will not trigger the message (src: Donald Becker)
- (Roger Luethi)
- - show confused chip where to continue after Tx error
- - location of collision counter is chip specific
- - allow selecting backoff algorithm (module parameter)
-
- LK1.1.15 (jgarzik):
- - Use new MII lib helper generic_mii_ioctl
-
- LK1.1.16 (Roger Luethi)
- - Etherleak fix
- - Handle Tx buffer underrun
- - Fix bugs in full duplex handling
- - New reset code uses "force reset" cmd on Rhine-II
- - Various clean ups
-
- LK1.1.17 (Roger Luethi)
- - Fix race in via_rhine_start_tx()
- - On errors, wait for Tx engine to turn off before scavenging
- - Handle Tx descriptor write-back race on Rhine-II
- - Force flushing for PCI posted writes
- - More reset code changes
-
- LK1.1.18 (Roger Luethi)
- - No filtering multicast in promisc mode (Edward Peng)
- - Fix for Rhine-I Tx timeouts
-
- LK1.1.19 (Roger Luethi)
- - Increase Tx threshold for unspecified errors
-
- LK1.2.0-2.6 (Roger Luethi)
- - Massive clean-up
- - Rewrite PHY, media handling (remove options, full_duplex, backoff)
- - Fix Tx engine race for good
- - Craig Brind: Zero padded aligned buffers for short packets.
+ [link no longer provides useful info -jgarzik]
*/
#define DRV_NAME "via-rhine"
-#define DRV_VERSION "1.2.0-2.6"
-#define DRV_RELDATE "June-10-2004"
+#define DRV_VERSION "1.4.0"
+#define DRV_RELDATE "June-27-2006"
/* A few user-configurable values.
@@ -356,12 +252,11 @@ enum rhine_quirks {
/* Beware of PCI posted writes */
#define IOSYNC do { ioread8(ioaddr + StationAddr); } while (0)
-static struct pci_device_id rhine_pci_tbl[] =
-{
- {0x1106, 0x3043, PCI_ANY_ID, PCI_ANY_ID, 0, 0, }, /* VT86C100A */
- {0x1106, 0x3065, PCI_ANY_ID, PCI_ANY_ID, 0, 0, }, /* VT6102 */
- {0x1106, 0x3106, PCI_ANY_ID, PCI_ANY_ID, 0, 0, }, /* 6105{,L,LOM} */
- {0x1106, 0x3053, PCI_ANY_ID, PCI_ANY_ID, 0, 0, }, /* VT6105M */
+static const struct pci_device_id rhine_pci_tbl[] = {
+ { 0x1106, 0x3043, PCI_ANY_ID, PCI_ANY_ID, }, /* VT86C100A */
+ { 0x1106, 0x3065, PCI_ANY_ID, PCI_ANY_ID, }, /* VT6102 */
+ { 0x1106, 0x3106, PCI_ANY_ID, PCI_ANY_ID, }, /* 6105{,L,LOM} */
+ { 0x1106, 0x3053, PCI_ANY_ID, PCI_ANY_ID, }, /* VT6105M */
{ } /* terminate list */
};
MODULE_DEVICE_TABLE(pci, rhine_pci_tbl);
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index 09e05fe..7412400 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -231,7 +231,8 @@ static int rx_copybreak = 200;
module_param(rx_copybreak, int, 0644);
MODULE_PARM_DESC(rx_copybreak, "Copy breakpoint for copy-only-tiny-frames");
-static void velocity_init_info(struct pci_dev *pdev, struct velocity_info *vptr, struct velocity_info_tbl *info);
+static void velocity_init_info(struct pci_dev *pdev, struct velocity_info *vptr,
+ const struct velocity_info_tbl *info);
static int velocity_get_pci_info(struct velocity_info *, struct pci_dev *pdev);
static void velocity_print_info(struct velocity_info *vptr);
static int velocity_open(struct net_device *dev);
@@ -296,9 +297,9 @@ #endif /* !CONFIG_PM */
* Internal board variants. At the moment we have only one
*/
-static struct velocity_info_tbl chip_info_table[] = {
- {CHIP_TYPE_VT6110, "VIA Networking Velocity Family Gigabit Ethernet Adapter", 256, 1, 0x00FFFFFFUL},
- {0, NULL}
+static const struct velocity_info_tbl chip_info_table[] __devinitdata = {
+ {CHIP_TYPE_VT6110, "VIA Networking Velocity Family Gigabit Ethernet Adapter", 1, 0x00FFFFFFUL},
+ { }
};
/*
@@ -306,10 +307,9 @@ static struct velocity_info_tbl chip_inf
* device driver. Used for hotplug autoloading.
*/
-static struct pci_device_id velocity_id_table[] __devinitdata = {
- {PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_612X,
- PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) chip_info_table},
- {0, }
+static const struct pci_device_id velocity_id_table[] __devinitdata = {
+ { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_612X) },
+ { }
};
MODULE_DEVICE_TABLE(pci, velocity_id_table);
@@ -343,7 +343,7 @@ static char __devinit *get_chip_name(enu
static void __devexit velocity_remove1(struct pci_dev *pdev)
{
struct net_device *dev = pci_get_drvdata(pdev);
- struct velocity_info *vptr = dev->priv;
+ struct velocity_info *vptr = netdev_priv(dev);
#ifdef CONFIG_PM
unsigned long flags;
@@ -688,21 +688,23 @@ static int __devinit velocity_found1(str
static int first = 1;
struct net_device *dev;
int i;
- struct velocity_info_tbl *info = (struct velocity_info_tbl *) ent->driver_data;
+ const struct velocity_info_tbl *info = &chip_info_table[ent->driver_data];
struct velocity_info *vptr;
struct mac_regs __iomem * regs;
int ret = -ENOMEM;
+ /* FIXME: this driver, like almost all other ethernet drivers,
+ * can support more than MAX_UNITS.
+ */
if (velocity_nics >= MAX_UNITS) {
- printk(KERN_NOTICE VELOCITY_NAME ": already found %d NICs.\n",
- velocity_nics);
+ dev_printk(KERN_NOTICE, &pdev->dev, "already found %d NICs.\n",
+ velocity_nics);
return -ENODEV;
}
dev = alloc_etherdev(sizeof(struct velocity_info));
-
- if (dev == NULL) {
- printk(KERN_ERR VELOCITY_NAME ": allocate net device failed.\n");
+ if (!dev) {
+ dev_printk(KERN_ERR, &pdev->dev, "allocate net device failed.\n");
goto out;
}
@@ -710,7 +712,7 @@ static int __devinit velocity_found1(str
SET_MODULE_OWNER(dev);
SET_NETDEV_DEV(dev, &pdev->dev);
- vptr = dev->priv;
+ vptr = netdev_priv(dev);
if (first) {
@@ -733,17 +735,17 @@ static int __devinit velocity_found1(str
ret = velocity_get_pci_info(vptr, pdev);
if (ret < 0) {
- printk(KERN_ERR VELOCITY_NAME ": Failed to find PCI device.\n");
+ /* error message already printed */
goto err_disable;
}
ret = pci_request_regions(pdev, VELOCITY_NAME);
if (ret < 0) {
- printk(KERN_ERR VELOCITY_NAME ": Failed to find PCI device.\n");
+ dev_printk(KERN_ERR, &pdev->dev, "No PCI resources.\n");
goto err_disable;
}
- regs = ioremap(vptr->memaddr, vptr->io_size);
+ regs = ioremap(vptr->memaddr, VELOCITY_IO_SIZE);
if (regs == NULL) {
ret = -EIO;
goto err_release_res;
@@ -861,13 +863,14 @@ static void __devinit velocity_print_inf
* discovered.
*/
-static void __devinit velocity_init_info(struct pci_dev *pdev, struct velocity_info *vptr, struct velocity_info_tbl *info)
+static void __devinit velocity_init_info(struct pci_dev *pdev,
+ struct velocity_info *vptr,
+ const struct velocity_info_tbl *info)
{
memset(vptr, 0, sizeof(struct velocity_info));
vptr->pdev = pdev;
vptr->chip_id = info->chip_id;
- vptr->io_size = info->io_size;
vptr->num_txq = info->txqueue;
vptr->multicast_limit = MCAM_SIZE;
spin_lock_init(&vptr->lock);
@@ -885,8 +888,7 @@ static void __devinit velocity_init_info
static int __devinit velocity_get_pci_info(struct velocity_info *vptr, struct pci_dev *pdev)
{
-
- if(pci_read_config_byte(pdev, PCI_REVISION_ID, &vptr->rev_id) < 0)
+ if (pci_read_config_byte(pdev, PCI_REVISION_ID, &vptr->rev_id) < 0)
return -EIO;
pci_set_master(pdev);
@@ -894,24 +896,20 @@ static int __devinit velocity_get_pci_in
vptr->ioaddr = pci_resource_start(pdev, 0);
vptr->memaddr = pci_resource_start(pdev, 1);
- if(!(pci_resource_flags(pdev, 0) & IORESOURCE_IO))
- {
- printk(KERN_ERR "%s: region #0 is not an I/O resource, aborting.\n",
- pci_name(pdev));
+ if (!(pci_resource_flags(pdev, 0) & IORESOURCE_IO)) {
+ dev_printk(KERN_ERR, &pdev->dev,
+ "region #0 is not an I/O resource, aborting.\n");
return -EINVAL;
}
- if((pci_resource_flags(pdev, 1) & IORESOURCE_IO))
- {
- printk(KERN_ERR "%s: region #1 is an I/O resource, aborting.\n",
- pci_name(pdev));
+ if ((pci_resource_flags(pdev, 1) & IORESOURCE_IO)) {
+ dev_printk(KERN_ERR, &pdev->dev,
+ "region #1 is an I/O resource, aborting.\n");
return -EINVAL;
}
- if(pci_resource_len(pdev, 1) < 256)
- {
- printk(KERN_ERR "%s: region #1 is too small.\n",
- pci_name(pdev));
+ if (pci_resource_len(pdev, 1) < VELOCITY_IO_SIZE) {
+ dev_printk(KERN_ERR, &pdev->dev, "region #1 is too small.\n");
return -EINVAL;
}
vptr->pdev = pdev;
@@ -1730,7 +1728,7 @@ #endif
static int velocity_open(struct net_device *dev)
{
- struct velocity_info *vptr = dev->priv;
+ struct velocity_info *vptr = netdev_priv(dev);
int ret;
vptr->rx_buf_sz = (dev->mtu <= 1504 ? PKT_BUF_SZ : dev->mtu + 32);
@@ -1787,7 +1785,7 @@ err_free_desc_rings:
static int velocity_change_mtu(struct net_device *dev, int new_mtu)
{
- struct velocity_info *vptr = dev->priv;
+ struct velocity_info *vptr = netdev_priv(dev);
unsigned long flags;
int oldmtu = dev->mtu;
int ret = 0;
@@ -1863,7 +1861,7 @@ static void velocity_shutdown(struct vel
static int velocity_close(struct net_device *dev)
{
- struct velocity_info *vptr = dev->priv;
+ struct velocity_info *vptr = netdev_priv(dev);
netif_stop_queue(dev);
velocity_shutdown(vptr);
@@ -1896,7 +1894,7 @@ static int velocity_close(struct net_dev
static int velocity_xmit(struct sk_buff *skb, struct net_device *dev)
{
- struct velocity_info *vptr = dev->priv;
+ struct velocity_info *vptr = netdev_priv(dev);
int qnum = 0;
struct tx_desc *td_ptr;
struct velocity_td_info *tdinfo;
@@ -2051,7 +2049,7 @@ #endif
static int velocity_intr(int irq, void *dev_instance, struct pt_regs *regs)
{
struct net_device *dev = dev_instance;
- struct velocity_info *vptr = dev->priv;
+ struct velocity_info *vptr = netdev_priv(dev);
u32 isr_status;
int max_count = 0;
@@ -2106,7 +2104,7 @@ static int velocity_intr(int irq, void *
static void velocity_set_multi(struct net_device *dev)
{
- struct velocity_info *vptr = dev->priv;
+ struct velocity_info *vptr = netdev_priv(dev);
struct mac_regs __iomem * regs = vptr->mac_regs;
u8 rx_mode;
int i;
@@ -2155,7 +2153,7 @@ static void velocity_set_multi(struct ne
static struct net_device_stats *velocity_get_stats(struct net_device *dev)
{
- struct velocity_info *vptr = dev->priv;
+ struct velocity_info *vptr = netdev_priv(dev);
/* If the hardware is down, don't touch MII */
if(!netif_running(dev))
@@ -2198,7 +2196,7 @@ static struct net_device_stats *velocity
static int velocity_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
- struct velocity_info *vptr = dev->priv;
+ struct velocity_info *vptr = netdev_priv(dev);
int ret;
/* If we are asked for information and the device is power
@@ -2827,7 +2825,7 @@ static void enable_flow_control_ability(
static int velocity_ethtool_up(struct net_device *dev)
{
- struct velocity_info *vptr = dev->priv;
+ struct velocity_info *vptr = netdev_priv(dev);
if (!netif_running(dev))
pci_set_power_state(vptr->pdev, PCI_D0);
return 0;
@@ -2843,14 +2841,14 @@ static int velocity_ethtool_up(struct ne
static void velocity_ethtool_down(struct net_device *dev)
{
- struct velocity_info *vptr = dev->priv;
+ struct velocity_info *vptr = netdev_priv(dev);
if (!netif_running(dev))
pci_set_power_state(vptr->pdev, PCI_D3hot);
}
static int velocity_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{
- struct velocity_info *vptr = dev->priv;
+ struct velocity_info *vptr = netdev_priv(dev);
struct mac_regs __iomem * regs = vptr->mac_regs;
u32 status;
status = check_connection_type(vptr->mac_regs);
@@ -2875,7 +2873,7 @@ static int velocity_get_settings(struct
static int velocity_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{
- struct velocity_info *vptr = dev->priv;
+ struct velocity_info *vptr = netdev_priv(dev);
u32 curr_status;
u32 new_status = 0;
int ret = 0;
@@ -2898,14 +2896,14 @@ static int velocity_set_settings(struct
static u32 velocity_get_link(struct net_device *dev)
{
- struct velocity_info *vptr = dev->priv;
+ struct velocity_info *vptr = netdev_priv(dev);
struct mac_regs __iomem * regs = vptr->mac_regs;
return BYTE_REG_BITS_IS_ON(PHYSR0_LINKGD, ®s->PHYSR0) ? 0 : 1;
}
static void velocity_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
{
- struct velocity_info *vptr = dev->priv;
+ struct velocity_info *vptr = netdev_priv(dev);
strcpy(info->driver, VELOCITY_NAME);
strcpy(info->version, VELOCITY_VERSION);
strcpy(info->bus_info, pci_name(vptr->pdev));
@@ -2913,7 +2911,7 @@ static void velocity_get_drvinfo(struct
static void velocity_ethtool_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
{
- struct velocity_info *vptr = dev->priv;
+ struct velocity_info *vptr = netdev_priv(dev);
wol->supported = WAKE_PHY | WAKE_MAGIC | WAKE_UCAST | WAKE_ARP;
wol->wolopts |= WAKE_MAGIC;
/*
@@ -2929,7 +2927,7 @@ static void velocity_ethtool_get_wol(str
static int velocity_ethtool_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
{
- struct velocity_info *vptr = dev->priv;
+ struct velocity_info *vptr = netdev_priv(dev);
if (!(wol->wolopts & (WAKE_PHY | WAKE_MAGIC | WAKE_UCAST | WAKE_ARP)))
return -EFAULT;
@@ -2994,7 +2992,7 @@ static struct ethtool_ops velocity_ethto
static int velocity_mii_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
- struct velocity_info *vptr = dev->priv;
+ struct velocity_info *vptr = netdev_priv(dev);
struct mac_regs __iomem * regs = vptr->mac_regs;
unsigned long flags;
struct mii_ioctl_data *miidata = if_mii(ifr);
diff --git a/drivers/net/via-velocity.h b/drivers/net/via-velocity.h
index f1b2640..496c3d5 100644
--- a/drivers/net/via-velocity.h
+++ b/drivers/net/via-velocity.h
@@ -31,6 +31,8 @@ #define VELOCITY_NAME "via-velo
#define VELOCITY_FULL_DRV_NAM "VIA Networking Velocity Family Gigabit Ethernet Adapter Driver"
#define VELOCITY_VERSION "1.13"
+#define VELOCITY_IO_SIZE 256
+
#define PKT_BUF_SZ 1540
#define MAX_UNITS 8
@@ -1191,7 +1193,6 @@ enum chip_type {
struct velocity_info_tbl {
enum chip_type chip_id;
char *name;
- int io_size;
int txqueue;
u32 flags;
};
@@ -1751,7 +1752,6 @@ struct velocity_info {
struct mac_regs __iomem * mac_regs;
unsigned long memaddr;
unsigned long ioaddr;
- u32 io_size;
u8 rev_id;
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c
index 569305f..116636b 100644
--- a/drivers/net/yellowfin.c
+++ b/drivers/net/yellowfin.c
@@ -19,37 +19,13 @@
Support and updates available at
http://www.scyld.com/network/yellowfin.html
+ [link no longer provides useful info -jgarzik]
-
- Linux kernel changelog:
- -----------------------
-
- LK1.1.1 (jgarzik): Port to 2.4 kernel
-
- LK1.1.2 (jgarzik):
- * Merge in becker version 1.05
-
- LK1.1.3 (jgarzik):
- * Various cleanups
- * Update yellowfin_timer to correctly calculate duplex.
- (suggested by Manfred Spraul)
-
- LK1.1.4 (val@nmt.edu):
- * Fix three endian-ness bugs
- * Support dual function SYM53C885E ethernet chip
-
- LK1.1.5 (val@nmt.edu):
- * Fix forced full-duplex bug I introduced
-
- LK1.1.6 (val@nmt.edu):
- * Only print warning on truly "oversized" packets
- * Fix theoretical bug on gigabit cards - return to 1.1.3 behavior
-
*/
#define DRV_NAME "yellowfin"
-#define DRV_VERSION "1.05+LK1.1.6"
-#define DRV_RELDATE "Feb 11, 2002"
+#define DRV_VERSION "2.0"
+#define DRV_RELDATE "Jun 27, 2006"
#define PFX DRV_NAME ": "
@@ -239,8 +215,11 @@ enum capability_flags {
HasMACAddrBug=32, /* Only on early revs. */
DontUseEeprom=64, /* Don't read the MAC from the EEPROm. */
};
+
/* The PCI I/O space extent. */
-#define YELLOWFIN_SIZE 0x100
+enum {
+ YELLOWFIN_SIZE = 0x100,
+};
struct pci_id_info {
const char *name;
@@ -248,16 +227,14 @@ struct pci_id_info {
int pci, pci_mask, subsystem, subsystem_mask;
int revision, revision_mask; /* Only 8 bits. */
} id;
- int io_size; /* Needed for I/O region check or ioremap(). */
int drv_flags; /* Driver use, intended as capability flags. */
};
static const struct pci_id_info pci_id_tbl[] = {
{"Yellowfin G-NIC Gigabit Ethernet", { 0x07021000, 0xffffffff},
- YELLOWFIN_SIZE,
FullTxStatus | IsGigabit | HasMulticastBug | HasMACAddrBug | DontUseEeprom},
{"Symbios SYM83C885", { 0x07011000, 0xffffffff},
- YELLOWFIN_SIZE, HasMII | DontUseEeprom },
+ HasMII | DontUseEeprom },
{ }
};
^ permalink raw reply related
* Re: Problem with redirecting traffic via ifb device
From: jamal @ 2006-06-27 13:21 UTC (permalink / raw)
To: Egor Duda; +Cc: netdev
In-Reply-To: <449FBB60.2000600@corpit.ru>
On Mon, 2006-26-06 at 14:48 +0400, Egor Duda wrote:
> I have a linux router which is connected via pppoe to my ISP. My
> provider limits aggregate upload+download rate to some fixed amount of
> kbps, so to perform shaping on my router i'm trying to do the same on my
> router (to "own the queue", so to say). Since standard tbf accounts to
> the packets going only one way, i wanted to create virtual ifb
> interface, which will gather all incoming and outgoing packets, and then
> perform appropriate shaping on it.
>
> I'm doing it roughly in the following way:
>
> -------------------------------------------------------------------------
> tc qdisc add dev $iface ingress
> tc qdisc add dev $iface parent ffff: handle 1: prio
>
The above line doesnt seem to make a lot of sense and maybe the cause of
your problems. You cant have queues on ingress.
You probably want:
tc qdisc add dev $iface root handle 1: prio
?
> tc filter add dev $iface parent 1: protocol ip prio 10 \
> u32 match u32 0 0 flowid 1:1 \
> action ipt -j MARK --set-mark 1 \
> action mirred egress redirect dev ifb0
>
Above will mark all packets arriving on 1:0 (egress??) and mark them
with fwmark 1 and then redirect to ifb0.
If you are trying to do ingress do "parent ffff:"
> tc qdisc add dev $iface root handle 2: prio
>
wtf? is this the egress?
> tc filter add dev $iface parent 2: protocol ip prio 10 \
> u32 match u32 0 0 flowid 2:1 \
> action ipt -j MARK --set-mark 1 \
> action mirred egress redirect dev ifb0
> -------------------------------------------------------------------------
>
I think you need to get you scripts intent correct first. I am sorry, my
limited time would be more valuable if you narrow things down a little.
Ask questions in the user list and then come back if you have found a
bug. You definitely have bugs in the script and if you can help reducing
the variables i can help.
Some other ideas to try in narrowing down the issue:
--> Just do ingress alone first and see if that works
--> Just do egress alone and see if that works
---> do both.
--> dont use ipt - i dont trust it; the netfilter folks changed things
on me again. Pablo is helping me out resolving things.
cheers,
jamal
^ permalink raw reply
* Re: [Patch 1/1] AF_UNIX Datagram getpeersec [Updated #2]
From: Stephen Smalley @ 2006-06-27 13:14 UTC (permalink / raw)
To: James Morris
Cc: Catherine Zhang, netdev, David S. Miller, jmorris, chrisw,
Herbert Xu, tjaeger, Andrew Morton, latten, sergeh, gcwilson,
czhang.us
In-Reply-To: <Pine.LNX.4.64.0606270315130.30073@d.namei>
On Tue, 2006-06-27 at 03:16 -0400, James Morris wrote:
> On Tue, 27 Jun 2006, James Morris wrote:
>
> > I'll address that in a patch to follow. Could you please test these
> > updated patches? Thanks.
> >
>
>
> Below is a relative patch which only compiles this stuff into the core
> networking code when appropriate kernel config is selected.
>
> Please review.
>
>
> ---
>
> diff -purN -X dontdiff linux-2.6.p/include/net/scm.h linux-2.6.w/include/net/scm.h
> --- linux-2.6.p/include/net/scm.h 2006-06-27 02:26:02.000000000 -0400
> +++ linux-2.6.w/include/net/scm.h 2006-06-27 03:03:30.000000000 -0400
> @@ -19,7 +19,9 @@ struct scm_cookie
> {
> struct ucred creds; /* Skb credentials */
> struct scm_fp_list *fp; /* Passed files */
> +#ifdef CONFIG_SECURITY_NETWORK
> char *secdata; /* Security context */
What about saving the u32 seclen with the secdata, and using it later
rather than recomputing strlen(secdata)? That also avoids encoding an
assumption in the af_unix code about the content of the data (i.e.
NUL-terminated string), leaving that to the security module.
> +#endif
> unsigned long seq; /* Connection seqno */
> };
>
> @@ -49,6 +51,17 @@ static __inline__ int scm_send(struct so
> return __scm_send(sock, msg, scm);
> }
>
> +#ifdef CONFIG_SECURITY_NETWORK
> +static inline void scm_passec(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm)
> +{
> + if (test_bit(SOCK_PASSSEC, &sock->flags) && scm->secdata != NULL)
> + put_cmsg(msg, SOL_SOCKET, SCM_SECURITY, strlen(scm->secdata)+1, scm->secdata);
> +}
It would be cleaner if we had a scm->seclen to use above.
> +#ifdef CONFIG_SECURITY_NETWORKING
> +static void unix_get_peersec_dgram(struct sk_buff *skb)
> +{
> + int tmp = 0;
> +
> + err = security_socket_getpeersec_dgram(skb, UNIXSEC(skb), &tmp);
tmp should actually be u32 not int (also wrong in the original patch),
and it seems odd to throw it away rather than saving it and using it for
the put_cmsg.
--
Stephen Smalley
National Security Agency
^ permalink raw reply
* Re: [PATCH 2/3] [VLAN]: Update iif when receiving via VLAN device
From: jamal @ 2006-06-27 13:07 UTC (permalink / raw)
To: Thomas Graf; +Cc: Patrick McHardy, David Miller, netdev
In-Reply-To: <20060627100309.GU1376@postel.suug.ch>
On Tue, 2006-27-06 at 12:03 +0200, Thomas Graf wrote:
> * Patrick McHardy <kaber@trash.net> 2006-06-27 00:29
> > Doesn't sound too silly (actually quite nifty in my opinion),
> > but I'm not sure I understand correctly, binding to ifb doesn't
> > work since it changes both skb->dev and skb->input_dev.
>
> I don't understand this concern. So far the mirred action
> updates iif but that can be made configurable.
>
I am reading the thread backwards, so i may miss some of the obvious.
I also dont remember the exact discussion we had - but the consensus was
to leave the field setting as is.
Note the meta-setter (been sitting on it for too long) also set the
input_dev.
BTW, in regards to the VLANs, what is wrong with using the
netdev->iflink to figure the real device?
cheers,
jamal
^ permalink raw reply
* Re: [PATCH 0/2] NET: Accurate packet scheduling for ATM/ADSL
From: jamal @ 2006-06-27 13:01 UTC (permalink / raw)
To: Patrick McHardy
Cc: Stephen Hemminger, netdev, russell-tcatm, hawk,
Jesper Dangaard Brouer
In-Reply-To: <449FC329.7080609@trash.net>
On Mon, 2006-26-06 at 13:21 +0200, Patrick McHardy wrote:
> jamal wrote:
> > scalability issues abound when you have a gazillion things to look at.
> > There used or may still be a way to tell from looking at netlink socket
> > that an error occurred since last time - such as "a message was lost".
> > You could use that to tell a message was lost and do scanning only
> > then.
>
> It returns -ENOBUFS on socket overrun. Without it netlink notifications
> wouldn't be very useable as you couldn't figure out when you missed
> some.
>
I think you are probably right; it is -ENOBUFS. I recall something along
the lines of a socket->error flag somewhere. I will go and snoop on
code.
> >> but the ifi_change field will be different
> >>between notifications and dumps even if the object itself didn't
> >>change. "Lazy userspace" because looking at ifi_change is obviously
> >>only useful if it doesn't keep its last known state and tries to
> >>derive the change from update notifications alone .. which means it
> >>fails when notifications are lost.
> >>
> >
> >
> > But thats not the real intent for it.
>
> Then what is the intent, it doesn't carry any other information?
Generally it is a filter to what the ifi_flags reflect.
>From an event architecture scalability perspective, it is useful to be
able to look at what changed without having to query the source. That is
what ifi_change provides. So it is not "Lazy userspace" rather it is an
effective optimization.
You keep less state and you have less message exchanges between user and
kernel.
> It includes information that are not available any other way from
> the kernel, yet the information is not transmitted reliably. How
> could a program that relies on this possibly work reliable?
Ok, so first lets separate them as two different issues:
- Any message to user space may be lost whether it has ifi_change or
not. You need some way to figure out a message was lost and declare your
state may be invalid. The -ENOBUFs is one way to discover stale state.
- by looking at ifi_change i can tell what changed from about 10
other things reflected in the flags. If you get an ENOBUFS in this case
(or any other), it means your state is not consistent and to have
reliable info you need to query the kernel.
Hope that makes sense.
cheers,
jamal
^ permalink raw reply
* Re: [PATCH REPOST 0/2][RFC] Network Event Notifier Mechanism
From: Herbert Xu @ 2006-06-27 12:50 UTC (permalink / raw)
To: Steve Wise; +Cc: davem, netdev
In-Reply-To: <20060623201918.32482.89765.stgit@stevo-desktop>
Steve Wise <swise@opengridcomputing.com> wrote:
>
> This patch implements a mechanism that allows interested clients to
> register for notification of certain network events. The intended use
> is to allow RDMA devices (linux/drivers/infiniband) to be notified of
> neighbour updates, ICMP redirects, path MTU changes, and route changes.
>
> The reason these devices need update events is because they typically
> cache this information in hardware and need to be notified when this
> information has been updated.
>
> The key events of interest are:
>
> - neighbour mac address change
> - routing redirect (the next hop neighbour changes for a dst_entry)
> - path mtu change (the patch mtu for a dst_entry changes).
> - route add/deletes
I'd like to know more about what the RDMA device is going to do with this
information. I thought RDMA was for receiving packets? Most of the info
here pertains to transmission.
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply
* Re: [PATCH 0/2][RFC] Network Event Notifier Mechanism
From: jamal @ 2006-06-27 12:44 UTC (permalink / raw)
To: Steve Wise; +Cc: David Miller, netdev, caitlinb
In-Reply-To: <1151332486.2398.20.camel@stevo-desktop>
On Mon, 2006-26-06 at 09:34 -0500, Steve Wise wrote:
> On Sat, 2006-06-24 at 10:30 -0400, jamal wrote:
> The route/hh cache insertions might work for the initial dst MAC per
> next-hop IP. But this dst MAC can _change_ for various reasons (even
> though the next-hop IP remains the same). Such a change, I think,
> doesn't generate a new route + hh cache insertion, just a change to the
> hh entry.
>
> Also, I think the route cache entry is created _before_ the MAC addr is
> known. So we really need to know when the neighbour entry is updated
> with the MAC address as a result of ARP/ND. Hooking the correct spot in
> the neighbour code where the mac address gets stored also gets us the
> change event I described above.
>
> Does this make sense?
>
no - but as long as you solve the problem it should be fine.
[My goal was to help -factoring in some experiences- it seems you have
it under control though].
cheers,
jamal
^ permalink raw reply
* [NET]: Added GSO header verification
From: Herbert Xu @ 2006-06-27 12:07 UTC (permalink / raw)
To: David S. Miller, netdev
Hi Dave:
This feature is only needed by Xen but most of the code here is useful
for other things like TCPv4 ECN support.
[NET]: Added GSO header verification
When GSO packets come from an untrusted source (e.g., a Xen guest domain),
we need to verify the header integrity before passing it to the hardware.
Since the first step in GSO is to verify the header, we can reuse that
code by adding a new bit to gso_type: SKB_GSO_DODGY. Packets with this
bit set can only be fed directly to devices with the corresponding bit
NETIF_F_GSO_ROBUST. If the device doesn't have that bit, then the skb
is fed to the GSO engine which will allow the packet to be sent to the
hardware if it passes the header check.
This patch changes the sg flag to a full features flag. The same method
can be used to implement TSO ECN support. We simply have to mark packets
with CWR set with SKB_GSO_ECN so that only hardware with a corresponding
NETIF_F_TSO_ECN can accept them. The GSO engine can either fully segment
the packet, or segment the first MTU and pass the rest to the hardware for
further segmentation.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -315,6 +315,7 @@ struct net_device
#define NETIF_F_GSO_SHIFT 16
#define NETIF_F_TSO (SKB_GSO_TCPV4 << NETIF_F_GSO_SHIFT)
#define NETIF_F_UFO (SKB_GSO_UDPV4 << NETIF_F_GSO_SHIFT)
+#define NETIF_F_GSO_ROBUST (SKB_GSO_DODGY << NETIF_F_GSO_SHIFT)
#define NETIF_F_GEN_CSUM (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM)
#define NETIF_F_ALL_CSUM (NETIF_F_IP_CSUM | NETIF_F_GEN_CSUM)
@@ -543,7 +544,8 @@ struct packet_type {
struct net_device *,
struct packet_type *,
struct net_device *);
- struct sk_buff *(*gso_segment)(struct sk_buff *skb, int sg);
+ struct sk_buff *(*gso_segment)(struct sk_buff *skb,
+ int features);
void *af_packet_priv;
struct list_head list;
};
@@ -968,7 +970,7 @@ extern int netdev_max_backlog;
extern int weight_p;
extern int netdev_set_master(struct net_device *dev, struct net_device *master);
extern int skb_checksum_help(struct sk_buff *skb, int inward);
-extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, int sg);
+extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features);
#ifdef CONFIG_BUG
extern void netdev_rx_csum_fault(struct net_device *dev);
#else
@@ -988,11 +990,16 @@ extern void dev_seq_stop(struct seq_file
extern void linkwatch_run_queue(void);
+static inline int skb_gso_ok(struct sk_buff *skb, int features)
+{
+ int feature = skb_shinfo(skb)->gso_size ?
+ skb_shinfo(skb)->gso_type << NETIF_F_GSO_SHIFT : 0;
+ return (features & feature) != feature;
+}
+
static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
{
- int feature = skb_shinfo(skb)->gso_type << NETIF_F_GSO_SHIFT;
- return skb_shinfo(skb)->gso_size &&
- (dev->features & feature) != feature;
+ return skb_gso_ok(skb, dev->features);
}
#endif /* __KERNEL__ */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -172,6 +172,9 @@ enum {
enum {
SKB_GSO_TCPV4 = 1 << 0,
SKB_GSO_UDPV4 = 1 << 1,
+
+ /* This indicates the skb is from an untrusted source. */
+ SKB_GSO_DODGY = 1 << 2,
};
/**
@@ -1299,7 +1302,7 @@ extern void skb_split(struct sk_b
struct sk_buff *skb1, const u32 len);
extern void skb_release_data(struct sk_buff *skb);
-extern struct sk_buff *skb_segment(struct sk_buff *skb, int sg);
+extern struct sk_buff *skb_segment(struct sk_buff *skb, int features);
static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
int len, void *buffer)
diff --git a/include/net/protocol.h b/include/net/protocol.h
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -36,7 +36,8 @@
struct net_protocol {
int (*handler)(struct sk_buff *skb);
void (*err_handler)(struct sk_buff *skb, u32 info);
- struct sk_buff *(*gso_segment)(struct sk_buff *skb, int sg);
+ struct sk_buff *(*gso_segment)(struct sk_buff *skb,
+ int features);
int no_policy;
};
diff --git a/include/net/tcp.h b/include/net/tcp.h
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1086,7 +1086,7 @@ extern struct request_sock_ops tcp_reque
extern int tcp_v4_destroy_sock(struct sock *sk);
-extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int sg);
+extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features);
#ifdef CONFIG_PROC_FS
extern int tcp4_proc_init(void);
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -184,6 +184,6 @@ void br_dev_setup(struct net_device *dev
dev->set_mac_address = br_set_mac_address;
dev->priv_flags = IFF_EBRIDGE;
- dev->features = NETIF_F_SG | NETIF_F_FRAGLIST
- | NETIF_F_HIGHDMA | NETIF_F_TSO | NETIF_F_NO_CSUM;
+ dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
+ NETIF_F_TSO | NETIF_F_NO_CSUM | NETIF_F_GSO_ROBUST;
}
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -392,7 +392,8 @@ void br_features_recompute(struct net_br
features &= feature;
}
- br->dev->features = features | checksum | NETIF_F_LLTX;
+ br->dev->features = features | checksum | NETIF_F_LLTX |
+ NETIF_F_GSO_ROBUST;
}
/* called with RTNL */
diff --git a/net/core/dev.c b/net/core/dev.c
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1190,11 +1190,14 @@ out:
/**
* skb_gso_segment - Perform segmentation on skb.
* @skb: buffer to segment
- * @sg: whether scatter-gather is supported on the target.
+ * @features: features for the output path (see dev->features)
*
* This function segments the given skb and returns a list of segments.
+ *
+ * It may return NULL if the skb requires no segmentation. This is
+ * only possible when GSO is used for verifying header integrity.
*/
-struct sk_buff *skb_gso_segment(struct sk_buff *skb, int sg)
+struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features)
{
struct sk_buff *segs = ERR_PTR(-EPROTONOSUPPORT);
struct packet_type *ptype;
@@ -1210,12 +1213,14 @@ struct sk_buff *skb_gso_segment(struct s
rcu_read_lock();
list_for_each_entry_rcu(ptype, &ptype_base[ntohs(type) & 15], list) {
if (ptype->type == type && !ptype->dev && ptype->gso_segment) {
- segs = ptype->gso_segment(skb, sg);
+ segs = ptype->gso_segment(skb, features);
break;
}
}
rcu_read_unlock();
+ __skb_push(skb, skb->data - skb->mac.raw);
+
return segs;
}
@@ -1291,9 +1296,15 @@ static int dev_gso_segment(struct sk_buf
{
struct net_device *dev = skb->dev;
struct sk_buff *segs;
+ int features = dev->features & ~(illegal_highdma(dev, skb) ?
+ NETIF_F_SG : 0);
+
+ segs = skb_gso_segment(skb, features);
+
+ /* Verifying header integrity only. */
+ if (!segs)
+ return 0;
- segs = skb_gso_segment(skb, dev->features & NETIF_F_SG &&
- !illegal_highdma(dev, skb));
if (unlikely(IS_ERR(segs)))
return PTR_ERR(segs);
@@ -1310,13 +1321,17 @@ int dev_hard_start_xmit(struct sk_buff *
if (netdev_nit)
dev_queue_xmit_nit(skb, dev);
- if (!netif_needs_gso(dev, skb))
- return dev->hard_start_xmit(skb, dev);
+ if (netif_needs_gso(dev, skb)) {
+ if (unlikely(dev_gso_segment(skb)))
+ goto out_kfree_skb;
+ if (skb->next)
+ goto gso;
+ }
- if (unlikely(dev_gso_segment(skb)))
- goto out_kfree_skb;
+ return dev->hard_start_xmit(skb, dev);
}
+gso:
do {
struct sk_buff *nskb = skb->next;
int rc;
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1848,13 +1848,13 @@ EXPORT_SYMBOL_GPL(skb_pull_rcsum);
/**
* skb_segment - Perform protocol segmentation on skb.
* @skb: buffer to segment
- * @sg: whether scatter-gather can be used for generated segments
+ * @features: features for the output path (see dev->features)
*
* This function performs segmentation on the given skb. It returns
* the segment at the given position. It returns NULL if there are
* no more segments to generate, or when an error is encountered.
*/
-struct sk_buff *skb_segment(struct sk_buff *skb, int sg)
+struct sk_buff *skb_segment(struct sk_buff *skb, int features)
{
struct sk_buff *segs = NULL;
struct sk_buff *tail = NULL;
@@ -1863,6 +1863,7 @@ struct sk_buff *skb_segment(struct sk_bu
unsigned int offset = doffset;
unsigned int headroom;
unsigned int len;
+ int sg = features & NETIF_F_SG;
int nfrags = skb_shinfo(skb)->nr_frags;
int err = -ENOMEM;
int i = 0;
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1097,7 +1097,7 @@ int inet_sk_rebuild_header(struct sock *
EXPORT_SYMBOL(inet_sk_rebuild_header);
-static struct sk_buff *inet_gso_segment(struct sk_buff *skb, int sg)
+static struct sk_buff *inet_gso_segment(struct sk_buff *skb, int features)
{
struct sk_buff *segs = ERR_PTR(-EINVAL);
struct iphdr *iph;
@@ -1126,10 +1126,10 @@ static struct sk_buff *inet_gso_segment(
rcu_read_lock();
ops = rcu_dereference(inet_protos[proto]);
if (ops && ops->gso_segment)
- segs = ops->gso_segment(skb, sg);
+ segs = ops->gso_segment(skb, features);
rcu_read_unlock();
- if (IS_ERR(segs))
+ if (!segs || unlikely(IS_ERR(segs)))
goto out;
skb = segs;
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2145,7 +2145,7 @@ int compat_tcp_getsockopt(struct sock *s
EXPORT_SYMBOL(compat_tcp_getsockopt);
#endif
-struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int sg)
+struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features)
{
struct sk_buff *segs = ERR_PTR(-EINVAL);
struct tcphdr *th;
@@ -2166,10 +2166,14 @@ struct sk_buff *tcp_tso_segment(struct s
if (!pskb_may_pull(skb, thlen))
goto out;
+ segs = NULL;
+ if (skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST))
+ goto out;
+
oldlen = (u16)~skb->len;
__skb_pull(skb, thlen);
- segs = skb_segment(skb, sg);
+ segs = skb_segment(skb, features);
if (IS_ERR(segs))
goto out;
^ permalink raw reply
* Re: [patch 2/6] [Network namespace] Network device sharing by view
From: Andrey Savochkin @ 2006-06-27 11:55 UTC (permalink / raw)
To: Daniel Lezcano
Cc: linux-kernel, netdev, serue, haveblue, clg, Andrew Morton, dev,
herbert, devel, sam, ebiederm, viro, Alexey Kuznetsov
In-Reply-To: <44A1149E.6060802@fr.ibm.com>
Daniel,
On Tue, Jun 27, 2006 at 01:21:02PM +0200, Daniel Lezcano wrote:
> >>>My point is that if you make namespace tagging at routing time, and
> >>>your packets are being routed only once, you lose the ability
> >>>to have separate routing tables in each namespace.
> >>
> >>Right. What is the advantage of having separate the routing tables ?
> >
> >
> > Routing is everything.
> > For example, I want namespaces to have their private tunnel devices.
> > It means that namespaces should be allowed have private routes of local type,
> > private default routes, and so on...
> >
>
> Ok, we are talking about the same things. We do it only in a different way:
We are not talking about the same things.
It isn't a technical thing whether route lookup is performed before or after
namespace change.
It is a fundamental question determining functionality of network namespaces.
We are talking about the capabilities namespaces provide.
Your proposal essentially denies namespaces to have their own tunnel or other
devices. There is no point in having a device inside a namespace if the
namespace owner can't route all or some specific outgoing packets through
that device. You don't allow system administrators to completely delegate
management of network configuration to namespace owners.
Andrey
^ permalink raw reply
* Re: [patch 2/6] [Network namespace] Network device sharing by view
From: Eric W. Biederman @ 2006-06-27 11:52 UTC (permalink / raw)
To: Daniel Lezcano
Cc: Andrey Savochkin, linux-kernel, netdev, serue, haveblue, clg,
Andrew Morton, dev, herbert, devel, sam, viro, Alexey Kuznetsov
In-Reply-To: <44A1149E.6060802@fr.ibm.com>
Daniel Lezcano <dlezcano@fr.ibm.com> writes:
>>>>My point is that if you make namespace tagging at routing time, and
>>>>your packets are being routed only once, you lose the ability
>>>>to have separate routing tables in each namespace.
>>>
>>>Right. What is the advantage of having separate the routing tables ?
>> Routing is everything.
>> For example, I want namespaces to have their private tunnel devices.
>> It means that namespaces should be allowed have private routes of local type,
>> private default routes, and so on...
>>
>
> Ok, we are talking about the same things. We do it only in a different way:
>
> * separate routing table :
> namespace
> |
> \--- route_tables
> |
> \---routes
>
> * tagged routing table :
> route_tables
> |
> \---routes
> |
> \---namespace
There is a third possibility, that falls in between these two if local
communication is really the bottle neck.
We have the dst cache for caching routes and cache multiple transformations
that happen on a packet.
With a little extra knowledge it is possible to have the separate
routing tables but have special logic that recognizes the local tunnel
device that connects namespaces and have it look into the next
namespaces routes, and build up a complete stack of dst entries of
where the packet needs to go.
I keep forgetting about that possibility. But as long as everything
is done at the routing layer that should work.
> I use the second method, because I think it is more effecient and reduce the
> overhead. But the isolation is minimalist and only aims to avoid the application
> using ressources outside of the container (aka namespace) without taking care of
> the system. For example, I didn't take care of network devices, because as far
> as see I can't imagine an administrator wanting to change the network device
> name while there are hundred of containers running. Concerning tunnel devices
> for example, they should be created inside the container.
Inside the containers I want all network devices named eth0!
> I think, private network ressources method is more elegant and involves more
> network ressources, but there is probably a significant overhead and some
> difficulties to have __lightweight__ container (aka application container), make
> nfs working well, etc... I did some tests with tbench and the loopback with the
> private namespace and there is roughly an overhead of 4 % without the isolation
> since with the tagging method there is 1 % with the isolation.
The overhead went down?
> The network namespace aims the isolation for now, but the container based on the
> namespaces will probably need checkpoint/restart and migration ability. The
> migration is needed not only for servers but for HPC jobs too.
Yes.
> So I don't know what level of isolation/virtualization is really needed by
> users, what should be acceptable (strong isolation and overhead / weak isolation
> and efficiency). I don't know if people wanting strong isolation will not prefer
> Xen (cleary with much more overhead than your patches ;) )
We need a clean abstraction that optimizes well.
However local communication between containers is not what we should
benchmark. That can always be improved later. So long as the
performance is reasonable. What needs to be benchmarked is the
overhead of namespaces when connected to physical networking devices
and on their own local loopback, and comparing that to a kernel
without namespace support.
If we don't hurt that core case we have an implementation we can
merge. There are a lot of optimization opportunities for local
communications and we can do that after we have a correct and accepted
implementation. Anything else is optimizing too soon, and will
just be muddying the waters.
Eric
^ permalink raw reply
* Re: [patch 2/3] drivers/net/ns83820.c: add paramter to disable autonegotiation
From: Dan Faerch @ 2006-06-27 11:43 UTC (permalink / raw)
To: Benjamin LaHaise; +Cc: akpm, jeff, netdev, dan, jgarzik
In-Reply-To: <20060626162928.GA22614@kvack.org>
On Mon, 2006-06-26 at 12:29 -0400, Benjamin LaHaise wrote:
> This part is good, although doing something for copper cards needs doing,
> which probably means poking around to support the phy properly.
I Agree. But i dont have a copper card, nor the knowledge to do this. I
was actually hoping that someone could "fill in the blanks".
> > Also added a "disable_autoneg" module argument to completely disable
> > autoneg on all cards using this driver.
>
> This is the part I disagree with. Are you sure it isn't a bug in the
> link autonegotiation state machine for fibre cards? It should be defaulting
> to 1Gbit/full duplex if no autonegotiation is happening, and if it isn't
> then that should be fixed instead of papering over things with a config
> option.
In my setup, we use several fibercards on passive fiber-taps (tx only),
thus there is no link partner. If i dont disable autoneg, i simply cant
sniff traffic.
Skipping the initial autoneg solved the problem. Adding ethtool support
was just an extra courtesy upon request.
After adding ethtool support, i kept the disable_autoneg option to allow
one to operate with default autoneg disabled, and enabling autoneg
through ethtool where needed. Sort of a "reverse operation" mode.
If there IS a bug in the autoneg statemachine i would have no idea how
to fix it. My knowledge of hardware & drivers is unfortunately extremely
limited.
- Dan
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox