* Re: [PATCH 8/8] [I/OAT] TCP recv offload to I/OAT
From: Pavel Machek @ 2006-03-04 16:39 UTC (permalink / raw)
To: Chris Leech; +Cc: linux-kernel, netdev
In-Reply-To: <20060303214236.11908.98881.stgit@gitlost.site>
Hi!
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -262,6 +262,9 @@
> #include <net/tcp.h>
> #include <net/xfrm.h>
> #include <net/ip.h>
> +#ifdef CONFIG_NET_DMA
> +#include <net/netdma.h>
> +#endif
>
Remove the ifdefs, move them inside .h if needed.
> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
> index 7625eaf..9b6290d 100644
> --- a/net/ipv4/tcp_input.c
> +++ b/net/ipv4/tcp_input.c
> @@ -71,6 +71,9 @@
> #include <net/inet_common.h>
> #include <linux/ipsec.h>
> #include <asm/unaligned.h>
> +#ifdef CONFIG_NET_DMA
> +#include <net/netdma.h>
> +#endif
Here, too.
> +#ifdef CONFIG_NET_DMA
> + if (copied_early)
> + __skb_queue_tail(&sk->sk_async_wait_queue, skb);
> + else
> +#endif
> if (eaten)
> __kfree_skb(skb);
> else
Could you #define copied_early to 0 and avoid ifdefs?
> @@ -1091,8 +1094,18 @@ process:
> bh_lock_sock(sk);
> ret = 0;
> if (!sock_owned_by_user(sk)) {
> - if (!tcp_prequeue(sk, skb))
> +#ifdef CONFIG_NET_DMA
> + struct tcp_sock *tp = tcp_sk(sk);
> + if (!tp->ucopy.dma_chan && tp->ucopy.locked_list)
> + tp->ucopy.dma_chan = get_softnet_dma();
> + if (tp->ucopy.dma_chan)
> + ret = tcp_v4_do_rcv(sk, skb);
> + else
> +#endif
> + {
> + if (!tcp_prequeue(sk, skb))
> ret = tcp_v4_do_rcv(sk, skb);
> + }
> } else
Wrong indentation...
Pavel
--
Thanks, Sharp!
^ permalink raw reply
* Re: [RFC: 2.6 patch] let NET_CLS_ACT no longer depend on EXPERIMENTAL
From: Patrick McHardy @ 2006-03-04 16:56 UTC (permalink / raw)
To: Adrian Bunk; +Cc: netdev, linux-kernel
In-Reply-To: <20060304160755.GB9295@stusta.de>
Adrian Bunk wrote:
> This option should IMHO no longer depend on EXPERIMENTAL.
>
>
> Signed-off-by: Adrian Bunk <bunk@stusta.de>
>
> ---
>
> This patch was already sent on:
> - 12 Feb 2006
Yesterday I managed to crash my machine playing around with tc actions
within minutes. I haven't looked into it yet, but it seems it still
needs more testing.
^ permalink raw reply
* Re: [patch 1/2] natsemi: NAPI and a bugfix
From: Jeff Garzik @ 2006-03-04 17:15 UTC (permalink / raw)
To: Mark Brown; +Cc: Tim Hockin, netdev, linux-kernel
In-Reply-To: <20060202235155.775450000@lorien.sirena.org.uk>
Mark Brown wrote:
> This patch converts the natsemi driver to use NAPI. It was originally
> based on one written by Harald Welte, though it has since been modified
> quite a bit, most extensively in order to remove the ability to disable
> NAPI since none of the other drivers seem to provide that functionality
> any more.
>
> Signed-off-by: Mark Brown <broonie@sirena.org.uk>
applied 1-2
^ permalink raw reply
* [GIT] netdev queue contents
From: Jeff Garzik @ 2006-03-04 17:28 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel
The following stuff is queued for 2.6.17 [really 2.6.16-git1] at
rsync://rsync.kernel.org/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git
branch 'upstream':
Documentation/DocBook/sis900.tmpl | 585 ----------
Documentation/networking/sis900.txt | 257 ----
Documentation/DocBook/Makefile | 2
Documentation/feature-removal-schedule.txt | 7
Documentation/networking/00-INDEX | 2
arch/ppc/platforms/hdpu.c | 5
drivers/net/3c523.c | 9
drivers/net/3c59x.c | 7
drivers/net/7990.c | 2
drivers/net/8139cp.c | 2
drivers/net/8139too.c | 4
drivers/net/82596.c | 2
drivers/net/Kconfig | 25
drivers/net/apne.c | 7
drivers/net/arcnet/Kconfig | 4
drivers/net/arcnet/arc-rawmode.c | 2
drivers/net/arcnet/arc-rimi.c | 68 -
drivers/net/arcnet/arcnet.c | 20
drivers/net/arcnet/com90xx.c | 132 +-
drivers/net/arcnet/rfc1051.c | 2
drivers/net/arcnet/rfc1201.c | 2
drivers/net/arm/etherh.c | 3
drivers/net/bnx2.c | 10
drivers/net/bnx2_fw.h | 84 -
drivers/net/bonding/bond_alb.c | 2
drivers/net/bonding/bond_main.c | 45
drivers/net/bonding/bond_sysfs.c | 6
drivers/net/bonding/bonding.h | 33
drivers/net/chelsio/subr.c | 2
drivers/net/dgrs.c | 2
drivers/net/dgrs_firmware.c | 4
drivers/net/dl2k.c | 4
drivers/net/e100.c | 6
drivers/net/e1000/e1000.h | 46
drivers/net/e1000/e1000_ethtool.c | 97 -
drivers/net/e1000/e1000_hw.c | 734 +++++++++++++
drivers/net/e1000/e1000_hw.h | 319 +++++
drivers/net/e1000/e1000_main.c | 589 ++++------
drivers/net/e1000/e1000_param.c | 2
drivers/net/eepro100.c | 4
drivers/net/epic100.c | 4
drivers/net/eth16i.c | 11
drivers/net/fealnx.c | 2
drivers/net/forcedeth.c | 593 ++++++++++-
drivers/net/hamachi.c | 2
drivers/net/hamradio/baycom_epp.c | 2
drivers/net/hp100.c | 35
drivers/net/ibm_emac/ibm_emac_core.c | 40
drivers/net/ibm_emac/ibm_emac_core.h | 2
drivers/net/ibm_emac/ibm_emac_debug.c | 2
drivers/net/ibm_emac/ibm_emac_rgmii.h | 2
drivers/net/ibm_emac/ibm_emac_zmii.c | 7
drivers/net/ibm_emac/ibm_emac_zmii.h | 2
drivers/net/irda/Kconfig | 4
drivers/net/macsonic.c | 2
drivers/net/mv643xx_eth.c | 1560 ++++++++++-------------------
drivers/net/mv643xx_eth.h | 250 +---
drivers/net/natsemi.c | 192 ++-
drivers/net/ne-h8300.c | 5
drivers/net/ne.c | 7
drivers/net/ne2.c | 7
drivers/net/ne2k-pci.c | 2
drivers/net/ns83820.c | 7
drivers/net/oaknet.c | 3
drivers/net/pcmcia/3c574_cs.c | 2
drivers/net/pcmcia/3c589_cs.c | 5
drivers/net/pcmcia/fmvj18x_cs.c | 2
drivers/net/pcmcia/nmclan_cs.c | 2
drivers/net/pcmcia/pcnet_cs.c | 3
drivers/net/pcmcia/smc91c92_cs.c | 4
drivers/net/pcmcia/xirc2ps_cs.c | 2
drivers/net/pcnet32.c | 6
drivers/net/phy/phy.c | 2
drivers/net/plip.c | 4
drivers/net/ppp_async.c | 3
drivers/net/ppp_synctty.c | 2
drivers/net/r8169.c | 4
drivers/net/s2io.c | 618 ++++++++++-
drivers/net/s2io.h | 55 -
drivers/net/sb1000.c | 2
drivers/net/sb1250-mac.c | 109 +-
drivers/net/seeq8005.c | 5
drivers/net/shaper.c | 3
drivers/net/sis190.c | 2
drivers/net/sis900.c | 8
drivers/net/sk98lin/h/skaddr.h | 48
drivers/net/sk98lin/h/skcsum.h | 6
drivers/net/sk98lin/h/skgeinit.h | 56 -
drivers/net/sk98lin/h/skgepnmi.h | 4
drivers/net/sk98lin/h/skgesirq.h | 1
drivers/net/sk98lin/h/ski2c.h | 3
drivers/net/sk98lin/h/skvpd.h | 15
drivers/net/sk98lin/skaddr.c | 35
drivers/net/sk98lin/skgeinit.c | 148 --
drivers/net/sk98lin/skgemib.c | 7
drivers/net/sk98lin/skgepnmi.c | 153 --
drivers/net/sk98lin/skgesirq.c | 24
drivers/net/sk98lin/ski2c.c | 6
drivers/net/sk98lin/sklm80.c | 72 -
drivers/net/sk98lin/skrlmt.c | 1
drivers/net/sk98lin/skvpd.c | 108 --
drivers/net/sk98lin/skxmac2.c | 461 --------
drivers/net/skfp/fplustm.c | 14
drivers/net/skfp/pcmplc.c | 4
drivers/net/skfp/skfddi.c | 2
drivers/net/starfire.c | 40
drivers/net/sundance.c | 10
drivers/net/sungem_phy.c | 2
drivers/net/tg3.c | 4
drivers/net/tokenring/lanstreamer.c | 3
drivers/net/tokenring/olympic.c | 9
drivers/net/tulip/de2104x.c | 18
drivers/net/tulip/pnic.c | 3
drivers/net/tulip/winbond-840.c | 2
drivers/net/tulip/xircom_cb.c | 9
drivers/net/typhoon.c | 2
drivers/net/wan/Kconfig | 2
drivers/net/wan/hostess_sv11.c | 1
drivers/net/wan/sealevel.c | 1
drivers/net/wireless/Kconfig | 32
drivers/net/wireless/airo.c | 338 +++++-
drivers/net/wireless/atmel.c | 110 --
drivers/net/wireless/ipw2100.c | 48
drivers/net/wireless/ipw2100.h | 6
drivers/net/wireless/ipw2200.c | 881 ++++++++--------
drivers/net/wireless/ipw2200.h | 64 -
drivers/net/wireless/netwave_cs.c | 2
drivers/net/wireless/strip.c | 4
drivers/net/wireless/wavelan.p.h | 6
drivers/net/wireless/wavelan_cs.p.h | 9
drivers/net/yellowfin.c | 6
drivers/net/zorro8390.c | 7
include/linux/arcdevice.h | 9
include/linux/if.h | 3
include/linux/if_ether.h | 1
include/linux/mv643xx.h | 27
include/net/ieee80211.h | 177 +++
include/net/ieee80211_crypt.h | 3
net/Kconfig | 3
net/core/Makefile | 2
net/core/dev.c | 36
net/ieee80211/ieee80211_crypt.c | 11
net/ieee80211/ieee80211_crypt_ccmp.c | 8
net/ieee80211/ieee80211_crypt_tkip.c | 56 -
net/ieee80211/ieee80211_crypt_wep.c | 5
net/ieee80211/ieee80211_geo.c | 48
net/ieee80211/ieee80211_module.c | 20
net/ieee80211/ieee80211_rx.c | 153 ++
net/ieee80211/ieee80211_tx.c | 30
net/ieee80211/ieee80211_wx.c | 152 ++
net/socket.c | 9
151 files changed, 5390 insertions(+), 4874 deletions(-)
Adrian Bunk:
drivers/net/sk98lin/: possible cleanups
drivers/net/arcnet/: possible cleanups
drivers/net/s2io.c: make code static
net/: fix the WIRELESS_EXT abuse
AIRO{,_CS} <-> CRYPTO fixes
drivers/net/wireless/ipw2100.c: make ipw2100_wpa_assoc_frame() static
drivers/net/wireless/ipw2200: possible cleanups
[netdrvr] schedule eepro100 for removal
remove obsolete sis900 documentation
Al Viro:
arcnet probing cleanups and fixes
ibm_emac sparse annotations
appletalk/cops.h: missing const in struct ltfirmware
macsonic.c: missed s/driver_unregister/platform_driver_unregister/
missing include of asm/irq.h in drivers/net
bogus include of linux/irq.h in 7990.c
wrong ifdefs in 82596.c
dead code removed in hp100
Andreas Happe:
ipw2200: add monitor and qos entries to Kconfig
Andrew Morton:
git-netdev-all: s2io fixes
s2io c99 warning fix
Arjan van de Ven:
Massive net driver const-ification.
Arnaldo Carvalho de Melo:
sundance: Really read addr 0
Ayaz Abdulla:
forcedeth: Add vlan support
forcedeth: Add support for 64bit rings
forcedeth: Add support for MSI/MSIX
Catalin(ux aka Dino) BOIE:
Fix io ordering problems in e100
Dale Farnsworth:
mv643xx_eth: Remove needless mp->port_mac_addr
mv643xx_eth: Merge unicast and multicast address filtering code
mv643xx_eth: Rename mp->tx_ring_skbs to mp->tx_desc_count
mv643xx_eth: Make port queue enable/disable code consistent
mv643xx_eth: Clean up platform_data configuration
mv643xx_eth: Remove duplicate includes of linux/in.h and linux/ip.h
mv643xx_eth: Fix misplaced parenthesis in mv643xx_eth_port_disable_rx
mv643xx_eth: Rename "channels" to "queues"
mv643xx_eth: Select CONFIG_MII on CONFIG_MV643XX_ETH
mv643xx_eth: Refactor tx command queuing code
mv643xx_eth: Refactor/clean up tx queue handling
mv643xx_eth: Move #defines of constants to mv643xx_eth.h
mv643xx_eth: Clean up interrupt handling
mv643xx_eth: Remove non-working feature: task level rx queue refill
mv643xx_eth: Remove BIT0-BIT31 #defines
Dan Williams:
wireless/airo: add IWENCODEEXT and IWAUTH support
wireless/ipw2200: support WE-18 WPA enc_capa
wireless/atmel: convert constants to ieee80211 layer equivalents
wireless/airo: fix setting TX key index plus key in ENCODEEXT
wireless/airo: Remove 'Setting transmit key' info messages
Denis Vlasenko:
WEP fields are incorrectly shown to be INSIDE snap in the doc
ieee80211: trivial fix for misplaced ()'s
Eric Sesterhenn / snakebyte:
BUG_ON() Conversion in net/tulip/xircom_cb.c
BUG_ON() Conversion in net/tulip/de2104x.c
BUG_ON() Conversion in net/tulip/winbond-840.c
James Chapman:
mv643xx_eth: use MII library for PHY management
mv643xx_eth: use MII library for ethtool functions
Jan Niehusmann:
let IPW2{1,2}00 select IEEE80211
Jay Vosburgh:
bonding: suppress duplicate packets
Jeff Garzik:
s2io: set_multicast_list bug
Jeff Kirsher:
e1000: Remove Multiqueue code until we have support for MSI-X in our hardware
e1000: Fix dead counters
e1000: Fix lock up while setting ring parameters
e1000: Fix unecessary delay for 82573 controllers
e1000: Fix AMT losing connectivity when switching VLAN in passive mode
e1000: Fix dhcp issue when the skb structure fields are not filled properly
e1000: Fix 82543 issue when reading eeprom
e1000: Fix RSS if enabled in mid-connection
e1000: Fix Quadport Wake on LAN
e1000: Fix network problems when forced at 100Mb/s and to fix TSO when forced at 100Mb/s
e1000: Fix filling skb descriptors while using packet split
e1000: Add 82573 controller support to TSO fix
e1000: Add enabled Jumbo frame support for 82573L
e1000: Add performance enahancement by balancing TX and RX
e1000: Add support for new hardware (ESB2)
e1000: Fixed the following issues with ESB2 (requires ESB2 support):
e1000: Add copybreak when using packet split
e1000: Added a performance enhancement - prefetch
e1000: Added driver comments and whitespace changes. Modified long lines of code to ensure they would not wrap beyond 80 characters.
Johannes Berg:
ieee80211: fix sparse warning about missing "static"
Jon Mason:
trivial: fix spelling errors in Kconfigs
Komuro:
pcnet_cs: add new id (Logitec LPM-LN100TE)
Larry Finger:
ieee80211: common wx auth code
Add two management functions to ieee80211_rx.c
Marcelo Feitoza Parisi:
drivers/net/*: use time_after() and friends
Mark Brown:
natsemi: NAPI and a bugfix
natsemi: NAPI and a bugfix
Pete Zaitcev:
ieee80211_geo.c: remove frivolous BUG_ON's
Ralf Baechle:
sb1250-mac: Add support for the BCM1480
Ravinandan Arakali:
S2io: Large Receive Offload (LRO) feature(v2) for Neterion (s2io) 10GbE Xframe PCI-X and PCI-E NICs
Stefan Rompf:
starfire: Implement suspend/resume
ipw2200: Fix WPA network selection problem
Zhu Yi:
ieee80211: Log if netif_rx() drops the packet
ieee80211: Add LEAP authentication type
ieee80211: add flags for all geo channels
ieee80211: Add spectrum management information
ieee80211: kmalloc+memset -> kzalloc cleanups
ieee80211: TIM information element parsing
ieee80211: Add TKIP crypt->build_iv
ieee80211: Add 802.11h data type and structures
ieee80211: Add helpers for IBSS DFS handling
ieee80211: Add 802.11h information element parsing
ipw2100: Add LEAP authentication algorithm support
ipw2100: Make iwconfig txpower setting consistent with user input
ipw2100: Add generic geo information
ipw2100: remove white space and better format the code
increase ipw2100 driver version to git-1.1.4
ipw2200: Fix indirect SRAM/register 8/16-bit write routines
ipw2200: Mask out the WEP_KEY command dump from debug log for security reason
ipw2200: Add LEAP authentication algorithm support
ipw2200: Bluetooth coexistence support
ipw2200: use jiffies_to_msec() wherever possible
ipw2200: Make LED blinking frequency independent of HZ
ipw2200: add module parameter to enable/disable roaming
ipw2200: Scale firmware loading watchdog with the firmware size
ipw2200: stack reduction
ipw2200: Fix qos_cmd param switch bug
ipw2200: increase ipw2200 driver version
ipw2200: remove white space and better format the code
ipw2200: Semaphore to mutexes conversion
ipw2200: Disable hwcrypto by default
ieee80211: Use IWEVGENIE to set WPA IE
ipw2200: Fix software crypto shared WEP authentication problem
^ permalink raw reply
* [KJ] [Patch] kzalloc() conversion in drivers/net
From: Eric Sesterhenn @ 2006-03-04 17:56 UTC (permalink / raw)
To: kernel-janitors; +Cc: netdev
[-- Attachment #1: Type: text/plain, Size: 42367 bytes --]
hi,
this patch converts drivers/net to kzalloc usage.
Compile tested with allyes config.
It also fixes a bug in drivers/net/chelsio/espi.c, because
it called the memset() before checking if kmalloc failed.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
--- linux-2.6.16-rc5-mm1/drivers/net/e1000/e1000_ethtool.c.orig 2006-03-02 14:24:18.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/e1000/e1000_ethtool.c 2006-03-02 14:24:59.000000000 +0100
@@ -638,20 +638,18 @@ e1000_set_ringparam(struct net_device *n
tx_old = adapter->tx_ring;
rx_old = adapter->rx_ring;
- adapter->tx_ring = kmalloc(tx_ring_size, GFP_KERNEL);
+ adapter->tx_ring = kzalloc(tx_ring_size, GFP_KERNEL);
if (!adapter->tx_ring) {
err = -ENOMEM;
goto err_setup_rx;
}
- memset(adapter->tx_ring, 0, tx_ring_size);
- adapter->rx_ring = kmalloc(rx_ring_size, GFP_KERNEL);
+ adapter->rx_ring = kzalloc(rx_ring_size, GFP_KERNEL);
if (!adapter->rx_ring) {
kfree(adapter->tx_ring);
err = -ENOMEM;
goto err_setup_rx;
}
- memset(adapter->rx_ring, 0, rx_ring_size);
txdr = adapter->tx_ring;
rxdr = adapter->rx_ring;
@@ -1017,11 +1015,10 @@ e1000_setup_desc_rings(struct e1000_adap
txdr->count = E1000_DEFAULT_TXD;
size = txdr->count * sizeof(struct e1000_buffer);
- if (!(txdr->buffer_info = kmalloc(size, GFP_KERNEL))) {
+ if (!(txdr->buffer_info = kzalloc(size, GFP_KERNEL))) {
ret_val = 1;
goto err_nomem;
}
- memset(txdr->buffer_info, 0, size);
txdr->size = txdr->count * sizeof(struct e1000_tx_desc);
E1000_ROUNDUP(txdr->size, 4096);
@@ -1073,11 +1070,10 @@ e1000_setup_desc_rings(struct e1000_adap
rxdr->count = E1000_DEFAULT_RXD;
size = rxdr->count * sizeof(struct e1000_buffer);
- if (!(rxdr->buffer_info = kmalloc(size, GFP_KERNEL))) {
+ if (!(rxdr->buffer_info = kzalloc(size, GFP_KERNEL))) {
ret_val = 4;
goto err_nomem;
}
- memset(rxdr->buffer_info, 0, size);
rxdr->size = rxdr->count * sizeof(struct e1000_rx_desc);
if (!(rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma))) {
--- linux-2.6.16-rc5-mm1/drivers/net/e1000/e1000_main.c.orig 2006-03-02 14:25:05.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/e1000/e1000_main.c 2006-03-02 14:26:09.000000000 +0100
@@ -1114,28 +1114,25 @@ e1000_alloc_queues(struct e1000_adapter
int size;
size = sizeof(struct e1000_tx_ring) * adapter->num_tx_queues;
- adapter->tx_ring = kmalloc(size, GFP_KERNEL);
+ adapter->tx_ring = kzalloc(size, GFP_KERNEL);
if (!adapter->tx_ring)
return -ENOMEM;
- memset(adapter->tx_ring, 0, size);
size = sizeof(struct e1000_rx_ring) * adapter->num_rx_queues;
- adapter->rx_ring = kmalloc(size, GFP_KERNEL);
+ adapter->rx_ring = kzalloc(size, GFP_KERNEL);
if (!adapter->rx_ring) {
kfree(adapter->tx_ring);
return -ENOMEM;
}
- memset(adapter->rx_ring, 0, size);
#ifdef CONFIG_E1000_NAPI
size = sizeof(struct net_device) * adapter->num_rx_queues;
- adapter->polling_netdev = kmalloc(size, GFP_KERNEL);
+ adapter->polling_netdev = kzalloc(size, GFP_KERNEL);
if (!adapter->polling_netdev) {
kfree(adapter->tx_ring);
kfree(adapter->rx_ring);
return -ENOMEM;
}
- memset(adapter->polling_netdev, 0, size);
#endif
#ifdef CONFIG_E1000_MQ
@@ -1544,17 +1541,16 @@ e1000_setup_rx_resources(struct e1000_ad
memset(rxdr->buffer_info, 0, size);
size = sizeof(struct e1000_ps_page) * rxdr->count;
- rxdr->ps_page = kmalloc(size, GFP_KERNEL);
+ rxdr->ps_page = kzalloc(size, GFP_KERNEL);
if (!rxdr->ps_page) {
vfree(rxdr->buffer_info);
DPRINTK(PROBE, ERR,
"Unable to allocate memory for the receive descriptor ring\n");
return -ENOMEM;
}
- memset(rxdr->ps_page, 0, size);
size = sizeof(struct e1000_ps_page_dma) * rxdr->count;
- rxdr->ps_page_dma = kmalloc(size, GFP_KERNEL);
+ rxdr->ps_page_dma = kzalloc(size, GFP_KERNEL);
if (!rxdr->ps_page_dma) {
vfree(rxdr->buffer_info);
kfree(rxdr->ps_page);
@@ -1562,7 +1558,6 @@ e1000_setup_rx_resources(struct e1000_ad
"Unable to allocate memory for the receive descriptor ring\n");
return -ENOMEM;
}
- memset(rxdr->ps_page_dma, 0, size);
if (adapter->hw.mac_type <= e1000_82547_rev_2)
desc_len = sizeof(struct e1000_rx_desc);
--- linux-2.6.16-rc5-mm1/drivers/net/pcmcia/ibmtr_cs.c.orig 2006-03-02 14:26:19.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/pcmcia/ibmtr_cs.c 2006-03-02 14:26:28.000000000 +0100
@@ -146,9 +146,8 @@ static int ibmtr_attach(struct pcmcia_de
DEBUG(0, "ibmtr_attach()\n");
/* Create new token-ring device */
- info = kmalloc(sizeof(*info), GFP_KERNEL);
+ info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info) return -ENOMEM;
- memset(info,0,sizeof(*info));
dev = alloc_trdev(sizeof(struct tok_info));
if (!dev) {
kfree(info);
--- linux-2.6.16-rc5-mm1/drivers/net/slhc.c.orig 2006-03-02 14:26:39.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/slhc.c 2006-03-02 14:27:11.000000000 +0100
@@ -95,27 +95,23 @@ slhc_init(int rslots, int tslots)
register struct cstate *ts;
struct slcompress *comp;
- comp = (struct slcompress *)kmalloc(sizeof(struct slcompress),
- GFP_KERNEL);
+ comp = kzalloc(sizeof(struct slcompress), GFP_KERNEL);
if (! comp)
goto out_fail;
- memset(comp, 0, sizeof(struct slcompress));
if ( rslots > 0 && rslots < 256 ) {
size_t rsize = rslots * sizeof(struct cstate);
- comp->rstate = (struct cstate *) kmalloc(rsize, GFP_KERNEL);
+ comp->rstate = kzalloc(rsize, GFP_KERNEL);
if (! comp->rstate)
goto out_free;
- memset(comp->rstate, 0, rsize);
comp->rslot_limit = rslots - 1;
}
if ( tslots > 0 && tslots < 256 ) {
size_t tsize = tslots * sizeof(struct cstate);
- comp->tstate = (struct cstate *) kmalloc(tsize, GFP_KERNEL);
+ comp->tstate = kzalloc(tsize, GFP_KERNEL);
if (! comp->tstate)
goto out_free2;
- memset(comp->tstate, 0, tsize);
comp->tslot_limit = tslots - 1;
}
--- linux-2.6.16-rc5-mm1/drivers/net/sb1250-mac.c.orig 2006-03-02 14:27:18.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/sb1250-mac.c 2006-03-02 14:27:35.000000000 +0100
@@ -743,9 +743,7 @@ static void sbdma_initctx(sbmacdma_t *d,
*/
d->sbdma_ctxtable = (struct sk_buff **)
- kmalloc(d->sbdma_maxdescr*sizeof(struct sk_buff *), GFP_KERNEL);
-
- memset(d->sbdma_ctxtable,0,d->sbdma_maxdescr*sizeof(struct sk_buff *));
+ kzalloc(d->sbdma_maxdescr*sizeof(struct sk_buff *), GFP_KERNEL);
#ifdef CONFIG_SBMAC_COALESCE
/*
--- linux-2.6.16-rc5-mm1/drivers/net/ppp_async.c.orig 2006-03-02 14:27:44.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/ppp_async.c 2006-03-02 14:27:52.000000000 +0100
@@ -159,12 +159,11 @@ ppp_asynctty_open(struct tty_struct *tty
int err;
err = -ENOMEM;
- ap = kmalloc(sizeof(*ap), GFP_KERNEL);
+ ap = kzalloc(sizeof(*ap), GFP_KERNEL);
if (ap == 0)
goto out;
/* initialize the asyncppp structure */
- memset(ap, 0, sizeof(*ap));
ap->tty = tty;
ap->mru = PPP_MRU;
spin_lock_init(&ap->xmit_lock);
--- linux-2.6.16-rc5-mm1/drivers/net/loopback.c.orig 2006-03-02 14:28:00.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/loopback.c 2006-03-02 14:28:13.000000000 +0100
@@ -224,9 +224,8 @@ int __init loopback_init(void)
struct net_device_stats *stats;
/* Can survive without statistics */
- stats = kmalloc(sizeof(struct net_device_stats), GFP_KERNEL);
+ stats = kzalloc(sizeof(struct net_device_stats), GFP_KERNEL);
if (stats) {
- memset(stats, 0, sizeof(struct net_device_stats));
loopback_dev.priv = stats;
loopback_dev.get_stats = &get_stats;
}
--- linux-2.6.16-rc5-mm1/drivers/net/bnx2.c.orig 2006-03-02 14:28:26.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/bnx2.c 2006-03-02 14:29:22.000000000 +0100
@@ -397,12 +397,11 @@ bnx2_alloc_mem(struct bnx2 *bp)
{
int i;
- bp->tx_buf_ring = kmalloc(sizeof(struct sw_bd) * TX_DESC_CNT,
+ bp->tx_buf_ring = kzalloc(sizeof(struct sw_bd) * TX_DESC_CNT,
GFP_KERNEL);
if (bp->tx_buf_ring == NULL)
return -ENOMEM;
- memset(bp->tx_buf_ring, 0, sizeof(struct sw_bd) * TX_DESC_CNT);
bp->tx_desc_ring = pci_alloc_consistent(bp->pdev,
sizeof(struct tx_bd) *
TX_DESC_CNT,
--- linux-2.6.16-rc5-mm1/drivers/net/ppp_deflate.c.orig 2006-03-02 14:29:33.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/ppp_deflate.c 2006-03-02 14:30:00.000000000 +0100
@@ -121,12 +121,10 @@ static void *z_comp_alloc(unsigned char
if (w_size < DEFLATE_MIN_SIZE || w_size > DEFLATE_MAX_SIZE)
return NULL;
- state = (struct ppp_deflate_state *) kmalloc(sizeof(*state),
- GFP_KERNEL);
+ state = kzalloc(sizeof(*state), GFP_KERNEL);
if (state == NULL)
return NULL;
- memset (state, 0, sizeof (struct ppp_deflate_state));
state->strm.next_in = NULL;
state->w_size = w_size;
state->strm.workspace = vmalloc(zlib_deflate_workspacesize());
@@ -341,11 +339,10 @@ static void *z_decomp_alloc(unsigned cha
if (w_size < DEFLATE_MIN_SIZE || w_size > DEFLATE_MAX_SIZE)
return NULL;
- state = (struct ppp_deflate_state *) kmalloc(sizeof(*state), GFP_KERNEL);
+ state = kzalloc(sizeof(*state), GFP_KERNEL);
if (state == NULL)
return NULL;
- memset (state, 0, sizeof (struct ppp_deflate_state));
state->w_size = w_size;
state->strm.next_out = NULL;
state->strm.workspace = kmalloc(zlib_inflate_workspacesize(),
--- linux-2.6.16-rc5-mm1/drivers/net/iseries_veth.c.orig 2006-03-02 14:30:09.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/iseries_veth.c 2006-03-02 14:30:43.000000000 +0100
@@ -820,10 +820,9 @@ static int veth_init_connection(u8 rlp)
|| ! HvLpConfig_doLpsCommunicateOnVirtualLan(this_lp, rlp) )
return 0;
- cnx = kmalloc(sizeof(*cnx), GFP_KERNEL);
+ cnx = kzalloc(sizeof(*cnx), GFP_KERNEL);
if (! cnx)
return -ENOMEM;
- memset(cnx, 0, sizeof(*cnx));
cnx->remote_lp = rlp;
spin_lock_init(&cnx->lock);
@@ -850,14 +849,13 @@ static int veth_init_connection(u8 rlp)
if (rc != 0)
return rc;
- msgs = kmalloc(VETH_NUMBUFFERS * sizeof(struct veth_msg), GFP_KERNEL);
+ msgs = kzalloc(VETH_NUMBUFFERS * sizeof(struct veth_msg), GFP_KERNEL);
if (! msgs) {
veth_error("Can't allocate buffers for LPAR %d.\n", rlp);
return -ENOMEM;
}
cnx->msgs = msgs;
- memset(msgs, 0, VETH_NUMBUFFERS * sizeof(struct veth_msg));
for (i = 0; i < VETH_NUMBUFFERS; i++) {
msgs[i].token = i;
--- linux-2.6.16-rc5-mm1/drivers/net/via-velocity.c.orig 2006-03-02 14:30:54.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/via-velocity.c 2006-03-02 14:31:24.000000000 +0100
@@ -1072,10 +1072,9 @@ static int velocity_init_rd_ring(struct
unsigned int rsize = sizeof(struct velocity_rd_info) *
vptr->options.numrx;
- vptr->rd_info = kmalloc(rsize, GFP_KERNEL);
+ vptr->rd_info = kzalloc(rsize, GFP_KERNEL);
if(vptr->rd_info == NULL)
goto out;
- memset(vptr->rd_info, 0, rsize);
vptr->rd_filled = vptr->rd_dirty = vptr->rd_curr = 0;
@@ -1146,14 +1145,13 @@ static int velocity_init_td_ring(struct
for (j = 0; j < vptr->num_txq; j++) {
curr = vptr->td_pool_dma[j];
- vptr->td_infos[j] = kmalloc(tsize, GFP_KERNEL);
+ vptr->td_infos[j] = kzalloc(tsize, GFP_KERNEL);
if(vptr->td_infos[j] == NULL)
{
while(--j >= 0)
kfree(vptr->td_infos[j]);
return -ENOMEM;
}
- memset(vptr->td_infos[j], 0, tsize);
for (i = 0; i < vptr->options.numtx; i++, curr += sizeof(struct tx_desc)) {
td = &(vptr->td_rings[j][i]);
--- linux-2.6.16-rc5-mm1/drivers/net/pcnet32.c.orig 2006-03-02 14:31:32.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/pcnet32.c 2006-03-02 15:04:10.000000000 +0100
@@ -1480,41 +1480,37 @@ static int pcnet32_alloc_ring(struct net
return -ENOMEM;
}
- lp->tx_dma_addr = kmalloc(sizeof(dma_addr_t) * lp->tx_ring_size,
+ lp->tx_dma_addr = kcalloc(lp->tx_ring_size, sizeof(dma_addr_t),
GFP_ATOMIC);
if (!lp->tx_dma_addr) {
if (pcnet32_debug & NETIF_MSG_DRV)
printk("\n" KERN_ERR PFX "%s: Memory allocation failed.\n", name);
return -ENOMEM;
}
- memset(lp->tx_dma_addr, 0, sizeof(dma_addr_t) * lp->tx_ring_size);
- lp->rx_dma_addr = kmalloc(sizeof(dma_addr_t) * lp->rx_ring_size,
+ lp->rx_dma_addr = kcalloc(lp->rx_ring_size, sizeof(dma_addr_t),
GFP_ATOMIC);
if (!lp->rx_dma_addr) {
if (pcnet32_debug & NETIF_MSG_DRV)
printk("\n" KERN_ERR PFX "%s: Memory allocation failed.\n", name);
return -ENOMEM;
}
- memset(lp->rx_dma_addr, 0, sizeof(dma_addr_t) * lp->rx_ring_size);
- lp->tx_skbuff = kmalloc(sizeof(struct sk_buff *) * lp->tx_ring_size,
+ lp->tx_skbuff = kcalloc(lp->tx_ring_size, sizeof(struct sk_buff *),
GFP_ATOMIC);
if (!lp->tx_skbuff) {
if (pcnet32_debug & NETIF_MSG_DRV)
printk("\n" KERN_ERR PFX "%s: Memory allocation failed.\n", name);
return -ENOMEM;
}
- memset(lp->tx_skbuff, 0, sizeof(struct sk_buff *) * lp->tx_ring_size);
- lp->rx_skbuff = kmalloc(sizeof(struct sk_buff *) * lp->rx_ring_size,
+ lp->rx_skbuff = kcalloc(lp->rx_ring_size, sizeof(struct sk_buff *),
GFP_ATOMIC);
if (!lp->rx_skbuff) {
if (pcnet32_debug & NETIF_MSG_DRV)
printk("\n" KERN_ERR PFX "%s: Memory allocation failed.\n", name);
return -ENOMEM;
}
- memset(lp->rx_skbuff, 0, sizeof(struct sk_buff *) * lp->rx_ring_size);
return 0;
}
--- linux-2.6.16-rc5-mm1/drivers/net/fs_enet/fs_enet-mii.c.orig 2006-03-02 14:33:53.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/fs_enet/fs_enet-mii.c 2006-03-02 14:34:01.000000000 +0100
@@ -389,12 +389,11 @@ static struct fs_enet_mii_bus *create_bu
struct fs_enet_mii_bus *bus;
int ret = 0;
- bus = kmalloc(sizeof(*bus), GFP_KERNEL);
+ bus = kzalloc(sizeof(*bus), GFP_KERNEL);
if (bus == NULL) {
ret = -ENOMEM;
goto err;
}
- memset(bus, 0, sizeof(*bus));
spin_lock_init(&bus->mii_lock);
bus->bus_info = bi;
bus->refs = 0;
--- linux-2.6.16-rc5-mm1/drivers/net/ppp_mppe.c.orig 2006-03-02 14:34:21.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/ppp_mppe.c 2006-03-02 14:34:35.000000000 +0100
@@ -191,12 +191,10 @@ static void *mppe_alloc(unsigned char *o
|| options[0] != CI_MPPE || options[1] != CILEN_MPPE)
goto out;
- state = (struct ppp_mppe_state *) kmalloc(sizeof(*state), GFP_KERNEL);
+ state = kzalloc(sizeof(*state), GFP_KERNEL);
if (state == NULL)
goto out;
- memset(state, 0, sizeof(*state));
-
state->arc4 = crypto_alloc_tfm("arc4", 0);
if (!state->arc4)
goto out_free;
--- linux-2.6.16-rc5-mm1/drivers/net/irda/irtty-sir.c.orig 2006-03-02 14:34:51.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/irda/irtty-sir.c 2006-03-02 14:35:01.000000000 +0100
@@ -505,10 +505,9 @@ static int irtty_open(struct tty_struct
}
/* allocate private device info block */
- priv = kmalloc(sizeof(*priv), GFP_KERNEL);
+ priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (!priv)
goto out_put;
- memset(priv, 0, sizeof(*priv));
priv->magic = IRTTY_MAGIC;
priv->tty = tty;
--- linux-2.6.16-rc5-mm1/drivers/net/irda/irda-usb.c.orig 2006-03-02 14:35:49.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/irda/irda-usb.c 2006-03-02 14:36:12.000000000 +0100
@@ -1343,10 +1343,9 @@ static inline struct irda_class_desc *ir
struct irda_class_desc *desc;
int ret;
- desc = kmalloc(sizeof (*desc), GFP_KERNEL);
+ desc = kzalloc(sizeof (*desc), GFP_KERNEL);
if (desc == NULL)
return NULL;
- memset(desc, 0, sizeof(*desc));
/* USB-IrDA class spec 1.0:
* 6.1.3: Standard "Get Descriptor" Device Request is not
@@ -1495,12 +1494,10 @@ static int irda_usb_probe(struct usb_int
/* Don't change this buffer size and allocation without doing
* some heavy and complete testing. Don't ask why :-(
* Jean II */
- self->speed_buff = (char *) kmalloc(IRDA_USB_SPEED_MTU, GFP_KERNEL);
+ self->speed_buff = kzalloc(IRDA_USB_SPEED_MTU, GFP_KERNEL);
if (self->speed_buff == NULL)
goto err_out_3;
- memset(self->speed_buff, 0, IRDA_USB_SPEED_MTU);
-
ret = irda_usb_open(self);
if (ret)
goto err_out_4;
--- linux-2.6.16-rc5-mm1/drivers/net/chelsio/sge.c.orig 2006-03-02 14:36:45.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/chelsio/sge.c 2006-03-02 14:37:23.000000000 +0100
@@ -336,10 +336,9 @@ static int alloc_rx_resources(struct sge
goto err_no_mem;
memset(q->entries, 0, size);
size = sizeof(struct freelQ_ce) * q->size;
- q->centries = kmalloc(size, GFP_KERNEL);
+ q->centries = kzalloc(size, GFP_KERNEL);
if (!q->centries)
goto err_no_mem;
- memset(q->centries, 0, size);
}
/*
@@ -464,10 +463,9 @@ static int alloc_tx_resources(struct sge
goto err_no_mem;
memset(q->entries, 0, size);
size = sizeof(struct cmdQ_ce) * q->size;
- q->centries = kmalloc(size, GFP_KERNEL);
+ q->centries = kzalloc(size, GFP_KERNEL);
if (!q->centries)
goto err_no_mem;
- memset(q->centries, 0, size);
}
/*
@@ -1649,11 +1647,10 @@ static void espibug_workaround(void *dat
struct sge * __devinit t1_sge_create(struct adapter *adapter,
struct sge_params *p)
{
- struct sge *sge = kmalloc(sizeof(*sge), GFP_KERNEL);
+ struct sge *sge = kzalloc(sizeof(*sge), GFP_KERNEL);
if (!sge)
return NULL;
- memset(sge, 0, sizeof(*sge));
sge->adapter = adapter;
sge->netdev = adapter->port[0].dev;
--- linux-2.6.16-rc5-mm1/drivers/net/chelsio/espi.c.orig 2006-03-02 14:37:51.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/chelsio/espi.c 2006-03-02 14:38:49.000000000 +0100
@@ -296,9 +296,7 @@ void t1_espi_destroy(struct peespi *espi
struct peespi *t1_espi_create(adapter_t *adapter)
{
- struct peespi *espi = kmalloc(sizeof(*espi), GFP_KERNEL);
-
- memset(espi, 0, sizeof(*espi));
+ struct peespi *espi = kzalloc(sizeof(*espi), GFP_KERNEL);
if (espi)
espi->adapter = adapter;
--- linux-2.6.16-rc5-mm1/drivers/net/chelsio/mv88x201x.c.orig 2006-03-02 14:38:57.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/chelsio/mv88x201x.c 2006-03-02 14:39:07.000000000 +0100
@@ -205,11 +205,10 @@ static struct cphy *mv88x201x_phy_create
struct mdio_ops *mdio_ops)
{
u32 val;
- struct cphy *cphy = kmalloc(sizeof(*cphy), GFP_KERNEL);
+ struct cphy *cphy = kzalloc(sizeof(*cphy), GFP_KERNEL);
if (!cphy)
return NULL;
- memset(cphy, 0, sizeof(*cphy));
cphy_init(cphy, adapter, phy_addr, &mv88x201x_ops, mdio_ops);
/* Commands the PHY to enable XFP's clock. */
--- linux-2.6.16-rc5-mm1/drivers/net/mipsnet.c.orig 2006-03-02 14:39:19.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/mipsnet.c 2006-03-02 14:39:28.000000000 +0100
@@ -323,12 +323,11 @@ static int __init mipsnet_init_module(vo
goto out;
}
- if (!(pldev = kmalloc (sizeof (*pldev), GFP_KERNEL))) {
+ if (!(pldev = kzalloc (sizeof (*pldev), GFP_KERNEL))) {
err = -ENOMEM;
goto out_unregister_driver;
}
- memset (pldev, 0, sizeof (*pldev));
pldev->name = mipsnet_string;
pldev->id = 0;
pldev->dev.release = mipsnet_platform_release;
--- linux-2.6.16-rc5-mm1/drivers/net/wan/hdlc_fr.c.orig 2006-03-02 14:40:08.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/wan/hdlc_fr.c 2006-03-02 14:40:23.000000000 +0100
@@ -159,11 +159,10 @@ static inline pvc_device* add_pvc(struct
pvc_p = &(*pvc_p)->next;
}
- pvc = kmalloc(sizeof(pvc_device), GFP_ATOMIC);
+ pvc = kzalloc(sizeof(pvc_device), GFP_ATOMIC);
if (!pvc)
return NULL;
- memset(pvc, 0, sizeof(pvc_device));
pvc->dlci = dlci;
pvc->master = dev;
pvc->next = *pvc_p; /* Put it in the chain */
--- linux-2.6.16-rc5-mm1/drivers/net/wan/sdla_chdlc.c.orig 2006-03-02 14:40:32.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/wan/sdla_chdlc.c 2006-03-02 14:40:52.000000000 +0100
@@ -679,13 +679,11 @@ static int new_if(struct wan_device* wan
}
/* allocate and initialize private data */
- chdlc_priv_area = kmalloc(sizeof(chdlc_private_area_t), GFP_KERNEL);
+ chdlc_priv_area = kzalloc(sizeof(chdlc_private_area_t), GFP_KERNEL);
if(chdlc_priv_area == NULL)
return -ENOMEM;
- memset(chdlc_priv_area, 0, sizeof(chdlc_private_area_t));
-
chdlc_priv_area->card = card;
chdlc_priv_area->common.sk = NULL;
chdlc_priv_area->common.func = NULL;
--- linux-2.6.16-rc5-mm1/drivers/net/wan/hostess_sv11.c.orig 2006-03-02 14:41:05.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/wan/hostess_sv11.c 2006-03-02 14:41:27.000000000 +0100
@@ -231,11 +231,10 @@ static struct sv11_device *sv11_init(int
return NULL;
}
- sv=(struct sv11_device *)kmalloc(sizeof(struct sv11_device), GFP_KERNEL);
+ sv=kzalloc(sizeof(struct sv11_device), GFP_KERNEL);
if(!sv)
goto fail3;
- memset(sv, 0, sizeof(*sv));
sv->if_ptr=&sv->netdev;
sv->netdev.dev = alloc_netdev(0, "hdlc%d", sv11_setup);
--- linux-2.6.16-rc5-mm1/drivers/net/wan/sealevel.c.orig 2006-03-02 14:41:34.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/wan/sealevel.c 2006-03-02 14:41:45.000000000 +0100
@@ -270,11 +270,10 @@ static __init struct slvl_board *slvl_in
return NULL;
}
- b = kmalloc(sizeof(struct slvl_board), GFP_KERNEL);
+ b = kzalloc(sizeof(struct slvl_board), GFP_KERNEL);
if(!b)
goto fail3;
- memset(b, 0, sizeof(*b));
if (!(b->dev[0]= slvl_alloc(iobase, irq)))
goto fail2;
--- linux-2.6.16-rc5-mm1/drivers/net/wan/sdla_x25.c.orig 2006-03-02 14:41:55.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/wan/sdla_x25.c 2006-03-02 14:42:43.000000000 +0100
@@ -926,13 +926,11 @@ static int new_if(struct wan_device* wan
}
/* allocate and initialize private data */
- chan = kmalloc(sizeof(x25_channel_t), GFP_ATOMIC);
+ chan = kzalloc(sizeof(x25_channel_t), GFP_ATOMIC);
if (chan == NULL){
return -ENOMEM;
}
- memset(chan, 0, sizeof(x25_channel_t));
-
/* Bug Fix: Seg Err on PVC startup
* It must be here since bind_lcn_to_dev expects
* it bellow */
@@ -1194,7 +1192,7 @@ static int if_open(struct net_device* de
/* Allocate and initialize BH circular buffer */
/* Add 1 to MAX_BH_BUFF so we don't have test with (MAX_BH_BUFF-1) */
- chan->bh_head = kmalloc((sizeof(bh_data_t)*(MAX_BH_BUFF+1)),GFP_ATOMIC);
+ chan->bh_head = kzalloc((sizeof(bh_data_t)*(MAX_BH_BUFF+1)),GFP_ATOMIC);
if (chan->bh_head == NULL){
printk(KERN_INFO "%s: ERROR, failed to allocate memory ! BH_BUFFERS !\n",
@@ -1202,7 +1200,6 @@ static int if_open(struct net_device* de
return -ENOBUFS;
}
- memset(chan->bh_head,0,(sizeof(bh_data_t)*(MAX_BH_BUFF+1)));
atomic_set(&chan->bh_buff_used, 0);
/* Increment the number of interfaces */
--- linux-2.6.16-rc5-mm1/drivers/net/wan/sdla.c.orig 2006-03-02 14:42:53.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/wan/sdla.c 2006-03-02 14:43:21.000000000 +0100
@@ -1203,10 +1203,9 @@ static int sdla_xfer(struct net_device *
if (read)
{
- temp = kmalloc(mem.len, GFP_KERNEL);
+ temp = kzalloc(mem.len, GFP_KERNEL);
if (!temp)
return(-ENOMEM);
- memset(temp, 0, mem.len);
sdla_read(dev, mem.addr, temp, mem.len);
if(copy_to_user(mem.data, temp, mem.len))
{
--- linux-2.6.16-rc5-mm1/drivers/net/wan/cycx_x25.c.orig 2006-03-02 14:43:41.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/wan/cycx_x25.c 2006-03-02 14:44:01.000000000 +0100
@@ -376,11 +376,10 @@ static int cycx_wan_new_if(struct wan_de
}
/* allocate and initialize private data */
- chan = kmalloc(sizeof(struct cycx_x25_channel), GFP_KERNEL);
+ chan = kzalloc(sizeof(struct cycx_x25_channel), GFP_KERNEL);
if (!chan)
return -ENOMEM;
- memset(chan, 0, sizeof(*chan));
strcpy(chan->name, conf->name);
chan->card = card;
chan->link = conf->port;
--- linux-2.6.16-rc5-mm1/drivers/net/wan/c101.c.orig 2006-03-02 14:44:08.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/wan/c101.c 2006-03-02 14:44:17.000000000 +0100
@@ -309,12 +309,11 @@ static int __init c101_run(unsigned long
return -ENODEV;
}
- card = kmalloc(sizeof(card_t), GFP_KERNEL);
+ card = kzalloc(sizeof(card_t), GFP_KERNEL);
if (card == NULL) {
printk(KERN_ERR "c101: unable to allocate memory\n");
return -ENOBUFS;
}
- memset(card, 0, sizeof(card_t));
card->dev = alloc_hdlcdev(card);
if (!card->dev) {
--- linux-2.6.16-rc5-mm1/drivers/net/wan/wanpipe_multppp.c.orig 2006-03-02 14:44:24.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/wan/wanpipe_multppp.c 2006-03-02 14:44:36.000000000 +0100
@@ -539,13 +539,11 @@ static int new_if(struct wan_device* wan
}
/* allocate and initialize private data */
- chdlc_priv_area = kmalloc(sizeof(chdlc_private_area_t), GFP_KERNEL);
+ chdlc_priv_area = kzalloc(sizeof(chdlc_private_area_t), GFP_KERNEL);
if(chdlc_priv_area == NULL)
return -ENOMEM;
- memset(chdlc_priv_area, 0, sizeof(chdlc_private_area_t));
-
chdlc_priv_area->card = card;
/* initialize data */
--- linux-2.6.16-rc5-mm1/drivers/net/wan/sdla_ppp.c.orig 2006-03-02 14:44:51.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/wan/sdla_ppp.c 2006-03-02 14:45:02.000000000 +0100
@@ -528,13 +528,11 @@ static int new_if(struct wan_device *wan
}
/* allocate and initialize private data */
- ppp_priv_area = kmalloc(sizeof(ppp_private_area_t), GFP_KERNEL);
+ ppp_priv_area = kzalloc(sizeof(ppp_private_area_t), GFP_KERNEL);
if( ppp_priv_area == NULL )
return -ENOMEM;
- memset(ppp_priv_area, 0, sizeof(ppp_private_area_t));
-
ppp_priv_area->card = card;
/* initialize data */
--- linux-2.6.16-rc5-mm1/drivers/net/wan/cycx_main.c.orig 2006-03-02 14:45:12.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/wan/cycx_main.c 2006-03-02 14:45:35.000000000 +0100
@@ -114,13 +114,11 @@ static int __init cycx_init(void)
/* Verify number of cards and allocate adapter data space */
cycx_ncards = min_t(int, cycx_ncards, CYCX_MAX_CARDS);
cycx_ncards = max_t(int, cycx_ncards, 1);
- cycx_card_array = kmalloc(sizeof(struct cycx_device) * cycx_ncards,
+ cycx_card_array = kcalloc(cycx_ncards, sizeof(struct cycx_device),
GFP_KERNEL);
if (!cycx_card_array)
goto out;
- memset(cycx_card_array, 0, sizeof(struct cycx_device) * cycx_ncards);
-
/* Register adapters with WAN router */
for (cnt = 0; cnt < cycx_ncards; ++cnt) {
struct cycx_device *card = &cycx_card_array[cnt];
--- linux-2.6.16-rc5-mm1/drivers/net/wan/dscc4.c.orig 2006-03-02 14:45:45.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/wan/dscc4.c 2006-03-02 14:46:12.000000000 +0100
@@ -890,12 +890,11 @@ static int dscc4_found1(struct pci_dev *
struct dscc4_dev_priv *root;
int i, ret = -ENOMEM;
- root = kmalloc(dev_per_card*sizeof(*root), GFP_KERNEL);
+ root = kcalloc(dev_per_card, sizeof(*root), GFP_KERNEL);
if (!root) {
printk(KERN_ERR "%s: can't allocate data\n", DRV_NAME);
goto err_out;
}
- memset(root, 0, dev_per_card*sizeof(*root));
for (i = 0; i < dev_per_card; i++) {
root[i].dev = alloc_hdlcdev(root + i);
@@ -903,12 +902,11 @@ static int dscc4_found1(struct pci_dev *
goto err_free_dev;
}
- ppriv = kmalloc(sizeof(*ppriv), GFP_KERNEL);
+ ppriv = kzalloc(sizeof(*ppriv), GFP_KERNEL);
if (!ppriv) {
printk(KERN_ERR "%s: can't allocate private data\n", DRV_NAME);
goto err_free_dev;
}
- memset(ppriv, 0, sizeof(struct dscc4_pci_priv));
ppriv->root = root;
spin_lock_init(&ppriv->lock);
--- linux-2.6.16-rc5-mm1/drivers/net/wan/n2.c.orig 2006-03-02 14:46:20.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/wan/n2.c 2006-03-02 14:46:27.000000000 +0100
@@ -351,12 +351,11 @@ static int __init n2_run(unsigned long i
return -ENODEV;
}
- card = kmalloc(sizeof(card_t), GFP_KERNEL);
+ card = kzalloc(sizeof(card_t), GFP_KERNEL);
if (card == NULL) {
printk(KERN_ERR "n2: unable to allocate memory\n");
return -ENOBUFS;
}
- memset(card, 0, sizeof(card_t));
card->ports[0].dev = alloc_hdlcdev(&card->ports[0]);
card->ports[1].dev = alloc_hdlcdev(&card->ports[1]);
--- linux-2.6.16-rc5-mm1/drivers/net/wan/sdla_fr.c.orig 2006-03-02 14:46:37.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/wan/sdla_fr.c 2006-03-02 14:47:11.000000000 +0100
@@ -812,12 +812,11 @@ static int new_if(struct wan_device* wan
}
/* allocate and initialize private data */
- chan = kmalloc(sizeof(fr_channel_t), GFP_KERNEL);
+ chan = kzalloc(sizeof(fr_channel_t), GFP_KERNEL);
if (chan == NULL)
return -ENOMEM;
- memset(chan, 0, sizeof(fr_channel_t));
strcpy(chan->name, conf->name);
chan->card = card;
@@ -1214,8 +1213,7 @@ static int if_open(struct net_device* de
INIT_WORK(&chan->common.wanpipe_work, (void *)fr_bh, dev);
/* Allocate and initialize BH circular buffer */
- chan->bh_head = kmalloc((sizeof(bh_data_t)*MAX_BH_BUFF),GFP_ATOMIC);
- memset(chan->bh_head,0,(sizeof(bh_data_t)*MAX_BH_BUFF));
+ chan->bh_head = kzalloc((sizeof(bh_data_t)*MAX_BH_BUFF),GFP_ATOMIC);
atomic_set(&chan->bh_buff_used, 0);
netif_start_queue(dev);
--- linux-2.6.16-rc5-mm1/drivers/net/shaper.c.orig 2006-03-02 14:47:27.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/shaper.c 2006-03-02 14:47:44.000000000 +0100
@@ -601,10 +601,9 @@ static int __init shaper_init(void)
return -ENODEV;
alloc_size = sizeof(*dev) * shapers;
- devs = kmalloc(alloc_size, GFP_KERNEL);
+ devs = kzalloc(alloc_size, GFP_KERNEL);
if (!devs)
return -ENOMEM;
- memset(devs, 0, alloc_size);
for (i = 0; i < shapers; i++) {
--- linux-2.6.16-rc5-mm1/drivers/net/ppp_generic.c.orig 2006-03-02 14:47:52.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/ppp_generic.c 2006-03-02 14:48:22.000000000 +0100
@@ -2006,10 +2006,9 @@ ppp_register_channel(struct ppp_channel
{
struct channel *pch;
- pch = kmalloc(sizeof(struct channel), GFP_KERNEL);
+ pch = kzalloc(sizeof(struct channel), GFP_KERNEL);
if (pch == 0)
return -ENOMEM;
- memset(pch, 0, sizeof(struct channel));
pch->ppp = NULL;
pch->chan = chan;
chan->ppp = pch;
@@ -2717,8 +2716,7 @@ static void cardmap_set(struct cardmap *
if (p == NULL || (nr >> p->shift) >= CARDMAP_WIDTH) {
do {
/* need a new top level */
- struct cardmap *np = kmalloc(sizeof(*np), GFP_KERNEL);
- memset(np, 0, sizeof(*np));
+ struct cardmap *np = kzalloc(sizeof(*np), GFP_KERNEL);
np->ptr[0] = p;
if (p != NULL) {
np->shift = p->shift + CARDMAP_ORDER;
@@ -2732,8 +2730,7 @@ static void cardmap_set(struct cardmap *
while (p->shift > 0) {
i = (nr >> p->shift) & CARDMAP_MASK;
if (p->ptr[i] == NULL) {
- struct cardmap *np = kmalloc(sizeof(*np), GFP_KERNEL);
- memset(np, 0, sizeof(*np));
+ struct cardmap *np = kzalloc(sizeof(*np), GFP_KERNEL);
np->shift = p->shift - CARDMAP_ORDER;
np->parent = p;
p->ptr[i] = np;
--- linux-2.6.16-rc5-mm1/drivers/net/lance.c.orig 2006-03-02 14:48:31.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/lance.c 2006-03-02 14:48:47.000000000 +0100
@@ -532,11 +532,10 @@ static int __init lance_probe1(struct ne
dev->base_addr = ioaddr;
/* Make certain the data structures used by the LANCE are aligned and DMAble. */
- lp = kmalloc(sizeof(*lp), GFP_DMA | GFP_KERNEL);
+ lp = kzalloc(sizeof(*lp), GFP_DMA | GFP_KERNEL);
if(lp==NULL)
return -ENODEV;
if (lance_debug > 6) printk(" (#0x%05lx)", (unsigned long)lp);
- memset(lp, 0, sizeof(*lp));
dev->priv = lp;
lp->name = chipname;
lp->rx_buffs = (unsigned long)kmalloc(PKT_BUF_SZ*RX_RING_SIZE,
--- linux-2.6.16-rc5-mm1/drivers/net/wireless/prism54/oid_mgt.c.orig 2006-03-02 14:49:34.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/wireless/prism54/oid_mgt.c 2006-03-02 14:50:29.000000000 +0100
@@ -235,12 +235,10 @@ mgt_init(islpci_private *priv)
{
int i;
- priv->mib = kmalloc(OID_NUM_LAST * sizeof (void *), GFP_KERNEL);
+ priv->mib = kzalloc(OID_NUM_LAST * sizeof(void *), GFP_KERNEL);
if (!priv->mib)
return -ENOMEM;
- memset(priv->mib, 0, OID_NUM_LAST * sizeof (void *));
-
/* Alloc the cache */
for (i = 0; i < OID_NUM_LAST; i++) {
if (isl_oid[i].flags & OID_FLAG_CACHED) {
@@ -564,11 +562,9 @@ mgt_get_request(islpci_private *priv, en
if ((isl_oid[n].flags & OID_FLAG_TYPE) == OID_TYPE_U32)
res->u = ret ? 0 : le32_to_cpu(*(u32 *) _res);
else {
- res->ptr = kmalloc(reslen, GFP_KERNEL);
+ res->ptr = kzalloc(reslen, GFP_KERNEL);
BUG_ON(res->ptr == NULL);
- if (ret)
- memset(res->ptr, 0, reslen);
- else {
+ if (!ret) {
memcpy(res->ptr, _res, reslen);
mgt_le_to_cpu(isl_oid[n].flags & OID_FLAG_TYPE,
res->ptr);
--- linux-2.6.16-rc5-mm1/drivers/net/wireless/prism54/isl_ioctl.c.orig 2006-03-02 14:50:39.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/wireless/prism54/isl_ioctl.c 2006-03-02 14:51:16.000000000 +0100
@@ -1621,11 +1621,9 @@ prism54_wpa_ie_add(islpci_private *priv,
struct islpci_bss_wpa_ie, list);
list_del(&bss->list);
} else {
- bss = kmalloc(sizeof (*bss), GFP_ATOMIC);
- if (bss != NULL) {
+ bss = kzalloc(sizeof (*bss), GFP_ATOMIC);
+ if (bss != NULL)
priv->num_bss_wpa++;
- memset(bss, 0, sizeof (*bss));
- }
}
if (bss != NULL) {
memcpy(bss->bssid, bssid, ETH_ALEN);
@@ -2165,11 +2163,10 @@ prism2_ioctl_set_generic_element(struct
return -EINVAL;
alen = sizeof(*attach) + len;
- attach = kmalloc(alen, GFP_KERNEL);
+ attach = kzalloc(alen, GFP_KERNEL);
if (attach == NULL)
return -ENOMEM;
- memset(attach, 0, alen);
#define WLAN_FC_TYPE_MGMT 0
#define WLAN_FC_STYPE_ASSOC_REQ 0
#define WLAN_FC_STYPE_REASSOC_REQ 2
--- linux-2.6.16-rc5-mm1/drivers/net/wireless/hostap/hostap_ioctl.c.orig 2006-03-02 14:51:35.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/wireless/hostap/hostap_ioctl.c 2006-03-02 14:53:22.000000000 +0100
@@ -181,12 +181,10 @@ static int prism2_ioctl_siwencode(struct
struct ieee80211_crypt_data *new_crypt;
/* take WEP into use */
- new_crypt = (struct ieee80211_crypt_data *)
- kmalloc(sizeof(struct ieee80211_crypt_data),
+ new_crypt = kzalloc(sizeof(struct ieee80211_crypt_data),
GFP_KERNEL);
if (new_crypt == NULL)
return -ENOMEM;
- memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
new_crypt->ops = ieee80211_get_crypto_ops("WEP");
if (!new_crypt->ops) {
request_module("ieee80211_crypt_wep");
@@ -3320,14 +3318,12 @@ static int prism2_ioctl_siwencodeext(str
prism2_crypt_delayed_deinit(local, crypt);
- new_crypt = (struct ieee80211_crypt_data *)
- kmalloc(sizeof(struct ieee80211_crypt_data),
+ new_crypt = kzalloc(sizeof(struct ieee80211_crypt_data),
GFP_KERNEL);
if (new_crypt == NULL) {
ret = -ENOMEM;
goto done;
}
- memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
new_crypt->ops = ops;
new_crypt->priv = new_crypt->ops->init(i);
if (new_crypt->priv == NULL) {
@@ -3542,14 +3538,12 @@ static int prism2_ioctl_set_encryption(l
prism2_crypt_delayed_deinit(local, crypt);
- new_crypt = (struct ieee80211_crypt_data *)
- kmalloc(sizeof(struct ieee80211_crypt_data),
+ new_crypt = kzalloc(sizeof(struct ieee80211_crypt_data),
GFP_KERNEL);
if (new_crypt == NULL) {
ret = -ENOMEM;
goto done;
}
- memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
new_crypt->ops = ops;
new_crypt->priv = new_crypt->ops->init(param->u.crypt.idx);
if (new_crypt->priv == NULL) {
--- linux-2.6.16-rc5-mm1/drivers/net/wireless/hostap/hostap_ap.c.orig 2006-03-02 14:53:34.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/wireless/hostap/hostap_ap.c 2006-03-02 14:54:13.000000000 +0100
@@ -1099,15 +1099,13 @@ static struct sta_info * ap_add_sta(stru
{
struct sta_info *sta;
- sta = (struct sta_info *)
- kmalloc(sizeof(struct sta_info), GFP_ATOMIC);
+ sta = kzalloc(sizeof(struct sta_info), GFP_ATOMIC);
if (sta == NULL) {
PDEBUG(DEBUG_AP, "AP: kmalloc failed\n");
return NULL;
}
/* initialize STA info data */
- memset(sta, 0, sizeof(struct sta_info));
sta->local = ap->local;
skb_queue_head_init(&sta->tx_buf);
memcpy(sta->addr, addr, ETH_ALEN);
--- linux-2.6.16-rc5-mm1/drivers/net/wireless/hostap/hostap_cs.c.orig 2006-03-02 14:54:19.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/wireless/hostap/hostap_cs.c 2006-03-02 14:54:35.000000000 +0100
@@ -567,14 +567,13 @@ static int prism2_config(struct pcmcia_d
PDEBUG(DEBUG_FLOW, "prism2_config()\n");
parse = kmalloc(sizeof(cisparse_t), GFP_KERNEL);
- hw_priv = kmalloc(sizeof(*hw_priv), GFP_KERNEL);
+ hw_priv = kzalloc(sizeof(*hw_priv), GFP_KERNEL);
if (parse == NULL || hw_priv == NULL) {
kfree(parse);
kfree(hw_priv);
ret = -ENOMEM;
goto failed;
}
- memset(hw_priv, 0, sizeof(*hw_priv));
tuple.DesiredTuple = CISTPL_CONFIG;
tuple.Attributes = 0;
--- linux-2.6.16-rc5-mm1/drivers/net/wireless/hostap/hostap_info.c.orig 2006-03-02 14:54:42.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/wireless/hostap/hostap_info.c 2006-03-02 14:54:59.000000000 +0100
@@ -327,11 +327,10 @@ static void prism2_info_hostscanresults(
ptr = (u8 *) pos;
new_count = left / result_size;
- results = kmalloc(new_count * sizeof(struct hfa384x_hostscan_result),
+ results = kcalloc(new_count, sizeof(struct hfa384x_hostscan_result),
GFP_ATOMIC);
if (results == NULL)
return;
- memset(results, 0, new_count * sizeof(struct hfa384x_hostscan_result));
for (i = 0; i < new_count; i++) {
memcpy(&results[i], ptr, copy_len);
--- linux-2.6.16-rc5-mm1/drivers/net/wireless/hostap/hostap_pci.c.orig 2006-03-02 14:55:47.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/wireless/hostap/hostap_pci.c 2006-03-02 14:55:58.000000000 +0100
@@ -301,10 +301,9 @@ static int prism2_pci_probe(struct pci_d
struct hostap_interface *iface;
struct hostap_pci_priv *hw_priv;
- hw_priv = kmalloc(sizeof(*hw_priv), GFP_KERNEL);
+ hw_priv = kzalloc(sizeof(*hw_priv), GFP_KERNEL);
if (hw_priv == NULL)
return -ENOMEM;
- memset(hw_priv, 0, sizeof(*hw_priv));
if (pci_enable_device(pdev))
return -EIO;
--- linux-2.6.16-rc5-mm1/drivers/net/wireless/hostap/hostap_hw.c.orig 2006-03-02 14:56:05.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/wireless/hostap/hostap_hw.c 2006-03-02 14:56:54.000000000 +0100
@@ -348,14 +348,12 @@ static int hfa384x_cmd(struct net_device
if (signal_pending(current))
return -EINTR;
- entry = (struct hostap_cmd_queue *)
- kmalloc(sizeof(*entry), GFP_ATOMIC);
+ entry = kzalloc(sizeof(*entry), GFP_ATOMIC);
if (entry == NULL) {
printk(KERN_DEBUG "%s: hfa384x_cmd - kmalloc failed\n",
dev->name);
return -ENOMEM;
}
- memset(entry, 0, sizeof(*entry));
atomic_set(&entry->usecnt, 1);
entry->type = CMD_SLEEP;
entry->cmd = cmd;
@@ -518,14 +516,12 @@ static int hfa384x_cmd_callback(struct n
return -1;
}
- entry = (struct hostap_cmd_queue *)
- kmalloc(sizeof(*entry), GFP_ATOMIC);
+ entry = kzalloc(sizeof(*entry), GFP_ATOMIC);
if (entry == NULL) {
printk(KERN_DEBUG "%s: hfa384x_cmd_callback - kmalloc "
"failed\n", dev->name);
return -ENOMEM;
}
- memset(entry, 0, sizeof(*entry));
atomic_set(&entry->usecnt, 1);
entry->type = CMD_CALLBACK;
entry->cmd = cmd;
@@ -3013,14 +3009,12 @@ static int prism2_set_tim(struct net_dev
iface = netdev_priv(dev);
local = iface->local;
- new_entry = (struct set_tim_data *)
- kmalloc(sizeof(*new_entry), GFP_ATOMIC);
+ new_entry = kzalloc(sizeof(*new_entry), GFP_ATOMIC);
if (new_entry == NULL) {
printk(KERN_DEBUG "%s: prism2_set_tim: kmalloc failed\n",
local->dev->name);
return -ENOMEM;
}
- memset(new_entry, 0, sizeof(*new_entry));
new_entry->aid = aid;
new_entry->set = set;
--- linux-2.6.16-rc5-mm1/drivers/net/wireless/hostap/hostap_plx.c.orig 2006-03-02 14:57:02.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/wireless/hostap/hostap_plx.c 2006-03-02 14:57:11.000000000 +0100
@@ -446,10 +446,9 @@ static int prism2_plx_probe(struct pci_d
int tmd7160;
struct hostap_plx_priv *hw_priv;
- hw_priv = kmalloc(sizeof(*hw_priv), GFP_KERNEL);
+ hw_priv = kzalloc(sizeof(*hw_priv), GFP_KERNEL);
if (hw_priv == NULL)
return -ENOMEM;
- memset(hw_priv, 0, sizeof(*hw_priv));
if (pci_enable_device(pdev))
return -EIO;
--- linux-2.6.16-rc5-mm1/drivers/net/e100.c.orig 2006-03-02 14:57:25.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/e100.c 2006-03-02 14:57:41.000000000 +0100
@@ -1882,9 +1882,8 @@ static int e100_rx_alloc_list(struct nic
nic->rx_to_use = nic->rx_to_clean = NULL;
- if(!(nic->rxs = kmalloc(sizeof(struct rx) * count, GFP_ATOMIC)))
+ if(!(nic->rxs = kcalloc(count, sizeof(struct rx), GFP_ATOMIC)))
return -ENOMEM;
- memset(nic->rxs, 0, sizeof(struct rx) * count);
for(rx = nic->rxs, i = 0; i < count; rx++, i++) {
rx->next = (i + 1 < count) ? rx + 1 : nic->rxs;
--- linux-2.6.16-rc5-mm1/drivers/net/s2io.c.orig 2006-03-02 14:57:50.000000000 +0100
+++ linux-2.6.16-rc5-mm1/drivers/net/s2io.c 2006-03-02 14:58:42.000000000 +0100
@@ -407,14 +407,13 @@ static int init_shared_mem(struct s2io_n
for (i = 0; i < config->tx_fifo_num; i++) {
int fifo_len = config->tx_cfg[i].fifo_len;
int list_holder_size = fifo_len * sizeof(list_info_hold_t);
- mac_control->fifos[i].list_info = kmalloc(list_holder_size,
+ mac_control->fifos[i].list_info = kzalloc(list_holder_size,
GFP_KERNEL);
if (!mac_control->fifos[i].list_info) {
DBG_PRINT(ERR_DBG,
"Malloc failed for list_info\n");
return -ENOMEM;
}
- memset(mac_control->fifos[i].list_info, 0, list_holder_size);
}
for (i = 0; i < config->tx_fifo_num; i++) {
int page_num = TXD_MEM_PAGE_CNT(config->tx_cfg[i].fifo_len,
@@ -3229,24 +3228,21 @@ static int s2io_enable_msi_x(nic_t *nic)
u16 msi_control; /* Temp variable */
int ret, i, j, msix_indx = 1;
- nic->entries = kmalloc(MAX_REQUESTED_MSI_X * sizeof(struct msix_entry),
+ nic->entries = kzalloc(MAX_REQUESTED_MSI_X * sizeof(struct msix_entry),
GFP_KERNEL);
if (nic->entries == NULL) {
DBG_PRINT(ERR_DBG, "%s: Memory allocation failed\n", __FUNCTION__);
return -ENOMEM;
}
- memset(nic->entries, 0, MAX_REQUESTED_MSI_X * sizeof(struct msix_entry));
nic->s2io_entries =
- kmalloc(MAX_REQUESTED_MSI_X * sizeof(struct s2io_msix_entry),
+ kzalloc(MAX_REQUESTED_MSI_X * sizeof(struct s2io_msix_entry),
GFP_KERNEL);
if (nic->s2io_entries == NULL) {
DBG_PRINT(ERR_DBG, "%s: Memory allocation failed\n", __FUNCTION__);
kfree(nic->entries);
return -ENOMEM;
}
- memset(nic->s2io_entries, 0,
- MAX_REQUESTED_MSI_X * sizeof(struct s2io_msix_entry));
for (i=0; i< MAX_REQUESTED_MSI_X; i++) {
nic->entries[i].entry = i;
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply
* Re: [PATCH 0/8] Intel I/O Acceleration Technology (I/OAT)
From: Jan Engelhardt @ 2006-03-04 18:46 UTC (permalink / raw)
To: Chris Leech; +Cc: linux-kernel, netdev
In-Reply-To: <20060303214036.11908.10499.stgit@gitlost.site>
>This patch series is the first full release of the Intel(R) I/O
>Acceleration Technology (I/OAT) for Linux. It includes an in kernel API
>for offloading memory copies to hardware, a driver for the I/OAT DMA memcpy
>engine, and changes to the TCP stack to offload copies of received
>networking data to application space.
>
Does this buy the normal standard desktop user anything?
Jan Engelhardt
--
^ permalink raw reply
* Re: [RFC: 2.6 patch] let NET_CLS_ACT no longer depend on EXPERIMENTAL
From: jamal @ 2006-03-04 18:52 UTC (permalink / raw)
To: Patrick McHardy; +Cc: Adrian Bunk, netdev, linux-kernel
In-Reply-To: <4409C6BA.60803@trash.net>
On Sat, 2006-04-03 at 17:56 +0100, Patrick McHardy wrote:
> Adrian Bunk wrote:
> > This option should IMHO no longer depend on EXPERIMENTAL.
> >
> >
> > Signed-off-by: Adrian Bunk <bunk@stusta.de>
> >
> > ---
> >
> > This patch was already sent on:
> > - 12 Feb 2006
>
> Yesterday I managed to crash my machine playing around with tc actions
> within minutes. I haven't looked into it yet, but it seems it still
> needs more testing.
Simple: Fix the bug and submit a patch. If you cant find the cause post
what you are doing.
What is the metric for going from experimental to non-experimental?
I surely hope it doesnt come to some irrational reasoning like
"Patrick found a bug"[1].
- It has been around since 2.6.7/8;
- I use it extensively on about 10 machines since (I am pretty sure a
lot more extensively than Patrick)
- I know people who use it extensively
- I am pretty sure there are people that i dont know who use it
extensively
So on Adrian's patch and above reasoning:
ACKed-by: Jamal Hadi Salim <hadi@cyberus.ca>
cheers,
jamal
[1]If you used half of that logic on netfilter it would still be
experimental or rather should be demoted to experimental.
^ permalink raw reply
* Re: [PATCH 1/8] [I/OAT] DMA memcpy subsystem
From: Benjamin LaHaise @ 2006-03-04 19:20 UTC (permalink / raw)
To: Chris Leech; +Cc: linux-kernel, netdev
In-Reply-To: <20060303214220.11908.75517.stgit@gitlost.site>
On Fri, Mar 03, 2006 at 01:42:20PM -0800, Chris Leech wrote:
> +void dma_async_device_unregister(struct dma_device* device)
> +{
...
> + kref_put(&device->refcount, dma_async_device_cleanup);
> + wait_for_completion(&device->done);
> +}
This looks like a bug: device is dereferenced after it is potentially
freed.
-ben
--
"Time is of no importance, Mr. President, only life is important."
Don't Email: <dont@kvack.org>.
^ permalink raw reply
* Re: [RFC: 2.6 patch] let NET_CLS_ACT no longer depend on EXPERIMENTAL
From: Patrick McHardy @ 2006-03-04 20:36 UTC (permalink / raw)
To: hadi; +Cc: Adrian Bunk, netdev, linux-kernel
In-Reply-To: <1141498341.5185.32.camel@localhost.localdomain>
jamal wrote:
> On Sat, 2006-04-03 at 17:56 +0100, Patrick McHardy wrote:
>
>>Adrian Bunk wrote:
>>
>>>This option should IMHO no longer depend on EXPERIMENTAL.
>>>
>>
>>Yesterday I managed to crash my machine playing around with tc actions
>>within minutes. I haven't looked into it yet, but it seems it still
>>needs more testing.
>
>
> Simple: Fix the bug and submit a patch. If you cant find the cause post
> what you are doing.
I'll fix it.
> What is the metric for going from experimental to non-experimental?
> I surely hope it doesnt come to some irrational reasoning like
> "Patrick found a bug"[1].
I think a sane metric is "opinion of people who know the code". But
I don't care much, I don't think many people care whether something
is maked experimental or not.
> [1]If you used half of that logic on netfilter it would still be
> experimental or rather should be demoted to experimental.
I'll take that as a compliment :)
^ permalink raw reply
* Re: GigE on PowerMac G5
From: Benjamin Herrenschmidt @ 2006-03-04 21:16 UTC (permalink / raw)
To: Andreas Schwab; +Cc: netdev, linuxppc64-dev
In-Reply-To: <jebqwmfeh9.fsf@sykes.suse.de>
On Sat, 2006-03-04 at 15:53 +0100, Andreas Schwab wrote:
> [Sorry for duplicate posting, I've used the wrong list address.]
>
> I suppose the NIC in the PowerMac G5 can do GigE, yet when plugged into a
> GB switch it is only willing to talk 100MB with it. Any idea why? Kernel
> is 2.6.16-rc5-git2.
Works for me... Must be a problem with auto-neg and your switch, or the
cable.... Can you check how the switch is configured maybe ? You can
also try forcing the link speed with ethtool.
Ben.
> # lsprop /proc/device-tree/ht@0,f2000000/pci@6/ethernet@f
> name "ethernet"
> linux,phandle ff9c53d8
> interrupt-parent ff9779b0
> gbit-phy
> assigned-addresses 82047810 00000000 80400000 00000000 00200000
> 82047830 00000000 80300000 00000000 00100000
> local-mac-address 00 0a 95 ba b8 70 .....p
> stats 00000000 00000000 00000000 00000000 00000000
> reg 00047800 00000000 00000000 00000000 00000000
> 02047810 00000000 00000000 00000000 00020000
> 02047830 00000000 00000000 00000000 00010000
> max-frame-size 000005ee (1518)
> address-bits 00000030 (48)
> built-in
> compatible "K2-GMAC"
> category "net"
> removable "network"
> network-type "ethernet"
> device_type "network"
> fast-back-to-back
> devsel-speed 00000002
> max-latency 00000040 (64)
> min-grant 00000040 (64)
> interrupts 00000029 00000001
> class-code 00020000 (131072)
> revision-id 00000000
> device-id 0000004c (76)
> vendor-id 0000106b (4203)
> # ethtool eth0
> Settings for eth0:
> Supported ports: [ TP MII ]
> Supported link modes: 10baseT/Half 10baseT/Full
> 100baseT/Half 100baseT/Full
> 1000baseT/Half 1000baseT/Full
> Supports auto-negotiation: Yes
> Advertised link modes: 10baseT/Half 10baseT/Full
> 100baseT/Half 100baseT/Full
> 1000baseT/Half 1000baseT/Full
> Advertised auto-negotiation: No
> Speed: 100Mb/s
> Duplex: Full
> Port: MII
> PHYAD: 0
> Transceiver: external
> Auto-negotiation: on
> Supports Wake-on: g
> Wake-on: d
> Current message level: 0x00000007 (7)
> Link detected: yes
>
> Andreas.
>
^ permalink raw reply
* Re: [PATCH 0/8] Intel I/O Acceleration Technology (I/OAT)
From: David S. Miller @ 2006-03-04 21:41 UTC (permalink / raw)
To: jengelh; +Cc: christopher.leech, linux-kernel, netdev
In-Reply-To: <Pine.LNX.4.61.0603041945520.29991@yvahk01.tjqt.qr>
From: Jan Engelhardt <jengelh@linux01.gwdg.de>
Date: Sat, 4 Mar 2006 19:46:22 +0100 (MET)
> Does this buy the normal standard desktop user anything?
Absolutely, it optimizes end-node performance.
^ permalink raw reply
* Re: [PATCH 8/8] [I/OAT] TCP recv offload to I/OAT
From: Greg KH @ 2006-03-04 23:18 UTC (permalink / raw)
To: Chris Leech; +Cc: linux-kernel, netdev
In-Reply-To: <20060303214236.11908.98881.stgit@gitlost.site>
On Fri, Mar 03, 2006 at 01:42:36PM -0800, Chris Leech wrote:
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index 13abfa2..b792048 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -262,6 +262,9 @@
> #include <net/tcp.h>
> #include <net/xfrm.h>
> #include <net/ip.h>
> +#ifdef CONFIG_NET_DMA
> +#include <net/netdma.h>
> +#endif
#ifdef is not needed here (try not to put #ifdef in .c files.) I think
a few of your other usages of #ifdef in this file can also be removed
with judicious use of inline functions in a .h file.
thanks,
greg k-h
^ permalink raw reply
* Re: GigE on PowerMac G5
From: Paul Mackerras @ 2006-03-04 23:36 UTC (permalink / raw)
To: Andreas Schwab; +Cc: netdev, linuxppc64-dev
In-Reply-To: <jebqwmfeh9.fsf@sykes.suse.de>
Andreas Schwab writes:
> I suppose the NIC in the PowerMac G5 can do GigE, yet when plugged into a
> GB switch it is only willing to talk 100MB with it. Any idea why? Kernel
> is 2.6.16-rc5-git2.
It does 1000Mb/s here...
# ethtool eth0
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Advertised auto-negotiation: No
Speed: 1000Mb/s
Duplex: Full
Port: MII
PHYAD: 0
Transceiver: external
Auto-negotiation: on
Supports Wake-on: g
Wake-on: d
Current message level: 0x00000007 (7)
Link detected: yes
Paul.
^ permalink raw reply
* Re: 2.6.16-rc5-mm2: IPW_QOS: two remarks
From: Andreas Happe @ 2006-03-05 0:46 UTC (permalink / raw)
To: Adrian Bunk; +Cc: Andrew Morton, linux-kernel, linville, jgarzik, netdev
In-Reply-To: <20060303152641.GR9295@stusta.de>
On Friday 03 March 2006 16:26, Adrian Bunk wrote:
> Two remarks regarding the new IPW_QOS option:
> - it should be named IPW2200_QOS (similar to the other IPW2200_*
> options)
done.
> - please add a help text
i could add some stuff about WMM to its help text, but I think someone more
involved with the ipw2200-project should do that.
andy
Add the following config entries for the ipw2200 driver to
drivers/net/wireless/Kconfig
* IPW2200_MONITOR
enables Monitor mode, as this seems to generate lots of firmware errors
it depends upon BROKEN
* IPW2200_QOS
enables QoS feature - this is under development right now, so it depends
upon EXPERIMENTAL.
Changes:
* Renamed IPW_QOS to IPW2200_QOS as requested by Adrian Bunk.
* Made IPW2200_MONITOR depend upon BROKEN
* QoS option is named IPW_QOS not IPW2200_MONITOR.
Spotted by Daniel Paschka, thanks.
Signed-off-by: Andreas Happe <andreashappe@snikt.net>
diff -uprN linux-2.6.15-base/drivers/net/wireless/ipw2200.c
linux-2.6.15/drivers/net/wireless/ipw2200.c
--- linux-2.6.15-base/drivers/net/wireless/ipw2200.c 2006-03-05
01:17:52.000000000 +0100
+++ linux-2.6.15/drivers/net/wireless/ipw2200.c 2006-03-05 01:28:04.000000000
+0100
@@ -60,7 +60,7 @@ static const char ipw_modes[] = {
'a', 'b', 'g', '?'
};
-#ifdef CONFIG_IPW_QOS
+#ifdef CONFIG_IPW2200_QOS
static int qos_enable = 0;
static int qos_burst_enable = 0;
static int qos_no_ack_mask = 0;
@@ -124,7 +124,7 @@ static int ipw_send_qos_params_command(s
*qos_param);
static int ipw_send_qos_info_command(struct ipw_priv *priv, struct
ieee80211_qos_information_element
*qos_param);
-#endif /* CONFIG_IPW_QOS */
+#endif /* CONFIG_IPW2200_QOS */
static struct iw_statistics *ipw_get_wireless_stats(struct net_device *dev);
static void ipw_remove_current_network(struct ipw_priv *priv);
@@ -4208,7 +4208,7 @@ static void ipw_rx_notification(struct i
queue_work(priv->workqueue,
&priv->system_config);
-#ifdef CONFIG_IPW_QOS
+#ifdef CONFIG_IPW2200_QOS
#define IPW_GET_PACKET_STYPE(x) WLAN_FC_GET_STYPE( \
le16_to_cpu(((struct ieee80211_hdr *)(x))->frame_ctl))
if ((priv->status & STATUS_AUTH) &&
@@ -6549,7 +6549,7 @@ static int ipw_wx_set_mlme(struct net_de
return 0;
}
-#ifdef CONFIG_IPW_QOS
+#ifdef CONFIG_IPW2200_QOS
/* QoS */
/*
@@ -7031,7 +7031,7 @@ static int ipw_send_qos_info_command(str
return ipw_send_cmd(priv, &cmd);
}
-#endif /* CONFIG_IPW_QOS */
+#endif /* CONFIG_IPW2200_QOS */
static int ipw_associate_network(struct ipw_priv *priv,
struct ieee80211_network *network,
@@ -7193,7 +7193,7 @@ static int ipw_associate_network(struct
priv->assoc_network = network;
-#ifdef CONFIG_IPW_QOS
+#ifdef CONFIG_IPW2200_QOS
ipw_qos_association(priv, network);
#endif
@@ -8027,10 +8027,10 @@ static int ipw_sw_reset(struct ipw_priv
IPW_DEBUG_INFO("Bind to static channel %d\n", channel);
/* TODO: Validate that provided channel is in range */
}
-#ifdef CONFIG_IPW_QOS
+#ifdef CONFIG_IPW2200_QOS
ipw_qos_init(priv, qos_enable, qos_burst_enable,
burst_duration_CCK, burst_duration_OFDM);
-#endif /* CONFIG_IPW_QOS */
+#endif /* CONFIG_IPW2200_QOS */
switch (mode) {
case 1:
@@ -9636,7 +9636,7 @@ static int ipw_tx_skb(struct ipw_priv *p
txb->fragments[0]->data;
int i = 0;
struct tfd_frame *tfd;
-#ifdef CONFIG_IPW_QOS
+#ifdef CONFIG_IPW2200_QOS
int tx_id = ipw_get_tx_queue_number(priv, pri);
struct clx2_tx_queue *txq = &priv->txq[tx_id];
#else
@@ -9749,9 +9749,9 @@ static int ipw_tx_skb(struct ipw_priv *p
/* No hardware encryption */
tfd->u.data.tx_flags |= DCT_FLAG_NO_WEP;
-#ifdef CONFIG_IPW_QOS
+#ifdef CONFIG_IPW2200_QOS
ipw_qos_set_tx_queue_command(priv, pri, &(tfd->u.data), unicast);
-#endif /* CONFIG_IPW_QOS */
+#endif /* CONFIG_IPW2200_QOS */
/* payload */
tfd->u.data.num_chunks = cpu_to_le32(min((u8) (NUM_TFD_CHUNKS - 2),
@@ -9828,12 +9828,12 @@ static int ipw_tx_skb(struct ipw_priv *p
static int ipw_net_is_queue_full(struct net_device *dev, int pri)
{
struct ipw_priv *priv = ieee80211_priv(dev);
-#ifdef CONFIG_IPW_QOS
+#ifdef CONFIG_IPW2200_QOS
int tx_id = ipw_get_tx_queue_number(priv, pri);
struct clx2_tx_queue *txq = &priv->txq[tx_id];
#else
struct clx2_tx_queue *txq = &priv->txq[0];
-#endif /* CONFIG_IPW_QOS */
+#endif /* CONFIG_IPW2200_QOS */
if (ipw_queue_space(&txq->q) < txq->q.high_mark)
return 1;
@@ -10157,10 +10157,10 @@ static int ipw_setup_deferred_work(struc
INIT_WORK(&priv->merge_networks,
(void (*)(void *))ipw_merge_adhoc_network, priv);
-#ifdef CONFIG_IPW_QOS
+#ifdef CONFIG_IPW2200_QOS
INIT_WORK(&priv->qos_activate, (void (*)(void *))ipw_bg_qos_activate,
priv);
-#endif /* CONFIG_IPW_QOS */
+#endif /* CONFIG_IPW2200_QOS */
tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long))
ipw_irq_tasklet, (unsigned long)priv);
@@ -10309,10 +10309,10 @@ static int ipw_config(struct ipw_priv *p
if (ipw_send_rts_threshold(priv, priv->rts_threshold))
goto error;
}
-#ifdef CONFIG_IPW_QOS
+#ifdef CONFIG_IPW2200_QOS
IPW_DEBUG_QOS("QoS: call ipw_qos_activate\n");
ipw_qos_activate(priv, NULL);
-#endif /* CONFIG_IPW_QOS */
+#endif /* CONFIG_IPW2200_QOS */
if (ipw_set_random_seed(priv))
goto error;
@@ -11023,11 +11023,11 @@ static int ipw_pci_probe(struct pci_dev
priv->ieee->set_security = shim__set_security;
priv->ieee->is_queue_full = ipw_net_is_queue_full;
-#ifdef CONFIG_IPW_QOS
+#ifdef CONFIG_IPW2200_QOS
priv->ieee->handle_probe_response = ipw_handle_beacon;
priv->ieee->handle_beacon = ipw_handle_probe_response;
priv->ieee->handle_assoc_response = ipw_handle_assoc_response;
-#endif /* CONFIG_IPW_QOS */
+#endif /* CONFIG_IPW2200_QOS */
priv->ieee->perfect_rssi = -20;
priv->ieee->worst_rssi = -85;
@@ -11256,7 +11256,7 @@ MODULE_PARM_DESC(debug, "debug output ma
module_param(channel, int, 0444);
MODULE_PARM_DESC(channel, "channel to limit associate to (default 0 [ANY])");
-#ifdef CONFIG_IPW_QOS
+#ifdef CONFIG_IPW2200_QOS
module_param(qos_enable, int, 0444);
MODULE_PARM_DESC(qos_enable, "enable all QoS functionalitis");
@@ -11271,7 +11271,7 @@ MODULE_PARM_DESC(burst_duration_CCK, "se
module_param(burst_duration_OFDM, int, 0444);
MODULE_PARM_DESC(burst_duration_OFDM, "set OFDM burst value");
-#endif /* CONFIG_IPW_QOS */
+#endif /* CONFIG_IPW2200_QOS */
#ifdef CONFIG_IPW2200_MONITOR
module_param(mode, int, 0444);
diff -uprN linux-2.6.15-base/drivers/net/wireless/Kconfig
linux-2.6.15/drivers/net/wireless/Kconfig
--- linux-2.6.15-base/drivers/net/wireless/Kconfig 2006-03-05
01:17:52.000000000 +0100
+++ linux-2.6.15/drivers/net/wireless/Kconfig 2006-03-05 01:25:38.000000000
+0100
@@ -237,6 +237,20 @@ config IPW2200_DEBUG
If you are not trying to debug or develop the IPW2200 driver, you
most likely want to say N here.
+config IPW2200_MONITOR
+ bool "Enable promiscuous mode"
+ depends on IPW2200 && BROKEN
+ ---help---
+ Enables promiscuous/monitor mode support for the ipw2200 driver.
+
+ With this feature compiled into the driver, you can switch to.
+ promiscuous mode via the Wireless Tool's Monitor mode. While in this
+ mode, no packets can be sent.
+
+config IPW2200_QOS
+ bool "Enable QoS support"
+ depends on IPW2200 && EXPERIMENTAL
+
config AIRO
tristate "Cisco/Aironet 34X/35X/4500/4800 ISA and PCI cards"
depends on NET_RADIO && ISA_DMA_API && CRYPTO && (PCI || BROKEN)
^ permalink raw reply
* Re: [PATCH 0/8] Intel I/O Acceleration Technology (I/OAT)
From: Evgeniy Polyakov @ 2006-03-05 1:43 UTC (permalink / raw)
To: David S. Miller; +Cc: jengelh, christopher.leech, linux-kernel, netdev
In-Reply-To: <20060304.134144.122314124.davem@davemloft.net>
On Sat, Mar 04, 2006 at 01:41:44PM -0800, David S. Miller (davem@davemloft.net) wrote:
> From: Jan Engelhardt <jengelh@linux01.gwdg.de>
> Date: Sat, 4 Mar 2006 19:46:22 +0100 (MET)
>
> > Does this buy the normal standard desktop user anything?
>
> Absolutely, it optimizes end-node performance.
It really depends on how it is used.
According to investigation made for kevent based FS AIO reading,
get_user_pages() performange graph looks like sqrt() function
with plato starting on about 64-80 pages on Xeon 2.4Ghz with 1Gb of ram,
while memcopy() is linear, so it can be noticebly slower than
copy_to_user() if get_user_pages() is used aggressively, so userspace
application must reuse the same, already grabbed buffer for maximum
performance, but Intel folks did not provide theirs usage case and any
benchmarks as far as I know.
--
Evgeniy Polyakov
^ permalink raw reply
* Re: [PATCH 0/8] Intel I/O Acceleration Technology (I/OAT)
From: David S. Miller @ 2006-03-05 2:08 UTC (permalink / raw)
To: johnpol; +Cc: jengelh, christopher.leech, linux-kernel, netdev
In-Reply-To: <20060305014324.GA20026@2ka.mipt.ru>
From: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Date: Sun, 5 Mar 2006 04:43:25 +0300
> According to investigation made for kevent based FS AIO reading,
> get_user_pages() performange graph looks like sqrt() function
> with plato starting on about 64-80 pages on Xeon 2.4Ghz with 1Gb of ram,
> while memcopy() is linear, so it can be noticebly slower than
> copy_to_user() if get_user_pages() is used aggressively, so userspace
> application must reuse the same, already grabbed buffer for maximum
> performance, but Intel folks did not provide theirs usage case and any
> benchmarks as far as I know.
Of course, and programming the DMA controller has overhead
as well. This is why would would not use I/O AT with small
transfer sizes.
^ permalink raw reply
* Re: [PATCH 4/8] [I/OAT] Utility functions for offloading sk_buff to iovec copies
From: Andrew Morton @ 2006-03-05 7:15 UTC (permalink / raw)
To: Chris Leech; +Cc: linux-kernel, netdev
In-Reply-To: <20060303214227.11908.75473.stgit@gitlost.site>
Chris Leech <christopher.leech@intel.com> wrote:
>
> +
> +#define NUM_PAGES_SPANNED(start, length) \
> + ((PAGE_ALIGN((unsigned long)start + length) - \
> + ((unsigned long)start & PAGE_MASK)) >> PAGE_SHIFT)
static inline all-lower-case functions are much nicer.
> +/*
> + * Lock down all the iovec pages needed for len bytes.
> + * Return a struct dma_locked_list to keep track of pages locked down.
> + *
> + * We are allocating a single chunk of memory, and then carving it up into
> + * 3 sections, the latter 2 whose size depends on the number of iovecs and the
> + * total number of pages, respectively.
> + */
> +int dma_lock_iovec_pages(struct iovec *iov, size_t len, struct dma_locked_list
> + **locked_list)
Please rename this to dma_pin_iovec_pages(). Locking a page is a quite
different concept from pinning it, and this function doesn't lock any
pages.
> +{
> + struct dma_locked_list *local_list;
> + struct page **pages;
> + int i;
> + int ret;
> +
> + int nr_iovecs = 0;
> + int iovec_len_used = 0;
> + int iovec_pages_used = 0;
Extraneous blank line there.
> + /* don't lock down non-user-based iovecs */
> + if (segment_eq(get_fs(), KERNEL_DS)) {
> + *locked_list = NULL;
> + return 0;
> + }
hm, haven't seen that before. Makes sense, I guess.
> + /* determine how many iovecs/pages there are, up front */
> + do {
> + iovec_len_used += iov[nr_iovecs].iov_len;
> + iovec_pages_used += NUM_PAGES_SPANNED(iov[nr_iovecs].iov_base,
> + iov[nr_iovecs].iov_len);
> + nr_iovecs++;
> + } while (iovec_len_used < len);
> +
> + /* single kmalloc for locked list, page_list[], and the page arrays */
> + local_list = kmalloc(sizeof(*local_list)
> + + (nr_iovecs * sizeof (struct dma_page_list))
> + + (iovec_pages_used * sizeof (struct page*)), GFP_KERNEL);
What is the upper bound on the size of this allocation?
> + if (!local_list)
> + return -ENOMEM;
> +
> + /* list of pages starts right after the page list array */
> + pages = (struct page **) &local_list->page_list[nr_iovecs];
> +
> + /* it's a userspace pointer */
> + might_sleep();
kmalloc(GFP_KERNEL) already did that.
> + for (i = 0; i < nr_iovecs; i++) {
> + struct dma_page_list *page_list = &local_list->page_list[i];
> +
> + len -= iov[i].iov_len;
> +
> + if (!access_ok(VERIFY_WRITE, iov[i].iov_base, iov[i].iov_len)) {
> + dma_unlock_iovec_pages(local_list);
> + return -EFAULT;
> + }
A return statement buried down in the guts of a largeish function isn't
good from a code maintainability POV.
> + page_list->nr_pages = NUM_PAGES_SPANNED(iov[i].iov_base,
> + iov[i].iov_len);
> + page_list->base_address = iov[i].iov_base;
> +
> + page_list->pages = pages;
> + pages += page_list->nr_pages;
> +
> + /* lock pages down */
> + down_read(¤t->mm->mmap_sem);
> + ret = get_user_pages(
> + current,
> + current->mm,
> + (unsigned long) iov[i].iov_base,
> + page_list->nr_pages,
> + 1,
> + 0,
> + page_list->pages,
> + NULL);
Yes, it has a lot of args. It's nice to add comments like this:
ret = get_user_pages(
current,
current->mm,
(unsigned long) iov[i].iov_base,
page_list->nr_pages,
1, /* write */
0, /* force */
page_list->pages,
NULL);
> + up_read(¤t->mm->mmap_sem);
> +
> + if (ret != page_list->nr_pages) {
> + goto mem_error;
> + }
Unneded braces.
> + local_list->nr_iovecs = i + 1;
> + }
> +
> + *locked_list = local_list;
> + return 0;
Suggest you change this function to return locked_list, or an IS_ERR value
on error.
> +void dma_unlock_iovec_pages(struct dma_locked_list *locked_list)
> +{
> + int i, j;
> +
> + if (!locked_list)
> + return;
> +
> + for (i = 0; i < locked_list->nr_iovecs; i++) {
> + struct dma_page_list *page_list = &locked_list->page_list[i];
> + for (j = 0; j < page_list->nr_pages; j++) {
> + SetPageDirty(page_list->pages[j]);
> + page_cache_release(page_list->pages[j]);
> + }
> + }
> +
> + kfree(locked_list);
> +}
SetPageDirty() is very wrong. It fails to mark pagecache pages as dirty in
the radix tree so they won't get written back.
You'll need to use set_page_dirty_lock() here or, if you happen to have
protected the inode which backs this potential mmap (really the
address_space) from reclaim then set_page_dirty() will work. Probably
it'll be set_page_dirty_lock().
If this is called from cant-sleep context then things get ugly. If it's
called from interrupt context then moreso. See fs/direct-io.c,
bio_set_pages_dirty(), bio_check_pages_dirty(), etc.
I don't see a check for "did we write to user pages" here. Because we
don't need to dirty the pages if we were reading them (transmitting from
userspace).
But given that dma_lock_iovec_pages() is only set up for writing to
userspace I guess this code is implicitly receive-only. It's hard to tell
when the description, is, like the code comments, so scant.
> +static dma_cookie_t dma_memcpy_tokerneliovec(struct dma_chan *chan, struct
> + iovec *iov, unsigned char *kdata, size_t len)
You owe us two underscores ;)
> +/*
> + * We have already locked down the pages we will be using in the iovecs.
"pinned"
> + * Each entry in iov array has corresponding entry in locked_list->page_list.
> + * Using array indexing to keep iov[] and page_list[] in sync.
> + * Initial elements in iov array's iov->iov_len will be 0 if already copied into
> + * by another call.
> + * iov array length remaining guaranteed to be bigger than len.
> + */
> +dma_cookie_t dma_memcpy_toiovec(struct dma_chan *chan, struct iovec *iov,
> + struct dma_locked_list *locked_list, unsigned char *kdata, size_t len)
> +{
> + int iov_byte_offset;
> + int copy;
> + dma_cookie_t dma_cookie = 0;
> + int iovec_idx;
> + int page_idx;
> +
> + if (!chan)
> + return memcpy_toiovec(iov, kdata, len);
> +
> + /* -> kernel copies (e.g. smbfs) */
> + if (!locked_list)
> + return dma_memcpy_tokerneliovec(chan, iov, kdata, len);
> +
> + iovec_idx = 0;
> + while (iovec_idx < locked_list->nr_iovecs) {
> + struct dma_page_list *page_list;
> +
> + /* skip already used-up iovecs */
> + while (!iov[iovec_idx].iov_len)
> + iovec_idx++;
Is it assured that this array was zero-terminated?
> +
> +dma_cookie_t dma_memcpy_pg_toiovec(struct dma_chan *chan, struct iovec *iov,
> + struct dma_locked_list *locked_list, struct page *page,
> + unsigned int offset, size_t len)
pleeeeeze comment your code.
> +{
> + int iov_byte_offset;
> + int copy;
> + dma_cookie_t dma_cookie = 0;
> + int iovec_idx;
> + int page_idx;
> + int err;
> +
> + /* this needs as-yet-unimplemented buf-to-buff, so punt. */
> + /* TODO: use dma for this */
> + if (!chan || !locked_list) {
Really you should rename locked_list to pinned_list throughout, and
dma_locked_list to dma_pinned_list.
> + iovec_idx = 0;
> + while (iovec_idx < locked_list->nr_iovecs) {
> + struct dma_page_list *page_list;
> +
> + /* skip already used-up iovecs */
> + while (!iov[iovec_idx].iov_len)
> + iovec_idx++;
Can this also run off the end?
> +int dma_lock_iovec_pages(struct iovec *iov, size_t len, struct dma_locked_list
> + **locked_list)
> +{
> + *locked_list = NULL;
> +
> + return 0;
> +}
> +
> +void dma_unlock_iovec_pages(struct dma_locked_list* locked_list)
> +{ }
You might want to make these guys static inlines in a header and not
compile this file at all if !CONFIG_DMA_ENGINE.
> +struct dma_page_list
> +{
struct dma_page_list {
> +struct dma_locked_list
> +{
struct dma_pinned_list {
> + int nr_iovecs;
> + struct dma_page_list page_list[0];
We can use [] instead of [0] now that gcc-2.95.x has gone away.
> +int dma_lock_iovec_pages(struct iovec *iov, size_t len,
> + struct dma_locked_list **locked_list);
> +void dma_unlock_iovec_pages(struct dma_locked_list* locked_list);
"pin", "unpin".
> +#ifdef CONFIG_NET_DMA
> +
> +/**
> + * dma_skb_copy_datagram_iovec - Copy a datagram to an iovec.
> + * @skb - buffer to copy
> + * @offset - offset in the buffer to start copying from
> + * @iovec - io vector to copy to
> + * @len - amount of data to copy from buffer to iovec
> + * @locked_list - locked iovec buffer data
> + *
> + * Note: the iovec is modified during the copy.
Modifying the caller's iovec is a bit rude. Hard to avoid, I guess.
> + */
> +int dma_skb_copy_datagram_iovec(struct dma_chan *chan,
> + struct sk_buff *skb, int offset, struct iovec *to,
> + size_t len, struct dma_locked_list *locked_list)
> +{
> + int start = skb_headlen(skb);
> + int i, copy = start - offset;
> + dma_cookie_t cookie = 0;
> +
> + /* Copy header. */
> + if (copy > 0) {
> + if (copy > len)
> + copy = len;
> + if ((cookie = dma_memcpy_toiovec(chan, to, locked_list,
> + skb->data + offset, copy)) < 0)
> + goto fault;
> + if ((len -= copy) == 0)
> + goto end;
Please avoid
if ((lhs = rhs))
constructs. Instead do
lhs = rhs;
if (lhs)
(entire patchset - there are quite a lot)
> + offset += copy;
> + }
> +
> + /* Copy paged appendix. Hmm... why does this look so complicated? */
> + for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
> + int end;
> +
> + BUG_TRAP(start <= offset + len);
<wonders why BUG_TRAP still exists>
> + if ((copy = end - offset) > 0) {
> ...
> + if (!(len -= copy))
> ...
> + if ((copy = end - offset) > 0) {
> ...
> + if ((len -= copy) == 0)
>
See above.
> +#else
> +
> +int dma_skb_copy_datagram_iovec(struct dma_chan *chan,
> + const struct sk_buff *skb, int offset, struct iovec *to,
> + size_t len, struct dma_locked_list *locked_list)
> +{
> + return skb_copy_datagram_iovec(skb, offset, to, len);
> +}
> +
> +#endif
Again, consider putting this in a header as an inline, avoid compiling this
file altogether.
^ permalink raw reply
* Re: [PATCH 5/8] [I/OAT] Structure changes for TCP recv offload to I/OAT
From: Andrew Morton @ 2006-03-05 7:19 UTC (permalink / raw)
To: Chris Leech; +Cc: linux-kernel, netdev
In-Reply-To: <20060303214229.11908.19898.stgit@gitlost.site>
Chris Leech <christopher.leech@intel.com> wrote:
>
> +#ifdef CONFIG_NET_DMA
> +#include <linux/dmaengine.h>
> +#endif
Please move the ifdefs into the header and include it unconditionally
(entire patchset).
^ permalink raw reply
* Re: [PATCH 7/8] [I/OAT] Add a sysctl for tuning the I/OAT offloaded I/O threshold
From: Andrew Morton @ 2006-03-05 7:21 UTC (permalink / raw)
To: Chris Leech; +Cc: linux-kernel, netdev
In-Reply-To: <20060303214234.11908.99495.stgit@gitlost.site>
Chris Leech <christopher.leech@intel.com> wrote:
>
> Any socket recv of less than this ammount will not be offloaded
>
> ...
>
> +int sysctl_tcp_dma_copybreak = NET_DMA_DEFAULT_COPYBREAK;
Is it appropriate that this tunable be kernel-wide, rather than more
finely-grained?
^ permalink raw reply
* Re: [PATCH 8/8] [I/OAT] TCP recv offload to I/OAT
From: Andrew Morton @ 2006-03-05 7:30 UTC (permalink / raw)
To: Chris Leech; +Cc: linux-kernel, netdev
In-Reply-To: <20060303214236.11908.98881.stgit@gitlost.site>
Chris Leech <christopher.leech@intel.com> wrote:
>
> Locks down user pages and sets up for DMA in tcp_recvmsg, then calls
> dma_async_try_early_copy in tcp_v4_do_rcv
>
+#ifdef CONFIG_NET_DMA
+#ifdef CONFIG_NET_DMA
+#ifdef CONFIG_NET_DMA
+#ifdef CONFIG_NET_DMA
+#ifdef CONFIG_NET_DMA
+#ifdef CONFIG_NET_DMA
+#ifdef CONFIG_NET_DMA
+#ifdef CONFIG_NET_DMA
+#ifdef CONFIG_NET_DMA
+#ifdef CONFIG_NET_DMA
+#ifdef CONFIG_NET_DMA
+#ifdef CONFIG_NET_DMA
+#ifdef CONFIG_NET_DMA
+#ifdef CONFIG_NET_DMA
+#ifdef CONFIG_NET_DMA
+#ifdef CONFIG_NET_DMA
waaay too many ifdefs. There are various tricks we use to minimise them.
> +#ifdef CONFIG_NET_DMA
> + tp->ucopy.dma_chan = NULL;
> + if ((len > sysctl_tcp_dma_copybreak) && !(flags & MSG_PEEK) && !sysctl_tcp_low_latency && __get_cpu_var(softnet_data.net_dma))
> + dma_lock_iovec_pages(msg->msg_iov, len, &tp->ucopy.locked_list);
> +#endif
Please try to fit code into 80 columns.
That's decimal 80 ;)
> @@ -1328,13 +1342,39 @@ do_prequeue:
> }
>
> if (!(flags & MSG_TRUNC)) {
> - err = skb_copy_datagram_iovec(skb, offset,
> - msg->msg_iov, used);
> - if (err) {
> - /* Exception. Bailout! */
> - if (!copied)
> - copied = -EFAULT;
> - break;
> +#ifdef CONFIG_NET_DMA
> + if (!tp->ucopy.dma_chan && tp->ucopy.locked_list)
> + tp->ucopy.dma_chan = get_softnet_dma();
> +
> + if (tp->ucopy.dma_chan) {
> + tp->ucopy.dma_cookie = dma_skb_copy_datagram_iovec(
> + tp->ucopy.dma_chan, skb, offset,
> + msg->msg_iov, used,
> + tp->ucopy.locked_list);
> +
> + if (tp->ucopy.dma_cookie < 0) {
> +
> + printk(KERN_ALERT "dma_cookie < 0\n");
> +
> + /* Exception. Bailout! */
> + if (!copied)
> + copied = -EFAULT;
> + break;
> + }
> + if ((offset + used) == skb->len)
> + copied_early = 1;
> +
Consider trimming some of those blank lines. I don't think they add any
value?
> + } else
> +#endif
> + {
These games with ifdefs and else statements aren't at all pleasant.
Sometimes they're hard to avoid, but you'll probably find that some code
rearrangemnt (in a preceding patch) makes it easier. Like, split this
function into several.
> @@ -1354,15 +1394,33 @@ skip_copy:
>
> if (skb->h.th->fin)
> goto found_fin_ok;
> - if (!(flags & MSG_PEEK))
> - sk_eat_skb(sk, skb);
> + if (!(flags & MSG_PEEK)) {
> + if (!copied_early)
> + sk_eat_skb(sk, skb);
> +#ifdef CONFIG_NET_DMA
> + else {
> + __skb_unlink(skb, &sk->sk_receive_queue);
> + __skb_queue_tail(&sk->sk_async_wait_queue, skb);
> + copied_early = 0;
> + }
> +#endif
> ...
> - sk_eat_skb(sk, skb);
> + if (!(flags & MSG_PEEK)) {
> + if (!copied_early)
> + sk_eat_skb(sk, skb);
> +#ifdef CONFIG_NET_DMA
> + else {
> + __skb_unlink(skb, &sk->sk_receive_queue);
> + __skb_queue_tail(&sk->sk_async_wait_queue, skb);
> + copied_early = 0;
> + }
> +#endif
> + }
etc.
> +#ifdef CONFIG_NET_DMA
> + if (copied_early)
> + __skb_queue_tail(&sk->sk_async_wait_queue, skb);
> + else
> +#endif
> if (eaten)
> __kfree_skb(skb);
> else
etc.
> @@ -4049,6 +4067,52 @@ discard:
> return 0;
> }
>
> +#ifdef CONFIG_NET_DMA
> +int dma_async_try_early_copy(struct sock *sk, struct sk_buff *skb, int hlen)
> +{
> + struct tcp_sock *tp = tcp_sk(sk);
> + int chunk = skb->len - hlen;
> + int dma_cookie;
> + int copied_early = 0;
> +
> + if (tp->ucopy.wakeup)
> + goto out;
In this case a simple
return 0;
would be fine. We haven't done anything yet.
> +#ifdef CONFIG_NET_DMA
> + struct tcp_sock *tp = tcp_sk(sk);
> + if (!tp->ucopy.dma_chan && tp->ucopy.locked_list)
> + tp->ucopy.dma_chan = get_softnet_dma();
> + if (tp->ucopy.dma_chan)
> + ret = tcp_v4_do_rcv(sk, skb);
> + else
> +#endif
> + {
> + if (!tcp_prequeue(sk, skb))
> ret = tcp_v4_do_rcv(sk, skb);
> + }
> } else
etc.
> +#ifdef CONFIG_NET_DMA
> + struct tcp_sock *tp = tcp_sk(sk);
> + if (tp->ucopy.dma_chan)
> + ret = tcp_v6_do_rcv(sk, skb);
> + else
> +#endif
> + {
> + if (!tcp_prequeue(sk, skb))
> + ret = tcp_v6_do_rcv(sk, skb);
> + }
> } else
ow, my eyes!
^ permalink raw reply
* Re: [PATCH 0/8] Intel I/O Acceleration Technology (I/OAT)
From: Andrew Morton @ 2006-03-05 8:09 UTC (permalink / raw)
To: chris.leech; +Cc: christopher.leech, jeff, linux-kernel, netdev
In-Reply-To: <41b516cb0603031439n13e4df4cg8e5b21b606d2b4b8@mail.gmail.com>
"Chris Leech" <christopher.leech@intel.com> wrote:
>
> > Patch #2 didn't make it. Too big for the list?
>
> Could be, it's the largest of the series. I've attached the gziped
> patch. I can try and split this up for the future.
>
> ..
>
> [I/OAT] Driver for the Intel(R) I/OAT DMA engine
> Adds a new ioatdma driver
>
> ...
> +struct cb_pci_pmcap_register {
> + uint32_t capid:8; /* RO: 01h */
> + uint32_t nxtcapptr:8;
> + uint32_t version:3; /* RO: 010b */
> + uint32_t pmeclk:1; /* RO: 0b */
> + uint32_t reserved:1; /* RV: 0b */
> + uint32_t dsi:1; /* RO: 0b */
> + uint32_t aux_current:3; /* RO: 000b */
> + uint32_t d1_support:1; /* RO: 0b */
> + uint32_t d2_support:1; /* RO: 0b */
> + uint32_t pme_support:5; /* RO: 11001b */
> +};
This maps onto hardware registers? No big-endian plans in Intel's future? ;)
I have a vague feeling that gcc changed its layout of bitfields many years
ago. I guess we're fairly safe against that. Presumably gcc and icc use the
same layout?
Still. It's a bit of a concern, but I guess we can worry about that if it
happens.
> +
> +static inline u8 read_reg8(struct cb_device *device, unsigned int offset)
> +{
> + return readb(device->reg_base + offset);
> +}
These are fairly generic-sounding names. In fact the as-yet-unmerged tiacx
wireless driver is already using these, privately to
drivers/net/wireless/tiacx/pci.c.
> +static int enumerate_dma_channels(struct cb_device *device)
> +{
> + u8 xfercap_scale;
> + u32 xfercap;
> + int i;
> + struct cb_dma_chan *cb_chan;
> +
> + device->common.chancnt = read_reg8(device, CB_CHANCNT_OFFSET);
> + xfercap_scale = read_reg8(device, CB_XFERCAP_OFFSET);
> + xfercap = (xfercap_scale == 0 ? ~0UL : (1 << xfercap_scale));
I recommend using just "-1" to represent the all-ones pattern. It simply
works, in all situations.
Where you _did_ want the UL was after that "1".
> + for (i = 0; i < device->common.chancnt; i++) {
> + cb_chan = kzalloc(sizeof(*cb_chan), GFP_KERNEL);
> + if (!cb_chan)
> + return -ENOMEM;
memory leak?
> + cb_chan->device = device;
> + cb_chan->reg_base = device->reg_base + (0x80 * (i + 1));
> + cb_chan->xfercap = xfercap;
> + spin_lock_init(&cb_chan->cleanup_lock);
> + spin_lock_init(&cb_chan->desc_lock);
> + INIT_LIST_HEAD(&cb_chan->free_desc);
> + INIT_LIST_HEAD(&cb_chan->used_desc);
> + /* This should be made common somewhere in dmaengine.c */
> + cb_chan->common.device = &device->common;
> + cb_chan->common.client = NULL;
> + list_add_tail(&cb_chan->common.device_node, &device->common.channels);
No locking needed for that list?
> +static struct cb_desc_sw * cb_dma_alloc_descriptor(struct cb_dma_chan *cb_chan)
There's a mix of styles here. I don't think the space after the asterisk does
anything useful, and it could be argued that it's incorrect (or misleading)
wrt C declaration semantics.
> +{
> + struct cb_dma_descriptor *desc;
What do all these "cb"'s stand for, anyway?
> + struct cb_desc_sw *desc_sw;
> + struct cb_device *cb_device = to_cb_device(cb_chan->common.device);
> + dma_addr_t phys;
> +
> + desc = pci_pool_alloc(cb_device->dma_pool, GFP_ATOMIC, &phys);
> + if (!desc)
> + return NULL;
> +
> + desc_sw = kzalloc(sizeof(*desc_sw), GFP_ATOMIC);
GFP_ATOMIC is to be avoided if at all possible. It stresses the memory system
and can easily fail under load.
>From my reading, two of the callers could trivially call this function outside
spin_lock_bh() and the third could perhaps do so with a little work. You
could at least fix up two of those callers, and pass in the gfp_flags.
<wonders why the heck dma_pool_alloc() uses SLAB_ATOMIC when the caller's
passing in the gfp_flags>
> +/* returns the actual number of allocated descriptors */
> +static int cb_dma_alloc_chan_resources(struct dma_chan *chan)
> +{
> ...
> + /* Allocate descriptors */
> + spin_lock_bh(&cb_chan->desc_lock);
> + for (i = 0; i < INITIAL_CB_DESC_COUNT; i++) {
> + desc = cb_dma_alloc_descriptor(cb_chan);
> + if (!desc) {
> + printk(KERN_ERR "CB: Only %d initial descriptors\n", i);
> + break;
> + }
> + list_add_tail(&desc->node, &cb_chan->free_desc);
> + }
> + spin_unlock_bh(&cb_chan->desc_lock);
Here's one such caller.
> +
> +static void cb_dma_free_chan_resources(struct dma_chan *chan)
> +{
> + struct cb_dma_chan *cb_chan = to_cb_chan(chan);
> + struct cb_device *cb_device = to_cb_device(chan->device);
> + struct cb_desc_sw *desc, *_desc;
> + u16 chanctrl;
> + int in_use_descs = 0;
> +
> + cb_dma_memcpy_cleanup(cb_chan);
> +
> + chan_write_reg8(cb_chan, CB_CHANCMD_OFFSET, CB_CHANCMD_RESET);
> +
> + spin_lock_bh(&cb_chan->desc_lock);
> + list_for_each_entry_safe(desc, _desc, &cb_chan->used_desc, node) {
> + in_use_descs++;
> + list_del(&desc->node);
> + pci_pool_free(cb_device->dma_pool, desc->hw, desc->phys);
> + kfree(desc);
> + }
> + list_for_each_entry_safe(desc, _desc, &cb_chan->free_desc, node) {
> + list_del(&desc->node);
> + pci_pool_free(cb_device->dma_pool, desc->hw, desc->phys);
> + kfree(desc);
> + }
> + spin_unlock_bh(&cb_chan->desc_lock);
Do we actually need the lock there? If we're freeing everything which it
protects anwyay?
> +
> +static void cb_dma_memcpy_cleanup(struct cb_dma_chan *chan)
> +{
> + unsigned long phys_complete;
> + struct cb_desc_sw *desc, *_desc;
> + dma_cookie_t cookie = 0;
> +
> + prefetch(chan->completion_virt);
> +
> + if (!spin_trylock(&chan->cleanup_lock))
> + return;
What's going on here? Lock ranking problems? spin_trylock() in
non-infrastructural code is a bit of a red flag.
Whatever the reason, it needs a comment in there please. That comment should
also explain why simply baling out is acceptable.
> +
> +static irqreturn_t cb_do_interrupt(int irq, void *data, struct pt_regs *regs)
> +{
> + struct cb_device *instance = data;
> + unsigned long attnstatus;
> + u8 intrctrl;
> +
> + intrctrl = read_reg8(instance, CB_INTRCTRL_OFFSET);
> +
> + if (!(intrctrl & CB_INTRCTRL_MASTER_INT_EN)) {
> + return IRQ_NONE;
> + }
braces.
> + attnstatus = (unsigned long) read_reg32(instance, CB_ATTNSTATUS_OFFSET);
Unneeded cast.
> +static void cb_start_null_desc(struct cb_dma_chan *cb_chan)
> +{
> + struct cb_desc_sw *desc;
> +
> + spin_lock_bh(&cb_chan->desc_lock);
> +
> + if (!list_empty(&cb_chan->free_desc)) {
> + desc = to_cb_desc(cb_chan->free_desc.next);
> + list_del(&desc->node);
> + } else {
> + /* try to get another desc */
> + desc = cb_dma_alloc_descriptor(cb_chan);
> + /* will this ever happen? */
> + BUG_ON(!desc);
> + }
> +
> + desc->hw->ctl = CB_DMA_DESCRIPTOR_NUL;
> + desc->hw->next = 0;
> +
> + list_add_tail(&desc->node, &cb_chan->used_desc);
> +
> +#if (BITS_PER_LONG == 64)
> + chan_write_reg64(cb_chan, CB_CHAINADDR_OFFSET, desc->phys);
> +#else
> + chan_write_reg32(cb_chan, CB_CHAINADDR_OFFSET_LOW, (u32) desc->phys);
> + chan_write_reg32(cb_chan, CB_CHAINADDR_OFFSET_HIGH, 0);
> +#endif
> + chan_write_reg8(cb_chan, CB_CHANCMD_OFFSET, CB_CHANCMD_START);
> +
> + spin_unlock_bh(&cb_chan->desc_lock);
> +}
Can the chan_write*() calls be moved outside the locked region?
> +/*
> + * Perform a CB transaction to verify the HW works.
> + */
Damn, I wish I knew what CB meant.
> +#define CB_TEST_SIZE 2000
> +
> +static int cb_self_test(struct cb_device *device)
> +{
> + int i;
> + u8 *src;
> + u8 *dest;
> + struct dma_chan *dma_chan;
> + dma_cookie_t cookie;
> + int err = 0;
> +
> + src = kzalloc(sizeof(u8) * CB_TEST_SIZE, SLAB_KERNEL);
> + if (!src)
> + return -ENOMEM;
> + dest = kzalloc(sizeof(u8) * CB_TEST_SIZE, SLAB_KERNEL);
> + if (!dest) {
> + kfree(src);
> + return -ENOMEM;
> + }
> +
> + /* Fill in src buffer */
> + for (i = 0; i < CB_TEST_SIZE; i++)
> + src[i] = (u8)i;
memset?
> + /* Start copy, using first DMA channel */
> + dma_chan = container_of(device->common.channels.next, struct dma_chan, device_node);
> +
> + cb_dma_alloc_chan_resources(dma_chan);
cb_dma_alloc_chan_resources() can fail.
> + cookie = cb_dma_memcpy_buf_to_buf(dma_chan, dest, src, CB_TEST_SIZE);
> + cb_dma_memcpy_issue_pending(dma_chan);
> +
> + udelay(1000);
msleep(1) would be preferred.
> +static int __devinit cb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> +{
> + int err;
> + unsigned long mmio_start, mmio_len;
> + void *reg_base;
> + struct cb_device *device;
> +
> + err = pci_enable_device(pdev);
> + if (err)
> + goto err_enable_device;
> +
> + err = pci_set_dma_mask(pdev, DMA_64BIT_MASK);
> + if (err)
> + err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
> + if (err)
> + goto err_set_dma_mask;
> +
> + err = pci_request_regions(pdev, cb_pci_drv.name);
> + if (err)
> + goto err_request_regions;
> +
> + mmio_start = pci_resource_start(pdev, 0);
> + mmio_len = pci_resource_len(pdev, 0);
> +
> + reg_base = ioremap(mmio_start, mmio_len);
> + if (!reg_base) {
> + err = -ENOMEM;
> + goto err_ioremap;
> + }
> +
> + device = kzalloc(sizeof(*device), GFP_KERNEL);
> + if (!device) {
> + err = -ENOMEM;
> + goto err_kzalloc;
> + }
> +
> + /* DMA coherent memory pool for DMA descriptor allocations */
> + device->dma_pool = pci_pool_create("dma_desc_pool", pdev,
> + sizeof(struct cb_dma_descriptor), 64, 0);
> + if (!device->dma_pool) {
> + err = -ENOMEM;
> + goto err_dma_pool;
> + }
> +
> + device->completion_pool = pci_pool_create("completion_pool", pdev, sizeof(u64), SMP_CACHE_BYTES, SMP_CACHE_BYTES);
> + if (!device->completion_pool) {
> + err = -ENOMEM;
> + goto err_completion_pool;
> + }
> +
> + device->pdev = pdev;
> + pci_set_drvdata(pdev, device);
> +#ifdef CONFIG_PCI_MSI
> + if (pci_enable_msi(pdev) == 0) {
> + device->msi = 1;
> + } else {
> + device->msi = 0;
> + }
> +#endif
> + err = request_irq(pdev->irq, &cb_do_interrupt, SA_SHIRQ, "ioat",
> + device);
> + if (err)
> + goto err_irq;
> +
> + device->reg_base = reg_base;
> +
> + write_reg8(device, CB_INTRCTRL_OFFSET, CB_INTRCTRL_MASTER_INT_EN);
> + pci_set_master(pdev);
> +
> + INIT_LIST_HEAD(&device->common.channels);
> + enumerate_dma_channels(device);
enumerate_dma_channels() can fail.
> + device->common.device_alloc_chan_resources = cb_dma_alloc_chan_resources;
> + device->common.device_free_chan_resources = cb_dma_free_chan_resources;
> + device->common.device_memcpy_buf_to_buf = cb_dma_memcpy_buf_to_buf;
> + device->common.device_memcpy_buf_to_pg = cb_dma_memcpy_buf_to_pg;
> + device->common.device_memcpy_pg_to_pg = cb_dma_memcpy_pg_to_pg;
> + device->common.device_memcpy_complete = cb_dma_is_complete;
> + device->common.device_memcpy_issue_pending = cb_dma_memcpy_issue_pending;
> + printk(KERN_INFO "Intel(R) I/OAT DMA Engine found, %d channels\n",
> + device->common.chancnt);
> +
> + if ((err = cb_self_test(device)))
> + goto err_self_test;
> +
> + dma_async_device_register(&device->common);
> +
> + return 0;
> +
> +err_self_test:
> +err_irq:
> + pci_pool_destroy(device->completion_pool);
> +err_completion_pool:
> + pci_pool_destroy(device->dma_pool);
> +err_dma_pool:
> + kfree(device);
> +err_kzalloc:
> + iounmap(reg_base);
> +err_ioremap:
> + pci_release_regions(pdev);
> +err_request_regions:
> +err_set_dma_mask:
You might want a pci_disable_device() in here.
> +err_enable_device:
> + return err;
> +}
> +
> +static void __devexit cb_remove(struct pci_dev *pdev)
> +{
> + struct cb_device *device;
> +
> + device = pci_get_drvdata(pdev);
> + dma_async_device_unregister(&device->common);
pci_disable_device()?
> + free_irq(device->pdev->irq, device);
> +#ifdef CONFIG_PCI_MSI
> + if (device->msi)
> + pci_disable_msi(device->pdev);
> +#endif
> + pci_pool_destroy(device->dma_pool);
> + pci_pool_destroy(device->completion_pool);
> + iounmap(device->reg_base);
> + pci_release_regions(pdev);
> + kfree(device);
> +}
> +
> +/* MODULE API */
> +MODULE_VERSION("1.0");
> +MODULE_LICENSE("GPL");
> +MODULE_AUTHOR("Intel Corporation");
> +
> +static int __init cb_init_module(void)
> +{
> + /* it's currently unsafe to unload this module */
> + /* if forced, worst case is that rmmod hangs */
How come?
> + if (THIS_MODULE != NULL)
> + THIS_MODULE->unsafe = 1;
> +
> + return pci_module_init(&cb_pci_drv);
> +}
> +
> +#define CB_LOW_COMPLETION_MASK 0xffffffc0
> +
> +extern struct list_head dma_device_list;
> +extern struct list_head dma_client_list;
It's strange to see extern decls for lists, but no decl for their lock. A
comment might help.
> +struct cb_dma_chan {
> +
> + void *reg_base;
> +
> + dma_cookie_t completed_cookie;
> + unsigned long last_completion;
> +
> + u32 xfercap; /* XFERCAP register value expanded out */
> +
> + spinlock_t cleanup_lock;
> + spinlock_t desc_lock;
> + struct list_head free_desc;
> + struct list_head used_desc;
> +
> + int pending;
> +
> + struct cb_device *device;
> + struct dma_chan common;
> +
> + dma_addr_t completion_addr;
> + union {
> + u64 full; /* HW completion writeback */
> + struct {
> + u32 low;
> + u32 high;
> + };
> + } *completion_virt;
> +};
Again, is it safe to assume that these parts will never be present in
big-endian machines?
^ permalink raw reply
* Re: [PATCH 8/8] [I/OAT] TCP recv offload to I/OAT
From: Andrew Morton @ 2006-03-05 8:45 UTC (permalink / raw)
To: Chris Leech; +Cc: linux-kernel, netdev
In-Reply-To: <20060303214236.11908.98881.stgit@gitlost.site>
Chris Leech <christopher.leech@intel.com> wrote:
>
> +#ifdef CONFIG_NET_DMA
> + tp->ucopy.dma_chan = NULL;
> + if ((len > sysctl_tcp_dma_copybreak) && !(flags & MSG_PEEK) && !sysctl_tcp_low_latency && __get_cpu_var(softnet_data.net_dma))
> + dma_lock_iovec_pages(msg->msg_iov, len, &tp->ucopy.locked_list);
> +#endif
The __get_cpu_var() here will run smp_processor_id() from preemptible
context. You'll get a big warning if the correct debug options are set.
The reason for this is that preemption could cause this code to hop between
CPUs.
Please always test code with all debug options enabled and with full kernel
preemption.
^ permalink raw reply
* Discourage duplicate symbols in the kernel? [Was: Intel I/O Acc...]
From: Sam Ravnborg @ 2006-03-05 9:02 UTC (permalink / raw)
To: Andrew Morton; +Cc: chris.leech, christopher.leech, jeff, linux-kernel, netdev
In-Reply-To: <20060305000933.2d799138.akpm@osdl.org>
On Sun, Mar 05, 2006 at 12:09:33AM -0800, Andrew Morton wrote:
> > +
> > +static inline u8 read_reg8(struct cb_device *device, unsigned int offset)
> > +{
> > + return readb(device->reg_base + offset);
> > +}
>
> These are fairly generic-sounding names. In fact the as-yet-unmerged tiacx
> wireless driver is already using these, privately to
> drivers/net/wireless/tiacx/pci.c.
Do we in general discourage duplicate symbols even if they are static?
[ppc64, allmodconfig]
$> nm vmlinux | fgrep ' t ' | awk '{print $3}' | sort | uniq -dc
2 .add_bridge
2 .base_probe
2 .c_next
2 .c_start
2 .c_stop
3 .cpu_callback
2 .default_open
2 .default_read_file
2 .default_write_file
2 .dev_ifsioc
2 .do_open
4 .dst_output
2 .dump_seek
2 .dump_write
2 .elf_core_dump
2 .elf_map
2 .exact_lock
2 .exact_match
2 .exit_elf_binfmt
2 .fill_note
2 .fill_prstatus
2 .fillonedir
2 .fini
2 .fixup_one_level_bus_range
5 .init
8 .init_once
3 .iommu_bus_setup_null
3 .iommu_dev_setup_null
2 .klist_devices_get
2 .klist_devices_put
2 .load_elf_binary
2 .load_elf_interp
2 .load_elf_library
3 .m_next
3 .m_start
3 .m_stop
2 .maydump
3 .modalias_show
2 .next_device
3 .notesize
2 .padzero
2 .raw_ioctl
2 .s_next
2 .s_show
2 .s_start
2 .s_stop
2 .seq_next
2 .seq_show
2 .seq_start
2 .seq_stop
2 .set_brk
2 .setkey
2 .state_show
2 .state_store
2 .store_uevent
2 .u3_ht_cfg_access
2 .u3_ht_read_config
2 .u3_ht_write_config
2 .writenote
3 __initcall_init
2 __setup_netdev_boot_setup
2 __setup_str_netdev_boot_setup
If I did a make allyesconfig the result looks much more scary.
Sam
^ permalink raw reply
* Re: Discourage duplicate symbols in the kernel? [Was: Intel I/O Acc...]
From: Andrew Morton @ 2006-03-05 9:18 UTC (permalink / raw)
To: Sam Ravnborg; +Cc: chris.leech, christopher.leech, jeff, linux-kernel, netdev
In-Reply-To: <20060305090251.GA9116@mars.ravnborg.org>
Sam Ravnborg <sam@ravnborg.org> wrote:
>
> On Sun, Mar 05, 2006 at 12:09:33AM -0800, Andrew Morton wrote:
> > > +
> > > +static inline u8 read_reg8(struct cb_device *device, unsigned int offset)
> > > +{
> > > + return readb(device->reg_base + offset);
> > > +}
> >
> > These are fairly generic-sounding names. In fact the as-yet-unmerged tiacx
> > wireless driver is already using these, privately to
> > drivers/net/wireless/tiacx/pci.c.
>
> Do we in general discourage duplicate symbols even if they are static?
Well, it's a bit irritating that it confuses ctags. But in this case, one
set is in a header file so the risk of collisions is much-increased.
^ permalink raw reply
* Re: [PATCH 8/8] [I/OAT] TCP recv offload to I/OAT
From: David S. Miller @ 2006-03-05 10:27 UTC (permalink / raw)
To: akpm; +Cc: christopher.leech, linux-kernel, netdev
In-Reply-To: <20060305004534.1d94b3cf.akpm@osdl.org>
From: Andrew Morton <akpm@osdl.org>
Date: Sun, 5 Mar 2006 00:45:34 -0800
> The __get_cpu_var() here will run smp_processor_id() from preemptible
> context. You'll get a big warning if the correct debug options are set.
>
> The reason for this is that preemption could cause this code to hop between
> CPUs.
>
> Please always test code with all debug options enabled and with full kernel
> preemption.
To be fair that warning doesn't trigger on some platforms, such as
sparc64 where the __get_cpu_var() implementation simply takes the
value from a fixed cpu register and doesn't do the debugging check.
Sparc64 should add the check when debugging options are enabled, for
sure, but the point is that it may not entirely be the tester's fault.
:-)
^ 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