* Re: [PATCH 1/2] ipvs: ip_vs_ftp depends on nf_conntrack_ftp helper
From: Julian Anastasov @ 2012-07-12 19:43 UTC (permalink / raw)
To: Pablo Neira Ayuso
Cc: Simon Horman, lvs-devel, netdev, netfilter-devel, Wensong Zhang,
Hans Schillstrom, Jesper Dangaard Brouer
In-Reply-To: <20120712153937.GB18793@1984>
Hello,
On Thu, 12 Jul 2012, Pablo Neira Ayuso wrote:
> On Wed, Jul 11, 2012 at 09:25:26AM +0900, Simon Horman wrote:
> > From: Julian Anastasov <ja@ssi.bg>
> >
> > The FTP application indirectly depends on the
> > nf_conntrack_ftp helper for proper NAT support. If the
> > module is not loaded, IPVS can resize the packets for the
> > command connection, eg. PASV response but the SEQ adjustment
> > logic in ipv4_confirm is not called without helper.
> >
> > Signed-off-by: Julian Anastasov <ja@ssi.bg>
> > Signed-off-by: Simon Horman <horms@verge.net.au>
> > ---
> > net/netfilter/ipvs/Kconfig | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/net/netfilter/ipvs/Kconfig b/net/netfilter/ipvs/Kconfig
> > index f987138..8b2cffd 100644
> > --- a/net/netfilter/ipvs/Kconfig
> > +++ b/net/netfilter/ipvs/Kconfig
> > @@ -250,7 +250,8 @@ comment 'IPVS application helper'
> >
> > config IP_VS_FTP
> > tristate "FTP protocol helper"
> > - depends on IP_VS_PROTO_TCP && NF_CONNTRACK && NF_NAT
> > + depends on IP_VS_PROTO_TCP && NF_CONNTRACK && NF_NAT && \
> > + NF_CONNTRACK_FTP
>
> If you require FTP NAT support, then this depends on NF_NAT_FTP
> instead of NF_CONNTRACK_FTP.
No, I just checked again, it works without nf_nat_ftp,
only nf_nat, nf_conntrack_ftp and iptable_nat are needed.
We use packet mangling part from nf_nat (nf_nat_mangle_tcp_packet).
Regards
--
Julian Anastasov <ja@ssi.bg>
^ permalink raw reply
* Re: [RFC PATCH 0/2] Coalesce MMIO writes for transmits
From: Alexander Duyck @ 2012-07-12 19:01 UTC (permalink / raw)
To: Stephen Hemminger
Cc: netdev, davem, jeffrey.t.kirsher, edumazet, bhutchings, therbert,
alexander.duyck
In-Reply-To: <20120712102331.42a7b041@nehalam.linuxnetplumber.net>
On 07/12/2012 10:23 AM, Stephen Hemminger wrote:
> On Wed, 11 Jul 2012 17:25:58 -0700
> Alexander Duyck <alexander.h.duyck@intel.com> wrote:
>
>> This patch set is meant to address recent issues I found with ixgbe
>> performance being bound by Tx tail writes. With these changes in place
>> and the dispatch_limit set to 1 or more I see a significant increase in
>> performance.
>>
>> In the case of one of my systems I saw the routing rate for 7 queues jump
>> from 10.5 to 11.7Mpps. The overall increase I have seen on most systems is
>> something on the order of about 15%. In the case of pktgen I have also
>> seen a noticeable increase as the previous limit for transmits was
>> ~12.5Mpps, but with this patch set in place and the dispatch_limit enabled
>> the value increases to ~14.2Mpps.
>>
>> I expected there to be an increase in latency, however so far I have not
>> ran into that. I have tried running NPtcp tests for latency and seen no
>> difference in the coalesced and non-coalesced transaction times. I welcome
>> any suggestions for tests I might run that might expose any latency issues
>> as a result of this patch.
>>
>> ---
>>
>> Alexander Duyck (2):
>> ixgbe: Add functionality for delaying the MMIO write for Tx
>> net: Add new network device function to allow for MMIO batching
>>
>>
>> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 22 +++++++-
>> include/linux/netdevice.h | 57 +++++++++++++++++++++
>> net/core/dev.c | 67 +++++++++++++++++++++++++
>> net/core/net-sysfs.c | 36 +++++++++++++
>> 4 files changed, 180 insertions(+), 2 deletions(-)
>>
> This is a good idea. I was thinking of adding a multi-skb operation
> to netdevice_ops to allow this. Something like ndo_start_xmit_pkts but
> the problem is how to deal with the boundary case where there is only
> a limited number of slots in the ring. Using a "that's all folks"
> operation seems better.
I had considered a multi-skb operation originally, but the problem was
in my case I would have had to come up with a more complex buffering
mechanism to generate a stream of skbs before handing them off to the
device. By letting the transmit path proceed normally I shouldn't have
any effect on things like the byte queue limits for the transmit queues
and such.
The wierd bit is how this issue was showing up. I don't know if you
recall my presentation from plumbers last year, but one of the things I
had brought up was the qdisc spinlock being an issue. However it was
actually this MMIO write that was causing the problem because it was
posting a write to non-coherent memory and then the spinlock was getting
stalled behind the write and couldn't complete until the write was
completed. With this change in place and the dispatch_limit set to
something like 31 I see the CPU utilization for spinlocks drop from 15%
(90% sch_direct_xmit / 10% dev_queue_xmit) to 5% (66% sch_direct_xmit /
33% dev_queue_xmit). Makes me wonder what other hotspots we have in the
drivers that can be resolved by avoiding MMIO followed by locked
operations.
Thanks,
Alex
^ permalink raw reply
* pull request: wireless-next 2012-07-12
From: John W. Linville @ 2012-07-12 18:15 UTC (permalink / raw)
To: davem; +Cc: linux-wireless, netdev
[-- Attachment #1: Type: text/plain, Size: 27801 bytes --]
commit 38a00840638b4932152bca48098dbfa069d942a2
Dave,
Here is another batch of updates intended for 3.6.
Several drivers see updates: mwifiex, ath9k, iwlwifi, brcmsmac,
wlcore/wl12xx/wl18xx, and a handful of others. The bcma bus got a
lot of attention from Hauke Mehrtens. The cfg80211 component gets
a flurry of patches for multi-channel support, and the mac80211
component gets the first few VHT (11ac) and 60GHz (11ad) patches.
This also includes the removal of the iwmc3200 drivers, since the
hardware never became available to normal people.
Additionally, the NFC subsystem gets a series of updates. According to
Samuel, "Here are the interesting bits:
- A better error management for the HCI stack.
- An LLCP "late" binding implementation for a better NFC SAP usage. SAPs are
now reserved only when there's a client for it.
- Support for Sony RC-S360 (a.k.a. PaSoRi) pn533 based dongle. We can read and
write NFC tags and also establish a p2p link with this dongle now.
- A few LLCP fixes."
Finally, this includes another pull of the fixes from the wireless
tree in order to resolve some merge issues.
Please let me know if there problems!
Thanks,
John
P.S. This includes the bcma fix for the build issue on MIPS mentioned
in response to the previous pull request.
---
The following changes since commit 391e5c22f5f4e55817f8ba18a08ea717ed2d4a1f:
ipv4: Remove tb_peers from fib_table. (2012-07-12 09:39:28 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next.git for-davem
for you to fetch changes up to 38a00840638b4932152bca48098dbfa069d942a2:
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem (2012-07-12 13:44:50 -0400)
----------------------------------------------------------------
Amitkumar Karwar (1):
mwifiex: add set_antenna handler support
Arend van Spriel (1):
brcmsmac: fix brcms_c_regd_init() which crashed after 11ad patch
Arik Nemtsov (9):
wlcore/wl12xx/wl18xx: check min FW version
wlcore: don't stop tx queue via watermark if already stopped
wlcore: remove recover cmd from testmode
wlcore: avoid debug prints during intended FW recovery
wlcore: always clear recovery flag during recovery_work
wlcore: don't set SDIO_FAILED flag when driver state is off
wlcore: define number of supported bands internally
wl12xx/wl18xx: use a dynamic PS timeout of 1.5sec
wlcore: determine AP extra rates correctly
Avinash Patil (6):
mwifiex: pass cfg80211_beacon_data to mwifiex_set_mgmt_ie()
mwifiex: separate IE parsing for Head/Tail IEs and beacon_ies etc
mwifiex: overwrite earlier IE buffers for new set IE request
mwifiex: add change_beacon cfg80211 handler
mwifiex: advertise WPS probe response offload support to cfg80211
mwifiex: parse WPS IEs from beacon_data
Christian Lamparter (2):
carl9170: import 1.9.6 firmware headers
carl9170: fix HT peer BA session corruption
Dan Carpenter (1):
wlcore: fix a couple small memory leaks
Eliad Peller (6):
mac80211: flush queues before deauth/disassoc
mac80211: don't require associated->beacon_ies for ps
mac80211: allow calling ieee80211_ap_probereq_get() during auth/assoc
mac80211: always set in_reconfig=false on wakeup
wlcore: implement .flush callback
wlcore: check ssid length against the correct element
Emmanuel Grumbach (2):
iwlwifi: configure the queues from the op_mode
iwlwifi: disable the watchdog for queues by default
Eric Lapuyade (15):
NFC: Prepare asynchronous error management for driver and shdlc
NFC: Removed addressed shdlc TODOs
NFC: Handle SHDLC RSET frames from an SHDLC connected chip
NFC: Remove an impossible HCI error case
NFC: Implement HCP reaggregation allocation error case
NFC: Changed HCI cmd execution completion result to std linux errno
NFC: Driver failure API
NFC: Factorize HCI cmd completion
NFC: Implement HCI driver or internal error management
NFC: Core must test the device polling state inside the device lock
NFC: nfc_targets_found() should accept zero target found
NFC: nfc_driver_failure() implementation
NFC: Error management documentation
NFC: update PN544 HCI driver state when opened/closed
NFC: Allow HCI driver to pre-open pipes to some gates
Gabor Juhos (20):
ath9k: define DEVID for QCA955x
ath9k: define MAC version for AR9550
ath9k: set MAC version for AR9550
ath9k: add platform_device_id for AR9550
ath9k: add BB name string for AR9550
ath9k: clear pciexpress flag for AR9550
ath9k: enable TX/RX data byte swap for AR9550
ath9k: add initvals for AR9550
ath9k: add mode register initialization code for AR9550
ath9k: read spur frequency information from eeprom for AR9550
ath9k: fix XPABIASLEVEL settings for AR9550
ath9k: fix antenna control configuration for AR9550
ath9k: fix PAPRD settings for AR9550
ath9k: fix RF channel frequency configuration for AR9550
ath9k: disable SYNC_HOST1_FATAL interrupts for AR9550
ath9k: skip internal regulator configuration for AR9550
ath9k: fix PLL initialization for AR9550
ath9k: enable PLL workaround for AR9550
ath9k: set 4ADDRESS bit in RX filter for AR9550
ath9k: enable support for AR9550
Hauke Mehrtens (28):
bcma: extend workaround for bcm4331
bcma: add constants for chip ids
bcma: remove fix for 4329b0 bad LPOM is detection
bcma: add PCI ID for BCM43224
bcma: complete workaround for BCMA43224 and BCM4313
bcma: remove bcma_pmu_{pll,swreg}_init()
bcma: remove chip ids doing nothing from PMU initialization.
bcma: add bcma_pmu_spuravoid_pllupdate()
bcma: add mdelay bcma_pmu_resources_init()
brcmsmac: remove PCIE() macro
brcmsmac: remove PCI_FORCEHT() macro
brcmsmac: remove ai_get_buscore{type,rev}()
brcmsmac: use container_of instead of cast
brcmsmac: remove ai_findcore()
brcmsmac: remove si_pmu_init() and si_pmu_res_init()
brcmsmac: remove si_pmu_spuravoid_pllupdate()
brcmsmac: remove some redundant chip common workarounds
brcmsmac: use core id constants from bcma
brcmsmac: use chip and package id constants from bcma
brcmsmac: remove some unnessessacry casts and void pointer
brcmsmac: add a conditions for core rev 17 again
brcmsmac: add some workarounds for other chips again
brcmsmac: extend xmtfifo_sz array
brcmsmac: fix DMA on SoCs
brcmsmac: extend brcms_c_chipmatch() to also handle non PCIe devices
brcmsmac: fix read in write_phy_reg
brcmsmac: handle non PCI devices in the phy code
bcma: add PMU clock support for BCM4706
Ido Yariv (1):
wlcore: Prevent processing of work items during op_stop
Johannes Berg (17):
iwlwifi: bump trace message limit
iwlwifi: use __get_str in tracing
iwlwifi: limit dwell time more strictly
mac80211: make __ieee80211_recalc_idle static
cfg80211: don't allow WoWLAN support without CONFIG_PM
mac80211: don't expose ieee80211_add_srates_ie()
Merge remote-tracking branch 'wireless-next/master' into mac80211-next
iwlwifi: add trailing newline to some messages
iwlwifi: fix debug message level
mac80211: remove tx_frags driver callback
mac80211_hwsim: fix NUM_BANDS usage
mac80211: add TX prepare API
iwlwifi: remove unneeded NULL check
cfg80211: fix locking regression in monitor channel tracking
mac80211: fix debugfs default key links
mac80211: fix crash with single-queue drivers
mac80211_hwsim: add testmode code to stop/wake queues
John W. Linville (7):
Merge branch 'master' of git://git.kernel.org/.../linville/wireless
Merge branch 'for-john' of git://git.sipsolutions.net/mac80211-next
Merge branch 'for-john' of git://git.kernel.org/.../iwlwifi/iwlwifi-next
iwmc3200wifi: remove driver for unavailable hardware
i2400m: remove SDIO device support
iwmc3200top: remove driver for unavailable hardware
Merge branch 'master' of git://git.kernel.org/.../linville/wireless-next into for-davem
Luciano Coelho (1):
wl12xx/wlcore: increase FW filename version
Luis R. Rodriguez (1):
ath5k: replace modparam_all_channels with CONFIG_ATH5K_TEST_CHANNELS
Mahesh Palivela (3):
wireless: add VHT (802.11ac) definitions
cfg80211: allow advertising VHT capabilities
mac80211: include VHT capability IE in probe requests
Michal Kazior (13):
cfg80211: introduce cfg80211_stop_ap
cfg80211: .stop_ap when interface is going down
cfg80211: add channel tracking for AP and mesh
cfg80211: track ibss fixed channel
cfg80211: introduce cfg80211_get_chan_state
cfg80211: track monitor interfaces count
mac80211: refactor virtual monitor code
cfg80211: refuse to .set_monitor_channel when non-monitors are present
cfg80211: track monitor channel
cfg80211: set initial monitor channel
cfg80211/mac80211: remove .get_channel
cfg80211: add channel checking for iface combinations
cfg80211: respect iface combinations when starting operation
Mohammed Shafi Shajakhan (3):
ath9k: Fix clearing of BTCOEX flags
ath9k: Fix MCI cleanup
ath9k: Stop the BTCOEX timers before disabling BTCOEX
Oskar Schirmer (1):
net/wireless: remove macro defined twice with same value
Rafał Miłecki (3):
b43: N-PHY: fix RSSI calibration
bcma: use custom printing functions
bcma: fix CC driver compilation on MIPS
Rajkumar Manoharan (6):
ath9k_hw: start noisefloor calibration after MCI reset
ath9k_hw: do not load noise floor readings when it is running
ath9k: fix fullsleep power consumption when BTCOEX is enabled
ath9k: fix power consumption on network sleep when BTCOEX is enabled
ath9k_hw: fix AR9462 2g5g switch on full reset
ath9k_hw: remove debugging masks from AR_MCI_INTERRUPT_RX_MSG_DEFAULT
Richard A. Griffiths (1):
iwlwifi: disallow log_event access if interface down
Samuel Ortiz (18):
NFC: Add modules alias for NFC sockets
NFC: Add netlink module alias for NFC
NFC: Update LLCP socket target index when getting a connection
NFC: Fix LLCP getname socket op
NFC: Build LLCP general bytes upon request
NFC: Close listening LLCP sockets when the device is gone
NFC: Release LLCP SAP when the owner is released
NFC: Forbid LLCP service name reusing
NFC: Forbid SSAP binding to a not well known LLCP service
NFC: LLCP late binding
NFC: Handle LLCP Disconnected Mode frames
NFC: Remove warning from nfc_llcp_local_put
NFC: Do not return EBUSY when stopping a poll that's already stopped
NFC: Dereference LLCP bind socket address after checking for it to be NULL
NFC: Add initial Sony RC-S360 support to pn533
NFC: Use communicate thru only for PaSoRi when trying to read Felica tags
NFC: Add ISO 14443 type B protocol
NFC: Check for llcp_sock and its device from llcp_sock_getname
Stanislaw Gruszka (3):
rt2x00pci: small 3290 changes cleanup
rt2800lib: merge same defines
rt2x00: remove unused argument
Thomas Huehn (2):
mac80211: reduce IEEE80211_TX_MAX_RATES
ath9k: fixing register bit shift values of control packets to support TPC
Victor Goldenshtein (1):
wlcore: enable sched scan while connected
Vladimir Kondratiev (5):
cfg80211: add 802.11ad (60gHz band) support
wireless: regulatory for 60g
wireless: 60g protocol constants
{nl,cfg}80211: support high bitrates
cfg80211: bitrate calculation for 60g
Yoni Divinsky (2):
wlcore: add probe request templates for sched and one-shot scans
wlcore: change the wait for event mechanism
Documentation/nfc/nfc-hci.txt | 33 +
MAINTAINERS | 8 -
drivers/bcma/bcma_private.h | 9 +
drivers/bcma/core.c | 10 +-
drivers/bcma/driver_chipcommon.c | 5 +-
drivers/bcma/driver_chipcommon_pmu.c | 369 +++--
drivers/bcma/driver_mips.c | 24 +-
drivers/bcma/driver_pci_host.c | 18 +-
drivers/bcma/host_pci.c | 5 +-
drivers/bcma/main.c | 19 +-
drivers/bcma/scan.c | 24 +-
drivers/bcma/sprom.c | 26 +-
drivers/misc/Kconfig | 1 -
drivers/misc/Makefile | 1 -
drivers/misc/iwmc3200top/Kconfig | 20 -
drivers/misc/iwmc3200top/Makefile | 29 -
drivers/misc/iwmc3200top/debugfs.c | 137 --
drivers/misc/iwmc3200top/debugfs.h | 58 -
drivers/misc/iwmc3200top/fw-download.c | 358 ----
drivers/misc/iwmc3200top/fw-msg.h | 113 --
drivers/misc/iwmc3200top/iwmc3200top.h | 205 ---
drivers/misc/iwmc3200top/log.c | 348 ----
drivers/misc/iwmc3200top/log.h | 171 --
drivers/misc/iwmc3200top/main.c | 662 --------
drivers/net/wimax/i2400m/Kconfig | 22 -
drivers/net/wimax/i2400m/Makefile | 8 -
drivers/net/wimax/i2400m/driver.c | 3 +-
drivers/net/wimax/i2400m/fw.c | 3 +-
drivers/net/wimax/i2400m/i2400m-sdio.h | 157 --
drivers/net/wimax/i2400m/i2400m.h | 13 +-
drivers/net/wimax/i2400m/sdio-debug-levels.h | 22 -
drivers/net/wimax/i2400m/sdio-fw.c | 210 ---
drivers/net/wimax/i2400m/sdio-rx.c | 301 ----
drivers/net/wimax/i2400m/sdio-tx.c | 177 --
drivers/net/wimax/i2400m/sdio.c | 602 -------
drivers/net/wireless/Kconfig | 1 -
drivers/net/wireless/Makefile | 2 -
drivers/net/wireless/ath/ath5k/Kconfig | 8 +
drivers/net/wireless/ath/ath5k/base.c | 17 +-
drivers/net/wireless/ath/ath6kl/cfg80211.c | 2 +
drivers/net/wireless/ath/ath9k/ahb.c | 4 +
drivers/net/wireless/ath/ath9k/ar9003_calib.c | 13 +-
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 7 +-
drivers/net/wireless/ath/ath9k/ar9003_hw.c | 87 +-
drivers/net/wireless/ath/ath9k/ar9003_mci.c | 18 +-
drivers/net/wireless/ath/ath9k/ar9003_paprd.c | 2 +-
drivers/net/wireless/ath/ath9k/ar9003_phy.c | 72 +-
drivers/net/wireless/ath/ath9k/ar9003_phy.h | 6 +-
.../net/wireless/ath/ath9k/ar955x_1p0_initvals.h | 1284 +++++++++++++++
drivers/net/wireless/ath/ath9k/ath9k.h | 4 +
drivers/net/wireless/ath/ath9k/gpio.c | 25 +-
drivers/net/wireless/ath/ath9k/hw.c | 46 +-
drivers/net/wireless/ath/ath9k/hw.h | 2 +
drivers/net/wireless/ath/ath9k/mac.c | 2 +-
drivers/net/wireless/ath/ath9k/mac.h | 1 +
drivers/net/wireless/ath/ath9k/main.c | 16 +-
drivers/net/wireless/ath/ath9k/mci.c | 2 +-
drivers/net/wireless/ath/ath9k/recv.c | 3 +
drivers/net/wireless/ath/ath9k/reg.h | 16 +-
drivers/net/wireless/ath/carl9170/carl9170.h | 11 +
drivers/net/wireless/ath/carl9170/fw.c | 3 +
drivers/net/wireless/ath/carl9170/fwdesc.h | 3 +
drivers/net/wireless/ath/carl9170/main.c | 6 +
drivers/net/wireless/ath/carl9170/rx.c | 49 +
drivers/net/wireless/ath/carl9170/tx.c | 69 +-
drivers/net/wireless/ath/carl9170/version.h | 8 +-
drivers/net/wireless/b43/phy_n.c | 17 +-
drivers/net/wireless/brcm80211/brcmsmac/aiutils.c | 128 +-
drivers/net/wireless/brcm80211/brcmsmac/aiutils.h | 16 -
drivers/net/wireless/brcm80211/brcmsmac/channel.c | 17 +-
drivers/net/wireless/brcm80211/brcmsmac/dma.c | 15 +-
.../net/wireless/brcm80211/brcmsmac/mac80211_if.c | 3 +-
drivers/net/wireless/brcm80211/brcmsmac/main.c | 87 +-
.../net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c | 22 +-
.../net/wireless/brcm80211/brcmsmac/phy/phy_n.c | 140 +-
drivers/net/wireless/brcm80211/brcmsmac/pmu.c | 172 +-
drivers/net/wireless/brcm80211/brcmsmac/pmu.h | 3 -
drivers/net/wireless/brcm80211/brcmsmac/pub.h | 2 +-
drivers/net/wireless/brcm80211/include/soc.h | 62 -
drivers/net/wireless/iwlegacy/3945-rs.c | 2 +-
drivers/net/wireless/iwlwifi/dvm/commands.h | 40 +-
drivers/net/wireless/iwlwifi/dvm/debugfs.c | 6 +-
drivers/net/wireless/iwlwifi/dvm/dev.h | 16 -
drivers/net/wireless/iwlwifi/dvm/main.c | 56 +-
drivers/net/wireless/iwlwifi/dvm/scan.c | 37 +-
drivers/net/wireless/iwlwifi/dvm/ucode.c | 37 +
drivers/net/wireless/iwlwifi/iwl-debug.c | 5 +-
drivers/net/wireless/iwlwifi/iwl-devtrace.h | 4 +-
drivers/net/wireless/iwlwifi/iwl-drv.c | 1 +
drivers/net/wireless/iwlwifi/iwl-trans.h | 27 +-
drivers/net/wireless/iwlwifi/pcie/internal.h | 3 +-
drivers/net/wireless/iwlwifi/pcie/rx.c | 3 -
drivers/net/wireless/iwlwifi/pcie/trans.c | 36 +-
drivers/net/wireless/iwmc3200wifi/Kconfig | 39 -
drivers/net/wireless/iwmc3200wifi/Makefile | 10 -
drivers/net/wireless/iwmc3200wifi/bus.h | 57 -
drivers/net/wireless/iwmc3200wifi/cfg80211.c | 882 ----------
drivers/net/wireless/iwmc3200wifi/cfg80211.h | 31 -
drivers/net/wireless/iwmc3200wifi/commands.c | 1002 ------------
drivers/net/wireless/iwmc3200wifi/commands.h | 509 ------
drivers/net/wireless/iwmc3200wifi/debug.h | 123 --
drivers/net/wireless/iwmc3200wifi/debugfs.c | 488 ------
drivers/net/wireless/iwmc3200wifi/eeprom.c | 234 ---
drivers/net/wireless/iwmc3200wifi/eeprom.h | 127 --
drivers/net/wireless/iwmc3200wifi/fw.c | 416 -----
drivers/net/wireless/iwmc3200wifi/fw.h | 100 --
drivers/net/wireless/iwmc3200wifi/hal.c | 470 ------
drivers/net/wireless/iwmc3200wifi/hal.h | 237 ---
drivers/net/wireless/iwmc3200wifi/iwm.h | 367 -----
drivers/net/wireless/iwmc3200wifi/lmac.h | 484 ------
drivers/net/wireless/iwmc3200wifi/main.c | 847 ----------
drivers/net/wireless/iwmc3200wifi/netdev.c | 191 ---
drivers/net/wireless/iwmc3200wifi/rx.c | 1701 --------------------
drivers/net/wireless/iwmc3200wifi/rx.h | 60 -
drivers/net/wireless/iwmc3200wifi/sdio.c | 509 ------
drivers/net/wireless/iwmc3200wifi/sdio.h | 64 -
drivers/net/wireless/iwmc3200wifi/trace.c | 3 -
drivers/net/wireless/iwmc3200wifi/trace.h | 283 ----
drivers/net/wireless/iwmc3200wifi/tx.c | 529 ------
drivers/net/wireless/iwmc3200wifi/umac.h | 789 ---------
drivers/net/wireless/libertas/host.h | 1 -
drivers/net/wireless/mac80211_hwsim.c | 12 +-
drivers/net/wireless/mwifiex/cfg80211.c | 76 +-
drivers/net/wireless/mwifiex/fw.h | 21 +
drivers/net/wireless/mwifiex/ie.c | 185 ++-
drivers/net/wireless/mwifiex/ioctl.h | 5 +
drivers/net/wireless/mwifiex/main.h | 2 +-
drivers/net/wireless/mwifiex/sta_cmd.c | 37 +
drivers/net/wireless/mwifiex/sta_cmdresp.c | 30 +
drivers/net/wireless/p54/txrx.c | 6 +-
drivers/net/wireless/rt2x00/rt2800lib.c | 29 +-
drivers/net/wireless/rt2x00/rt2800pci.c | 8 +-
drivers/net/wireless/rt2x00/rt2x00queue.c | 10 +-
drivers/net/wireless/rt2x00/rt2x00queue.h | 5 +-
drivers/net/wireless/rt2x00/rt2x00usb.c | 20 +-
drivers/net/wireless/ti/wl12xx/main.c | 26 +-
drivers/net/wireless/ti/wl12xx/wl12xx.h | 14 +
drivers/net/wireless/ti/wl18xx/main.c | 27 +-
drivers/net/wireless/ti/wl18xx/wl18xx.h | 7 +
drivers/net/wireless/ti/wlcore/boot.c | 55 +-
drivers/net/wireless/ti/wlcore/cmd.c | 22 +-
drivers/net/wireless/ti/wlcore/cmd.h | 6 +-
drivers/net/wireless/ti/wlcore/init.c | 16 +
drivers/net/wireless/ti/wlcore/io.c | 6 +
drivers/net/wireless/ti/wlcore/io.h | 13 +-
drivers/net/wireless/ti/wlcore/main.c | 77 +-
drivers/net/wireless/ti/wlcore/scan.c | 11 +-
drivers/net/wireless/ti/wlcore/sdio.c | 6 -
drivers/net/wireless/ti/wlcore/spi.c | 6 -
drivers/net/wireless/ti/wlcore/testmode.c | 13 +-
drivers/net/wireless/ti/wlcore/wlcore.h | 25 +-
drivers/net/wireless/ti/wlcore/wlcore_i.h | 16 +-
drivers/nfc/nfcwilink.c | 7 +-
drivers/nfc/pn533.c | 224 ++-
drivers/nfc/pn544_hci.c | 37 +-
include/linux/bcma/bcma.h | 30 +
include/linux/bcma/bcma_driver_chipcommon.h | 37 +
include/linux/ieee80211.h | 160 +-
include/linux/nfc.h | 14 +-
include/linux/nl80211.h | 17 +
include/net/cfg80211.h | 40 +-
include/net/mac80211.h | 44 +-
include/net/nfc/hci.h | 19 +-
include/net/nfc/nfc.h | 2 +
net/mac80211/cfg.c | 24 +-
net/mac80211/debugfs_key.c | 16 +-
net/mac80211/driver-ops.h | 22 +-
net/mac80211/ieee80211_i.h | 11 +-
net/mac80211/iface.c | 258 ++-
net/mac80211/main.c | 17 +-
net/mac80211/mesh_plink.c | 4 +-
net/mac80211/mlme.c | 28 +-
net/mac80211/trace.h | 7 +
net/mac80211/tx.c | 16 +-
net/mac80211/util.c | 49 +-
net/nfc/core.c | 38 +-
net/nfc/hci/command.c | 26 +-
net/nfc/hci/core.c | 104 +-
net/nfc/hci/hci.h | 12 +-
net/nfc/hci/shdlc.c | 38 +-
net/nfc/llcp/llcp.c | 342 ++--
net/nfc/llcp/llcp.h | 5 +
net/nfc/llcp/sock.c | 31 +-
net/nfc/nci/core.c | 5 +-
net/nfc/nci/ntf.c | 5 +-
net/nfc/netlink.c | 9 +
net/wireless/Makefile | 2 +-
net/wireless/ap.c | 46 +
net/wireless/chan.c | 62 +-
net/wireless/core.c | 84 +-
net/wireless/core.h | 64 +-
net/wireless/ibss.c | 11 +
net/wireless/mesh.c | 30 +-
net/wireless/mlme.c | 17 +
net/wireless/nl80211.c | 65 +-
net/wireless/reg.c | 5 +-
net/wireless/util.c | 156 +-
net/wireless/wext-compat.c | 9 +-
198 files changed, 4692 insertions(+), 15819 deletions(-)
delete mode 100644 drivers/misc/iwmc3200top/Kconfig
delete mode 100644 drivers/misc/iwmc3200top/Makefile
delete mode 100644 drivers/misc/iwmc3200top/debugfs.c
delete mode 100644 drivers/misc/iwmc3200top/debugfs.h
delete mode 100644 drivers/misc/iwmc3200top/fw-download.c
delete mode 100644 drivers/misc/iwmc3200top/fw-msg.h
delete mode 100644 drivers/misc/iwmc3200top/iwmc3200top.h
delete mode 100644 drivers/misc/iwmc3200top/log.c
delete mode 100644 drivers/misc/iwmc3200top/log.h
delete mode 100644 drivers/misc/iwmc3200top/main.c
delete mode 100644 drivers/net/wimax/i2400m/i2400m-sdio.h
delete mode 100644 drivers/net/wimax/i2400m/sdio-debug-levels.h
delete mode 100644 drivers/net/wimax/i2400m/sdio-fw.c
delete mode 100644 drivers/net/wimax/i2400m/sdio-rx.c
delete mode 100644 drivers/net/wimax/i2400m/sdio-tx.c
delete mode 100644 drivers/net/wimax/i2400m/sdio.c
create mode 100644 drivers/net/wireless/ath/ath9k/ar955x_1p0_initvals.h
delete mode 100644 drivers/net/wireless/iwmc3200wifi/Kconfig
delete mode 100644 drivers/net/wireless/iwmc3200wifi/Makefile
delete mode 100644 drivers/net/wireless/iwmc3200wifi/bus.h
delete mode 100644 drivers/net/wireless/iwmc3200wifi/cfg80211.c
delete mode 100644 drivers/net/wireless/iwmc3200wifi/cfg80211.h
delete mode 100644 drivers/net/wireless/iwmc3200wifi/commands.c
delete mode 100644 drivers/net/wireless/iwmc3200wifi/commands.h
delete mode 100644 drivers/net/wireless/iwmc3200wifi/debug.h
delete mode 100644 drivers/net/wireless/iwmc3200wifi/debugfs.c
delete mode 100644 drivers/net/wireless/iwmc3200wifi/eeprom.c
delete mode 100644 drivers/net/wireless/iwmc3200wifi/eeprom.h
delete mode 100644 drivers/net/wireless/iwmc3200wifi/fw.c
delete mode 100644 drivers/net/wireless/iwmc3200wifi/fw.h
delete mode 100644 drivers/net/wireless/iwmc3200wifi/hal.c
delete mode 100644 drivers/net/wireless/iwmc3200wifi/hal.h
delete mode 100644 drivers/net/wireless/iwmc3200wifi/iwm.h
delete mode 100644 drivers/net/wireless/iwmc3200wifi/lmac.h
delete mode 100644 drivers/net/wireless/iwmc3200wifi/main.c
delete mode 100644 drivers/net/wireless/iwmc3200wifi/netdev.c
delete mode 100644 drivers/net/wireless/iwmc3200wifi/rx.c
delete mode 100644 drivers/net/wireless/iwmc3200wifi/rx.h
delete mode 100644 drivers/net/wireless/iwmc3200wifi/sdio.c
delete mode 100644 drivers/net/wireless/iwmc3200wifi/sdio.h
delete mode 100644 drivers/net/wireless/iwmc3200wifi/trace.c
delete mode 100644 drivers/net/wireless/iwmc3200wifi/trace.h
delete mode 100644 drivers/net/wireless/iwmc3200wifi/tx.c
delete mode 100644 drivers/net/wireless/iwmc3200wifi/umac.h
create mode 100644 net/wireless/ap.c
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [PATCH] ixgbevf - Prevent RX/TX statistics getting reset to zero
From: Jeff Kirsher @ 2012-07-12 18:26 UTC (permalink / raw)
To: Narendra_K, gregory.v.rose; +Cc: netdev
In-Reply-To: <E31FB011129F30488D5861F38390491520D00B9F01@BLRX7MCDC201.AMER.DELL.COM>
[-- Attachment #1: Type: text/plain, Size: 2116 bytes --]
On 07/12/2012 06:55 AM, Narendra_K@Dell.com wrote:
> Hello,
>
> [Apologies if you are receiving this message twice. I am resending the message, as I got message delivery failure note].
>
> While exploring SR-IOV on Intel 82599EB 10-Gigabit SFP+ adapter, I had the following observation. I enabled two VFs by passing 'max_vfs=2' to ixgbe driver. One of the VFs was assigned to a guest.
> In the guest, the ifconfig and ip tools reported 'RX packets' and 'TX packets' as zero, after pinging to a remote host. Looking into it further, the commit 4197aa7bb81877ebb06e4f2cc1b5fea2da23a7bd implements 64 bit per ring statistics. It seemed like the 'total_bytes' and 'total_packets' of RX and TX ring were being reset to zero by the RX and TX interrupt handlers, resulting in the user space tools reporting zero RX and TX bytes.
>
> The attached patch addresses the issue by preventing the resetting of RX and TX ring statistics to zero. The patch was taken against latest mainline 3.5-rc6 kernel.
>
> I tested the patch by pinging from the guest OS to a remote host.
>
> ping -f <remote host> -c 10000
>
> The ip and ifcofig showed the statistics increased by 10000 packets.
>
> # lspci | grep 82599
> 04:00.0 Ethernet controller: Intel Corporation 82599EB 10-Gigabit SFP+ Network Connection (rev 01)
> 04:00.1 Ethernet controller: Intel Corporation 82599EB 10-Gigabit SFP+ Network Connection (rev 01)
> 04:10.0 Ethernet controller: Intel Corporation 82599 Ethernet Controller Virtual Function (rev 01)
> 04:10.1 Ethernet controller: Intel Corporation 82599 Ethernet Controller Virtual Function (rev 01)
> 04:10.2 Ethernet controller: Intel Corporation 82599 Ethernet Controller Virtual Function (rev 01)
> 04:10.3 Ethernet controller: Intel Corporation 82599 Ethernet Controller Virtual Function (rev 01)
>
> # lspci -s 04:00.0 -n
> 04:00.0 0200: 8086:154d (rev 01)
> # lspci -s 04:10.0 -n
> 04:10.0 0200: 8086:10ed (rev 01)
>
> Please let me know if additional details and logs are required.
>
> With regards,
> Narendra K
>
>
>
Thanks, I will add the patch to my queue
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 900 bytes --]
^ permalink raw reply
* RE: 82571EB: Detected Hardware Unit Hang
From: Dave, Tushar N @ 2012-07-12 18:19 UTC (permalink / raw)
To: Joe Jin
Cc: e1000-devel@lists.sf.net, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
In-Reply-To: <4FFE787B.9050201@oracle.com>
>-----Original Message-----
>From: Joe Jin [mailto:joe.jin@oracle.com]
>Sent: Thursday, July 12, 2012 12:11 AM
>To: Dave, Tushar N
>Cc: e1000-devel@lists.sf.net; netdev@vger.kernel.org; linux-
>kernel@vger.kernel.org
>Subject: Re: 82571EB: Detected Hardware Unit Hang
>
>On 07/12/12 14:41, Dave, Tushar N wrote:
>>> On 07/12/12 13:57, Dave, Tushar N wrote:
>>>>> -----Original Message-----
>>>>> From: Joe Jin [mailto:joe.jin@oracle.com]
>>>>> Sent: Wednesday, July 11, 2012 8:13 PM
>>>>> To: Dave, Tushar N
>>>>> Cc: e1000-devel@lists.sf.net; netdev@vger.kernel.org; linux-
>>>>> kernel@vger.kernel.org
>>>>> Subject: Re: 82571EB: Detected Hardware Unit Hang
>>>>>
>>>>> On 07/12/12 11:07, Dave, Tushar N wrote:
>>>>>>> -----Original Message-----
>>>>>>> From: Joe Jin [mailto:joe.jin@oracle.com]
>>>>>>> Sent: Wednesday, July 11, 2012 7:58 PM
>>>>>>> To: Dave, Tushar N
>>>>>>> Cc: e1000-devel@lists.sf.net; netdev@vger.kernel.org; linux-
>>>>>>> kernel@vger.kernel.org
>>>>>>> Subject: Re: 82571EB: Detected Hardware Unit Hang
>>>>>>>
>>>>>>> On 07/12/12 10:52, Dave, Tushar N wrote:
>>>>>>>> What is the exact error messages in BIOS log?
>>>>>>>
>>>>>>> Error message from BIOS event log:
>>>>>>> 07/12/12 05:54:00
>>>>>>> PCI Express Non-Fatal Error
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Joe
>>>>> Hi Tushar,
>>>>>
>>>>> Please find eeprom from attachment.
>>>>
>>>> Do you have lspci -vvv dump of entire system before and after issue
>>> occurs? If you have can you send it to me?
>>>>
>>>
>> Sorry but I meant the full lspci -vvv of *entire system* before and
>after issue occurs and not of 82571 only.
>>
>
>Before:
>=======
>00:00.0 Host bridge: Intel Corporation 5500 I/O Hub to ESI Port (rev 22)
> Subsystem: Oracle Corporation Device 5352
Joe, thanks for all the data.
You said you have changed max payload size and issue stop occurring. How did you change it? Where did you make that change in BIOS or EEPROM or in PCIe config space?
Also please send me the full dmesg of entire system after you change max payload size.
Thanks.
^ permalink raw reply
* RE: [patch] qlge: fix an "&&" vs "||" bug
From: Jitendra Kalsaria @ 2012-07-12 18:15 UTC (permalink / raw)
To: Dan Carpenter, Anirban Chakraborty
Cc: Ron Mercer, Dept-Eng Linux Driver, netdev,
kernel-janitors@vger.kernel.org
In-Reply-To: <20120712144702.GB24202@elgon.mountain>
-----Original Message-----
>From: Dan Carpenter [mailto:dan.carpenter@oracle.com]
>Sent: Thursday, July 12, 2012 7:47 AM
>To: Anirban Chakraborty
>Cc: Jitendra Kalsaria; Ron Mercer; Dept-Eng Linux Driver; netdev; kernel-janitors@vger.kernel.org
>Subject: [patch] qlge: fix an "&&" vs "||" bug
>
>The condition is always true so WOL will never work.
>
>Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
>diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c b/drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c
>index 3d4462b..6f316ab 100644
>--- a/drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c
>+++ b/drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c
>@@ -440,7 +440,7 @@ static int ql_set_wol(struct net_device *ndev, struct ethtool_wolinfo *wol)
> unsigned short ssys_dev = qdev->pdev->subsystem_device;
>
> /* WOL is only supported for mezz card. */
>- if (ssys_dev != QLGE_MEZZ_SSYS_ID_068 ||
>+ if (ssys_dev != QLGE_MEZZ_SSYS_ID_068 &&
> ssys_dev != QLGE_MEZZ_SSYS_ID_180) {
> netif_info(qdev, drv, qdev->ndev,
> "WOL is only supported for mezz card\n");
Acked-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
^ permalink raw reply
* Re: [trivial PATCH 2/7] ixgbe: remove unused #define
From: Jeff Kirsher @ 2012-07-12 18:15 UTC (permalink / raw)
To: Jon Mason
Cc: trivial, linux-kernel, Jesse Brandeburg, Bruce Allan,
Carolyn Wyborny, Don Skidmore, Greg Rose, Peter P Waskiewicz Jr,
Alex Duyck, John Ronciak, netdev
In-Reply-To: <1341960208.3336.43.camel@jtkirshe-mobl>
[-- Attachment #1: Type: text/plain, Size: 1699 bytes --]
On Tue, 2012-07-10 at 15:43 -0700, Jeff Kirsher wrote:
> On Tue, 2012-07-10 at 15:31 -0700, Jon Mason wrote:
> > Remove unused IXGBE_INTEL_VENDOR_ID #define
> >
> > Signed-off-by: Jon Mason <jdmason@kudzu.us>
> > Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> > Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
> > Cc: Bruce Allan <bruce.w.allan@intel.com>
> > Cc: Carolyn Wyborny <carolyn.wyborny@intel.com>
> > Cc: Don Skidmore <donald.c.skidmore@intel.com>
> > Cc: Greg Rose <gregory.v.rose@intel.com>
> > Cc: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
> > Cc: Alex Duyck <alexander.h.duyck@intel.com>
> > Cc: John Ronciak <john.ronciak@intel.com>
> > ---
> > drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | 3 ---
> > 1 file changed, 3 deletions(-)
>
> This should also go through David Miller's networking tree's. Adding
> netdev mailing list.
>
> Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
After looking at this further, I rescind my ACK.
NAK, this define is used in several places in ixgbe_main.c and the
driver will not compile with this patch.
>
> >
> > diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
> > index 204848d..c8d8040 100644
> > --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
> > +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
> > @@ -32,9 +32,6 @@
> > #include <linux/mdio.h>
> > #include <linux/netdevice.h>
> >
> > -/* Vendor ID */
> > -#define IXGBE_INTEL_VENDOR_ID 0x8086
> > -
> > /* Device IDs */
> > #define IXGBE_DEV_ID_82598 0x10B6
> > #define IXGBE_DEV_ID_82598_BX 0x1508
>
>
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* [PATCH net-next] tipc: Use pr_fmt
From: Joe Perches @ 2012-07-12 17:51 UTC (permalink / raw)
To: Paul Gortmaker; +Cc: davem, netdev, Jon Maloy, Erik Hugne, ying.xue
In-Reply-To: <1342111201-9426-1-git-send-email-paul.gortmaker@windriver.com>
Remove embedded "TIPC: " prefix from pr_<level> uses.
Add '#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt' to core.h
Make sure core.h is the first include in all .c files.
This changes the prefix from "TIPC: " to "tipc: "
Other miscellaneous changes in link.c to coalesce multiple
pr_info uses without newlines to single pr_info output.
Align a few arguments to open parenthesis as well.
Signed-off-by: Joe Perches <joe@perches.com>
---
On Thu, 2012-07-12 at 12:39 -0400, Paul Gortmaker wrote:
> The main thrust of what happens in this series is to deal with
> the request you'd made a while ago about making it so TIPC did
> not have its own specific (and complex) logging infrastructure.
Excellent.
How about extending this to use the more common pr_fmt prefix?
net/tipc/bcast.c | 2 +-
net/tipc/bearer.c | 34 ++++++++++++++--------------
net/tipc/config.c | 6 ++--
net/tipc/core.c | 11 ++++-----
net/tipc/core.h | 2 +
net/tipc/discover.c | 2 +-
net/tipc/handler.c | 4 +-
net/tipc/link.c | 57 ++++++++++++++++++++++++-----------------------
net/tipc/name_distr.c | 12 +++++-----
net/tipc/name_table.c | 22 +++++++++---------
net/tipc/net.c | 6 ++--
net/tipc/netlink.c | 2 +-
net/tipc/node.c | 17 ++++++-------
net/tipc/node_subscr.c | 2 +-
net/tipc/port.c | 8 +++---
net/tipc/ref.c | 10 ++++----
net/tipc/socket.c | 10 ++++----
net/tipc/subscr.c | 12 +++++-----
18 files changed, 110 insertions(+), 109 deletions(-)
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
index 5b84337..e4e6d8c 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -875,7 +875,7 @@ void tipc_port_list_add(struct tipc_port_list *pl_ptr, u32 port)
if (!item->next) {
item->next = kmalloc(sizeof(*item), GFP_ATOMIC);
if (!item->next) {
- pr_warn("TIPC: Incomplete multicast delivery, no memory\n");
+ pr_warn("Incomplete multicast delivery, no memory\n");
return;
}
item->next->next = NULL;
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 1186413..09e7124 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -123,7 +123,7 @@ int tipc_register_media(struct tipc_media *m_ptr)
exit:
write_unlock_bh(&tipc_net_lock);
if (res)
- pr_warn("TIPC: Media <%s> registration error\n", m_ptr->name);
+ pr_warn("Media <%s> registration error\n", m_ptr->name);
return res;
}
@@ -420,12 +420,12 @@ int tipc_enable_bearer(const char *name, u32 disc_domain, u32 priority)
int res = -EINVAL;
if (!tipc_own_addr) {
- pr_warn("TIPC: Bearer <%s> rejected, not supported in standalone mode\n",
+ pr_warn("Bearer <%s> rejected, not supported in standalone mode\n",
name);
return -ENOPROTOOPT;
}
if (!bearer_name_validate(name, &b_names)) {
- pr_warn("TIPC: Bearer <%s> rejected, illegal name\n", name);
+ pr_warn("Bearer <%s> rejected, illegal name\n", name);
return -EINVAL;
}
if (tipc_addr_domain_valid(disc_domain) &&
@@ -437,13 +437,13 @@ int tipc_enable_bearer(const char *name, u32 disc_domain, u32 priority)
res = 0; /* accept specified node in own cluster */
}
if (res) {
- pr_warn("TIPC: Bearer <%s> rejected, illegal discovery domain\n",
+ pr_warn("Bearer <%s> rejected, illegal discovery domain\n",
name);
return -EINVAL;
}
if ((priority > TIPC_MAX_LINK_PRI) &&
(priority != TIPC_MEDIA_LINK_PRI)) {
- pr_warn("TIPC: Bearer <%s> rejected, illegal priority\n", name);
+ pr_warn("Bearer <%s> rejected, illegal priority\n", name);
return -EINVAL;
}
@@ -451,7 +451,7 @@ int tipc_enable_bearer(const char *name, u32 disc_domain, u32 priority)
m_ptr = tipc_media_find(b_names.media_name);
if (!m_ptr) {
- pr_warn("TIPC: Bearer <%s> rejected, media <%s> not registered\n",
+ pr_warn("Bearer <%s> rejected, media <%s> not registered\n",
name, b_names.media_name);
goto exit;
}
@@ -468,24 +468,24 @@ restart:
continue;
}
if (!strcmp(name, tipc_bearers[i].name)) {
- pr_warn("TIPC: Bearer <%s> rejected, already enabled\n",
+ pr_warn("Bearer <%s> rejected, already enabled\n",
name);
goto exit;
}
if ((tipc_bearers[i].priority == priority) &&
(++with_this_prio > 2)) {
if (priority-- == 0) {
- pr_warn("TIPC: Bearer <%s> rejected, duplicate priority\n",
+ pr_warn("Bearer <%s> rejected, duplicate priority\n",
name);
goto exit;
}
- pr_warn("TIPC: Bearer <%s> priority adjustment required %u->%u\n",
+ pr_warn("Bearer <%s> priority adjustment required %u->%u\n",
name, priority + 1, priority);
goto restart;
}
}
if (bearer_id >= MAX_BEARERS) {
- pr_warn("TIPC: Bearer <%s> rejected, bearer limit reached (%u)\n",
+ pr_warn("Bearer <%s> rejected, bearer limit reached (%u)\n",
name, MAX_BEARERS);
goto exit;
}
@@ -494,7 +494,7 @@ restart:
strcpy(b_ptr->name, name);
res = m_ptr->enable_bearer(b_ptr);
if (res) {
- pr_warn("TIPC: Bearer <%s> rejected, enable failure (%d)\n",
+ pr_warn("Bearer <%s> rejected, enable failure (%d)\n",
name, -res);
goto exit;
}
@@ -513,11 +513,11 @@ restart:
res = tipc_disc_create(b_ptr, &m_ptr->bcast_addr, disc_domain);
if (res) {
bearer_disable(b_ptr);
- pr_warn("TIPC: Bearer <%s> rejected, discovery object creation failed\n",
+ pr_warn("Bearer <%s> rejected, discovery object creation failed\n",
name);
goto exit;
}
- pr_info("TIPC: Enabled bearer <%s>, discovery domain %s, priority %u\n",
+ pr_info("Enabled bearer <%s>, discovery domain %s, priority %u\n",
name,
tipc_addr_string_fill(addr_string, disc_domain), priority);
exit:
@@ -537,12 +537,12 @@ int tipc_block_bearer(const char *name)
read_lock_bh(&tipc_net_lock);
b_ptr = tipc_bearer_find(name);
if (!b_ptr) {
- pr_warn("TIPC: Attempt to block unknown bearer <%s>\n", name);
+ pr_warn("Attempt to block unknown bearer <%s>\n", name);
read_unlock_bh(&tipc_net_lock);
return -EINVAL;
}
- pr_info("TIPC: Blocking bearer <%s>\n", name);
+ pr_info("Blocking bearer <%s>\n", name);
spin_lock_bh(&b_ptr->lock);
b_ptr->blocked = 1;
list_splice_init(&b_ptr->cong_links, &b_ptr->links);
@@ -568,7 +568,7 @@ static void bearer_disable(struct tipc_bearer *b_ptr)
struct tipc_link *l_ptr;
struct tipc_link *temp_l_ptr;
- pr_info("TIPC: Disabling bearer <%s>\n", b_ptr->name);
+ pr_info("Disabling bearer <%s>\n", b_ptr->name);
spin_lock_bh(&b_ptr->lock);
b_ptr->blocked = 1;
b_ptr->media->disable_bearer(b_ptr);
@@ -590,7 +590,7 @@ int tipc_disable_bearer(const char *name)
write_lock_bh(&tipc_net_lock);
b_ptr = tipc_bearer_find(name);
if (b_ptr == NULL) {
- pr_warn("TIPC: Attempt to disable unknown bearer <%s>\n", name);
+ pr_warn("Attempt to disable unknown bearer <%s>\n", name);
res = -EINVAL;
} else {
bearer_disable(b_ptr);
diff --git a/net/tipc/config.c b/net/tipc/config.c
index 7cbff85..a056a38 100644
--- a/net/tipc/config.c
+++ b/net/tipc/config.c
@@ -437,7 +437,7 @@ static void cfg_named_msg_event(void *userdata,
if ((size < sizeof(*req_hdr)) ||
(size != TCM_ALIGN(ntohl(req_hdr->tcm_len))) ||
(ntohs(req_hdr->tcm_flags) != TCM_F_REQUEST)) {
- pr_warn("TIPC: Invalid configuration message discarded\n");
+ pr_warn("Invalid configuration message discarded\n");
return;
}
@@ -483,7 +483,7 @@ int tipc_cfg_init(void)
return 0;
failed:
- pr_err("TIPC: Unable to create configuration service\n");
+ pr_err("Unable to create configuration service\n");
return res;
}
@@ -499,7 +499,7 @@ void tipc_cfg_reinit(void)
seq.lower = seq.upper = tipc_own_addr;
res = tipc_publish(config_port_ref, TIPC_ZONE_SCOPE, &seq);
if (res)
- pr_err("TIPC: Unable to reinitialize configuration service\n");
+ pr_err("Unable to reinitialize configuration service\n");
}
void tipc_cfg_stop(void)
diff --git a/net/tipc/core.c b/net/tipc/core.c
index a6deab4..6586eac 100644
--- a/net/tipc/core.c
+++ b/net/tipc/core.c
@@ -34,14 +34,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <linux/module.h>
-
#include "core.h"
#include "ref.h"
#include "name_table.h"
#include "subscr.h"
#include "config.h"
+#include <linux/module.h>
#ifndef CONFIG_TIPC_PORTS
#define CONFIG_TIPC_PORTS 8191
@@ -157,7 +156,7 @@ static int __init tipc_init(void)
{
int res;
- pr_info("TIPC: Activated (version " TIPC_MOD_VER ")\n");
+ pr_info("Activated (version " TIPC_MOD_VER ")\n");
tipc_own_addr = 0;
tipc_remote_management = 1;
@@ -168,9 +167,9 @@ static int __init tipc_init(void)
res = tipc_core_start();
if (res)
- pr_err("TIPC: Unable to start in single node mode\n");
+ pr_err("Unable to start in single node mode\n");
else
- pr_info("TIPC: Started in single node mode\n");
+ pr_info("Started in single node mode\n");
return res;
}
@@ -178,7 +177,7 @@ static void __exit tipc_exit(void)
{
tipc_core_stop_net();
tipc_core_stop();
- pr_info("TIPC: Deactivated\n");
+ pr_info("Deactivated\n");
}
module_init(tipc_init);
diff --git a/net/tipc/core.h b/net/tipc/core.h
index 253e53a..fd42e10 100644
--- a/net/tipc/core.h
+++ b/net/tipc/core.h
@@ -37,6 +37,8 @@
#ifndef _TIPC_CORE_H
#define _TIPC_CORE_H
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include <linux/tipc.h>
#include <linux/tipc_config.h>
#include <linux/types.h>
diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index f385fde..38059e5 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -104,7 +104,7 @@ static void disc_dupl_alert(struct tipc_bearer *b_ptr, u32 node_addr,
tipc_addr_string_fill(node_addr_str, node_addr);
tipc_media_addr_printf(media_addr_str, sizeof(media_addr_str),
media_addr);
- pr_warn("TIPC: Duplicate %s using %s seen on <%s>\n",
+ pr_warn("Duplicate %s using %s seen on <%s>\n",
node_addr_str, media_addr_str, b_ptr->name);
}
diff --git a/net/tipc/handler.c b/net/tipc/handler.c
index 061e7a6..7a52d39 100644
--- a/net/tipc/handler.c
+++ b/net/tipc/handler.c
@@ -57,14 +57,14 @@ unsigned int tipc_k_signal(Handler routine, unsigned long argument)
struct queue_item *item;
if (!handler_enabled) {
- pr_err("TIPC: Signal request ignored by handler\n");
+ pr_err("Signal request ignored by handler\n");
return -ENOPROTOOPT;
}
spin_lock_bh(&qitem_lock);
item = kmem_cache_alloc(tipc_queue_item_cache, GFP_ATOMIC);
if (!item) {
- pr_err("TIPC: Signal queue out of memory\n");
+ pr_err("Signal queue out of memory\n");
spin_unlock_bh(&qitem_lock);
return -ENOMEM;
}
diff --git a/net/tipc/link.c b/net/tipc/link.c
index dab3503..1c1e615 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -44,9 +44,9 @@
/*
* Error message prefixes
*/
-static const char *link_co_err = "TIPC: Link changeover error, ";
-static const char *link_rst_msg = "TIPC: Resetting link ";
-static const char *link_unk_evt = "TIPC: Unknown link event ";
+static const char *link_co_err = "Link changeover error, ";
+static const char *link_rst_msg = "Resetting link ";
+static const char *link_unk_evt = "Unknown link event ";
/*
* Out-of-range value for link session numbers
@@ -306,21 +306,20 @@ struct tipc_link *tipc_link_create(struct tipc_node *n_ptr,
if (n_ptr->link_cnt >= 2) {
tipc_addr_string_fill(addr_string, n_ptr->addr);
- pr_err("TIPC: Attempt to establish third link to %s\n",
- addr_string);
+ pr_err("Attempt to establish third link to %s\n", addr_string);
return NULL;
}
if (n_ptr->links[b_ptr->identity]) {
tipc_addr_string_fill(addr_string, n_ptr->addr);
- pr_err("TIPC: Attempt to establish second link on <%s> to %s\n",
- b_ptr->name, addr_string);
+ pr_err("Attempt to establish second link on <%s> to %s\n",
+ b_ptr->name, addr_string);
return NULL;
}
l_ptr = kzalloc(sizeof(*l_ptr), GFP_ATOMIC);
if (!l_ptr) {
- pr_warn("TIPC: Link creation failed, no memory\n");
+ pr_warn("Link creation failed, no memory\n");
return NULL;
}
@@ -378,7 +377,7 @@ struct tipc_link *tipc_link_create(struct tipc_node *n_ptr,
void tipc_link_delete(struct tipc_link *l_ptr)
{
if (!l_ptr) {
- pr_err("TIPC: Attempt to delete non-existent link\n");
+ pr_err("Attempt to delete non-existent link\n");
return;
}
@@ -762,7 +761,7 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
}
break;
default:
- pr_err("TIPC: Unknown link state %u/%u\n", l_ptr->state, event);
+ pr_err("Unknown link state %u/%u\n", l_ptr->state, event);
}
}
@@ -1417,7 +1416,7 @@ static void link_reset_all(unsigned long addr)
tipc_node_lock(n_ptr);
- pr_warn("TIPC: Resetting all links to %s\n",
+ pr_warn("Resetting all links to %s\n",
tipc_addr_string_fill(addr_string, n_ptr->addr));
for (i = 0; i < MAX_BEARERS; i++) {
@@ -1436,7 +1435,7 @@ static void link_retransmit_failure(struct tipc_link *l_ptr,
{
struct tipc_msg *msg = buf_msg(buf);
- pr_warn("TIPC: Retransmission failure on link <%s>\n", l_ptr->name);
+ pr_warn("Retransmission failure on link <%s>\n", l_ptr->name);
if (l_ptr->addr) {
/* Handle failure on standard link */
@@ -1448,21 +1447,23 @@ static void link_retransmit_failure(struct tipc_link *l_ptr,
struct tipc_node *n_ptr;
char addr_string[16];
- pr_info("TIPC: Msg seq number: %u, ", msg_seqno(msg));
- pr_info("TIPC: Outstanding acks: %lu\n",
+ pr_info("Msg seq number: %u, ", msg_seqno(msg));
+ pr_cont("Outstanding acks: %lu\n",
(unsigned long) TIPC_SKB_CB(buf)->handle);
n_ptr = tipc_bclink_retransmit_to();
tipc_node_lock(n_ptr);
tipc_addr_string_fill(addr_string, n_ptr->addr);
- pr_info("TIPC: Broadcast link info for %s\n", addr_string);
- pr_info("TIPC: Supportable: %d, ", n_ptr->bclink.supportable);
- pr_info("TIPC: Supported: %d, ", n_ptr->bclink.supported);
- pr_info("TIPC: Acked: %u\n", n_ptr->bclink.acked);
- pr_info("TIPC: Last in: %u, ", n_ptr->bclink.last_in);
- pr_info("TIPC: Oos state: %u, ", n_ptr->bclink.oos_state);
- pr_info("TIPC: Last sent: %u\n", n_ptr->bclink.last_sent);
+ pr_info("Broadcast link info for %s\n", addr_string);
+ pr_info("Supportable: %d, Supported: %d, Acked: %u\n",
+ n_ptr->bclink.supportable,
+ n_ptr->bclink.supported,
+ n_ptr->bclink.acked);
+ pr_info("Last in: %u, Oos state: %u, Last sent: %u\n",
+ n_ptr->bclink.last_in,
+ n_ptr->bclink.oos_state,
+ n_ptr->bclink.last_sent);
tipc_k_signal((Handler)link_reset_all, (unsigned long)n_ptr->addr);
@@ -1487,8 +1488,8 @@ void tipc_link_retransmit(struct tipc_link *l_ptr, struct sk_buff *buf,
l_ptr->retransm_queue_head = msg_seqno(msg);
l_ptr->retransm_queue_size = retransmits;
} else {
- pr_err("TIPC: Unexpected retransmit on link %s (qsize=%d)\n",
- l_ptr->name, l_ptr->retransm_queue_size);
+ pr_err("Unexpected retransmit on link %s (qsize=%d)\n",
+ l_ptr->name, l_ptr->retransm_queue_size);
}
return;
} else {
@@ -2304,8 +2305,8 @@ static int link_recv_changeover_msg(struct tipc_link **l_ptr,
if (!dest_link)
goto exit;
if (dest_link == *l_ptr) {
- pr_err("TIPC: Unexpected changeover message on link <%s>\n",
- (*l_ptr)->name);
+ pr_err("Unexpected changeover message on link <%s>\n",
+ (*l_ptr)->name);
goto exit;
}
*l_ptr = dest_link;
@@ -2372,7 +2373,7 @@ void tipc_link_recv_bundle(struct sk_buff *buf)
while (msgcount--) {
obuf = buf_extract(buf, pos);
if (obuf == NULL) {
- pr_warn("TIPC: Link unable to unbundle message(s)\n");
+ pr_warn("Link unable to unbundle message(s)\n");
break;
}
pos += align(msg_size(buf_msg(obuf)));
@@ -2543,7 +2544,7 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
set_fragm_size(pbuf, fragm_sz);
set_expected_frags(pbuf, exp_fragm_cnt - 1);
} else {
- pr_debug("TIPC: Link unable to reassemble fragmented message\n");
+ pr_debug("Link unable to reassemble fragmented message\n");
kfree_skb(fbuf);
return -1;
}
@@ -3010,7 +3011,7 @@ u32 tipc_link_get_max_pkt(u32 dest, u32 selector)
static void link_print(struct tipc_link *l_ptr, const char *str)
{
- pr_info("TIPC: %s Link %x<%s>:", str, l_ptr->addr, l_ptr->b_ptr->name);
+ pr_info("%s Link %x<%s>:", str, l_ptr->addr, l_ptr->b_ptr->name);
if (link_working_unknown(l_ptr))
pr_cont(":WU\n");
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c
index cdd614e..55d3928 100644
--- a/net/tipc/name_distr.c
+++ b/net/tipc/name_distr.c
@@ -161,7 +161,7 @@ void tipc_named_publish(struct publication *publ)
buf = named_prepare_buf(PUBLICATION, ITEM_SIZE, 0);
if (!buf) {
- pr_warn("TIPC: Publication distribution failure\n");
+ pr_warn("Publication distribution failure\n");
return;
}
@@ -186,7 +186,7 @@ void tipc_named_withdraw(struct publication *publ)
buf = named_prepare_buf(WITHDRAWAL, ITEM_SIZE, 0);
if (!buf) {
- pr_warn("TIPC: Withdrawal distribution failure\n");
+ pr_warn("Withdrawal distribution failure\n");
return;
}
@@ -213,7 +213,7 @@ static void named_distribute(struct list_head *message_list, u32 node,
rest -= left;
buf = named_prepare_buf(PUBLICATION, left, node);
if (!buf) {
- pr_warn("TIPC: Bulk publication failure\n");
+ pr_warn("Bulk publication failure\n");
return;
}
item = (struct distr_item *)msg_data(buf_msg(buf));
@@ -283,7 +283,7 @@ static void named_purge_publ(struct publication *publ)
write_unlock_bh(&tipc_nametbl_lock);
if (p != publ) {
- pr_err("TIPC: Unable to remove publication from failed node\n"
+ pr_err("Unable to remove publication from failed node\n"
" (type=%u, lower=%u, node=0x%x, ref=%u, key=%u)\n",
publ->type, publ->lower, publ->node, publ->ref,
publ->key);
@@ -330,14 +330,14 @@ void tipc_named_recv(struct sk_buff *buf)
tipc_nodesub_unsubscribe(&publ->subscr);
kfree(publ);
} else {
- pr_err("TIPC: Unable to remove publication by node 0x%x\n"
+ pr_err("Unable to remove publication by node 0x%x\n"
" (type=%u, lower=%u, ref=%u, key=%u)\n",
msg_orignode(msg), ntohl(item->type),
ntohl(item->lower), ntohl(item->ref),
ntohl(item->key));
}
} else {
- pr_warn("TIPC: Unrecognized name table message received\n");
+ pr_warn("Unrecognized name table message received\n");
}
item++;
}
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
index 0b7eaf1..360c478 100644
--- a/net/tipc/name_table.c
+++ b/net/tipc/name_table.c
@@ -126,7 +126,7 @@ static struct publication *publ_create(u32 type, u32 lower, u32 upper,
{
struct publication *publ = kzalloc(sizeof(*publ), GFP_ATOMIC);
if (publ == NULL) {
- pr_warn("TIPC: Publication creation failure, no memory\n");
+ pr_warn("Publication creation failure, no memory\n");
return NULL;
}
@@ -163,7 +163,7 @@ static struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_hea
struct sub_seq *sseq = tipc_subseq_alloc(1);
if (!nseq || !sseq) {
- pr_warn("TIPC: Name sequence creation failed, no memory\n");
+ pr_warn("Name sequence creation failed, no memory\n");
kfree(nseq);
kfree(sseq);
return NULL;
@@ -263,7 +263,7 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
/* Lower end overlaps existing entry => need an exact match */
if ((sseq->lower != lower) || (sseq->upper != upper)) {
- pr_warn("TIPC: Cannot publish {%u,%u,%u}, overlap error\n",
+ pr_warn("Cannot publish {%u,%u,%u}, overlap error\n",
type, lower, upper);
return NULL;
}
@@ -286,7 +286,7 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
/* Fail if upper end overlaps into an existing entry */
if ((inspos < nseq->first_free) &&
(upper >= nseq->sseqs[inspos].lower)) {
- pr_warn("TIPC: Cannot publish {%u,%u,%u}, overlap error\n",
+ pr_warn("Cannot publish {%u,%u,%u}, overlap error\n",
type, lower, upper);
return NULL;
}
@@ -296,7 +296,7 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
struct sub_seq *sseqs = tipc_subseq_alloc(nseq->alloc * 2);
if (!sseqs) {
- pr_warn("TIPC: Cannot publish {%u,%u,%u}, no memory\n",
+ pr_warn("Cannot publish {%u,%u,%u}, no memory\n",
type, lower, upper);
return NULL;
}
@@ -309,7 +309,7 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
info = kzalloc(sizeof(*info), GFP_ATOMIC);
if (!info) {
- pr_warn("TIPC: Cannot publish {%u,%u,%u}, no memory\n",
+ pr_warn("Cannot publish {%u,%u,%u}, no memory\n",
type, lower, upper);
return NULL;
}
@@ -492,7 +492,7 @@ struct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper,
if ((scope < TIPC_ZONE_SCOPE) || (scope > TIPC_NODE_SCOPE) ||
(lower > upper)) {
- pr_debug("TIPC: Failed to publish illegal {%u,%u,%u} with scope %u\n",
+ pr_debug("Failed to publish illegal {%u,%u,%u} with scope %u\n",
type, lower, upper, scope);
return NULL;
}
@@ -668,7 +668,7 @@ struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper,
struct publication *publ;
if (table.local_publ_count >= tipc_max_publications) {
- pr_warn("TIPC: Publication failed, local publication limit reached (%u)\n",
+ pr_warn("Publication failed, local publication limit reached (%u)\n",
tipc_max_publications);
return NULL;
}
@@ -702,7 +702,7 @@ int tipc_nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key)
return 1;
}
write_unlock_bh(&tipc_nametbl_lock);
- pr_err("TIPC: Unable to remove local publication\n"
+ pr_err("Unable to remove local publication\n"
"(type=%u, lower=%u, ref=%u, key=%u)\n",
type, lower, ref, key);
return 0;
@@ -725,7 +725,7 @@ void tipc_nametbl_subscribe(struct tipc_subscription *s)
tipc_nameseq_subscribe(seq, s);
spin_unlock_bh(&seq->lock);
} else {
- pr_warn("TIPC: Failed to create subscription for {%u,%u,%u}\n",
+ pr_warn("Failed to create subscription for {%u,%u,%u}\n",
s->seq.type, s->seq.lower, s->seq.upper);
}
write_unlock_bh(&tipc_nametbl_lock);
@@ -956,7 +956,7 @@ void tipc_nametbl_stop(void)
for (i = 0; i < tipc_nametbl_size; i++) {
if (hlist_empty(&table.types[i]))
continue;
- pr_err("TIPC: nametbl_stop(): orphaned hash chain detected\n");
+ pr_err("nametbl_stop(): orphaned hash chain detected\n");
break;
}
kfree(table.types);
diff --git a/net/tipc/net.c b/net/tipc/net.c
index 38a34b9..5b5cea2 100644
--- a/net/tipc/net.c
+++ b/net/tipc/net.c
@@ -184,8 +184,8 @@ int tipc_net_start(u32 addr)
tipc_cfg_reinit();
- pr_info("TIPC: Started in network mode\n");
- pr_info("TIPC: Own node address %s, network identity %u\n",
+ pr_info("Started in network mode\n");
+ pr_info("Own node address %s, network identity %u\n",
tipc_addr_string_fill(addr_string, tipc_own_addr), tipc_net_id);
return 0;
}
@@ -202,5 +202,5 @@ void tipc_net_stop(void)
list_for_each_entry_safe(node, t_node, &tipc_node_list, list)
tipc_node_delete(node);
write_unlock_bh(&tipc_net_lock);
- pr_info("TIPC: Left network mode\n");
+ pr_info("Left network mode\n");
}
diff --git a/net/tipc/netlink.c b/net/tipc/netlink.c
index f8ca12d..47a839d 100644
--- a/net/tipc/netlink.c
+++ b/net/tipc/netlink.c
@@ -90,7 +90,7 @@ int tipc_netlink_start(void)
res = genl_register_family_with_ops(&tipc_genl_family,
&tipc_genl_ops, 1);
if (res) {
- pr_err("TIPC: Failed to register netlink interface\n");
+ pr_err("Failed to register netlink interface\n");
return res;
}
diff --git a/net/tipc/node.c b/net/tipc/node.c
index e03fc45..d21db20 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -105,7 +105,7 @@ struct tipc_node *tipc_node_create(u32 addr)
n_ptr = kzalloc(sizeof(*n_ptr), GFP_ATOMIC);
if (!n_ptr) {
spin_unlock_bh(&node_create_lock);
- pr_warn("TIPC: Node creation failed, no memory\n");
+ pr_warn("Node creation failed, no memory\n");
return NULL;
}
@@ -151,7 +151,7 @@ void tipc_node_link_up(struct tipc_node *n_ptr, struct tipc_link *l_ptr)
n_ptr->working_links++;
- pr_info("TIPC: Established link <%s> on network plane %c\n",
+ pr_info("Established link <%s> on network plane %c\n",
l_ptr->name, l_ptr->b_ptr->net_plane);
if (!active[0]) {
@@ -160,7 +160,7 @@ void tipc_node_link_up(struct tipc_node *n_ptr, struct tipc_link *l_ptr)
return;
}
if (l_ptr->priority < active[0]->priority) {
- pr_info("TIPC: New link <%s> becomes standby\n", l_ptr->name);
+ pr_info("New link <%s> becomes standby\n", l_ptr->name);
return;
}
tipc_link_send_duplicate(active[0], l_ptr);
@@ -168,10 +168,9 @@ void tipc_node_link_up(struct tipc_node *n_ptr, struct tipc_link *l_ptr)
active[0] = l_ptr;
return;
}
- pr_info("TIPC: Old link <%s> becomes standby\n", active[0]->name);
+ pr_info("Old link <%s> becomes standby\n", active[0]->name);
if (active[1] != active[0])
- pr_info("TIPC: Old link <%s> becomes standby\n",
- active[1]->name);
+ pr_info("Old link <%s> becomes standby\n", active[1]->name);
active[0] = active[1] = l_ptr;
}
@@ -212,11 +211,11 @@ void tipc_node_link_down(struct tipc_node *n_ptr, struct tipc_link *l_ptr)
n_ptr->working_links--;
if (!tipc_link_is_active(l_ptr)) {
- pr_info("TIPC: Lost standby link <%s> on network plane %c\n",
+ pr_info("Lost standby link <%s> on network plane %c\n",
l_ptr->name, l_ptr->b_ptr->net_plane);
return;
}
- pr_info("TIPC: Lost link <%s> on network plane %c\n",
+ pr_info("Lost link <%s> on network plane %c\n",
l_ptr->name, l_ptr->b_ptr->net_plane);
active = &n_ptr->active_links[0];
@@ -291,7 +290,7 @@ static void node_lost_contact(struct tipc_node *n_ptr)
char addr_string[16];
u32 i;
- pr_info("TIPC: Lost contact with %s\n",
+ pr_info("Lost contact with %s\n",
tipc_addr_string_fill(addr_string, n_ptr->addr));
/* Flush broadcast link info associated with lost node */
diff --git a/net/tipc/node_subscr.c b/net/tipc/node_subscr.c
index 2256281..5e34b01 100644
--- a/net/tipc/node_subscr.c
+++ b/net/tipc/node_subscr.c
@@ -51,7 +51,7 @@ void tipc_nodesub_subscribe(struct tipc_node_subscr *node_sub, u32 addr,
node_sub->node = tipc_node_find(addr);
if (!node_sub->node) {
- pr_warn("TIPC: Node subscription rejected, unknown node 0x%x\n",
+ pr_warn("Node subscription rejected, unknown node 0x%x\n",
addr);
return;
}
diff --git a/net/tipc/port.c b/net/tipc/port.c
index cee4d24..07c42fb 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -191,7 +191,7 @@ void tipc_port_recv_mcast(struct sk_buff *buf, struct tipc_port_list *dp)
struct sk_buff *b = skb_clone(buf, GFP_ATOMIC);
if (b == NULL) {
- pr_warn("TIPC: Unable to deliver multicast message(s)\n");
+ pr_warn("Unable to deliver multicast message(s)\n");
goto exit;
}
if ((index == 0) && (cnt != 0))
@@ -221,12 +221,12 @@ struct tipc_port *tipc_createport_raw(void *usr_handle,
p_ptr = kzalloc(sizeof(*p_ptr), GFP_ATOMIC);
if (!p_ptr) {
- pr_warn("TIPC: Port creation failed, no memory\n");
+ pr_warn("Port creation failed, no memory\n");
return NULL;
}
ref = tipc_ref_acquire(p_ptr, &p_ptr->lock);
if (!ref) {
- pr_warn("TIPC: Port creation failed, ref. table exhausted\n");
+ pr_warn("Port creation failed, ref. table exhausted\n");
kfree(p_ptr);
return NULL;
}
@@ -912,7 +912,7 @@ int tipc_createport(void *usr_handle,
up_ptr = kmalloc(sizeof(*up_ptr), GFP_ATOMIC);
if (!up_ptr) {
- pr_warn("TIPC: Port creation failed, no memory\n");
+ pr_warn("Port creation failed, no memory\n");
return -ENOMEM;
}
p_ptr = tipc_createport_raw(NULL, port_dispatcher, port_wakeup,
diff --git a/net/tipc/ref.c b/net/tipc/ref.c
index 7435871..2a2a938 100644
--- a/net/tipc/ref.c
+++ b/net/tipc/ref.c
@@ -153,11 +153,11 @@ u32 tipc_ref_acquire(void *object, spinlock_t **lock)
struct reference *entry = NULL;
if (!object) {
- pr_err("TIPC: Attempt to acquire ref. to non-existent obj\n");
+ pr_err("Attempt to acquire ref. to non-existent obj\n");
return 0;
}
if (!tipc_ref_table.entries) {
- pr_err("TIPC: Ref. table not found in acquisition attempt\n");
+ pr_err("Ref. table not found in acquisition attempt\n");
return 0;
}
@@ -211,7 +211,7 @@ void tipc_ref_discard(u32 ref)
u32 index_mask;
if (!tipc_ref_table.entries) {
- pr_err("TIPC: Ref. table not found during discard attempt\n");
+ pr_err("Ref. table not found during discard attempt\n");
return;
}
@@ -222,11 +222,11 @@ void tipc_ref_discard(u32 ref)
write_lock_bh(&ref_table_lock);
if (!entry->object) {
- pr_err("TIPC: Attempt to discard ref. to non-existent obj\n");
+ pr_err("Attempt to discard ref. to non-existent obj\n");
goto exit;
}
if (entry->ref != ref) {
- pr_err("TIPC: Attempt to discard non-existent reference\n");
+ pr_err("Attempt to discard non-existent reference\n");
goto exit;
}
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index fefec9c..09dc5b9 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -34,12 +34,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <linux/export.h>
-#include <net/sock.h>
-
#include "core.h"
#include "port.h"
+#include <linux/export.h>
+#include <net/sock.h>
+
#define SS_LISTENING -1 /* socket is listening */
#define SS_READY -2 /* socket is connectionless */
@@ -1787,13 +1787,13 @@ int tipc_socket_init(void)
res = proto_register(&tipc_proto, 1);
if (res) {
- pr_err("TIPC: Failed to register TIPC protocol type\n");
+ pr_err("Failed to register TIPC protocol type\n");
goto out;
}
res = sock_register(&tipc_family_ops);
if (res) {
- pr_err("TIPC: Failed to register TIPC socket type\n");
+ pr_err("Failed to register TIPC socket type\n");
proto_unregister(&tipc_proto);
goto out;
}
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c
index 18703a5..5ed5965 100644
--- a/net/tipc/subscr.c
+++ b/net/tipc/subscr.c
@@ -305,7 +305,7 @@ static struct tipc_subscription *subscr_subscribe(struct tipc_subscr *s,
/* Refuse subscription if global limit exceeded */
if (atomic_read(&topsrv.subscription_count) >= tipc_max_subscriptions) {
- pr_warn("TIPC: Subscription rejected, limit reached (%u)\n",
+ pr_warn("Subscription rejected, limit reached (%u)\n",
tipc_max_subscriptions);
subscr_terminate(subscriber);
return NULL;
@@ -314,7 +314,7 @@ static struct tipc_subscription *subscr_subscribe(struct tipc_subscr *s,
/* Allocate subscription object */
sub = kmalloc(sizeof(*sub), GFP_ATOMIC);
if (!sub) {
- pr_warn("TIPC: Subscription rejected, no memory\n");
+ pr_warn("Subscription rejected, no memory\n");
subscr_terminate(subscriber);
return NULL;
}
@@ -328,7 +328,7 @@ static struct tipc_subscription *subscr_subscribe(struct tipc_subscr *s,
if ((!(sub->filter & TIPC_SUB_PORTS) ==
!(sub->filter & TIPC_SUB_SERVICE)) ||
(sub->seq.lower > sub->seq.upper)) {
- pr_warn("TIPC: Subscription rejected, illegal request\n");
+ pr_warn("Subscription rejected, illegal request\n");
kfree(sub);
subscr_terminate(subscriber);
return NULL;
@@ -440,7 +440,7 @@ static void subscr_named_msg_event(void *usr_handle,
/* Create subscriber object */
subscriber = kzalloc(sizeof(struct tipc_subscriber), GFP_ATOMIC);
if (subscriber == NULL) {
- pr_warn("TIPC: Subscriber rejected, no memory\n");
+ pr_warn("Subscriber rejected, no memory\n");
return;
}
INIT_LIST_HEAD(&subscriber->subscription_list);
@@ -458,7 +458,7 @@ static void subscr_named_msg_event(void *usr_handle,
NULL,
&subscriber->port_ref);
if (subscriber->port_ref == 0) {
- pr_warn("TIPC: Subscriber rejected, unable to create port\n");
+ pr_warn("Subscriber rejected, unable to create port\n");
kfree(subscriber);
return;
}
@@ -517,7 +517,7 @@ int tipc_subscr_start(void)
return 0;
failed:
- pr_err("TIPC: Failed to create subscription service\n");
+ pr_err("Failed to create subscription service\n");
return res;
}
^ permalink raw reply related
* [DANGER 8/7]: ipv4: Cache output routes in fib_info nexthops.
From: David Miller @ 2012-07-12 17:47 UTC (permalink / raw)
To: netdev
Signed-off-by: David S. Miller <davem@davemloft.net>
---
If you really feel like playing with fire, try this patch
on top of the routing cache removal patches.
It gets the output route lookup down to 888 cycles for me.
Something is flaky about it, when I ssh into my test system
for the first time after a boot there is a strange delay of
some sort. It's as if the SYN-ACK is dropped on the way out
of the test machine, and my desktop has to retry the initial
SYN. I plan to investigate this after some sleep.
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index e91fedd..d133110 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -45,6 +45,7 @@ struct fib_config {
};
struct fib_info;
+struct rtable;
struct fib_nh {
struct net_device *nh_dev;
@@ -63,6 +64,8 @@ struct fib_nh {
__be32 nh_gw;
__be32 nh_saddr;
int nh_saddr_genid;
+
+ struct rtable *rth;
};
/*
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index d71bfbd..d1240a0 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -148,6 +148,8 @@ static void free_fib_info_rcu(struct rcu_head *head)
change_nexthops(fi) {
if (nexthop_nh->nh_dev)
dev_put(nexthop_nh->nh_dev);
+ if (nexthop_nh->rth)
+ dst_release(&nexthop_nh->rth->dst);
} endfor_nexthops(fi);
release_net(fi->fib_net);
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index c4b2df6..53b006a 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -983,6 +983,8 @@ static void rt_set_nexthop(struct rtable *rt, const struct flowi4 *fl4,
#ifdef CONFIG_IP_ROUTE_CLASSID
rt->dst.tclassid = FIB_RES_NH(*res).nh_tclassid;
#endif
+ FIB_RES_NH(*res).rth = rt;
+ dst_clone(&rt->dst);
}
#ifdef CONFIG_IP_ROUTE_CLASSID
@@ -1468,6 +1470,13 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
fi = NULL;
}
+ if (fi) {
+ rth = FIB_RES_NH(*res).rth;
+ if (rth) {
+ dst_use(&rth->dst, jiffies);
+ return rth;
+ }
+ }
rth = rt_dst_alloc(dev_out,
IN_DEV_CONF_GET(in_dev, NOPOLICY),
IN_DEV_CONF_GET(in_dev, NOXFRM));
^ permalink raw reply related
* [PATCH 6/6] ipv4: Remove 'rt_dst' from 'struct rtable'
From: David Miller @ 2012-07-12 17:43 UTC (permalink / raw)
To: netdev
Signed-off-by: David S. Miller <davem@davemloft.net>
---
include/net/route.h | 1 -
net/ipv4/route.c | 45 +++++++++------------------------------------
net/ipv4/xfrm4_policy.c | 1 -
3 files changed, 9 insertions(+), 38 deletions(-)
diff --git a/include/net/route.h b/include/net/route.h
index 757fe40..6d111bc 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -48,7 +48,6 @@ struct rtable {
unsigned int rt_flags;
__u16 rt_type;
- __be32 rt_dst; /* Path destination */
int rt_route_iif;
int rt_iif;
int rt_oif;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 266d1bc..c4b2df6 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -690,7 +690,7 @@ void ip_rt_send_redirect(struct sk_buff *skb)
peer->rate_tokens == ip_rt_redirect_number)
net_warn_ratelimited("host %pI4/if%d ignores redirects for %pI4 to %pI4\n",
&ip_hdr(skb)->saddr, rt->rt_iif,
- &rt->rt_dst, &rt->rt_gateway);
+ &ip_hdr(skb)->daddr, &rt->rt_gateway);
#endif
}
out_put_peer:
@@ -951,8 +951,7 @@ static unsigned int ipv4_mtu(const struct dst_entry *dst)
mtu = dst->dev->mtu;
if (unlikely(dst_metric_locked(dst, RTAX_MTU))) {
-
- if (rt->rt_gateway != rt->rt_dst && mtu > 576)
+ if (rt->rt_gateway != 0 && mtu > 576)
mtu = 576;
}
@@ -1047,7 +1046,6 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
rth->rt_genid = rt_genid(dev_net(dev));
rth->rt_flags = RTCF_MULTICAST;
rth->rt_type = RTN_MULTICAST;
- rth->rt_dst = daddr;
rth->rt_route_iif = dev->ifindex;
rth->rt_iif = dev->ifindex;
rth->rt_oif = 0;
@@ -1166,7 +1164,6 @@ static int __mkroute_input(struct sk_buff *skb,
rth->rt_genid = rt_genid(dev_net(rth->dst.dev));
rth->rt_flags = flags;
rth->rt_type = res->type;
- rth->rt_dst = daddr;
rth->rt_route_iif = in_dev->dev->ifindex;
rth->rt_iif = in_dev->dev->ifindex;
rth->rt_oif = 0;
@@ -1332,7 +1329,6 @@ local_input:
rth->rt_genid = rt_genid(net);
rth->rt_flags = flags|RTCF_LOCAL;
rth->rt_type = res.type;
- rth->rt_dst = daddr;
rth->rt_route_iif = dev->ifindex;
rth->rt_iif = dev->ifindex;
rth->rt_oif = 0;
@@ -1483,7 +1479,6 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
rth->rt_genid = rt_genid(dev_net(dev_out));
rth->rt_flags = flags;
rth->rt_type = type;
- rth->rt_dst = fl4->daddr;
rth->rt_route_iif = 0;
rth->rt_iif = orig_oif ? : dev_out->ifindex;
rth->rt_oif = orig_oif;
@@ -1771,7 +1766,6 @@ struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_or
rt->rt_genid = rt_genid(net);
rt->rt_flags = ort->rt_flags;
rt->rt_type = ort->rt_type;
- rt->rt_dst = ort->rt_dst;
rt->rt_gateway = ort->rt_gateway;
rt->fi = ort->fi;
if (rt->fi)
@@ -1802,9 +1796,9 @@ struct rtable *ip_route_output_flow(struct net *net, struct flowi4 *flp4,
}
EXPORT_SYMBOL_GPL(ip_route_output_flow);
-static int rt_fill_info(struct net *net, __be32 src, struct flowi4 *fl4,
- struct sk_buff *skb, u32 pid, u32 seq, int event,
- int nowait, unsigned int flags)
+static int rt_fill_info(struct net *net, __be32 dst, __be32 src,
+ struct flowi4 *fl4, struct sk_buff *skb, u32 pid,
+ u32 seq, int event, int nowait, unsigned int flags)
{
struct rtable *rt = skb_rtable(skb);
struct rtmsg *r;
@@ -1831,7 +1825,7 @@ static int rt_fill_info(struct net *net, __be32 src, struct flowi4 *fl4,
if (rt->rt_flags & RTCF_NOTIFY)
r->rtm_flags |= RTM_F_NOTIFY;
- if (nla_put_be32(skb, RTA_DST, rt->rt_dst))
+ if (nla_put_be32(skb, RTA_DST, dst))
goto nla_put_failure;
if (src) {
r->rtm_src_len = 32;
@@ -1872,29 +1866,8 @@ static int rt_fill_info(struct net *net, __be32 src, struct flowi4 *fl4,
}
if (rt_is_input_route(rt)) {
-#ifdef CONFIG_IP_MROUTE
- __be32 dst = rt->rt_dst;
-
- if (ipv4_is_multicast(dst) && !ipv4_is_local_multicast(dst) &&
- IPV4_DEVCONF_ALL(net, MC_FORWARDING)) {
- int err = ipmr_get_route(net, skb,
- fl4->saddr, fl4->daddr,
- r, nowait);
- if (err <= 0) {
- if (!nowait) {
- if (err == 0)
- return 0;
- goto nla_put_failure;
- } else {
- if (err == -EMSGSIZE)
- goto nla_put_failure;
- error = err;
- }
- }
- } else
-#endif
- if (nla_put_u32(skb, RTA_IIF, rt->rt_iif))
- goto nla_put_failure;
+ if (nla_put_u32(skb, RTA_IIF, rt->rt_iif))
+ goto nla_put_failure;
}
if (rtnl_put_cacheinfo(skb, &rt->dst, 0, expires, error) < 0)
@@ -1989,7 +1962,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void
if (rtm->rtm_flags & RTM_F_NOTIFY)
rt->rt_flags |= RTCF_NOTIFY;
- err = rt_fill_info(net, src, &fl4, skb,
+ err = rt_fill_info(net, dst, src, &fl4, skb,
NETLINK_CB(in_skb).pid, nlh->nlmsg_seq,
RTM_NEWROUTE, 0, 0);
if (err <= 0)
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index dbaf7bc..7c1e410 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -91,7 +91,6 @@ static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
xdst->u.rt.rt_flags = rt->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST |
RTCF_LOCAL);
xdst->u.rt.rt_type = rt->rt_type;
- xdst->u.rt.rt_dst = rt->rt_dst;
xdst->u.rt.rt_gateway = rt->rt_gateway;
xdst->u.rt.rt_pmtu = rt->rt_pmtu;
--
1.7.10.4
^ permalink raw reply related
* [PATCH 5/6] ipv4: Remove 'rt_mark' from 'struct rtable'
From: David Miller @ 2012-07-12 17:43 UTC (permalink / raw)
To: netdev
Signed-off-by: David S. Miller <davem@davemloft.net>
---
include/net/route.h | 1 -
net/ipv4/ipmr.c | 2 +-
net/ipv4/route.c | 9 ++-------
net/ipv4/xfrm4_policy.c | 1 -
4 files changed, 3 insertions(+), 10 deletions(-)
diff --git a/include/net/route.h b/include/net/route.h
index 85d1093..757fe40 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -52,7 +52,6 @@ struct rtable {
int rt_route_iif;
int rt_iif;
int rt_oif;
- __u32 rt_mark;
/* Info on neighbour */
__be32 rt_gateway;
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 5716c6b..eee3bf6 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -1797,7 +1797,7 @@ static struct mr_table *ipmr_rt_fib_lookup(struct net *net, struct sk_buff *skb)
.flowi4_tos = RT_TOS(iph->tos),
.flowi4_oif = rt->rt_oif,
.flowi4_iif = rt->rt_iif,
- .flowi4_mark = rt->rt_mark,
+ .flowi4_mark = skb->mark,
};
struct mr_table *mrt;
int err;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 6e66f6f..266d1bc 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1051,7 +1051,6 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
rth->rt_route_iif = dev->ifindex;
rth->rt_iif = dev->ifindex;
rth->rt_oif = 0;
- rth->rt_mark = skb->mark;
rth->rt_pmtu = 0;
rth->rt_gateway = daddr;
rth->fi = NULL;
@@ -1171,7 +1170,6 @@ static int __mkroute_input(struct sk_buff *skb,
rth->rt_route_iif = in_dev->dev->ifindex;
rth->rt_iif = in_dev->dev->ifindex;
rth->rt_oif = 0;
- rth->rt_mark = skb->mark;
rth->rt_pmtu = 0;
rth->rt_gateway = daddr;
rth->fi = NULL;
@@ -1338,7 +1336,6 @@ local_input:
rth->rt_route_iif = dev->ifindex;
rth->rt_iif = dev->ifindex;
rth->rt_oif = 0;
- rth->rt_mark = skb->mark;
rth->rt_pmtu = 0;
rth->rt_gateway = daddr;
rth->fi = NULL;
@@ -1490,7 +1487,6 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
rth->rt_route_iif = 0;
rth->rt_iif = orig_oif ? : dev_out->ifindex;
rth->rt_oif = orig_oif;
- rth->rt_mark = fl4->flowi4_mark;
rth->rt_pmtu = 0;
rth->rt_gateway = fl4->daddr;
rth->fi = NULL;
@@ -1770,7 +1766,6 @@ struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_or
rt->rt_route_iif = ort->rt_route_iif;
rt->rt_iif = ort->rt_iif;
rt->rt_oif = ort->rt_oif;
- rt->rt_mark = ort->rt_mark;
rt->rt_pmtu = ort->rt_pmtu;
rt->rt_genid = rt_genid(net);
@@ -1863,8 +1858,8 @@ static int rt_fill_info(struct net *net, __be32 src, struct flowi4 *fl4,
if (rtnetlink_put_metrics(skb, dst_metrics_ptr(&rt->dst)) < 0)
goto nla_put_failure;
- if (rt->rt_mark &&
- nla_put_be32(skb, RTA_MARK, rt->rt_mark))
+ if (fl4->flowi4_mark &&
+ nla_put_be32(skb, RTA_MARK, fl4->flowi4_mark))
goto nla_put_failure;
error = rt->dst.error;
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index dd67dd1..dbaf7bc 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -82,7 +82,6 @@ static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
xdst->u.rt.rt_route_iif = fl4->flowi4_iif;
xdst->u.rt.rt_iif = fl4->flowi4_iif;
xdst->u.rt.rt_oif = fl4->flowi4_oif;
- xdst->u.rt.rt_mark = fl4->flowi4_mark;
xdst->u.dst.dev = dev;
dev_hold(dev);
--
1.7.10.4
^ permalink raw reply related
* [PATCH 4/6] ipv4: Kill 'rt_src' from 'struct rtable'
From: David Miller @ 2012-07-12 17:43 UTC (permalink / raw)
To: netdev
Signed-off-by: David S. Miller <davem@davemloft.net>
---
include/net/route.h | 1 -
net/ipv4/route.c | 34 +++++++++++++++-------------------
net/ipv4/xfrm4_policy.c | 1 -
3 files changed, 15 insertions(+), 21 deletions(-)
diff --git a/include/net/route.h b/include/net/route.h
index 935fa59..85d1093 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -49,7 +49,6 @@ struct rtable {
__u16 rt_type;
__be32 rt_dst; /* Path destination */
- __be32 rt_src; /* Path source */
int rt_route_iif;
int rt_iif;
int rt_oif;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index fb9b4eb0..6e66f6f 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1048,7 +1048,6 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
rth->rt_flags = RTCF_MULTICAST;
rth->rt_type = RTN_MULTICAST;
rth->rt_dst = daddr;
- rth->rt_src = saddr;
rth->rt_route_iif = dev->ifindex;
rth->rt_iif = dev->ifindex;
rth->rt_oif = 0;
@@ -1169,7 +1168,6 @@ static int __mkroute_input(struct sk_buff *skb,
rth->rt_flags = flags;
rth->rt_type = res->type;
rth->rt_dst = daddr;
- rth->rt_src = saddr;
rth->rt_route_iif = in_dev->dev->ifindex;
rth->rt_iif = in_dev->dev->ifindex;
rth->rt_oif = 0;
@@ -1337,7 +1335,6 @@ local_input:
rth->rt_flags = flags|RTCF_LOCAL;
rth->rt_type = res.type;
rth->rt_dst = daddr;
- rth->rt_src = saddr;
rth->rt_route_iif = dev->ifindex;
rth->rt_iif = dev->ifindex;
rth->rt_oif = 0;
@@ -1490,7 +1487,6 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
rth->rt_flags = flags;
rth->rt_type = type;
rth->rt_dst = fl4->daddr;
- rth->rt_src = fl4->saddr;
rth->rt_route_iif = 0;
rth->rt_iif = orig_oif ? : dev_out->ifindex;
rth->rt_oif = orig_oif;
@@ -1781,7 +1777,6 @@ struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_or
rt->rt_flags = ort->rt_flags;
rt->rt_type = ort->rt_type;
rt->rt_dst = ort->rt_dst;
- rt->rt_src = ort->rt_src;
rt->rt_gateway = ort->rt_gateway;
rt->fi = ort->fi;
if (rt->fi)
@@ -1812,7 +1807,7 @@ struct rtable *ip_route_output_flow(struct net *net, struct flowi4 *flp4,
}
EXPORT_SYMBOL_GPL(ip_route_output_flow);
-static int rt_fill_info(struct net *net, __be32 src, u8 tos,
+static int rt_fill_info(struct net *net, __be32 src, struct flowi4 *fl4,
struct sk_buff *skb, u32 pid, u32 seq, int event,
int nowait, unsigned int flags)
{
@@ -1830,7 +1825,7 @@ static int rt_fill_info(struct net *net, __be32 src, u8 tos,
r->rtm_family = AF_INET;
r->rtm_dst_len = 32;
r->rtm_src_len = 0;
- r->rtm_tos = tos;
+ r->rtm_tos = fl4->flowi4_tos;
r->rtm_table = RT_TABLE_MAIN;
if (nla_put_u32(skb, RTA_TABLE, RT_TABLE_MAIN))
goto nla_put_failure;
@@ -1857,11 +1852,11 @@ static int rt_fill_info(struct net *net, __be32 src, u8 tos,
goto nla_put_failure;
#endif
if (!rt_is_input_route(rt) &&
- rt->rt_src != src) {
- if (nla_put_be32(skb, RTA_PREFSRC, rt->rt_src))
+ fl4->saddr != src) {
+ if (nla_put_be32(skb, RTA_PREFSRC, fl4->saddr))
goto nla_put_failure;
}
- if (rt->rt_dst != rt->rt_gateway &&
+ if (fl4->daddr != rt->rt_gateway &&
nla_put_be32(skb, RTA_GATEWAY, rt->rt_gateway))
goto nla_put_failure;
@@ -1888,7 +1883,7 @@ static int rt_fill_info(struct net *net, __be32 src, u8 tos,
if (ipv4_is_multicast(dst) && !ipv4_is_local_multicast(dst) &&
IPV4_DEVCONF_ALL(net, MC_FORWARDING)) {
int err = ipmr_get_route(net, skb,
- rt->rt_src, rt->rt_dst,
+ fl4->saddr, fl4->daddr,
r, nowait);
if (err <= 0) {
if (!nowait) {
@@ -1923,6 +1918,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void
struct rtmsg *rtm;
struct nlattr *tb[RTA_MAX+1];
struct rtable *rt = NULL;
+ struct flowi4 fl4;
__be32 dst = 0;
__be32 src = 0;
u32 iif;
@@ -1957,6 +1953,13 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void
iif = tb[RTA_IIF] ? nla_get_u32(tb[RTA_IIF]) : 0;
mark = tb[RTA_MARK] ? nla_get_u32(tb[RTA_MARK]) : 0;
+ memset(&fl4, 0, sizeof(fl4));
+ fl4.daddr = dst;
+ fl4.saddr = src;
+ fl4.flowi4_tos = rtm->rtm_tos;
+ fl4.flowi4_oif = tb[RTA_OIF] ? nla_get_u32(tb[RTA_OIF]) : 0;
+ fl4.flowi4_mark = mark;
+
if (iif) {
struct net_device *dev;
@@ -1977,13 +1980,6 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void
if (err == 0 && rt->dst.error)
err = -rt->dst.error;
} else {
- struct flowi4 fl4 = {
- .daddr = dst,
- .saddr = src,
- .flowi4_tos = rtm->rtm_tos,
- .flowi4_oif = tb[RTA_OIF] ? nla_get_u32(tb[RTA_OIF]) : 0,
- .flowi4_mark = mark,
- };
rt = ip_route_output_key(net, &fl4);
err = 0;
@@ -1998,7 +1994,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void
if (rtm->rtm_flags & RTM_F_NOTIFY)
rt->rt_flags |= RTCF_NOTIFY;
- err = rt_fill_info(net, src, rtm->rtm_tos, skb,
+ err = rt_fill_info(net, src, &fl4, skb,
NETLINK_CB(in_skb).pid, nlh->nlmsg_seq,
RTM_NEWROUTE, 0, 0);
if (err <= 0)
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index a9f0aa8..dd67dd1 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -92,7 +92,6 @@ static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
xdst->u.rt.rt_flags = rt->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST |
RTCF_LOCAL);
xdst->u.rt.rt_type = rt->rt_type;
- xdst->u.rt.rt_src = rt->rt_src;
xdst->u.rt.rt_dst = rt->rt_dst;
xdst->u.rt.rt_gateway = rt->rt_gateway;
xdst->u.rt.rt_pmtu = rt->rt_pmtu;
--
1.7.10.4
^ permalink raw reply related
* [PATCH 3/6] ipv4: Remove rt_key_{src,dst,tos} from struct rtable.
From: David Miller @ 2012-07-12 17:43 UTC (permalink / raw)
To: netdev
They are always used in contexts where they can be reconstituted,
or where the finally resolved rt->rt_{src,dst} is semantically
equivalent.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
include/net/route.h | 5 -----
net/ipv4/route.c | 39 +++++++++------------------------------
net/ipv4/xfrm4_policy.c | 3 ---
3 files changed, 9 insertions(+), 38 deletions(-)
diff --git a/include/net/route.h b/include/net/route.h
index 5c86c47..935fa59 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -44,14 +44,9 @@ struct fib_info;
struct rtable {
struct dst_entry dst;
- /* Lookup key. */
- __be32 rt_key_dst;
- __be32 rt_key_src;
-
int rt_genid;
unsigned int rt_flags;
__u16 rt_type;
- __u8 rt_key_tos;
__be32 rt_dst; /* Path destination */
__be32 rt_src; /* Path source */
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 184f386..fb9b4eb0 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1044,12 +1044,9 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
#endif
rth->dst.output = ip_rt_bug;
- rth->rt_key_dst = daddr;
- rth->rt_key_src = saddr;
rth->rt_genid = rt_genid(dev_net(dev));
rth->rt_flags = RTCF_MULTICAST;
rth->rt_type = RTN_MULTICAST;
- rth->rt_key_tos = tos;
rth->rt_dst = daddr;
rth->rt_src = saddr;
rth->rt_route_iif = dev->ifindex;
@@ -1168,12 +1165,9 @@ static int __mkroute_input(struct sk_buff *skb,
goto cleanup;
}
- rth->rt_key_dst = daddr;
- rth->rt_key_src = saddr;
rth->rt_genid = rt_genid(dev_net(rth->dst.dev));
rth->rt_flags = flags;
rth->rt_type = res->type;
- rth->rt_key_tos = tos;
rth->rt_dst = daddr;
rth->rt_src = saddr;
rth->rt_route_iif = in_dev->dev->ifindex;
@@ -1339,12 +1333,9 @@ local_input:
rth->dst.tclassid = itag;
#endif
- rth->rt_key_dst = daddr;
- rth->rt_key_src = saddr;
rth->rt_genid = rt_genid(net);
rth->rt_flags = flags|RTCF_LOCAL;
rth->rt_type = res.type;
- rth->rt_key_tos = tos;
rth->rt_dst = daddr;
rth->rt_src = saddr;
rth->rt_route_iif = dev->ifindex;
@@ -1444,9 +1435,7 @@ EXPORT_SYMBOL(ip_route_input);
/* called with rcu_read_lock() */
static struct rtable *__mkroute_output(const struct fib_result *res,
- const struct flowi4 *fl4,
- __be32 orig_daddr, __be32 orig_saddr,
- int orig_oif, __u8 orig_rtos,
+ const struct flowi4 *fl4, int orig_oif,
struct net_device *dev_out,
unsigned int flags)
{
@@ -1497,12 +1486,9 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
rth->dst.output = ip_output;
- rth->rt_key_dst = orig_daddr;
- rth->rt_key_src = orig_saddr;
rth->rt_genid = rt_genid(dev_net(dev_out));
rth->rt_flags = flags;
rth->rt_type = type;
- rth->rt_key_tos = orig_rtos;
rth->rt_dst = fl4->daddr;
rth->rt_src = fl4->saddr;
rth->rt_route_iif = 0;
@@ -1553,8 +1539,6 @@ struct rtable *__ip_route_output_key(struct net *net, struct flowi4 *fl4)
unsigned int flags = 0;
struct fib_result res;
struct rtable *rth;
- __be32 orig_daddr;
- __be32 orig_saddr;
int orig_oif;
res.fi = NULL;
@@ -1563,8 +1547,6 @@ struct rtable *__ip_route_output_key(struct net *net, struct flowi4 *fl4)
res.r = NULL;
#endif
- orig_daddr = fl4->daddr;
- orig_saddr = fl4->saddr;
orig_oif = fl4->flowi4_oif;
fl4->flowi4_iif = net->loopback_dev->ifindex;
@@ -1726,8 +1708,7 @@ struct rtable *__ip_route_output_key(struct net *net, struct flowi4 *fl4)
make_route:
- rth = __mkroute_output(&res, fl4, orig_daddr, orig_saddr, orig_oif,
- tos, dev_out, flags);
+ rth = __mkroute_output(&res, fl4, orig_oif, dev_out, flags);
out:
rcu_read_unlock();
@@ -1790,9 +1771,6 @@ struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_or
if (new->dev)
dev_hold(new->dev);
- rt->rt_key_dst = ort->rt_key_dst;
- rt->rt_key_src = ort->rt_key_src;
- rt->rt_key_tos = ort->rt_key_tos;
rt->rt_route_iif = ort->rt_route_iif;
rt->rt_iif = ort->rt_iif;
rt->rt_oif = ort->rt_oif;
@@ -1834,7 +1812,7 @@ struct rtable *ip_route_output_flow(struct net *net, struct flowi4 *flp4,
}
EXPORT_SYMBOL_GPL(ip_route_output_flow);
-static int rt_fill_info(struct net *net,
+static int rt_fill_info(struct net *net, __be32 src, u8 tos,
struct sk_buff *skb, u32 pid, u32 seq, int event,
int nowait, unsigned int flags)
{
@@ -1852,7 +1830,7 @@ static int rt_fill_info(struct net *net,
r->rtm_family = AF_INET;
r->rtm_dst_len = 32;
r->rtm_src_len = 0;
- r->rtm_tos = rt->rt_key_tos;
+ r->rtm_tos = tos;
r->rtm_table = RT_TABLE_MAIN;
if (nla_put_u32(skb, RTA_TABLE, RT_TABLE_MAIN))
goto nla_put_failure;
@@ -1865,9 +1843,9 @@ static int rt_fill_info(struct net *net,
if (nla_put_be32(skb, RTA_DST, rt->rt_dst))
goto nla_put_failure;
- if (rt->rt_key_src) {
+ if (src) {
r->rtm_src_len = 32;
- if (nla_put_be32(skb, RTA_SRC, rt->rt_key_src))
+ if (nla_put_be32(skb, RTA_SRC, src))
goto nla_put_failure;
}
if (rt->dst.dev &&
@@ -1879,7 +1857,7 @@ static int rt_fill_info(struct net *net,
goto nla_put_failure;
#endif
if (!rt_is_input_route(rt) &&
- rt->rt_src != rt->rt_key_src) {
+ rt->rt_src != src) {
if (nla_put_be32(skb, RTA_PREFSRC, rt->rt_src))
goto nla_put_failure;
}
@@ -2020,7 +1998,8 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void
if (rtm->rtm_flags & RTM_F_NOTIFY)
rt->rt_flags |= RTCF_NOTIFY;
- err = rt_fill_info(net, skb, NETLINK_CB(in_skb).pid, nlh->nlmsg_seq,
+ err = rt_fill_info(net, src, rtm->rtm_tos, skb,
+ NETLINK_CB(in_skb).pid, nlh->nlmsg_seq,
RTM_NEWROUTE, 0, 0);
if (err <= 0)
goto errout_free;
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index 737131c..a9f0aa8 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -79,9 +79,6 @@ static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
struct rtable *rt = (struct rtable *)xdst->route;
const struct flowi4 *fl4 = &fl->u.ip4;
- xdst->u.rt.rt_key_dst = fl4->daddr;
- xdst->u.rt.rt_key_src = fl4->saddr;
- xdst->u.rt.rt_key_tos = fl4->flowi4_tos;
xdst->u.rt.rt_route_iif = fl4->flowi4_iif;
xdst->u.rt.rt_iif = fl4->flowi4_iif;
xdst->u.rt.rt_oif = fl4->flowi4_oif;
--
1.7.10.4
^ permalink raw reply related
* [PATCH 2/6] ipv4: Kill ip_route_input_noref().
From: David Miller @ 2012-07-12 17:43 UTC (permalink / raw)
To: netdev
The "noref" argument to ip_route_input_common() is now always ignored
because we do not cache routes, and in that case we must always grab
a reference to the resulting 'dst'.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
include/net/route.h | 16 ++--------------
net/ipv4/arp.c | 2 +-
net/ipv4/ip_fragment.c | 4 ++--
net/ipv4/ip_input.c | 4 ++--
net/ipv4/route.c | 6 +++---
net/ipv4/xfrm4_input.c | 4 ++--
6 files changed, 12 insertions(+), 24 deletions(-)
diff --git a/include/net/route.h b/include/net/route.h
index 5dcfeb6..5c86c47 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -160,20 +160,8 @@ static inline struct rtable *ip_route_output_gre(struct net *net, struct flowi4
return ip_route_output_key(net, fl4);
}
-extern int ip_route_input_common(struct sk_buff *skb, __be32 dst, __be32 src,
- u8 tos, struct net_device *devin, bool noref);
-
-static inline int ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src,
- u8 tos, struct net_device *devin)
-{
- return ip_route_input_common(skb, dst, src, tos, devin, false);
-}
-
-static inline int ip_route_input_noref(struct sk_buff *skb, __be32 dst, __be32 src,
- u8 tos, struct net_device *devin)
-{
- return ip_route_input_common(skb, dst, src, tos, devin, true);
-}
+extern int ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src,
+ u8 tos, struct net_device *devin);
extern void ipv4_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu,
int oif, u32 mark, u8 protocol, int flow_flags);
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 2e560f0..c38293f 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -828,7 +828,7 @@ static int arp_process(struct sk_buff *skb)
}
if (arp->ar_op == htons(ARPOP_REQUEST) &&
- ip_route_input_noref(skb, tip, sip, 0, dev) == 0) {
+ ip_route_input(skb, tip, sip, 0, dev) == 0) {
rt = skb_rtable(skb);
addr_type = rt->rt_type;
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 8d07c97..7ad88e5 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -258,8 +258,8 @@ static void ip_expire(unsigned long arg)
/* skb dst is stale, drop it, and perform route lookup again */
skb_dst_drop(head);
iph = ip_hdr(head);
- err = ip_route_input_noref(head, iph->daddr, iph->saddr,
- iph->tos, head->dev);
+ err = ip_route_input(head, iph->daddr, iph->saddr,
+ iph->tos, head->dev);
if (err)
goto out_rcu_unlock;
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index b27d444..4ebc6fe 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -336,8 +336,8 @@ static int ip_rcv_finish(struct sk_buff *skb)
* how the packet travels inside Linux networking.
*/
if (!skb_dst(skb)) {
- int err = ip_route_input_noref(skb, iph->daddr, iph->saddr,
- iph->tos, skb->dev);
+ int err = ip_route_input(skb, iph->daddr, iph->saddr,
+ iph->tos, skb->dev);
if (unlikely(err)) {
if (err == -EXDEV)
NET_INC_STATS_BH(dev_net(skb->dev),
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 4fdcb71..184f386 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1396,8 +1396,8 @@ martian_source_keep_err:
goto out;
}
-int ip_route_input_common(struct sk_buff *skb, __be32 daddr, __be32 saddr,
- u8 tos, struct net_device *dev, bool noref)
+int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr,
+ u8 tos, struct net_device *dev)
{
int res;
@@ -1440,7 +1440,7 @@ int ip_route_input_common(struct sk_buff *skb, __be32 daddr, __be32 saddr,
rcu_read_unlock();
return res;
}
-EXPORT_SYMBOL(ip_route_input_common);
+EXPORT_SYMBOL(ip_route_input);
/* called with rcu_read_lock() */
static struct rtable *__mkroute_output(const struct fib_result *res,
diff --git a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c
index 06814b6..58d23a5 100644
--- a/net/ipv4/xfrm4_input.c
+++ b/net/ipv4/xfrm4_input.c
@@ -27,8 +27,8 @@ static inline int xfrm4_rcv_encap_finish(struct sk_buff *skb)
if (skb_dst(skb) == NULL) {
const struct iphdr *iph = ip_hdr(skb);
- if (ip_route_input_noref(skb, iph->daddr, iph->saddr,
- iph->tos, skb->dev))
+ if (ip_route_input(skb, iph->daddr, iph->saddr,
+ iph->tos, skb->dev))
goto drop;
}
return dst_input(skb);
--
1.7.10.4
^ permalink raw reply related
* [PATCH 1/6] ipv4: Delete routing cache.
From: David Miller @ 2012-07-12 17:42 UTC (permalink / raw)
To: netdev
Signed-off-by: David S. Miller <davem@davemloft.net>
---
include/net/route.h | 1 -
net/ipv4/fib_frontend.c | 5 -
net/ipv4/route.c | 940 +----------------------------------------------
3 files changed, 13 insertions(+), 933 deletions(-)
diff --git a/include/net/route.h b/include/net/route.h
index ace3cb4..5dcfeb6 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -109,7 +109,6 @@ extern struct ip_rt_acct __percpu *ip_rt_acct;
struct in_device;
extern int ip_rt_init(void);
extern void rt_cache_flush(struct net *net, int how);
-extern void rt_cache_flush_batch(struct net *net);
extern struct rtable *__ip_route_output_key(struct net *, struct flowi4 *flp);
extern struct rtable *ip_route_output_flow(struct net *, struct flowi4 *flp,
struct sock *sk);
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 81f8571..3a0be46 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -1079,11 +1079,6 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
rt_cache_flush(dev_net(dev), 0);
break;
case NETDEV_UNREGISTER_BATCH:
- /* The batch unregister is only called on the first
- * device in the list of devices being unregistered.
- * Therefore we should not pass dev_net(dev) in here.
- */
- rt_cache_flush_batch(NULL);
break;
}
return NOTIFY_DONE;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 9319bf1..4fdcb71 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -133,10 +133,6 @@ static int ip_rt_gc_elasticity __read_mostly = 8;
static int ip_rt_mtu_expires __read_mostly = 10 * 60 * HZ;
static int ip_rt_min_pmtu __read_mostly = 512 + 20 + 20;
static int ip_rt_min_advmss __read_mostly = 256;
-static int rt_chain_length_max __read_mostly = 20;
-
-static struct delayed_work expires_work;
-static unsigned long expires_ljiffies;
/*
* Interface to generic destination cache.
@@ -150,7 +146,6 @@ static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst);
static void ipv4_link_failure(struct sk_buff *skb);
static void ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu);
static void ip_do_redirect(struct dst_entry *dst, struct sk_buff *skb);
-static int rt_garbage_collect(struct dst_ops *ops);
static void ipv4_dst_ifdown(struct dst_entry *dst, struct net_device *dev,
int how)
@@ -170,7 +165,6 @@ static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst,
static struct dst_ops ipv4_dst_ops = {
.family = AF_INET,
.protocol = cpu_to_be16(ETH_P_IP),
- .gc = rt_garbage_collect,
.check = ipv4_dst_check,
.default_advmss = ipv4_default_advmss,
.mtu = ipv4_mtu,
@@ -207,184 +201,30 @@ const __u8 ip_tos2prio[16] = {
};
EXPORT_SYMBOL(ip_tos2prio);
-/*
- * Route cache.
- */
-
-/* The locking scheme is rather straight forward:
- *
- * 1) Read-Copy Update protects the buckets of the central route hash.
- * 2) Only writers remove entries, and they hold the lock
- * as they look at rtable reference counts.
- * 3) Only readers acquire references to rtable entries,
- * they do so with atomic increments and with the
- * lock held.
- */
-
-struct rt_hash_bucket {
- struct rtable __rcu *chain;
-};
-
-#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) || \
- defined(CONFIG_PROVE_LOCKING)
-/*
- * Instead of using one spinlock for each rt_hash_bucket, we use a table of spinlocks
- * The size of this table is a power of two and depends on the number of CPUS.
- * (on lockdep we have a quite big spinlock_t, so keep the size down there)
- */
-#ifdef CONFIG_LOCKDEP
-# define RT_HASH_LOCK_SZ 256
-#else
-# if NR_CPUS >= 32
-# define RT_HASH_LOCK_SZ 4096
-# elif NR_CPUS >= 16
-# define RT_HASH_LOCK_SZ 2048
-# elif NR_CPUS >= 8
-# define RT_HASH_LOCK_SZ 1024
-# elif NR_CPUS >= 4
-# define RT_HASH_LOCK_SZ 512
-# else
-# define RT_HASH_LOCK_SZ 256
-# endif
-#endif
-
-static spinlock_t *rt_hash_locks;
-# define rt_hash_lock_addr(slot) &rt_hash_locks[(slot) & (RT_HASH_LOCK_SZ - 1)]
-
-static __init void rt_hash_lock_init(void)
-{
- int i;
-
- rt_hash_locks = kmalloc(sizeof(spinlock_t) * RT_HASH_LOCK_SZ,
- GFP_KERNEL);
- if (!rt_hash_locks)
- panic("IP: failed to allocate rt_hash_locks\n");
-
- for (i = 0; i < RT_HASH_LOCK_SZ; i++)
- spin_lock_init(&rt_hash_locks[i]);
-}
-#else
-# define rt_hash_lock_addr(slot) NULL
-
-static inline void rt_hash_lock_init(void)
-{
-}
-#endif
-
-static struct rt_hash_bucket *rt_hash_table __read_mostly;
-static unsigned int rt_hash_mask __read_mostly;
-static unsigned int rt_hash_log __read_mostly;
-
static DEFINE_PER_CPU(struct rt_cache_stat, rt_cache_stat);
#define RT_CACHE_STAT_INC(field) __this_cpu_inc(rt_cache_stat.field)
-static inline unsigned int rt_hash(__be32 daddr, __be32 saddr, int idx,
- int genid)
-{
- return jhash_3words((__force u32)daddr, (__force u32)saddr,
- idx, genid)
- & rt_hash_mask;
-}
-
static inline int rt_genid(struct net *net)
{
return atomic_read(&net->ipv4.rt_genid);
}
#ifdef CONFIG_PROC_FS
-struct rt_cache_iter_state {
- struct seq_net_private p;
- int bucket;
- int genid;
-};
-
-static struct rtable *rt_cache_get_first(struct seq_file *seq)
-{
- struct rt_cache_iter_state *st = seq->private;
- struct rtable *r = NULL;
-
- for (st->bucket = rt_hash_mask; st->bucket >= 0; --st->bucket) {
- if (!rcu_access_pointer(rt_hash_table[st->bucket].chain))
- continue;
- rcu_read_lock_bh();
- r = rcu_dereference_bh(rt_hash_table[st->bucket].chain);
- while (r) {
- if (dev_net(r->dst.dev) == seq_file_net(seq) &&
- r->rt_genid == st->genid)
- return r;
- r = rcu_dereference_bh(r->dst.rt_next);
- }
- rcu_read_unlock_bh();
- }
- return r;
-}
-
-static struct rtable *__rt_cache_get_next(struct seq_file *seq,
- struct rtable *r)
-{
- struct rt_cache_iter_state *st = seq->private;
-
- r = rcu_dereference_bh(r->dst.rt_next);
- while (!r) {
- rcu_read_unlock_bh();
- do {
- if (--st->bucket < 0)
- return NULL;
- } while (!rcu_access_pointer(rt_hash_table[st->bucket].chain));
- rcu_read_lock_bh();
- r = rcu_dereference_bh(rt_hash_table[st->bucket].chain);
- }
- return r;
-}
-
-static struct rtable *rt_cache_get_next(struct seq_file *seq,
- struct rtable *r)
-{
- struct rt_cache_iter_state *st = seq->private;
- while ((r = __rt_cache_get_next(seq, r)) != NULL) {
- if (dev_net(r->dst.dev) != seq_file_net(seq))
- continue;
- if (r->rt_genid == st->genid)
- break;
- }
- return r;
-}
-
-static struct rtable *rt_cache_get_idx(struct seq_file *seq, loff_t pos)
-{
- struct rtable *r = rt_cache_get_first(seq);
-
- if (r)
- while (pos && (r = rt_cache_get_next(seq, r)))
- --pos;
- return pos ? NULL : r;
-}
-
static void *rt_cache_seq_start(struct seq_file *seq, loff_t *pos)
{
- struct rt_cache_iter_state *st = seq->private;
if (*pos)
- return rt_cache_get_idx(seq, *pos - 1);
- st->genid = rt_genid(seq_file_net(seq));
+ return NULL;
return SEQ_START_TOKEN;
}
static void *rt_cache_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
- struct rtable *r;
-
- if (v == SEQ_START_TOKEN)
- r = rt_cache_get_first(seq);
- else
- r = rt_cache_get_next(seq, v);
++*pos;
- return r;
+ return NULL;
}
static void rt_cache_seq_stop(struct seq_file *seq, void *v)
{
- if (v && v != SEQ_START_TOKEN)
- rcu_read_unlock_bh();
}
static int rt_cache_seq_show(struct seq_file *seq, void *v)
@@ -394,24 +234,6 @@ static int rt_cache_seq_show(struct seq_file *seq, void *v)
"Iface\tDestination\tGateway \tFlags\t\tRefCnt\tUse\t"
"Metric\tSource\t\tMTU\tWindow\tIRTT\tTOS\tHHRef\t"
"HHUptod\tSpecDst");
- else {
- struct rtable *r = v;
- int len;
-
- seq_printf(seq, "%s\t%08X\t%08X\t%8X\t%d\t%u\t%d\t"
- "%08X\t%d\t%u\t%u\t%02X\t%d\t%1d\t%08X%n",
- r->dst.dev ? r->dst.dev->name : "*",
- (__force u32)r->rt_dst,
- (__force u32)r->rt_gateway,
- r->rt_flags, atomic_read(&r->dst.__refcnt),
- r->dst.__use, 0, (__force u32)r->rt_src,
- dst_metric_advmss(&r->dst) + 40,
- dst_metric(&r->dst, RTAX_WINDOW), 0,
- r->rt_key_tos,
- -1, 0, 0, &len);
-
- seq_printf(seq, "%*s\n", 127 - len, "");
- }
return 0;
}
@@ -424,8 +246,7 @@ static const struct seq_operations rt_cache_seq_ops = {
static int rt_cache_seq_open(struct inode *inode, struct file *file)
{
- return seq_open_net(inode, file, &rt_cache_seq_ops,
- sizeof(struct rt_cache_iter_state));
+ return seq_open(file, &rt_cache_seq_ops);
}
static const struct file_operations rt_cache_seq_fops = {
@@ -433,7 +254,7 @@ static const struct file_operations rt_cache_seq_fops = {
.open = rt_cache_seq_open,
.read = seq_read,
.llseek = seq_lseek,
- .release = seq_release_net,
+ .release = seq_release,
};
@@ -623,263 +444,12 @@ static inline int ip_rt_proc_init(void)
}
#endif /* CONFIG_PROC_FS */
-static inline void rt_free(struct rtable *rt)
-{
- call_rcu_bh(&rt->dst.rcu_head, dst_rcu_free);
-}
-
-static inline void rt_drop(struct rtable *rt)
-{
- ip_rt_put(rt);
- call_rcu_bh(&rt->dst.rcu_head, dst_rcu_free);
-}
-
-static inline int rt_fast_clean(struct rtable *rth)
-{
- /* Kill broadcast/multicast entries very aggresively, if they
- collide in hash table with more useful entries */
- return (rth->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) &&
- rt_is_input_route(rth) && rth->dst.rt_next;
-}
-
-static inline int rt_valuable(struct rtable *rth)
-{
- return (rth->rt_flags & (RTCF_REDIRECTED | RTCF_NOTIFY)) ||
- rth->dst.expires;
-}
-
-static int rt_may_expire(struct rtable *rth, unsigned long tmo1, unsigned long tmo2)
-{
- unsigned long age;
- int ret = 0;
-
- if (atomic_read(&rth->dst.__refcnt))
- goto out;
-
- age = jiffies - rth->dst.lastuse;
- if ((age <= tmo1 && !rt_fast_clean(rth)) ||
- (age <= tmo2 && rt_valuable(rth)))
- goto out;
- ret = 1;
-out: return ret;
-}
-
-/* Bits of score are:
- * 31: very valuable
- * 30: not quite useless
- * 29..0: usage counter
- */
-static inline u32 rt_score(struct rtable *rt)
-{
- u32 score = jiffies - rt->dst.lastuse;
-
- score = ~score & ~(3<<30);
-
- if (rt_valuable(rt))
- score |= (1<<31);
-
- if (rt_is_output_route(rt) ||
- !(rt->rt_flags & (RTCF_BROADCAST|RTCF_MULTICAST|RTCF_LOCAL)))
- score |= (1<<30);
-
- return score;
-}
-
-static inline bool rt_caching(const struct net *net)
-{
- return net->ipv4.current_rt_cache_rebuild_count <=
- net->ipv4.sysctl_rt_cache_rebuild_count;
-}
-
-static inline bool compare_hash_inputs(const struct rtable *rt1,
- const struct rtable *rt2)
-{
- return ((((__force u32)rt1->rt_key_dst ^ (__force u32)rt2->rt_key_dst) |
- ((__force u32)rt1->rt_key_src ^ (__force u32)rt2->rt_key_src) |
- (rt1->rt_route_iif ^ rt2->rt_route_iif)) == 0);
-}
-
-static inline int compare_keys(struct rtable *rt1, struct rtable *rt2)
-{
- return (((__force u32)rt1->rt_key_dst ^ (__force u32)rt2->rt_key_dst) |
- ((__force u32)rt1->rt_key_src ^ (__force u32)rt2->rt_key_src) |
- (rt1->rt_mark ^ rt2->rt_mark) |
- (rt1->rt_key_tos ^ rt2->rt_key_tos) |
- (rt1->rt_route_iif ^ rt2->rt_route_iif) |
- (rt1->rt_oif ^ rt2->rt_oif)) == 0;
-}
-
-static inline int compare_netns(struct rtable *rt1, struct rtable *rt2)
-{
- return net_eq(dev_net(rt1->dst.dev), dev_net(rt2->dst.dev));
-}
-
static inline int rt_is_expired(struct rtable *rth)
{
return rth->rt_genid != rt_genid(dev_net(rth->dst.dev));
}
/*
- * Perform a full scan of hash table and free all entries.
- * Can be called by a softirq or a process.
- * In the later case, we want to be reschedule if necessary
- */
-static void rt_do_flush(struct net *net, int process_context)
-{
- unsigned int i;
- struct rtable *rth, *next;
-
- for (i = 0; i <= rt_hash_mask; i++) {
- struct rtable __rcu **pprev;
- struct rtable *list;
-
- if (process_context && need_resched())
- cond_resched();
- rth = rcu_access_pointer(rt_hash_table[i].chain);
- if (!rth)
- continue;
-
- spin_lock_bh(rt_hash_lock_addr(i));
-
- list = NULL;
- pprev = &rt_hash_table[i].chain;
- rth = rcu_dereference_protected(*pprev,
- lockdep_is_held(rt_hash_lock_addr(i)));
-
- while (rth) {
- next = rcu_dereference_protected(rth->dst.rt_next,
- lockdep_is_held(rt_hash_lock_addr(i)));
-
- if (!net ||
- net_eq(dev_net(rth->dst.dev), net)) {
- rcu_assign_pointer(*pprev, next);
- rcu_assign_pointer(rth->dst.rt_next, list);
- list = rth;
- } else {
- pprev = &rth->dst.rt_next;
- }
- rth = next;
- }
-
- spin_unlock_bh(rt_hash_lock_addr(i));
-
- for (; list; list = next) {
- next = rcu_dereference_protected(list->dst.rt_next, 1);
- rt_free(list);
- }
- }
-}
-
-/*
- * While freeing expired entries, we compute average chain length
- * and standard deviation, using fixed-point arithmetic.
- * This to have an estimation of rt_chain_length_max
- * rt_chain_length_max = max(elasticity, AVG + 4*SD)
- * We use 3 bits for frational part, and 29 (or 61) for magnitude.
- */
-
-#define FRACT_BITS 3
-#define ONE (1UL << FRACT_BITS)
-
-/*
- * Given a hash chain and an item in this hash chain,
- * find if a previous entry has the same hash_inputs
- * (but differs on tos, mark or oif)
- * Returns 0 if an alias is found.
- * Returns ONE if rth has no alias before itself.
- */
-static int has_noalias(const struct rtable *head, const struct rtable *rth)
-{
- const struct rtable *aux = head;
-
- while (aux != rth) {
- if (compare_hash_inputs(aux, rth))
- return 0;
- aux = rcu_dereference_protected(aux->dst.rt_next, 1);
- }
- return ONE;
-}
-
-static void rt_check_expire(void)
-{
- static unsigned int rover;
- unsigned int i = rover, goal;
- struct rtable *rth;
- struct rtable __rcu **rthp;
- unsigned long samples = 0;
- unsigned long sum = 0, sum2 = 0;
- unsigned long delta;
- u64 mult;
-
- delta = jiffies - expires_ljiffies;
- expires_ljiffies = jiffies;
- mult = ((u64)delta) << rt_hash_log;
- if (ip_rt_gc_timeout > 1)
- do_div(mult, ip_rt_gc_timeout);
- goal = (unsigned int)mult;
- if (goal > rt_hash_mask)
- goal = rt_hash_mask + 1;
- for (; goal > 0; goal--) {
- unsigned long tmo = ip_rt_gc_timeout;
- unsigned long length;
-
- i = (i + 1) & rt_hash_mask;
- rthp = &rt_hash_table[i].chain;
-
- if (need_resched())
- cond_resched();
-
- samples++;
-
- if (rcu_dereference_raw(*rthp) == NULL)
- continue;
- length = 0;
- spin_lock_bh(rt_hash_lock_addr(i));
- while ((rth = rcu_dereference_protected(*rthp,
- lockdep_is_held(rt_hash_lock_addr(i)))) != NULL) {
- prefetch(rth->dst.rt_next);
- if (rt_is_expired(rth) ||
- rt_may_expire(rth, tmo, ip_rt_gc_timeout)) {
- *rthp = rth->dst.rt_next;
- rt_free(rth);
- continue;
- }
-
- /* We only count entries on a chain with equal
- * hash inputs once so that entries for
- * different QOS levels, and other non-hash
- * input attributes don't unfairly skew the
- * length computation
- */
- tmo >>= 1;
- rthp = &rth->dst.rt_next;
- length += has_noalias(rt_hash_table[i].chain, rth);
- }
- spin_unlock_bh(rt_hash_lock_addr(i));
- sum += length;
- sum2 += length*length;
- }
- if (samples) {
- unsigned long avg = sum / samples;
- unsigned long sd = int_sqrt(sum2 / samples - avg*avg);
- rt_chain_length_max = max_t(unsigned long,
- ip_rt_gc_elasticity,
- (avg + 4*sd) >> FRACT_BITS);
- }
- rover = i;
-}
-
-/*
- * rt_worker_func() is run in process context.
- * we call rt_check_expire() to scan part of the hash table
- */
-static void rt_worker_func(struct work_struct *work)
-{
- rt_check_expire();
- schedule_delayed_work(&expires_work, ip_rt_gc_interval);
-}
-
-/*
* Perturbation of rt_genid by a small quantity [1..256]
* Using 8 bits of shuffling ensure we can call rt_cache_invalidate()
* many times (2^24) without giving recent rt_genid.
@@ -900,167 +470,6 @@ static void rt_cache_invalidate(struct net *net)
void rt_cache_flush(struct net *net, int delay)
{
rt_cache_invalidate(net);
- if (delay >= 0)
- rt_do_flush(net, !in_softirq());
-}
-
-/* Flush previous cache invalidated entries from the cache */
-void rt_cache_flush_batch(struct net *net)
-{
- rt_do_flush(net, !in_softirq());
-}
-
-static void rt_emergency_hash_rebuild(struct net *net)
-{
- net_warn_ratelimited("Route hash chain too long!\n");
- rt_cache_invalidate(net);
-}
-
-/*
- Short description of GC goals.
-
- We want to build algorithm, which will keep routing cache
- at some equilibrium point, when number of aged off entries
- is kept approximately equal to newly generated ones.
-
- Current expiration strength is variable "expire".
- We try to adjust it dynamically, so that if networking
- is idle expires is large enough to keep enough of warm entries,
- and when load increases it reduces to limit cache size.
- */
-
-static int rt_garbage_collect(struct dst_ops *ops)
-{
- static unsigned long expire = RT_GC_TIMEOUT;
- static unsigned long last_gc;
- static int rover;
- static int equilibrium;
- struct rtable *rth;
- struct rtable __rcu **rthp;
- unsigned long now = jiffies;
- int goal;
- int entries = dst_entries_get_fast(&ipv4_dst_ops);
-
- /*
- * Garbage collection is pretty expensive,
- * do not make it too frequently.
- */
-
- RT_CACHE_STAT_INC(gc_total);
-
- if (now - last_gc < ip_rt_gc_min_interval &&
- entries < ip_rt_max_size) {
- RT_CACHE_STAT_INC(gc_ignored);
- goto out;
- }
-
- entries = dst_entries_get_slow(&ipv4_dst_ops);
- /* Calculate number of entries, which we want to expire now. */
- goal = entries - (ip_rt_gc_elasticity << rt_hash_log);
- if (goal <= 0) {
- if (equilibrium < ipv4_dst_ops.gc_thresh)
- equilibrium = ipv4_dst_ops.gc_thresh;
- goal = entries - equilibrium;
- if (goal > 0) {
- equilibrium += min_t(unsigned int, goal >> 1, rt_hash_mask + 1);
- goal = entries - equilibrium;
- }
- } else {
- /* We are in dangerous area. Try to reduce cache really
- * aggressively.
- */
- goal = max_t(unsigned int, goal >> 1, rt_hash_mask + 1);
- equilibrium = entries - goal;
- }
-
- if (now - last_gc >= ip_rt_gc_min_interval)
- last_gc = now;
-
- if (goal <= 0) {
- equilibrium += goal;
- goto work_done;
- }
-
- do {
- int i, k;
-
- for (i = rt_hash_mask, k = rover; i >= 0; i--) {
- unsigned long tmo = expire;
-
- k = (k + 1) & rt_hash_mask;
- rthp = &rt_hash_table[k].chain;
- spin_lock_bh(rt_hash_lock_addr(k));
- while ((rth = rcu_dereference_protected(*rthp,
- lockdep_is_held(rt_hash_lock_addr(k)))) != NULL) {
- if (!rt_is_expired(rth) &&
- !rt_may_expire(rth, tmo, expire)) {
- tmo >>= 1;
- rthp = &rth->dst.rt_next;
- continue;
- }
- *rthp = rth->dst.rt_next;
- rt_free(rth);
- goal--;
- }
- spin_unlock_bh(rt_hash_lock_addr(k));
- if (goal <= 0)
- break;
- }
- rover = k;
-
- if (goal <= 0)
- goto work_done;
-
- /* Goal is not achieved. We stop process if:
-
- - if expire reduced to zero. Otherwise, expire is halfed.
- - if table is not full.
- - if we are called from interrupt.
- - jiffies check is just fallback/debug loop breaker.
- We will not spin here for long time in any case.
- */
-
- RT_CACHE_STAT_INC(gc_goal_miss);
-
- if (expire == 0)
- break;
-
- expire >>= 1;
-
- if (dst_entries_get_fast(&ipv4_dst_ops) < ip_rt_max_size)
- goto out;
- } while (!in_softirq() && time_before_eq(jiffies, now));
-
- if (dst_entries_get_fast(&ipv4_dst_ops) < ip_rt_max_size)
- goto out;
- if (dst_entries_get_slow(&ipv4_dst_ops) < ip_rt_max_size)
- goto out;
- net_warn_ratelimited("dst cache overflow\n");
- RT_CACHE_STAT_INC(gc_dst_overflow);
- return 1;
-
-work_done:
- expire += ip_rt_gc_min_interval;
- if (expire > ip_rt_gc_timeout ||
- dst_entries_get_fast(&ipv4_dst_ops) < ipv4_dst_ops.gc_thresh ||
- dst_entries_get_slow(&ipv4_dst_ops) < ipv4_dst_ops.gc_thresh)
- expire = ip_rt_gc_timeout;
-out: return 0;
-}
-
-/*
- * Returns number of entries in a hash chain that have different hash_inputs
- */
-static int slow_chain_length(const struct rtable *head)
-{
- int length = 0;
- const struct rtable *rth = head;
-
- while (rth) {
- length += has_noalias(head, rth);
- rth = rcu_dereference_protected(rth->dst.rt_next, 1);
- }
- return length >> FRACT_BITS;
}
static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst,
@@ -1084,139 +493,6 @@ static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst,
return neigh_create(&arp_tbl, pkey, dev);
}
-static struct rtable *rt_intern_hash(unsigned int hash, struct rtable *rt,
- struct sk_buff *skb, int ifindex)
-{
- struct rtable *rth, *cand;
- struct rtable __rcu **rthp, **candp;
- unsigned long now;
- u32 min_score;
- int chain_length;
-
-restart:
- chain_length = 0;
- min_score = ~(u32)0;
- cand = NULL;
- candp = NULL;
- now = jiffies;
-
- if (!rt_caching(dev_net(rt->dst.dev)) || (rt->dst.flags & DST_NOCACHE)) {
- /*
- * If we're not caching, just tell the caller we
- * were successful and don't touch the route. The
- * caller hold the sole reference to the cache entry, and
- * it will be released when the caller is done with it.
- * If we drop it here, the callers have no way to resolve routes
- * when we're not caching. Instead, just point *rp at rt, so
- * the caller gets a single use out of the route
- * Note that we do rt_free on this new route entry, so that
- * once its refcount hits zero, we are still able to reap it
- * (Thanks Alexey)
- * Note: To avoid expensive rcu stuff for this uncached dst,
- * we set DST_NOCACHE so that dst_release() can free dst without
- * waiting a grace period.
- */
-
- rt->dst.flags |= DST_NOCACHE;
- goto skip_hashing;
- }
-
- rthp = &rt_hash_table[hash].chain;
-
- spin_lock_bh(rt_hash_lock_addr(hash));
- while ((rth = rcu_dereference_protected(*rthp,
- lockdep_is_held(rt_hash_lock_addr(hash)))) != NULL) {
- if (rt_is_expired(rth)) {
- *rthp = rth->dst.rt_next;
- rt_free(rth);
- continue;
- }
- if (compare_keys(rth, rt) && compare_netns(rth, rt)) {
- /* Put it first */
- *rthp = rth->dst.rt_next;
- /*
- * Since lookup is lockfree, the deletion
- * must be visible to another weakly ordered CPU before
- * the insertion at the start of the hash chain.
- */
- rcu_assign_pointer(rth->dst.rt_next,
- rt_hash_table[hash].chain);
- /*
- * Since lookup is lockfree, the update writes
- * must be ordered for consistency on SMP.
- */
- rcu_assign_pointer(rt_hash_table[hash].chain, rth);
-
- dst_use(&rth->dst, now);
- spin_unlock_bh(rt_hash_lock_addr(hash));
-
- rt_drop(rt);
- if (skb)
- skb_dst_set(skb, &rth->dst);
- return rth;
- }
-
- if (!atomic_read(&rth->dst.__refcnt)) {
- u32 score = rt_score(rth);
-
- if (score <= min_score) {
- cand = rth;
- candp = rthp;
- min_score = score;
- }
- }
-
- chain_length++;
-
- rthp = &rth->dst.rt_next;
- }
-
- if (cand) {
- /* ip_rt_gc_elasticity used to be average length of chain
- * length, when exceeded gc becomes really aggressive.
- *
- * The second limit is less certain. At the moment it allows
- * only 2 entries per bucket. We will see.
- */
- if (chain_length > ip_rt_gc_elasticity) {
- *candp = cand->dst.rt_next;
- rt_free(cand);
- }
- } else {
- if (chain_length > rt_chain_length_max &&
- slow_chain_length(rt_hash_table[hash].chain) > rt_chain_length_max) {
- struct net *net = dev_net(rt->dst.dev);
- int num = ++net->ipv4.current_rt_cache_rebuild_count;
- if (!rt_caching(net)) {
- pr_warn("%s: %d rebuilds is over limit, route caching disabled\n",
- rt->dst.dev->name, num);
- }
- rt_emergency_hash_rebuild(net);
- spin_unlock_bh(rt_hash_lock_addr(hash));
-
- hash = rt_hash(rt->rt_key_dst, rt->rt_key_src,
- ifindex, rt_genid(net));
- goto restart;
- }
- }
-
- rt->dst.rt_next = rt_hash_table[hash].chain;
-
- /*
- * Since lookup is lockfree, we must make sure
- * previous writes to rt are committed to memory
- * before making rt visible to other CPUS.
- */
- rcu_assign_pointer(rt_hash_table[hash].chain, rt);
-
- spin_unlock_bh(rt_hash_lock_addr(hash));
-
-skip_hashing:
- if (skb)
- skb_dst_set(skb, &rt->dst);
- return rt;
-}
-
/*
* Peer allocation may fail only in serious out-of-memory conditions. However
* we still can generate some output.
@@ -1253,26 +529,6 @@ void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more)
}
EXPORT_SYMBOL(__ip_select_ident);
-static void rt_del(unsigned int hash, struct rtable *rt)
-{
- struct rtable __rcu **rthp;
- struct rtable *aux;
-
- rthp = &rt_hash_table[hash].chain;
- spin_lock_bh(rt_hash_lock_addr(hash));
- ip_rt_put(rt);
- while ((aux = rcu_dereference_protected(*rthp,
- lockdep_is_held(rt_hash_lock_addr(hash)))) != NULL) {
- if (aux == rt || rt_is_expired(aux)) {
- *rthp = aux->dst.rt_next;
- rt_free(aux);
- continue;
- }
- rthp = &aux->dst.rt_next;
- }
- spin_unlock_bh(rt_hash_lock_addr(hash));
-}
-
static void ip_do_redirect(struct dst_entry *dst, struct sk_buff *skb)
{
__be32 new_gw = icmp_hdr(skb)->un.gateway;
@@ -1358,10 +614,7 @@ static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst)
ret = NULL;
} else if ((rt->rt_flags & RTCF_REDIRECTED) ||
rt->dst.expires) {
- unsigned int hash = rt_hash(rt->rt_key_dst, rt->rt_key_src,
- rt->rt_oif,
- rt_genid(dev_net(dst->dev)));
- rt_del(hash, rt);
+ ip_rt_put(rt);
ret = NULL;
}
}
@@ -1745,7 +998,7 @@ static struct rtable *rt_dst_alloc(struct net_device *dev,
bool nopolicy, bool noxfrm)
{
return dst_alloc(&ipv4_dst_ops, dev, 1, -1,
- DST_HOST |
+ DST_HOST | DST_NOCACHE |
(nopolicy ? DST_NOPOLICY : 0) |
(noxfrm ? DST_NOXFRM : 0));
}
@@ -1754,7 +1007,6 @@ static struct rtable *rt_dst_alloc(struct net_device *dev,
static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
u8 tos, struct net_device *dev, int our)
{
- unsigned int hash;
struct rtable *rth;
struct in_device *in_dev = __in_dev_get_rcu(dev);
u32 itag = 0;
@@ -1818,9 +1070,8 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
#endif
RT_CACHE_STAT_INC(in_slow_mc);
- hash = rt_hash(daddr, saddr, dev->ifindex, rt_genid(dev_net(dev)));
- rth = rt_intern_hash(hash, rth, skb, dev->ifindex);
- return IS_ERR(rth) ? PTR_ERR(rth) : 0;
+ skb_dst_set(skb, &rth->dst);
+ return 0;
e_nobufs:
return -ENOBUFS;
@@ -1952,7 +1203,6 @@ static int ip_mkroute_input(struct sk_buff *skb,
{
struct rtable *rth = NULL;
int err;
- unsigned int hash;
#ifdef CONFIG_IP_ROUTE_MULTIPATH
if (res->fi && res->fi->fib_nhs > 1)
@@ -1964,12 +1214,7 @@ static int ip_mkroute_input(struct sk_buff *skb,
if (err)
return err;
- /* put it into the cache */
- hash = rt_hash(daddr, saddr, fl4->flowi4_iif,
- rt_genid(dev_net(rth->dst.dev)));
- rth = rt_intern_hash(hash, rth, skb, fl4->flowi4_iif);
- if (IS_ERR(rth))
- return PTR_ERR(rth);
+ skb_dst_set(skb, &rth->dst);
return 0;
}
@@ -1993,7 +1238,6 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
unsigned int flags = 0;
u32 itag = 0;
struct rtable *rth;
- unsigned int hash;
int err = -EINVAL;
struct net *net = dev_net(dev);
@@ -2115,11 +1359,8 @@ local_input:
rth->dst.error= -err;
rth->rt_flags &= ~RTCF_LOCAL;
}
- hash = rt_hash(daddr, saddr, fl4.flowi4_iif, rt_genid(net));
- rth = rt_intern_hash(hash, rth, skb, fl4.flowi4_iif);
+ skb_dst_set(skb, &rth->dst);
err = 0;
- if (IS_ERR(rth))
- err = PTR_ERR(rth);
goto out;
no_route:
@@ -2158,46 +1399,10 @@ martian_source_keep_err:
int ip_route_input_common(struct sk_buff *skb, __be32 daddr, __be32 saddr,
u8 tos, struct net_device *dev, bool noref)
{
- struct rtable *rth;
- unsigned int hash;
- int iif = dev->ifindex;
- struct net *net;
int res;
- net = dev_net(dev);
-
rcu_read_lock();
- if (!rt_caching(net))
- goto skip_cache;
-
- tos &= IPTOS_RT_MASK;
- hash = rt_hash(daddr, saddr, iif, rt_genid(net));
-
- for (rth = rcu_dereference(rt_hash_table[hash].chain); rth;
- rth = rcu_dereference(rth->dst.rt_next)) {
- if ((((__force u32)rth->rt_key_dst ^ (__force u32)daddr) |
- ((__force u32)rth->rt_key_src ^ (__force u32)saddr) |
- (rth->rt_route_iif ^ iif) |
- (rth->rt_key_tos ^ tos)) == 0 &&
- rth->rt_mark == skb->mark &&
- net_eq(dev_net(rth->dst.dev), net) &&
- !rt_is_expired(rth)) {
- if (noref) {
- dst_use_noref(&rth->dst, jiffies);
- skb_dst_set_noref(skb, &rth->dst);
- } else {
- dst_use(&rth->dst, jiffies);
- skb_dst_set(skb, &rth->dst);
- }
- RT_CACHE_STAT_INC(in_hit);
- rcu_read_unlock();
- return 0;
- }
- RT_CACHE_STAT_INC(in_hlist_search);
- }
-
-skip_cache:
/* Multicast recognition logic is moved from route cache to here.
The problem was that too many Ethernet cards have broken/missing
hardware multicast filters :-( As result the host on multicasting
@@ -2339,10 +1544,9 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
/*
* Major route resolver routine.
- * called with rcu_read_lock();
*/
-static struct rtable *ip_route_output_slow(struct net *net, struct flowi4 *fl4)
+struct rtable *__ip_route_output_key(struct net *net, struct flowi4 *fl4)
{
struct net_device *dev_out = NULL;
__u8 tos = RT_FL_TOS(fl4);
@@ -2524,57 +1728,11 @@ static struct rtable *ip_route_output_slow(struct net *net, struct flowi4 *fl4)
make_route:
rth = __mkroute_output(&res, fl4, orig_daddr, orig_saddr, orig_oif,
tos, dev_out, flags);
- if (!IS_ERR(rth)) {
- unsigned int hash;
-
- hash = rt_hash(orig_daddr, orig_saddr, orig_oif,
- rt_genid(dev_net(dev_out)));
- rth = rt_intern_hash(hash, rth, NULL, orig_oif);
- }
out:
rcu_read_unlock();
return rth;
}
-
-struct rtable *__ip_route_output_key(struct net *net, struct flowi4 *flp4)
-{
- struct rtable *rth;
- unsigned int hash;
-
- if (!rt_caching(net))
- goto slow_output;
-
- hash = rt_hash(flp4->daddr, flp4->saddr, flp4->flowi4_oif, rt_genid(net));
-
- rcu_read_lock_bh();
- for (rth = rcu_dereference_bh(rt_hash_table[hash].chain); rth;
- rth = rcu_dereference_bh(rth->dst.rt_next)) {
- if (rth->rt_key_dst == flp4->daddr &&
- rth->rt_key_src == flp4->saddr &&
- rt_is_output_route(rth) &&
- rth->rt_oif == flp4->flowi4_oif &&
- rth->rt_mark == flp4->flowi4_mark &&
- !((rth->rt_key_tos ^ flp4->flowi4_tos) &
- (IPTOS_RT_MASK | RTO_ONLINK)) &&
- net_eq(dev_net(rth->dst.dev), net) &&
- !rt_is_expired(rth)) {
- dst_use(&rth->dst, jiffies);
- RT_CACHE_STAT_INC(out_hit);
- rcu_read_unlock_bh();
- if (!flp4->saddr)
- flp4->saddr = rth->rt_src;
- if (!flp4->daddr)
- flp4->daddr = rth->rt_dst;
- return rth;
- }
- RT_CACHE_STAT_INC(out_hlist_search);
- }
- rcu_read_unlock_bh();
-
-slow_output:
- return ip_route_output_slow(net, flp4);
-}
EXPORT_SYMBOL_GPL(__ip_route_output_key);
static struct dst_entry *ipv4_blackhole_dst_check(struct dst_entry *dst, u32 cookie)
@@ -2878,43 +2036,6 @@ errout_free:
int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb)
{
- struct rtable *rt;
- int h, s_h;
- int idx, s_idx;
- struct net *net;
-
- net = sock_net(skb->sk);
-
- s_h = cb->args[0];
- if (s_h < 0)
- s_h = 0;
- s_idx = idx = cb->args[1];
- for (h = s_h; h <= rt_hash_mask; h++, s_idx = 0) {
- if (!rt_hash_table[h].chain)
- continue;
- rcu_read_lock_bh();
- for (rt = rcu_dereference_bh(rt_hash_table[h].chain), idx = 0; rt;
- rt = rcu_dereference_bh(rt->dst.rt_next), idx++) {
- if (!net_eq(dev_net(rt->dst.dev), net) || idx < s_idx)
- continue;
- if (rt_is_expired(rt))
- continue;
- skb_dst_set_noref(skb, &rt->dst);
- if (rt_fill_info(net, skb, NETLINK_CB(cb->skb).pid,
- cb->nlh->nlmsg_seq, RTM_NEWROUTE,
- 1, NLM_F_MULTI) <= 0) {
- skb_dst_drop(skb);
- rcu_read_unlock_bh();
- goto done;
- }
- skb_dst_drop(skb);
- }
- rcu_read_unlock_bh();
- }
-
-done:
- cb->args[0] = h;
- cb->args[1] = idx;
return skb->len;
}
@@ -3148,22 +2269,6 @@ static __net_initdata struct pernet_operations ipv4_inetpeer_ops = {
struct ip_rt_acct __percpu *ip_rt_acct __read_mostly;
#endif /* CONFIG_IP_ROUTE_CLASSID */
-static __initdata unsigned long rhash_entries;
-static int __init set_rhash_entries(char *str)
-{
- ssize_t ret;
-
- if (!str)
- return 0;
-
- ret = kstrtoul(str, 0, &rhash_entries);
- if (ret)
- return 0;
-
- return 1;
-}
-__setup("rhash_entries=", set_rhash_entries);
-
int __init ip_rt_init(void)
{
int rc = 0;
@@ -3186,31 +2291,12 @@ int __init ip_rt_init(void)
if (dst_entries_init(&ipv4_dst_blackhole_ops) < 0)
panic("IP: failed to allocate ipv4_dst_blackhole_ops counter\n");
- rt_hash_table = (struct rt_hash_bucket *)
- alloc_large_system_hash("IP route cache",
- sizeof(struct rt_hash_bucket),
- rhash_entries,
- (totalram_pages >= 128 * 1024) ?
- 15 : 17,
- 0,
- &rt_hash_log,
- &rt_hash_mask,
- 0,
- rhash_entries ? 0 : 512 * 1024);
- memset(rt_hash_table, 0, (rt_hash_mask + 1) * sizeof(struct rt_hash_bucket));
- rt_hash_lock_init();
-
- ipv4_dst_ops.gc_thresh = (rt_hash_mask + 1);
- ip_rt_max_size = (rt_hash_mask + 1) * 16;
+ ipv4_dst_ops.gc_thresh = ~0;
+ ip_rt_max_size = INT_MAX;
devinet_init();
ip_fib_init();
- INIT_DELAYED_WORK_DEFERRABLE(&expires_work, rt_worker_func);
- expires_ljiffies = jiffies;
- schedule_delayed_work(&expires_work,
- net_random() % ip_rt_gc_interval + ip_rt_gc_interval);
-
if (ip_rt_proc_init())
pr_err("Unable to create route proc files\n");
#ifdef CONFIG_XFRM
--
1.7.10.4
^ permalink raw reply related
* [PATCH 0/6]: Another routing cache removal respin.
From: David Miller @ 2012-07-12 17:42 UTC (permalink / raw)
To: netdev
New patch at the end this time, getting rid of rt->rt_dst :-)
Most recent performance numbers:
> 1) Output route lookup: ~2150 cycles
> 2) Input route lookups: ~2600 cycles (rpfilter=0)
> ~3700 cycles (rpfilter=1)
How things stand now:
1) Output route lookup: ~1600 cycles
2) Input route lookups: ~2200 cycles (rpfilter=0)
~3100 cycles (rpfilter=1)
Signed-off-by: David S. Miller <davem@davemloft.net>
^ permalink raw reply
* Re: [RFC PATCH 0/2] Coalesce MMIO writes for transmits
From: Stephen Hemminger @ 2012-07-12 17:23 UTC (permalink / raw)
To: Alexander Duyck
Cc: netdev, davem, jeffrey.t.kirsher, edumazet, bhutchings, therbert,
alexander.duyck
In-Reply-To: <20120712002103.27846.73812.stgit@gitlad.jf.intel.com>
On Wed, 11 Jul 2012 17:25:58 -0700
Alexander Duyck <alexander.h.duyck@intel.com> wrote:
> This patch set is meant to address recent issues I found with ixgbe
> performance being bound by Tx tail writes. With these changes in place
> and the dispatch_limit set to 1 or more I see a significant increase in
> performance.
>
> In the case of one of my systems I saw the routing rate for 7 queues jump
> from 10.5 to 11.7Mpps. The overall increase I have seen on most systems is
> something on the order of about 15%. In the case of pktgen I have also
> seen a noticeable increase as the previous limit for transmits was
> ~12.5Mpps, but with this patch set in place and the dispatch_limit enabled
> the value increases to ~14.2Mpps.
>
> I expected there to be an increase in latency, however so far I have not
> ran into that. I have tried running NPtcp tests for latency and seen no
> difference in the coalesced and non-coalesced transaction times. I welcome
> any suggestions for tests I might run that might expose any latency issues
> as a result of this patch.
>
> ---
>
> Alexander Duyck (2):
> ixgbe: Add functionality for delaying the MMIO write for Tx
> net: Add new network device function to allow for MMIO batching
>
>
> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 22 +++++++-
> include/linux/netdevice.h | 57 +++++++++++++++++++++
> net/core/dev.c | 67 +++++++++++++++++++++++++
> net/core/net-sysfs.c | 36 +++++++++++++
> 4 files changed, 180 insertions(+), 2 deletions(-)
>
This is a good idea. I was thinking of adding a multi-skb operation
to netdevice_ops to allow this. Something like ndo_start_xmit_pkts but
the problem is how to deal with the boundary case where there is only
a limited number of slots in the ring. Using a "that's all folks"
operation seems better.
^ permalink raw reply
* [PATCH] ISDN:Add check for return value of pnp_activate_dev()
From: Karsten Keil @ 2012-07-12 17:01 UTC (permalink / raw)
To: netdev
pnp_activate_dev() return value needs to be checked to make sure that
following calls calls to the PNP functions do work correctly.
Fix for report #44491 on bugzilla.kernel.org.
Signed-off-by: Karsten Keil <kkeil@linux-pingi.de>
---
drivers/isdn/hisax/isurf.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/isdn/hisax/isurf.c b/drivers/isdn/hisax/isurf.c
index ea27172..c1530fe 100644
--- a/drivers/isdn/hisax/isurf.c
+++ b/drivers/isdn/hisax/isurf.c
@@ -231,6 +231,11 @@ setup_isurf(struct IsdnCard *card)
}
pnp_disable_dev(pnp_d);
err = pnp_activate_dev(pnp_d);
+ if (err < 0) {
+ pr_warn("%s: pnp_activate_dev ret=%d\n",
+ __func__, err);
+ return 0;
+ }
cs->hw.isurf.reset = pnp_port_start(pnp_d, 0);
cs->hw.isurf.phymem = pnp_mem_start(pnp_d, 1);
cs->irq = pnp_irq(pnp_d, 0);
--
1.7.7
^ permalink raw reply related
* Re: [RFC PATCH v2] tcp: TCP Small Queues
From: Jim Gettys @ 2012-07-12 16:54 UTC (permalink / raw)
To: John Heffner; +Cc: nanditad, netdev, codel, mattmathis, ncardwell, David Miller
In-Reply-To: <CABrhC0mONb3Ki5YYM1rfiBZnCKd2tYFvdYpuur-u3gDYRii1tw@mail.gmail.com>
On 07/12/2012 12:44 PM, John Heffner wrote:
> On Thu, Jul 12, 2012 at 9:46 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>> On Thu, 2012-07-12 at 09:33 -0400, John Heffner wrote:
>>> One general question: why a per-connection limit? I haven't been
>>> following the bufferbloat conversation closely so I may have missed
>>> some of the conversation. But it seems that multiple connections will
>>> still cause longer queue times.
>> We already have a per-device limit, in qdisc.
>>
>> If you want to monitor several tcp sessions, I urge you use a controller
>> for that. Like codel or fq_codel.
>>
>> Experiments show that limiting to two TSO packets in qdisc per tcp flow
>> is enough to stop insane qdisc queueing, without impact on throughput
>> for people wanting fast tcp sessions.
>>
>> Thats not solving the more general problem of having 1000 competing
>> flows.
> Right, AQM (and probably some modifications to the congestion control)
> is the more general solution.
>
> I guess I'm just trying to justify in my mind that the case of a small
> number of local connections is worth handling in this special way. It
> seems like a generally reasonable thing, but it's definitely not a
> general solution to minimizing latency. One thing worth noting: on a
> system routing traffic, local connections may be at a disadvantage
> relative to connections being forwarded, sharing the same interface
> queue, if that queue is the bottleneck.
Kathy simulated CoDel across a pretty wide range of RTT's seen at the
edge of the network, and things behave pretty well. She did say she
needed to think more and simulate the data center cases; haven't had a
chance to chat with her about that. Of course, you can do some
experiments pretty easily yourself, and we'd love to see whatever
results you get.
- Jim
>
> Architecturally, the inconsistency between a local queue and a queue
> one hop away bothers me a bit, but it's something I can learn to live
> with if it really does improve a common case significantly. ;-)
>
> Thanks,
> -John
> _______________________________________________
> Codel mailing list
> Codel@lists.bufferbloat.net
> https://lists.bufferbloat.net/listinfo/codel
^ permalink raw reply
* [PATCH] ipv4: Remove tb_peers from fib_table.
From: David Miller @ 2012-07-12 16:46 UTC (permalink / raw)
To: netdev
No longer used.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
include/net/ip_fib.h | 1 -
net/ipv4/fib_trie.c | 3 ---
2 files changed, 4 deletions(-)
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 000c467..e91fedd 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -162,7 +162,6 @@ struct fib_table {
u32 tb_id;
int tb_default;
int tb_num_default;
- struct inet_peer_base tb_peers;
unsigned long tb_data[0];
};
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 9b0f259..18cbc15 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1843,8 +1843,6 @@ int fib_table_flush(struct fib_table *tb)
if (ll && hlist_empty(&ll->list))
trie_leaf_remove(t, ll);
- inetpeer_invalidate_tree(&tb->tb_peers);
-
pr_debug("trie_flush found=%d\n", found);
return found;
}
@@ -1993,7 +1991,6 @@ struct fib_table *fib_trie_table(u32 id)
tb->tb_id = id;
tb->tb_default = -1;
tb->tb_num_default = 0;
- inet_peer_base_init(&tb->tb_peers);
t = (struct trie *) tb->tb_data;
memset(t, 0, sizeof(*t));
--
1.7.10.4
^ permalink raw reply related
* Re: [RFC PATCH v2] tcp: TCP Small Queues
From: John Heffner @ 2012-07-12 16:44 UTC (permalink / raw)
To: Eric Dumazet
Cc: David Miller, ycheng, dave.taht, netdev, codel, therbert,
mattmathis, nanditad, ncardwell, andrewmcgr
In-Reply-To: <1342100812.3265.8260.camel@edumazet-glaptop>
On Thu, Jul 12, 2012 at 9:46 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Thu, 2012-07-12 at 09:33 -0400, John Heffner wrote:
>> One general question: why a per-connection limit? I haven't been
>> following the bufferbloat conversation closely so I may have missed
>> some of the conversation. But it seems that multiple connections will
>> still cause longer queue times.
>
> We already have a per-device limit, in qdisc.
>
> If you want to monitor several tcp sessions, I urge you use a controller
> for that. Like codel or fq_codel.
>
> Experiments show that limiting to two TSO packets in qdisc per tcp flow
> is enough to stop insane qdisc queueing, without impact on throughput
> for people wanting fast tcp sessions.
>
> Thats not solving the more general problem of having 1000 competing
> flows.
Right, AQM (and probably some modifications to the congestion control)
is the more general solution.
I guess I'm just trying to justify in my mind that the case of a small
number of local connections is worth handling in this special way. It
seems like a generally reasonable thing, but it's definitely not a
general solution to minimizing latency. One thing worth noting: on a
system routing traffic, local connections may be at a disadvantage
relative to connections being forwarded, sharing the same interface
queue, if that queue is the bottleneck.
Architecturally, the inconsistency between a local queue and a queue
one hop away bothers me a bit, but it's something I can learn to live
with if it really does improve a common case significantly. ;-)
Thanks,
-John
^ permalink raw reply
* [PATCH net-next 7/8] tipc: phase out most of the struct print_buf usage
From: Paul Gortmaker @ 2012-07-12 16:40 UTC (permalink / raw)
To: davem; +Cc: netdev, Jon Maloy, Erik Hugne, ying.xue, Paul Gortmaker
In-Reply-To: <1342111201-9426-1-git-send-email-paul.gortmaker@windriver.com>
From: Erik Hugne <erik.hugne@ericsson.com>
The tipc_printf is renamed to tipc_snprintf, as the new name
describes more what the function actually does. It is also
changed to take a buffer and length parameter and return
number of characters written to the buffer. All callers of
this function that used to pass a print_buf are updated.
Final removal of the struct print_buf itself will be done
synchronously with the pending removal of the deprecated
logging code that also was using it.
Functions that build up a response message with a list of
ports, nametable contents etc. are changed to return the number
of characters written to the output buffer. This information
was previously hidden in a field of the print_buf struct, and
the number of chars written was fetched with a call to
tipc_printbuf_validate. This function is removed since it
is no longer referenced nor needed.
A generic max size ULTRA_STRING_MAX_LEN is defined, named
in keeping with the existing TIPC_TLV_ULTRA_STRING, and the
various definitions in port, link and nametable code that
largely duplicated this information are removed. This means
that amount of link statistics that can be returned is now
increased from 2k to 32k.
The buffer overflow check is now done just before the reply
message is passed over netlink or TIPC to a remote node and
the message indicating a truncated buffer is changed to a less
dramatic one (less CAPS), placed at the end of the message.
Signed-off-by: Erik Hugne <erik.hugne@ericsson.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
net/tipc/bcast.c | 63 +++++++++++-------------
net/tipc/bearer.c | 10 ++--
net/tipc/bearer.h | 2 +-
net/tipc/config.c | 27 ++++++----
net/tipc/core.h | 4 +-
net/tipc/discover.c | 6 +--
net/tipc/link.c | 130 +++++++++++++++++++++++++------------------------
net/tipc/log.c | 47 ++----------------
net/tipc/name_table.c | 88 +++++++++++++++++++--------------
net/tipc/port.c | 58 ++++++++++++----------
10 files changed, 213 insertions(+), 222 deletions(-)
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
index c4414c7..5b84337 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -701,48 +701,43 @@ void tipc_bcbearer_sort(void)
int tipc_bclink_stats(char *buf, const u32 buf_size)
{
- struct print_buf pb;
+ int ret;
+ struct tipc_stats *s;
if (!bcl)
return 0;
- tipc_printbuf_init(&pb, buf, buf_size);
-
spin_lock_bh(&bc_lock);
- tipc_printf(&pb, "Link <%s>\n"
- " Window:%u packets\n",
- bcl->name, bcl->queue_limit[0]);
- tipc_printf(&pb, " RX packets:%u fragments:%u/%u bundles:%u/%u\n",
- bcl->stats.recv_info,
- bcl->stats.recv_fragments,
- bcl->stats.recv_fragmented,
- bcl->stats.recv_bundles,
- bcl->stats.recv_bundled);
- tipc_printf(&pb, " TX packets:%u fragments:%u/%u bundles:%u/%u\n",
- bcl->stats.sent_info,
- bcl->stats.sent_fragments,
- bcl->stats.sent_fragmented,
- bcl->stats.sent_bundles,
- bcl->stats.sent_bundled);
- tipc_printf(&pb, " RX naks:%u defs:%u dups:%u\n",
- bcl->stats.recv_nacks,
- bcl->stats.deferred_recv,
- bcl->stats.duplicates);
- tipc_printf(&pb, " TX naks:%u acks:%u dups:%u\n",
- bcl->stats.sent_nacks,
- bcl->stats.sent_acks,
- bcl->stats.retransmitted);
- tipc_printf(&pb, " Congestion bearer:%u link:%u Send queue max:%u avg:%u\n",
- bcl->stats.bearer_congs,
- bcl->stats.link_congs,
- bcl->stats.max_queue_sz,
- bcl->stats.queue_sz_counts
- ? (bcl->stats.accu_queue_sz / bcl->stats.queue_sz_counts)
- : 0);
+ s = &bcl->stats;
+
+ ret = tipc_snprintf(buf, buf_size, "Link <%s>\n"
+ " Window:%u packets\n",
+ bcl->name, bcl->queue_limit[0]);
+ ret += tipc_snprintf(buf + ret, buf_size - ret,
+ " RX packets:%u fragments:%u/%u bundles:%u/%u\n",
+ s->recv_info, s->recv_fragments,
+ s->recv_fragmented, s->recv_bundles,
+ s->recv_bundled);
+ ret += tipc_snprintf(buf + ret, buf_size - ret,
+ " TX packets:%u fragments:%u/%u bundles:%u/%u\n",
+ s->sent_info, s->sent_fragments,
+ s->sent_fragmented, s->sent_bundles,
+ s->sent_bundled);
+ ret += tipc_snprintf(buf + ret, buf_size - ret,
+ " RX naks:%u defs:%u dups:%u\n",
+ s->recv_nacks, s->deferred_recv, s->duplicates);
+ ret += tipc_snprintf(buf + ret, buf_size - ret,
+ " TX naks:%u acks:%u dups:%u\n",
+ s->sent_nacks, s->sent_acks, s->retransmitted);
+ ret += tipc_snprintf(buf + ret, buf_size - ret,
+ " Congestion bearer:%u link:%u Send queue max:%u avg:%u\n",
+ s->bearer_congs, s->link_congs, s->max_queue_sz,
+ s->queue_sz_counts ?
+ (s->accu_queue_sz / s->queue_sz_counts) : 0);
spin_unlock_bh(&bc_lock);
- return tipc_printbuf_validate(&pb);
+ return ret;
}
int tipc_bclink_reset_stats(void)
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index a663d30..1186413 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -130,21 +130,23 @@ exit:
/**
* tipc_media_addr_printf - record media address in print buffer
*/
-void tipc_media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a)
+void tipc_media_addr_printf(char *buf, int len, struct tipc_media_addr *a)
{
char addr_str[MAX_ADDR_STR];
struct tipc_media *m_ptr;
+ int ret;
m_ptr = media_find_id(a->media_id);
if (m_ptr && !m_ptr->addr2str(a, addr_str, sizeof(addr_str)))
- tipc_printf(pb, "%s(%s)", m_ptr->name, addr_str);
+ ret = tipc_snprintf(buf, len, "%s(%s)", m_ptr->name, addr_str);
else {
u32 i;
- tipc_printf(pb, "UNKNOWN(%u)", a->media_id);
+ ret = tipc_snprintf(buf, len, "UNKNOWN(%u)", a->media_id);
for (i = 0; i < sizeof(a->value); i++)
- tipc_printf(pb, "-%02x", a->value[i]);
+ ret += tipc_snprintf(buf - ret, len + ret,
+ "-%02x", a->value[i]);
}
}
diff --git a/net/tipc/bearer.h b/net/tipc/bearer.h
index 4680de1..dd4c2ab 100644
--- a/net/tipc/bearer.h
+++ b/net/tipc/bearer.h
@@ -179,7 +179,7 @@ void tipc_eth_media_stop(void);
int tipc_media_set_priority(const char *name, u32 new_value);
int tipc_media_set_window(const char *name, u32 new_value);
-void tipc_media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a);
+void tipc_media_addr_printf(char *buf, int len, struct tipc_media_addr *a);
struct sk_buff *tipc_media_get_names(void);
struct sk_buff *tipc_bearer_get_names(void);
diff --git a/net/tipc/config.c b/net/tipc/config.c
index 30e5b0a..65057e9 100644
--- a/net/tipc/config.c
+++ b/net/tipc/config.c
@@ -39,6 +39,8 @@
#include "name_table.h"
#include "config.h"
+#define REPLY_TRUNCATED "<truncated>\n"
+
static u32 config_port_ref;
static DEFINE_SPINLOCK(config_lock);
@@ -104,13 +106,12 @@ struct sk_buff *tipc_cfg_reply_string_type(u16 tlv_type, char *string)
return buf;
}
-#define MAX_STATS_INFO 2000
-
static struct sk_buff *tipc_show_stats(void)
{
struct sk_buff *buf;
struct tlv_desc *rep_tlv;
- struct print_buf pb;
+ char *pb;
+ int pb_len;
int str_len;
u32 value;
@@ -121,17 +122,16 @@ static struct sk_buff *tipc_show_stats(void)
if (value != 0)
return tipc_cfg_reply_error_string("unsupported argument");
- buf = tipc_cfg_reply_alloc(TLV_SPACE(MAX_STATS_INFO));
+ buf = tipc_cfg_reply_alloc(TLV_SPACE(ULTRA_STRING_MAX_LEN));
if (buf == NULL)
return NULL;
rep_tlv = (struct tlv_desc *)buf->data;
- tipc_printbuf_init(&pb, (char *)TLV_DATA(rep_tlv), MAX_STATS_INFO);
-
- tipc_printf(&pb, "TIPC version " TIPC_MOD_VER "\n");
+ pb = TLV_DATA(rep_tlv);
+ pb_len = ULTRA_STRING_MAX_LEN;
- /* Use additional tipc_printf()'s to return more info ... */
- str_len = tipc_printbuf_validate(&pb);
+ str_len = tipc_snprintf(pb, pb_len, "TIPC version " TIPC_MOD_VER "\n");
+ str_len += 1; /* for "\0" */
skb_put(buf, TLV_SPACE(str_len));
TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len);
@@ -408,6 +408,15 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area
break;
}
+ WARN_ON(rep_tlv_buf->len > TLV_SPACE(ULTRA_STRING_MAX_LEN));
+
+ /* Append an error message if we cannot return all requested data */
+ if (rep_tlv_buf->len == TLV_SPACE(ULTRA_STRING_MAX_LEN)) {
+ if (*(rep_tlv_buf->data + ULTRA_STRING_MAX_LEN) != '\0')
+ sprintf(rep_tlv_buf->data + rep_tlv_buf->len -
+ sizeof(REPLY_TRUNCATED) - 1, REPLY_TRUNCATED);
+ }
+
/* Return reply buffer */
exit:
spin_unlock_bh(&config_lock);
diff --git a/net/tipc/core.h b/net/tipc/core.h
index c7b5ab5..7ba74ba 100644
--- a/net/tipc/core.h
+++ b/net/tipc/core.h
@@ -58,6 +58,8 @@
#define TIPC_MOD_VER "2.0.0"
+#define ULTRA_STRING_MAX_LEN 32768
+
struct tipc_msg; /* msg.h */
struct print_buf; /* log.h */
@@ -80,7 +82,7 @@ extern struct print_buf *const TIPC_NULL;
extern struct print_buf *const TIPC_CONS;
extern struct print_buf *const TIPC_LOG;
-void tipc_printf(struct print_buf *, const char *fmt, ...);
+int tipc_snprintf(char *buf, int len, const char *fmt, ...);
/*
* TIPC_OUTPUT is the destination print buffer for system messages.
diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index 8f92e52..f385fde 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -100,12 +100,10 @@ static void disc_dupl_alert(struct tipc_bearer *b_ptr, u32 node_addr,
{
char node_addr_str[16];
char media_addr_str[64];
- struct print_buf pb;
tipc_addr_string_fill(node_addr_str, node_addr);
- tipc_printbuf_init(&pb, media_addr_str, sizeof(media_addr_str));
- tipc_media_addr_printf(&pb, media_addr);
- tipc_printbuf_validate(&pb);
+ tipc_media_addr_printf(media_addr_str, sizeof(media_addr_str),
+ media_addr);
pr_warn("TIPC: Duplicate %s using %s seen on <%s>\n",
node_addr_str, media_addr_str, b_ptr->name);
}
diff --git a/net/tipc/link.c b/net/tipc/link.c
index bf4cc41..dab3503 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -2865,112 +2865,114 @@ static u32 percent(u32 count, u32 total)
*/
static int tipc_link_stats(const char *name, char *buf, const u32 buf_size)
{
- struct print_buf pb;
- struct tipc_link *l_ptr;
+ struct tipc_link *l;
+ struct tipc_stats *s;
struct tipc_node *node;
char *status;
u32 profile_total = 0;
+ int ret;
if (!strcmp(name, tipc_bclink_name))
return tipc_bclink_stats(buf, buf_size);
- tipc_printbuf_init(&pb, buf, buf_size);
-
read_lock_bh(&tipc_net_lock);
- l_ptr = link_find_link(name, &node);
- if (!l_ptr) {
+ l = link_find_link(name, &node);
+ if (!l) {
read_unlock_bh(&tipc_net_lock);
return 0;
}
tipc_node_lock(node);
+ s = &l->stats;
- if (tipc_link_is_active(l_ptr))
+ if (tipc_link_is_active(l))
status = "ACTIVE";
- else if (tipc_link_is_up(l_ptr))
+ else if (tipc_link_is_up(l))
status = "STANDBY";
else
status = "DEFUNCT";
- tipc_printf(&pb, "Link <%s>\n"
- " %s MTU:%u Priority:%u Tolerance:%u ms"
- " Window:%u packets\n",
- l_ptr->name, status, l_ptr->max_pkt,
- l_ptr->priority, l_ptr->tolerance, l_ptr->queue_limit[0]);
- tipc_printf(&pb, " RX packets:%u fragments:%u/%u bundles:%u/%u\n",
- l_ptr->next_in_no - l_ptr->stats.recv_info,
- l_ptr->stats.recv_fragments,
- l_ptr->stats.recv_fragmented,
- l_ptr->stats.recv_bundles,
- l_ptr->stats.recv_bundled);
- tipc_printf(&pb, " TX packets:%u fragments:%u/%u bundles:%u/%u\n",
- l_ptr->next_out_no - l_ptr->stats.sent_info,
- l_ptr->stats.sent_fragments,
- l_ptr->stats.sent_fragmented,
- l_ptr->stats.sent_bundles,
- l_ptr->stats.sent_bundled);
- profile_total = l_ptr->stats.msg_length_counts;
+
+ ret = tipc_snprintf(buf, buf_size, "Link <%s>\n"
+ " %s MTU:%u Priority:%u Tolerance:%u ms"
+ " Window:%u packets\n",
+ l->name, status, l->max_pkt, l->priority,
+ l->tolerance, l->queue_limit[0]);
+
+ ret += tipc_snprintf(buf + ret, buf_size - ret,
+ " RX packets:%u fragments:%u/%u bundles:%u/%u\n",
+ l->next_in_no - s->recv_info, s->recv_fragments,
+ s->recv_fragmented, s->recv_bundles,
+ s->recv_bundled);
+
+ ret += tipc_snprintf(buf + ret, buf_size - ret,
+ " TX packets:%u fragments:%u/%u bundles:%u/%u\n",
+ l->next_out_no - s->sent_info, s->sent_fragments,
+ s->sent_fragmented, s->sent_bundles,
+ s->sent_bundled);
+
+ profile_total = s->msg_length_counts;
if (!profile_total)
profile_total = 1;
- tipc_printf(&pb, " TX profile sample:%u packets average:%u octets\n"
- " 0-64:%u%% -256:%u%% -1024:%u%% -4096:%u%% "
- "-16384:%u%% -32768:%u%% -66000:%u%%\n",
- l_ptr->stats.msg_length_counts,
- l_ptr->stats.msg_lengths_total / profile_total,
- percent(l_ptr->stats.msg_length_profile[0], profile_total),
- percent(l_ptr->stats.msg_length_profile[1], profile_total),
- percent(l_ptr->stats.msg_length_profile[2], profile_total),
- percent(l_ptr->stats.msg_length_profile[3], profile_total),
- percent(l_ptr->stats.msg_length_profile[4], profile_total),
- percent(l_ptr->stats.msg_length_profile[5], profile_total),
- percent(l_ptr->stats.msg_length_profile[6], profile_total));
- tipc_printf(&pb, " RX states:%u probes:%u naks:%u defs:%u dups:%u\n",
- l_ptr->stats.recv_states,
- l_ptr->stats.recv_probes,
- l_ptr->stats.recv_nacks,
- l_ptr->stats.deferred_recv,
- l_ptr->stats.duplicates);
- tipc_printf(&pb, " TX states:%u probes:%u naks:%u acks:%u dups:%u\n",
- l_ptr->stats.sent_states,
- l_ptr->stats.sent_probes,
- l_ptr->stats.sent_nacks,
- l_ptr->stats.sent_acks,
- l_ptr->stats.retransmitted);
- tipc_printf(&pb, " Congestion bearer:%u link:%u Send queue max:%u avg:%u\n",
- l_ptr->stats.bearer_congs,
- l_ptr->stats.link_congs,
- l_ptr->stats.max_queue_sz,
- l_ptr->stats.queue_sz_counts
- ? (l_ptr->stats.accu_queue_sz / l_ptr->stats.queue_sz_counts)
- : 0);
+
+ ret += tipc_snprintf(buf + ret, buf_size - ret,
+ " TX profile sample:%u packets average:%u octets\n"
+ " 0-64:%u%% -256:%u%% -1024:%u%% -4096:%u%% "
+ "-16384:%u%% -32768:%u%% -66000:%u%%\n",
+ s->msg_length_counts,
+ s->msg_lengths_total / profile_total,
+ percent(s->msg_length_profile[0], profile_total),
+ percent(s->msg_length_profile[1], profile_total),
+ percent(s->msg_length_profile[2], profile_total),
+ percent(s->msg_length_profile[3], profile_total),
+ percent(s->msg_length_profile[4], profile_total),
+ percent(s->msg_length_profile[5], profile_total),
+ percent(s->msg_length_profile[6], profile_total));
+
+ ret += tipc_snprintf(buf + ret, buf_size - ret,
+ " RX states:%u probes:%u naks:%u defs:%u"
+ " dups:%u\n", s->recv_states, s->recv_probes,
+ s->recv_nacks, s->deferred_recv, s->duplicates);
+
+ ret += tipc_snprintf(buf + ret, buf_size - ret,
+ " TX states:%u probes:%u naks:%u acks:%u"
+ " dups:%u\n", s->sent_states, s->sent_probes,
+ s->sent_nacks, s->sent_acks, s->retransmitted);
+
+ ret += tipc_snprintf(buf + ret, buf_size - ret,
+ " Congestion bearer:%u link:%u Send queue"
+ " max:%u avg:%u\n", s->bearer_congs, s->link_congs,
+ s->max_queue_sz, s->queue_sz_counts ?
+ (s->accu_queue_sz / s->queue_sz_counts) : 0);
tipc_node_unlock(node);
read_unlock_bh(&tipc_net_lock);
- return tipc_printbuf_validate(&pb);
+ return ret;
}
-#define MAX_LINK_STATS_INFO 2000
-
struct sk_buff *tipc_link_cmd_show_stats(const void *req_tlv_area, int req_tlv_space)
{
struct sk_buff *buf;
struct tlv_desc *rep_tlv;
int str_len;
+ int pb_len;
+ char *pb;
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_NAME))
return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
- buf = tipc_cfg_reply_alloc(TLV_SPACE(MAX_LINK_STATS_INFO));
+ buf = tipc_cfg_reply_alloc(TLV_SPACE(ULTRA_STRING_MAX_LEN));
if (!buf)
return NULL;
rep_tlv = (struct tlv_desc *)buf->data;
-
+ pb = TLV_DATA(rep_tlv);
+ pb_len = ULTRA_STRING_MAX_LEN;
str_len = tipc_link_stats((char *)TLV_DATA(req_tlv_area),
- (char *)TLV_DATA(rep_tlv), MAX_LINK_STATS_INFO);
+ pb, pb_len);
if (!str_len) {
kfree_skb(buf);
return tipc_cfg_reply_error_string("link not found");
}
-
+ str_len += 1; /* for "\0" */
skb_put(buf, TLV_SPACE(str_len));
TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len);
diff --git a/net/tipc/log.c b/net/tipc/log.c
index d01e37a..fa7ce92 100644
--- a/net/tipc/log.c
+++ b/net/tipc/log.c
@@ -125,40 +125,6 @@ static int tipc_printbuf_empty(struct print_buf *pb)
}
/**
- * tipc_printbuf_validate - check for print buffer overflow
- * @pb: pointer to print buffer structure
- *
- * Verifies that a print buffer has captured all data written to it.
- * If data has been lost, linearize buffer and prepend an error message
- *
- * Returns length of print buffer data string (including trailing NUL)
- */
-int tipc_printbuf_validate(struct print_buf *pb)
-{
- char *err = "\n\n*** PRINT BUFFER OVERFLOW ***\n\n";
- char *cp_buf;
- struct print_buf cb;
-
- if (!pb->buf)
- return 0;
-
- if (pb->buf[pb->size - 1] == 0) {
- cp_buf = kmalloc(pb->size, GFP_ATOMIC);
- if (cp_buf) {
- tipc_printbuf_init(&cb, cp_buf, pb->size);
- tipc_printbuf_move(&cb, pb);
- tipc_printbuf_move(pb, &cb);
- kfree(cp_buf);
- memcpy(pb->buf, err, strlen(err));
- } else {
- tipc_printbuf_reset(pb);
- tipc_printf(pb, err);
- }
- }
- return pb->crs - pb->buf + 1;
-}
-
-/**
* tipc_printbuf_move - move print buffer contents to another print buffer
* @pb_to: pointer to destination print buffer structure
* @pb_from: pointer to source print buffer structure
@@ -204,23 +170,20 @@ static void tipc_printbuf_move(struct print_buf *pb_to,
}
/**
- * tipc_printf - append formatted output to print buffer
- * @pb: pointer to print buffer
+ * tipc_snprintf - append formatted output to print buffer
+ * @buf: pointer to print buffer
+ * @len: buffer length
* @fmt: formatted info to be printed
*/
-void tipc_printf(struct print_buf *pb, const char *fmt, ...)
+int tipc_snprintf(char *buf, int len, const char *fmt, ...)
{
int i;
va_list args;
- char *buf;
- int len;
- buf = pb->crs;
- len = pb->buf + pb->size - pb->crs;
va_start(args, fmt);
i = vscnprintf(buf, len, fmt, args);
va_end(args);
- pb->crs += i;
+ return i;
}
/**
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
index 0b48fbb..0b7eaf1 100644
--- a/net/tipc/name_table.c
+++ b/net/tipc/name_table.c
@@ -753,19 +753,20 @@ void tipc_nametbl_unsubscribe(struct tipc_subscription *s)
/**
* subseq_list - print specified sub-sequence contents into the given buffer
*/
-static void subseq_list(struct sub_seq *sseq, struct print_buf *buf, u32 depth,
+static int subseq_list(struct sub_seq *sseq, char *buf, int len, u32 depth,
u32 index)
{
char portIdStr[27];
const char *scope_str[] = {"", " zone", " cluster", " node"};
struct publication *publ;
struct name_info *info;
+ int ret;
- tipc_printf(buf, "%-10u %-10u ", sseq->lower, sseq->upper);
+ ret = tipc_snprintf(buf, len, "%-10u %-10u ", sseq->lower, sseq->upper);
if (depth == 2) {
- tipc_printf(buf, "\n");
- return;
+ ret += tipc_snprintf(buf - ret, len + ret, "\n");
+ return ret;
}
info = sseq->info;
@@ -774,52 +775,58 @@ static void subseq_list(struct sub_seq *sseq, struct print_buf *buf, u32 depth,
sprintf(portIdStr, "<%u.%u.%u:%u>",
tipc_zone(publ->node), tipc_cluster(publ->node),
tipc_node(publ->node), publ->ref);
- tipc_printf(buf, "%-26s ", portIdStr);
+ ret += tipc_snprintf(buf + ret, len - ret, "%-26s ", portIdStr);
if (depth > 3) {
- tipc_printf(buf, "%-10u %s", publ->key,
- scope_str[publ->scope]);
+ ret += tipc_snprintf(buf + ret, len - ret, "%-10u %s",
+ publ->key, scope_str[publ->scope]);
}
if (!list_is_last(&publ->zone_list, &info->zone_list))
- tipc_printf(buf, "\n%33s", " ");
+ ret += tipc_snprintf(buf + ret, len - ret,
+ "\n%33s", " ");
};
- tipc_printf(buf, "\n");
+ ret += tipc_snprintf(buf + ret, len - ret, "\n");
+ return ret;
}
/**
* nameseq_list - print specified name sequence contents into the given buffer
*/
-static void nameseq_list(struct name_seq *seq, struct print_buf *buf, u32 depth,
+static int nameseq_list(struct name_seq *seq, char *buf, int len, u32 depth,
u32 type, u32 lowbound, u32 upbound, u32 index)
{
struct sub_seq *sseq;
char typearea[11];
+ int ret = 0;
if (seq->first_free == 0)
- return;
+ return 0;
sprintf(typearea, "%-10u", seq->type);
if (depth == 1) {
- tipc_printf(buf, "%s\n", typearea);
- return;
+ ret += tipc_snprintf(buf, len, "%s\n", typearea);
+ return ret;
}
for (sseq = seq->sseqs; sseq != &seq->sseqs[seq->first_free]; sseq++) {
if ((lowbound <= sseq->upper) && (upbound >= sseq->lower)) {
- tipc_printf(buf, "%s ", typearea);
+ ret += tipc_snprintf(buf + ret, len - ret, "%s ",
+ typearea);
spin_lock_bh(&seq->lock);
- subseq_list(sseq, buf, depth, index);
+ ret += subseq_list(sseq, buf + ret, len - ret,
+ depth, index);
spin_unlock_bh(&seq->lock);
sprintf(typearea, "%10s", " ");
}
}
+ return ret;
}
/**
* nametbl_header - print name table header into the given buffer
*/
-static void nametbl_header(struct print_buf *buf, u32 depth)
+static int nametbl_header(char *buf, int len, u32 depth)
{
const char *header[] = {
"Type ",
@@ -829,24 +836,27 @@ static void nametbl_header(struct print_buf *buf, u32 depth)
};
int i;
+ int ret = 0;
if (depth > 4)
depth = 4;
for (i = 0; i < depth; i++)
- tipc_printf(buf, header[i]);
- tipc_printf(buf, "\n");
+ ret += tipc_snprintf(buf + ret, len - ret, header[i]);
+ ret += tipc_snprintf(buf + ret, len - ret, "\n");
+ return ret;
}
/**
* nametbl_list - print specified name table contents into the given buffer
*/
-static void nametbl_list(struct print_buf *buf, u32 depth_info,
+static int nametbl_list(char *buf, int len, u32 depth_info,
u32 type, u32 lowbound, u32 upbound)
{
struct hlist_head *seq_head;
struct hlist_node *seq_node;
struct name_seq *seq;
int all_types;
+ int ret = 0;
u32 depth;
u32 i;
@@ -854,65 +864,69 @@ static void nametbl_list(struct print_buf *buf, u32 depth_info,
depth = (depth_info & ~TIPC_NTQ_ALLTYPES);
if (depth == 0)
- return;
+ return 0;
if (all_types) {
/* display all entries in name table to specified depth */
- nametbl_header(buf, depth);
+ ret += nametbl_header(buf, len, depth);
lowbound = 0;
upbound = ~0;
for (i = 0; i < tipc_nametbl_size; i++) {
seq_head = &table.types[i];
hlist_for_each_entry(seq, seq_node, seq_head, ns_list) {
- nameseq_list(seq, buf, depth, seq->type,
- lowbound, upbound, i);
+ ret += nameseq_list(seq, buf + ret, len - ret,
+ depth, seq->type,
+ lowbound, upbound, i);
}
}
} else {
/* display only the sequence that matches the specified type */
if (upbound < lowbound) {
- tipc_printf(buf, "invalid name sequence specified\n");
- return;
+ ret += tipc_snprintf(buf + ret, len - ret,
+ "invalid name sequence specified\n");
+ return ret;
}
- nametbl_header(buf, depth);
+ ret += nametbl_header(buf + ret, len - ret, depth);
i = hash(type);
seq_head = &table.types[i];
hlist_for_each_entry(seq, seq_node, seq_head, ns_list) {
if (seq->type == type) {
- nameseq_list(seq, buf, depth, type,
- lowbound, upbound, i);
+ ret += nameseq_list(seq, buf + ret, len - ret,
+ depth, type,
+ lowbound, upbound, i);
break;
}
}
}
+ return ret;
}
-#define MAX_NAME_TBL_QUERY 32768
-
struct sk_buff *tipc_nametbl_get(const void *req_tlv_area, int req_tlv_space)
{
struct sk_buff *buf;
struct tipc_name_table_query *argv;
struct tlv_desc *rep_tlv;
- struct print_buf b;
+ char *pb;
+ int pb_len;
int str_len;
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NAME_TBL_QUERY))
return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
- buf = tipc_cfg_reply_alloc(TLV_SPACE(MAX_NAME_TBL_QUERY));
+ buf = tipc_cfg_reply_alloc(TLV_SPACE(ULTRA_STRING_MAX_LEN));
if (!buf)
return NULL;
rep_tlv = (struct tlv_desc *)buf->data;
- tipc_printbuf_init(&b, TLV_DATA(rep_tlv), MAX_NAME_TBL_QUERY);
+ pb = TLV_DATA(rep_tlv);
+ pb_len = ULTRA_STRING_MAX_LEN;
argv = (struct tipc_name_table_query *)TLV_DATA(req_tlv_area);
read_lock_bh(&tipc_nametbl_lock);
- nametbl_list(&b, ntohl(argv->depth), ntohl(argv->type),
- ntohl(argv->lowbound), ntohl(argv->upbound));
+ str_len = nametbl_list(pb, pb_len, ntohl(argv->depth),
+ ntohl(argv->type),
+ ntohl(argv->lowbound), ntohl(argv->upbound));
read_unlock_bh(&tipc_nametbl_lock);
- str_len = tipc_printbuf_validate(&b);
-
+ str_len += 1; /* for "\0" */
skb_put(buf, TLV_SPACE(str_len));
TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len);
diff --git a/net/tipc/port.c b/net/tipc/port.c
index 5d374d7..cee4d24 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -581,67 +581,73 @@ exit:
kfree_skb(buf);
}
-static void port_print(struct tipc_port *p_ptr, struct print_buf *buf, int full_id)
+static int port_print(struct tipc_port *p_ptr, char *buf, int len, int full_id)
{
struct publication *publ;
+ int ret;
if (full_id)
- tipc_printf(buf, "<%u.%u.%u:%u>:",
- tipc_zone(tipc_own_addr), tipc_cluster(tipc_own_addr),
- tipc_node(tipc_own_addr), p_ptr->ref);
+ ret = tipc_snprintf(buf, len, "<%u.%u.%u:%u>:",
+ tipc_zone(tipc_own_addr),
+ tipc_cluster(tipc_own_addr),
+ tipc_node(tipc_own_addr), p_ptr->ref);
else
- tipc_printf(buf, "%-10u:", p_ptr->ref);
+ ret = tipc_snprintf(buf, len, "%-10u:", p_ptr->ref);
if (p_ptr->connected) {
u32 dport = port_peerport(p_ptr);
u32 destnode = port_peernode(p_ptr);
- tipc_printf(buf, " connected to <%u.%u.%u:%u>",
- tipc_zone(destnode), tipc_cluster(destnode),
- tipc_node(destnode), dport);
+ ret += tipc_snprintf(buf + ret, len - ret,
+ " connected to <%u.%u.%u:%u>",
+ tipc_zone(destnode),
+ tipc_cluster(destnode),
+ tipc_node(destnode), dport);
if (p_ptr->conn_type != 0)
- tipc_printf(buf, " via {%u,%u}",
- p_ptr->conn_type,
- p_ptr->conn_instance);
+ ret += tipc_snprintf(buf + ret, len - ret,
+ " via {%u,%u}", p_ptr->conn_type,
+ p_ptr->conn_instance);
} else if (p_ptr->published) {
- tipc_printf(buf, " bound to");
+ ret += tipc_snprintf(buf + ret, len - ret, " bound to");
list_for_each_entry(publ, &p_ptr->publications, pport_list) {
if (publ->lower == publ->upper)
- tipc_printf(buf, " {%u,%u}", publ->type,
- publ->lower);
+ ret += tipc_snprintf(buf + ret, len - ret,
+ " {%u,%u}", publ->type,
+ publ->lower);
else
- tipc_printf(buf, " {%u,%u,%u}", publ->type,
- publ->lower, publ->upper);
+ ret += tipc_snprintf(buf + ret, len - ret,
+ " {%u,%u,%u}", publ->type,
+ publ->lower, publ->upper);
}
}
- tipc_printf(buf, "\n");
+ ret += tipc_snprintf(buf + ret, len - ret, "\n");
+ return ret;
}
-#define MAX_PORT_QUERY 32768
-
struct sk_buff *tipc_port_get_ports(void)
{
struct sk_buff *buf;
struct tlv_desc *rep_tlv;
- struct print_buf pb;
+ char *pb;
+ int pb_len;
struct tipc_port *p_ptr;
- int str_len;
+ int str_len = 0;
- buf = tipc_cfg_reply_alloc(TLV_SPACE(MAX_PORT_QUERY));
+ buf = tipc_cfg_reply_alloc(TLV_SPACE(ULTRA_STRING_MAX_LEN));
if (!buf)
return NULL;
rep_tlv = (struct tlv_desc *)buf->data;
+ pb = TLV_DATA(rep_tlv);
+ pb_len = ULTRA_STRING_MAX_LEN;
- tipc_printbuf_init(&pb, TLV_DATA(rep_tlv), MAX_PORT_QUERY);
spin_lock_bh(&tipc_port_list_lock);
list_for_each_entry(p_ptr, &ports, port_list) {
spin_lock_bh(p_ptr->lock);
- port_print(p_ptr, &pb, 0);
+ str_len += port_print(p_ptr, pb, pb_len, 0);
spin_unlock_bh(p_ptr->lock);
}
spin_unlock_bh(&tipc_port_list_lock);
- str_len = tipc_printbuf_validate(&pb);
-
+ str_len += 1; /* for "\0" */
skb_put(buf, TLV_SPACE(str_len));
TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len);
--
1.7.9.7
^ permalink raw reply related
* [PATCH net-next 8/8] tipc: remove print_buf and deprecated log buffer code
From: Paul Gortmaker @ 2012-07-12 16:40 UTC (permalink / raw)
To: davem; +Cc: netdev, Jon Maloy, Erik Hugne, ying.xue, Paul Gortmaker
In-Reply-To: <1342111201-9426-1-git-send-email-paul.gortmaker@windriver.com>
From: Erik Hugne <erik.hugne@ericsson.com>
The internal log buffer handling functions can now safely be
removed since there is no code using it anymore. Requests to
interact with the internal tipc log buffer over netlink (in
config.c) will report 'obsolete command'.
This represents the final removal of any references to a
struct print_buf, and the removal of the struct itself.
We also get rid of a TIPC specific Kconfig in the process.
Finally, log.h is removed since it is not needed anymore.
Signed-off-by: Erik Hugne <erik.hugne@ericsson.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
include/linux/tipc_config.h | 4 +-
net/tipc/Kconfig | 13 ---
net/tipc/config.c | 8 +-
net/tipc/core.c | 7 --
net/tipc/core.h | 27 ------
net/tipc/link.h | 1 -
net/tipc/log.c | 213 -------------------------------------------
net/tipc/log.h | 66 --------------
8 files changed, 4 insertions(+), 335 deletions(-)
delete mode 100644 net/tipc/log.h
diff --git a/include/linux/tipc_config.h b/include/linux/tipc_config.h
index 9730b0e..c989284 100644
--- a/include/linux/tipc_config.h
+++ b/include/linux/tipc_config.h
@@ -102,8 +102,8 @@
#define TIPC_CMD_SET_LINK_TOL 0x4107 /* tx link_config, rx none */
#define TIPC_CMD_SET_LINK_PRI 0x4108 /* tx link_config, rx none */
#define TIPC_CMD_SET_LINK_WINDOW 0x4109 /* tx link_config, rx none */
-#define TIPC_CMD_SET_LOG_SIZE 0x410A /* tx unsigned, rx none */
-#define TIPC_CMD_DUMP_LOG 0x410B /* tx none, rx ultra_string */
+#define TIPC_CMD_SET_LOG_SIZE 0x410A /* obsoleted */
+#define TIPC_CMD_DUMP_LOG 0x410B /* obsoleted */
#define TIPC_CMD_RESET_LINK_STATS 0x410C /* tx link_name, rx none */
/*
diff --git a/net/tipc/Kconfig b/net/tipc/Kconfig
index e24519a..5854601 100644
--- a/net/tipc/Kconfig
+++ b/net/tipc/Kconfig
@@ -41,17 +41,4 @@ config TIPC_PORTS
Setting this to a smaller value saves some memory,
setting it to higher allows for more ports.
-config TIPC_LOG
- int "Size of log buffer"
- depends on TIPC_ADVANCED
- range 0 32768
- default "0"
- help
- Size (in bytes) of TIPC's internal log buffer, which records the
- occurrence of significant events. Can range from 0 to 32768 bytes;
- default is 0.
-
- There is no need to enable the log buffer unless the node will be
- managed remotely via TIPC.
-
endif # TIPC
diff --git a/net/tipc/config.c b/net/tipc/config.c
index 65057e9..7cbff85 100644
--- a/net/tipc/config.c
+++ b/net/tipc/config.c
@@ -334,12 +334,6 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area
case TIPC_CMD_SHOW_PORTS:
rep_tlv_buf = tipc_port_get_ports();
break;
- case TIPC_CMD_SET_LOG_SIZE:
- rep_tlv_buf = tipc_log_resize_cmd(req_tlv_area, req_tlv_space);
- break;
- case TIPC_CMD_DUMP_LOG:
- rep_tlv_buf = tipc_log_dump();
- break;
case TIPC_CMD_SHOW_STATS:
rep_tlv_buf = tipc_show_stats();
break;
@@ -399,6 +393,8 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area
case TIPC_CMD_GET_MAX_CLUSTERS:
case TIPC_CMD_SET_MAX_NODES:
case TIPC_CMD_GET_MAX_NODES:
+ case TIPC_CMD_SET_LOG_SIZE:
+ case TIPC_CMD_DUMP_LOG:
rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
" (obsolete command)");
break;
diff --git a/net/tipc/core.c b/net/tipc/core.c
index 019d054..a6deab4 100644
--- a/net/tipc/core.c
+++ b/net/tipc/core.c
@@ -47,9 +47,6 @@
#define CONFIG_TIPC_PORTS 8191
#endif
-#ifndef CONFIG_TIPC_LOG
-#define CONFIG_TIPC_LOG 0
-#endif
/* global variables used by multiple sub-systems within TIPC */
int tipc_random;
@@ -125,7 +122,6 @@ static void tipc_core_stop(void)
tipc_nametbl_stop();
tipc_ref_table_stop();
tipc_socket_stop();
- tipc_log_resize(0);
}
/**
@@ -161,9 +157,6 @@ static int __init tipc_init(void)
{
int res;
- if (tipc_log_resize(CONFIG_TIPC_LOG) != 0)
- pr_warn("TIPC: Unable to create log buffer\n");
-
pr_info("TIPC: Activated (version " TIPC_MOD_VER ")\n");
tipc_own_addr = 0;
diff --git a/net/tipc/core.h b/net/tipc/core.h
index 7ba74ba..253e53a 100644
--- a/net/tipc/core.h
+++ b/net/tipc/core.h
@@ -61,37 +61,10 @@
#define ULTRA_STRING_MAX_LEN 32768
struct tipc_msg; /* msg.h */
-struct print_buf; /* log.h */
-
-/*
- * TIPC system monitoring code
- */
-
-/*
- * TIPC's print buffer subsystem supports the following print buffers:
- *
- * TIPC_NULL : null buffer (i.e. print nowhere)
- * TIPC_CONS : system console
- * TIPC_LOG : TIPC log buffer
- * &buf : user-defined buffer (struct print_buf *)
- *
- * Note: TIPC_LOG is configured to echo its output to the system console;
- * user-defined buffers can be configured to do the same thing.
- */
-extern struct print_buf *const TIPC_NULL;
-extern struct print_buf *const TIPC_CONS;
-extern struct print_buf *const TIPC_LOG;
int tipc_snprintf(char *buf, int len, const char *fmt, ...);
/*
- * TIPC_OUTPUT is the destination print buffer for system messages.
- */
-#ifndef TIPC_OUTPUT
-#define TIPC_OUTPUT TIPC_LOG
-#endif
-
-/*
* TIPC-specific error codes
*/
#define ELINKCONG EAGAIN /* link congestion <=> resource unavailable */
diff --git a/net/tipc/link.h b/net/tipc/link.h
index 8024a56..6e92112 100644
--- a/net/tipc/link.h
+++ b/net/tipc/link.h
@@ -37,7 +37,6 @@
#ifndef _TIPC_LINK_H
#define _TIPC_LINK_H
-#include "log.h"
#include "msg.h"
#include "node.h"
diff --git a/net/tipc/log.c b/net/tipc/log.c
index fa7ce92..abef644 100644
--- a/net/tipc/log.c
+++ b/net/tipc/log.c
@@ -36,138 +36,6 @@
#include "core.h"
#include "config.h"
-#include "log.h"
-
-/*
- * TIPC pre-defines the following print buffers:
- *
- * TIPC_NULL : null buffer (i.e. print nowhere)
- * TIPC_CONS : system console
- * TIPC_LOG : TIPC log buffer
- *
- * Additional user-defined print buffers are also permitted.
- */
-static struct print_buf null_buf = { NULL, 0, NULL, 0 };
-struct print_buf *const TIPC_NULL = &null_buf;
-
-static struct print_buf cons_buf = { NULL, 0, NULL, 1 };
-struct print_buf *const TIPC_CONS = &cons_buf;
-
-static struct print_buf log_buf = { NULL, 0, NULL, 1 };
-struct print_buf *const TIPC_LOG = &log_buf;
-
-/*
- * Locking policy when using print buffers.
- *
- * 1) tipc_printf() uses 'print_lock' to protect against concurrent access to
- * 'print_string' when writing to a print buffer. This also protects against
- * concurrent writes to the print buffer being written to.
- *
- * 2) tipc_log_XXX() leverages the aforementioned use of 'print_lock' to
- * protect against all types of concurrent operations on their associated
- * print buffer (not just write operations).
- *
- * Note: All routines of the form tipc_printbuf_XXX() are lock-free, and rely
- * on the caller to prevent simultaneous use of the print buffer(s) being
- * manipulated.
- */
-static DEFINE_SPINLOCK(print_lock);
-
-static void tipc_printbuf_move(struct print_buf *pb_to,
- struct print_buf *pb_from);
-
-/**
- * tipc_printbuf_init - initialize print buffer to empty
- * @pb: pointer to print buffer structure
- * @raw: pointer to character array used by print buffer
- * @size: size of character array
- *
- * Note: If the character array is too small (or absent), the print buffer
- * becomes a null device that discards anything written to it.
- */
-void tipc_printbuf_init(struct print_buf *pb, char *raw, u32 size)
-{
- pb->buf = raw;
- pb->crs = raw;
- pb->size = size;
- pb->echo = 0;
-
- if (size < TIPC_PB_MIN_SIZE) {
- pb->buf = NULL;
- } else if (raw) {
- pb->buf[0] = 0;
- pb->buf[size - 1] = ~0;
- }
-}
-
-/**
- * tipc_printbuf_reset - reinitialize print buffer to empty state
- * @pb: pointer to print buffer structure
- */
-static void tipc_printbuf_reset(struct print_buf *pb)
-{
- if (pb->buf) {
- pb->crs = pb->buf;
- pb->buf[0] = 0;
- pb->buf[pb->size - 1] = ~0;
- }
-}
-
-/**
- * tipc_printbuf_empty - test if print buffer is in empty state
- * @pb: pointer to print buffer structure
- *
- * Returns non-zero if print buffer is empty.
- */
-static int tipc_printbuf_empty(struct print_buf *pb)
-{
- return !pb->buf || (pb->crs == pb->buf);
-}
-
-/**
- * tipc_printbuf_move - move print buffer contents to another print buffer
- * @pb_to: pointer to destination print buffer structure
- * @pb_from: pointer to source print buffer structure
- *
- * Current contents of destination print buffer (if any) are discarded.
- * Source print buffer becomes empty if a successful move occurs.
- */
-static void tipc_printbuf_move(struct print_buf *pb_to,
- struct print_buf *pb_from)
-{
- int len;
-
- /* Handle the cases where contents can't be moved */
- if (!pb_to->buf)
- return;
-
- if (!pb_from->buf) {
- tipc_printbuf_reset(pb_to);
- return;
- }
-
- if (pb_to->size < pb_from->size) {
- strcpy(pb_to->buf, "*** PRINT BUFFER MOVE ERROR ***");
- pb_to->buf[pb_to->size - 1] = ~0;
- pb_to->crs = strchr(pb_to->buf, 0);
- return;
- }
-
- /* Copy data from char after cursor to end (if used) */
- len = pb_from->buf + pb_from->size - pb_from->crs - 2;
- if ((pb_from->buf[pb_from->size - 1] == 0) && (len > 0)) {
- strcpy(pb_to->buf, pb_from->crs + 1);
- pb_to->crs = pb_to->buf + len;
- } else
- pb_to->crs = pb_to->buf;
-
- /* Copy data from start to cursor (always) */
- len = pb_from->crs - pb_from->buf;
- strcpy(pb_to->crs, pb_from->buf);
- pb_to->crs += len;
-
- tipc_printbuf_reset(pb_from);
-}
/**
* tipc_snprintf - append formatted output to print buffer
@@ -185,84 +53,3 @@ int tipc_snprintf(char *buf, int len, const char *fmt, ...)
va_end(args);
return i;
}
-
-/**
- * tipc_log_resize - change the size of the TIPC log buffer
- * @log_size: print buffer size to use
- */
-int tipc_log_resize(int log_size)
-{
- int res = 0;
-
- spin_lock_bh(&print_lock);
- kfree(TIPC_LOG->buf);
- TIPC_LOG->buf = NULL;
- if (log_size) {
- if (log_size < TIPC_PB_MIN_SIZE)
- log_size = TIPC_PB_MIN_SIZE;
- res = TIPC_LOG->echo;
- tipc_printbuf_init(TIPC_LOG, kmalloc(log_size, GFP_ATOMIC),
- log_size);
- TIPC_LOG->echo = res;
- res = !TIPC_LOG->buf;
- }
- spin_unlock_bh(&print_lock);
-
- return res;
-}
-
-/**
- * tipc_log_resize_cmd - reconfigure size of TIPC log buffer
- */
-struct sk_buff *tipc_log_resize_cmd(const void *req_tlv_area, int req_tlv_space)
-{
- u32 value;
-
- if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
- return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
-
- value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area));
- if (value > 32768)
- return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
- " (log size must be 0-32768)");
- if (tipc_log_resize(value))
- return tipc_cfg_reply_error_string(
- "unable to create specified log (log size is now 0)");
- return tipc_cfg_reply_none();
-}
-
-/**
- * tipc_log_dump - capture TIPC log buffer contents in configuration message
- */
-struct sk_buff *tipc_log_dump(void)
-{
- struct sk_buff *reply;
-
- spin_lock_bh(&print_lock);
- if (!TIPC_LOG->buf) {
- spin_unlock_bh(&print_lock);
- reply = tipc_cfg_reply_ultra_string("log not activated\n");
- } else if (tipc_printbuf_empty(TIPC_LOG)) {
- spin_unlock_bh(&print_lock);
- reply = tipc_cfg_reply_ultra_string("log is empty\n");
- } else {
- struct tlv_desc *rep_tlv;
- struct print_buf pb;
- int str_len;
-
- str_len = min(TIPC_LOG->size, 32768u);
- spin_unlock_bh(&print_lock);
- reply = tipc_cfg_reply_alloc(TLV_SPACE(str_len));
- if (reply) {
- rep_tlv = (struct tlv_desc *)reply->data;
- tipc_printbuf_init(&pb, TLV_DATA(rep_tlv), str_len);
- spin_lock_bh(&print_lock);
- tipc_printbuf_move(&pb, TIPC_LOG);
- spin_unlock_bh(&print_lock);
- str_len = strlen(TLV_DATA(rep_tlv)) + 1;
- skb_put(reply, TLV_SPACE(str_len));
- TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len);
- }
- }
- return reply;
-}
diff --git a/net/tipc/log.h b/net/tipc/log.h
deleted file mode 100644
index d1f5eb9..0000000
--- a/net/tipc/log.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * net/tipc/log.h: Include file for TIPC print buffer routines
- *
- * Copyright (c) 1997-2006, Ericsson AB
- * Copyright (c) 2005-2007, Wind River Systems
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the names of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * Alternatively, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") version 2 as published by the Free
- * Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _TIPC_LOG_H
-#define _TIPC_LOG_H
-
-/**
- * struct print_buf - TIPC print buffer structure
- * @buf: pointer to character array containing print buffer contents
- * @size: size of character array
- * @crs: pointer to first unused space in character array (i.e. final NUL)
- * @echo: echo output to system console if non-zero
- */
-struct print_buf {
- char *buf;
- u32 size;
- char *crs;
- int echo;
-};
-
-#define TIPC_PB_MIN_SIZE 64 /* minimum size for a print buffer's array */
-#define TIPC_PB_MAX_STR 512 /* max printable string (with trailing NUL) */
-
-void tipc_printbuf_init(struct print_buf *pb, char *buf, u32 size);
-int tipc_printbuf_validate(struct print_buf *pb);
-
-int tipc_log_resize(int log_size);
-
-struct sk_buff *tipc_log_resize_cmd(const void *req_tlv_area,
- int req_tlv_space);
-struct sk_buff *tipc_log_dump(void);
-
-#endif
--
1.7.9.7
^ permalink raw reply related
* [PATCH net-next 5/8] tipc: simplify link_print by divorcing it from using tipc_printf
From: Paul Gortmaker @ 2012-07-12 16:39 UTC (permalink / raw)
To: davem; +Cc: netdev, Jon Maloy, Erik Hugne, ying.xue, Paul Gortmaker
In-Reply-To: <1342111201-9426-1-git-send-email-paul.gortmaker@windriver.com>
To pave the way for a pending cleanup of tipc_printf, and
removal of struct print_buf entirely, we make that task simpler
by converting link_print to issue its messages with standard
printk infrastructure. [Original idea separated from a larger
patch from Erik Hugne <erik.hugne@ericsson.com>]
Cc: Erik Hugne <erik.hugne@ericsson.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
net/tipc/link.c | 24 +++++++-----------------
1 file changed, 7 insertions(+), 17 deletions(-)
diff --git a/net/tipc/link.c b/net/tipc/link.c
index b389ab9..bf4cc41 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -3008,26 +3008,16 @@ u32 tipc_link_get_max_pkt(u32 dest, u32 selector)
static void link_print(struct tipc_link *l_ptr, const char *str)
{
- char print_area[256];
- struct print_buf pb;
- struct print_buf *buf = &pb;
-
- tipc_printbuf_init(buf, print_area, sizeof(print_area));
-
- tipc_printf(buf, str);
- tipc_printf(buf, "Link %x<%s>:",
- l_ptr->addr, l_ptr->b_ptr->name);
+ pr_info("TIPC: %s Link %x<%s>:", str, l_ptr->addr, l_ptr->b_ptr->name);
if (link_working_unknown(l_ptr))
- tipc_printf(buf, ":WU");
+ pr_cont(":WU\n");
else if (link_reset_reset(l_ptr))
- tipc_printf(buf, ":RR");
+ pr_cont(":RR\n");
else if (link_reset_unknown(l_ptr))
- tipc_printf(buf, ":RU");
+ pr_cont(":RU\n");
else if (link_working_working(l_ptr))
- tipc_printf(buf, ":WW");
- tipc_printf(buf, "\n");
-
- tipc_printbuf_validate(buf);
- pr_info("TIPC: %s", print_area);
+ pr_cont(":WW\n");
+ else
+ pr_cont("\n");
}
--
1.7.9.7
^ permalink raw reply related
* [PATCH net-next 6/8] tipc: simplify print buffer handling in tipc_printf
From: Paul Gortmaker @ 2012-07-12 16:39 UTC (permalink / raw)
To: davem; +Cc: netdev, Jon Maloy, Erik Hugne, ying.xue, Paul Gortmaker
In-Reply-To: <1342111201-9426-1-git-send-email-paul.gortmaker@windriver.com>
From: Erik Hugne <erik.hugne@ericsson.com>
tipc_printf was previously used both to construct debug traces
and to append data to buffers that should be sent over netlink
to the tipc-config application. A global print_buffer was
used to format the string before it was copied to the actual
output buffer. This could lead to concurrent access of the
global print_buffer, which then had to be lock protected.
This is simplified by changing tipc_printf to append data
directly to the output buffer using vscnprintf.
With the new implementation of tipc_printf, there is no longer
any risk of concurrent access to the internal log buffer, so
the lock (and the comments describing it) are no longer
strictly necessary. However, there are still a few functions
that do grab this lock before resizing/dumping the log
buffer. We leave the lock, and these functions untouched since
they will be removed with a subsequent commit that drops the
deprecated log buffer handling code
Signed-off-by: Erik Hugne <erik.hugne@ericsson.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
net/tipc/log.c | 52 ++++++++++------------------------------------------
1 file changed, 10 insertions(+), 42 deletions(-)
diff --git a/net/tipc/log.c b/net/tipc/log.c
index 026733f..d01e37a 100644
--- a/net/tipc/log.c
+++ b/net/tipc/log.c
@@ -71,21 +71,11 @@ struct print_buf *const TIPC_LOG = &log_buf;
* on the caller to prevent simultaneous use of the print buffer(s) being
* manipulated.
*/
-static char print_string[TIPC_PB_MAX_STR];
static DEFINE_SPINLOCK(print_lock);
static void tipc_printbuf_move(struct print_buf *pb_to,
struct print_buf *pb_from);
-#define FORMAT(PTR, LEN, FMT) \
-{\
- va_list args;\
- va_start(args, FMT);\
- LEN = vsprintf(PTR, FMT, args);\
- va_end(args);\
- *(PTR + LEN) = '\0';\
-}
-
/**
* tipc_printbuf_init - initialize print buffer to empty
* @pb: pointer to print buffer structure
@@ -220,39 +210,17 @@ static void tipc_printbuf_move(struct print_buf *pb_to,
*/
void tipc_printf(struct print_buf *pb, const char *fmt, ...)
{
- int chars_to_add;
- int chars_left;
- char save_char;
-
- spin_lock_bh(&print_lock);
-
- FORMAT(print_string, chars_to_add, fmt);
- if (chars_to_add >= TIPC_PB_MAX_STR)
- strcpy(print_string, "*** PRINT BUFFER STRING TOO LONG ***");
-
- if (pb->buf) {
- chars_left = pb->buf + pb->size - pb->crs - 1;
- if (chars_to_add <= chars_left) {
- strcpy(pb->crs, print_string);
- pb->crs += chars_to_add;
- } else if (chars_to_add >= (pb->size - 1)) {
- strcpy(pb->buf, print_string + chars_to_add + 1
- - pb->size);
- pb->crs = pb->buf + pb->size - 1;
- } else {
- strcpy(pb->buf, print_string + chars_left);
- save_char = print_string[chars_left];
- print_string[chars_left] = 0;
- strcpy(pb->crs, print_string);
- print_string[chars_left] = save_char;
- pb->crs = pb->buf + chars_to_add - chars_left;
- }
- }
-
- if (pb->echo)
- printk("%s", print_string);
+ int i;
+ va_list args;
+ char *buf;
+ int len;
- spin_unlock_bh(&print_lock);
+ buf = pb->crs;
+ len = pb->buf + pb->size - pb->crs;
+ va_start(args, fmt);
+ i = vscnprintf(buf, len, fmt, args);
+ va_end(args);
+ pb->crs += i;
}
/**
--
1.7.9.7
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox