* Re: [PATCH net-next] net: dsa: mv88e6xxx: Be explicit about DT or pdata
From: Vivien Didelot @ 2018-05-31 13:51 UTC (permalink / raw)
To: Andrew Lunn, David Miller
Cc: Florian Fainelli, dan.carpenter, netdev, Andrew Lunn
In-Reply-To: <1527718542-22658-1-git-send-email-andrew@lunn.ch>
Andrew Lunn <andrew@lunn.ch> writes:
> Make it explicit that either device tree is used or platform data. If
> neither is available, abort the probe.
>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Fixes: 877b7cb0b6f2 ("net: dsa: mv88e6xxx: Add minimal platform_data support")
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
^ permalink raw reply
* Re: [PATCH v4 net-next 00/19] inet: frags: bring rhashtables to IP defrag
From: Eric Dumazet @ 2018-05-31 14:05 UTC (permalink / raw)
To: moshe
Cc: Tariq Toukan, Eric Dumazet, aring, David Miller, netdev,
Florian Westphal, Herbert Xu, Thomas Graf, Jesper Dangaard Brouer,
Alexander Aring, Stefan Schmidt, Kirill Tkhai, Eran Ben Elisha
In-Reply-To: <0bb2faec-ba8d-51d7-0c1a-12520b9168e8@mellanox.com>
On Thu, May 31, 2018 at 8:18 AM Moshe Shemesh <moshe@mellanox.com> wrote:
>
>
>
> I do see big improvement after changing the 3 parameters as Eric suggested:
> /proc/sys/net/ipv6/ip6frag_time set to 2
> /proc/sys/net/ipv6/ip6frag_low_thresh set to 104857600
> /proc/sys/net/ipv6/ip6frag_high_thresh set to 78643200
>
>
> [root@reg-l-vrt-67100-104 linux-stable]# netperf -H
> fe80::7efe:90ff:fed5:bb48%ens9,inet6 -t udp_stream --
> MIGRATED UDP STREAM TEST from ::0 (::) port 0 AF_INET6 to
> fe80::7efe:90ff:fed5:bb48%ens9 () port 0 AF_INET6
> Socket Message Elapsed Messages
> Size Size Time Okay Errors Throughput
> bytes bytes secs # # 10^6bits/sec
>
> 212992 65507 10.00 156387 0 8194.60
> 212992 10.00 76901 4029.57
>
> #kernel
> Ip6InReceives 7107999 0.0
> Ip6InDelivers 114126 0.0
> Ip6OutRequests 47 0.0
> Ip6ReasmTimeout 5115 0.0
> Ip6ReasmReqds 7107987 0.0
> Ip6ReasmOKs 114114 0.0
> Ip6ReasmFails 1714146 0.0
> ...
> Udp6InDatagrams 112486 0.0
> Udp6InErrors 1629 0.0
> Udp6RcvbufErrors 1629 0.0
> ...
>
> While before these parameters settings I got:
> [root@reg-l-vrt-67100-104 ~]# netperf -H
> fe80::e61d:2dff:feca:c7c3%ens9,inet6 -t udp_stream --
> MIGRATED UDP STREAM TEST from ::0 (::) port 0 AF_INET6 to
> fe80::e61d:2dff:feca:c7c3%ens9 () port 0 AF_INET6
> Socket Message Elapsed Messages
> Size Size Time Okay Errors Throughput
> bytes bytes secs # # 10^6bits/sec
>
> 212992 65507 10.00 145419 0 7620.35
> 212992 10.00 285 14.93
>
> #kernel
> Ip6InReceives 6665965 0.0
> Ip6InDelivers 300 0.0
> Ip6OutRequests 9 0.0
> Ip6ReasmReqds 6665950 0.0
> Ip6ReasmOKs 285 0.0
> Ip6ReasmFails 6650890 0.0
> ...
> Udp6InDatagrams 286 0.0
>
>
> however, before the patchset, I got much better results:
> [root@reg-l-vrt-67100-104 linux-stable]# netperf -H
> fe80::7efe:90ff:fed5:bb48%ens9,inet6 -t udp_stream --
> MIGRATED UDP STREAM TEST from ::0 (::) port 0 AF_INET6 to
> fe80::7efe:90ff:fed5:bb48%ens9 () port 0 AF_INET6
> Socket Message Elapsed Messages
> Size Size Time Okay Errors Throughput
> bytes bytes secs # # 10^6bits/sec
>
> 212992 65507 10.00 158935 0 8328.32
> 212992 10.00 144652 7579.88
>
>
> #kernel
> Ip6InReceives 7088903 0.0
> Ip6InDelivers 154117 0.0
> Ip6OutRequests 9 0.0
> Ip6ReasmReqds 7088889 0.0
> Ip6ReasmOKs 154103 0.0
> ...
> Udp6InDatagrams 144653 0.0
> Udp6InErrors 9451 0.0
> Udp6RcvbufErrors 9451 0.0
>
>
Hi Moshe
Your environment seems to be very lossy.
Frags and packets losses do not mix well, there is nothing really
magic we can do with that,
unless we can reserve GB of memory for frags.
Which is exactly was the reason for my patches in the first place.
Thanks.
^ permalink raw reply
* pull-request: wireless-drivers-next 2018-05-31
From: Kalle Valo @ 2018-05-31 14:10 UTC (permalink / raw)
To: David Miller; +Cc: linux-wireless, netdev, linux-kernel
Hi Dave,
here's a pull request to net-next tree for 4.18. More info below and
please let me know if there are any problems.
Kalle
The following changes since commit e3bb946cd922b773fdc03252aefbf2472d1d530c:
Merge branch 'TI-Ethernet-driver-warnings-fixes' (2018-05-21 16:17:11 -0400)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git tags/wireless-drivers-next-for-davem-2018-05-31
for you to fetch changes up to 76606886c9f433bb46ed9c8910cabce780b23f36:
Merge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git (2018-05-30 22:24:44 +0300)
----------------------------------------------------------------
wireless-drivers-next patches for 4.18
Hopefully the last pull request to 4.18 before the merge window.
Nothing major here, we have smaller new features and of course a lots
of fixes.
Major changes:
ath10k
* add memory dump support for QCA9888 and QCA99X0
* add support to configure channel dwell time
* support new DFS host confirmation feature in the firmware
ath
* update various regulatory mappings
wcn36xx
* various fixes to improve reliability
* add Factory Test Mode support
brmfmac
* add debugfs file for reading firmware capabilities
mwifiex
* support sysfs initiated device coredump
----------------------------------------------------------------
Ahmad Masri (1):
wil6210: align to latest auto generated wmi.h
Alexei Avshalom Lazar (2):
wil6210: disable tracing config option
wil6210: Initialize reply struct of the WMI commands
Andrey Shevchenko (3):
qtnfmac: remove unused function declarations
qtnfmac: fix bg_scan_period parameter processing
qtnfmac: cancel scan on disconnect
Anilkumar Kolli (1):
ath10k: add memory dump support for QCA9888 and QCA99X0
Arend Van Spriel (3):
brcmfmac: move ALLFFMAC variable in flowring module
brcmfmac: add support for sysfs initiated coredump
mwifiex: support sysfs initiated device coredump
Aviya Erenfeld (1):
iwlmvm: tdls: Check TDLS channel switch support
Colin Ian King (3):
ath10k: fix spelling mistake: "servive" -> "service"
rsi: fix spelling mistake "Uknown" -> "Unknown"
iwlwifi: mvm: remove division by size of sizeof(struct ieee80211_wmm_rule)
Daniel Mack (10):
wcn36xx: fix buffer commit logic on TX path
wcn36xx: set DMA mask explicitly
wcn36xx: don't disable RX IRQ from handler
wcn36xx: clear all masks in RX interrupt
wcn36xx: only handle packets when ED or DONE bit is set
wcn36xx: consider CTRL_EOP bit when looking for valid descriptors
wcn36xx: set PREASSOC and IDLE stated when BSS info changes
wcn36xx: drain pending indicator messages on shutdown
wcn36xx: simplify wcn36xx_smd_open()
wcn36xx: improve debug and error messages for SMD
Dedy Lansky (3):
wil6210: move WMI functionality out of wil_cfg80211_mgmt_tx
wil6210: remove unused rx_reorder members
wil6210: rate limit wil_rx_refill error
Dmitry Lebed (2):
qtnfmac: improve control path timeout handling
qtnfmac: fix firmware command error path
Emmanuel Grumbach (2):
iwlwifi: mvm: fix TSO with highly fragmented SKBs
iwlwifi: mvm: honor the max_amsdu_subframes limit
Erel Geron (1):
iwlwifi: fix non_shared_ant for 9000 devices
Erik Stromdahl (1):
ath10k: fix return value check in wake_tx_q op
Eyal Ilsar (1):
wcn36xx: Add support for Factory Test Mode (FTM)
Eyal Reizer (1):
wlcore: sdio: check for valid platform device data before suspend
Fabio Estevam (1):
ath10k: snoc: Remove owner assignment from platform_driver
Felix Fietkau (7):
mt76: fix sending encrypted broadcast packets for secondary interfaces
mt76: discard early received packets if not running yet
mt76: only stop tx queues on offchannel, not during the entire scan
mt76: prevent tx scheduling during channel change
mt76: move ieee80211_hw allocation to common core
mt76: wait for pending tx to complete before switching channel
mt76: use udelay instead of usleep_range in mt76x2_mac_stop
Franky Lin (3):
brcmfmac: validate user provided data for memdump before copying
brcmfmac: trigger memory dump upon firmware halt signal
brcmfmac: trigger memory dump on SDIO firmware halt message
Ganapathi Bhat (3):
mwifiex: avoid exporting mwifiex_send_cmd
mwifiex: handle race during mwifiex_usb_disconnect
mwifiex: skip sending GT_REKEY_OFFLOAD_CFG if firmware has no support
Golan Ben Ami (1):
iwlwifi: add csr configuration for 6300 devices
Govind Singh (1):
ath10k: replace bit shifts with the BIT() macro for rx desc bits
Gregory Greenman (1):
iwlwifi: mvm: open BA session only when sta is authorized
Gustavo A. R. Silva (2):
mwifiex: mark expected switch fall-throughs
rtlwifi: remove duplicate code
Igor Mitsyanko (1):
qtnfmac: decode error codes from firmware replies
Johannes Berg (1):
iwlwifi: mvm: fix race in queue notification wait
Kalle Valo (3):
Merge ath-next from git://git.kernel.org/.../kvalo/ath.git
Merge tag 'iwlwifi-next-for-kalle-2018-05-30' of git://git.kernel.org/.../iwlwifi/iwlwifi-next
Merge ath-next from git://git.kernel.org/.../kvalo/ath.git
Kenneth Lu (1):
ath10k: remove variables which set but not used
Lior David (2):
wil6210: fix call to wil6210_disconnect during unload
wil6210: change reply_size arg to u16 in wmi_call
Lorenzo Bianconi (1):
mt76x2: apply coverage class on slot time too
Luc Van Oostenryck (1):
ath6kl: fix ath6kl_data_tx()'s return type
Marcus Folkesson (1):
ath10k: hw: make consistent usage of ATH10K_FW_DIR in paths
Niklas Cassel (1):
ath10k: sdio: jump to correct label in error handling path
Ping-Ke Shih (13):
rtlwifi: remove CONNECTION_MONITOR flag
rtlwifi: remove duplicate rx_packet_type definition
rtlwifi: rename register-based C2H command IDs to V0
rtlwifi: remove duplicate C2H definition
rtlwifi: remove unused fw C2H command ID
rtlwifi: remove dummy hal_op rx_command_packet from rtl8188ee and rtl8723ae
rtlwifi: Add hal_op c2h_ra_report_handler for special process
rtlwifi: remove duplicate C2H handler
rtlwifi: remove hal_op rx_command_packet
rtlwifi: remove hal_op c2h_content_parsing
rtlwifi: use sk_buff to queue C2H commands
rtlwifi: access skb->data to get C2H data by macro
rtlwifi: fix btmpinfo timeout while processing C2H_BT_INFO
Pradeep Kumar Chitrapu (1):
ath10k: add support to configure channel dwell time
Rafał Miłecki (1):
brcmfmac: add debugfs entry for reading firmware capabilities
Sanjay Konduri (2):
rsi: add fix for crash during assertions
rsi: add fix for corruption of auto rate table
Sara Sharon (1):
iwlwifi: mvm: drop UNKNOWN security type frames
Sergey Matyukevich (3):
qtnfmac: simplify notation
qtnfmac: cleanup wdev structure between its uses
qtnfmac: fix invalid STA state on EAPOL failure
Shaul Triebitz (1):
iwlwifi: pcie: fix race in Rx buffer allocator
Sriram R (2):
ath: add support to get the detected radar specifications
ath10k: DFS Host Confirmation
Sven Eckelmann (35):
ath: Add regulatory mapping for Bahamas
ath: Add regulatory mapping for Bermuda
ath: Add regulatory mapping for Kenya
ath: Add regulatory mapping for Mauritius
ath: Add regulatory mapping for Montenegro
ath: Add regulatory mapping for Nicaragua
ath: Add regulatory mapping for Paraguya
ath: Add regulatory mapping for Serbia
ath: Add regulatory mapping for Tanzania
ath: Add regulatory mapping for Uganda
ath: Add regulatory mapping for APL2_FCCA
ath: Add regulatory mapping for APL13_WORLD
ath: Add regulatory mapping for ETSI8_WORLD
ath: Add regulatory mapping for ETSI9_WORLD
ath: Add regulatory mapping for FCC3_ETSIC
ath: Map Albania to ETSI1_WORLD
ath: Map Algeria to APL13_WORLD
ath: Map Australia to FCC3_WORLD
ath: Map Bangladesh to APL1_WORLD
ath: Map Brunei Darussalam to APL6_WORLD
ath: Map Bulgaria to ETSI1_WORLD
ath: Map Colombia to FCC1_FCCA
ath: Map Czech to ETSI1_WORLD
ath: Map Honduras to FCC3_WORLD
ath: Map Isreal to ETSI3_WORLD
ath: Map Macedonia to ETSI1_WORLD
ath: Map Malasia to FCC1_WORLD
ath: Map New Zealand to FCC3_ETSIC
ath: Map Peru to APL1_WORLD
ath: Map Philippines to FCC3_WORLD
ath: Map Romania to ETSI1_WORLD
ath: Map Russia to ETSI8_WORLD
ath: Map Singapore to FCC3_WORLD
ath: Map Ukraine to ETSI9_WORLD
ath: Map Zimbabwe to ETSI1_WORLD
Tamizh Chelvam (1):
ath10k: fix kernel panic while reading tpc_stats
Tony Lindgren (1):
wlcore: sdio: Fix flakey SDIO runtime PM handling
Tzu-En Huang (1):
rtlwifi: support accurate nullfunc frame tx ack report
Venkateswara Naralasetty (1):
ath10k: fix information leak in debugfs
Xinming Hu (3):
mwifiex: correct histogram data with appropriate index
mwifiex: increase log level for internal scan fail result
mwifiex: reserve passive scan time for radar channel
Yu Wang (1):
ath10k: add quiet mode support for QCA6174/QCA9377
YueHaibing (2):
ath10k: remove useless test before clk_disable_unprepare
atmel: Add missing call to pci_disable_device()
drivers/net/wireless/ath/ath10k/ahb.c | 9 +-
drivers/net/wireless/ath/ath10k/core.h | 22 ++
drivers/net/wireless/ath/ath10k/coredump.c | 98 ++++++
drivers/net/wireless/ath/ath10k/debug.c | 28 +-
drivers/net/wireless/ath/ath10k/debugfs_sta.c | 30 +-
drivers/net/wireless/ath/ath10k/hw.h | 4 +-
drivers/net/wireless/ath/ath10k/mac.c | 37 +-
drivers/net/wireless/ath/ath10k/rx_desc.h | 136 ++++----
drivers/net/wireless/ath/ath10k/sdio.c | 2 +-
drivers/net/wireless/ath/ath10k/snoc.c | 1 -
drivers/net/wireless/ath/ath10k/wmi-ops.h | 32 ++
drivers/net/wireless/ath/ath10k/wmi-tlv.c | 33 +-
drivers/net/wireless/ath/ath10k/wmi-tlv.h | 16 +
drivers/net/wireless/ath/ath10k/wmi.c | 206 +++++++++--
drivers/net/wireless/ath/ath10k/wmi.h | 34 +-
drivers/net/wireless/ath/ath6kl/core.h | 2 +-
drivers/net/wireless/ath/ath6kl/txrx.c | 2 +-
drivers/net/wireless/ath/ath9k/dfs.c | 2 +-
drivers/net/wireless/ath/dfs_pattern_detector.c | 5 +-
drivers/net/wireless/ath/dfs_pattern_detector.h | 3 +-
drivers/net/wireless/ath/dfs_pri_detector.h | 3 +-
drivers/net/wireless/ath/regd.h | 7 +
drivers/net/wireless/ath/regd_common.h | 60 ++--
drivers/net/wireless/ath/wcn36xx/Makefile | 2 +
drivers/net/wireless/ath/wcn36xx/dxe.c | 176 ++++++----
drivers/net/wireless/ath/wcn36xx/hal.h | 16 +
drivers/net/wireless/ath/wcn36xx/main.c | 13 +
drivers/net/wireless/ath/wcn36xx/smd.c | 113 +++++-
drivers/net/wireless/ath/wcn36xx/smd.h | 4 +
drivers/net/wireless/ath/wcn36xx/testmode.c | 149 ++++++++
drivers/net/wireless/ath/wcn36xx/testmode.h | 46 +++
drivers/net/wireless/ath/wcn36xx/testmode_i.h | 29 ++
drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 2 +
drivers/net/wireless/ath/wil6210/Kconfig | 2 +-
drivers/net/wireless/ath/wil6210/cfg80211.c | 61 +---
drivers/net/wireless/ath/wil6210/debugfs.c | 5 +-
drivers/net/wireless/ath/wil6210/main.c | 2 +
drivers/net/wireless/ath/wil6210/netdev.c | 8 +-
drivers/net/wireless/ath/wil6210/rx_reorder.c | 7 +-
drivers/net/wireless/ath/wil6210/txrx.c | 12 +-
drivers/net/wireless/ath/wil6210/wil6210.h | 13 +-
drivers/net/wireless/ath/wil6210/wmi.c | 152 +++++---
drivers/net/wireless/ath/wil6210/wmi.h | 387 +++++++++++++++++++--
drivers/net/wireless/atmel/atmel_pci.c | 4 +-
.../wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 1 +
.../net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 2 +
.../wireless/broadcom/brcm80211/brcmfmac/common.c | 2 -
.../wireless/broadcom/brcm80211/brcmfmac/common.h | 2 -
.../wireless/broadcom/brcm80211/brcmfmac/core.c | 8 +
.../wireless/broadcom/brcm80211/brcmfmac/debug.c | 3 +-
.../wireless/broadcom/brcm80211/brcmfmac/feature.c | 36 ++
.../broadcom/brcm80211/brcmfmac/flowring.c | 2 +
.../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 6 +
.../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 4 +-
drivers/net/wireless/intel/iwlwifi/cfg/6000.c | 1 +
drivers/net/wireless/intel/iwlwifi/cfg/9000.c | 2 +-
drivers/net/wireless/intel/iwlwifi/fw/api/rx.h | 1 +
drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c | 3 +-
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 8 +-
drivers/net/wireless/intel/iwlwifi/mvm/rs.c | 38 +-
drivers/net/wireless/intel/iwlwifi/mvm/rs.h | 7 +-
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 36 +-
drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 2 +-
drivers/net/wireless/intel/iwlwifi/mvm/sta.h | 10 +-
drivers/net/wireless/intel/iwlwifi/mvm/tdls.c | 16 +-
drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 16 +-
drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 3 +
drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 2 +
drivers/net/wireless/marvell/mwifiex/cfg80211.c | 24 +-
drivers/net/wireless/marvell/mwifiex/debugfs.c | 31 +-
drivers/net/wireless/marvell/mwifiex/fw.h | 1 +
drivers/net/wireless/marvell/mwifiex/main.h | 1 +
drivers/net/wireless/marvell/mwifiex/pcie.c | 18 +-
drivers/net/wireless/marvell/mwifiex/scan.c | 10 +-
drivers/net/wireless/marvell/mwifiex/sdio.c | 12 +
drivers/net/wireless/marvell/mwifiex/sta_event.c | 3 +
drivers/net/wireless/marvell/mwifiex/usb.c | 15 +
drivers/net/wireless/marvell/mwifiex/util.c | 15 +-
drivers/net/wireless/mediatek/mt76/dma.c | 4 +
drivers/net/wireless/mediatek/mt76/mac80211.c | 43 ++-
drivers/net/wireless/mediatek/mt76/mt76.h | 5 +
drivers/net/wireless/mediatek/mt76/mt76x2.h | 3 +
drivers/net/wireless/mediatek/mt76/mt76x2_init.c | 22 +-
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c | 3 +
drivers/net/wireless/mediatek/mt76/mt76x2_main.c | 15 +-
drivers/net/wireless/mediatek/mt76/tx.c | 4 +-
drivers/net/wireless/quantenna/qtnfmac/bus.h | 3 +-
drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 56 +--
drivers/net/wireless/quantenna/qtnfmac/commands.c | 35 +-
drivers/net/wireless/quantenna/qtnfmac/commands.h | 5 -
drivers/net/wireless/quantenna/qtnfmac/core.c | 3 +-
drivers/net/wireless/quantenna/qtnfmac/core.h | 2 -
drivers/net/wireless/quantenna/qtnfmac/event.c | 8 +-
.../net/wireless/quantenna/qtnfmac/pearl/pcie.c | 15 +-
drivers/net/wireless/quantenna/qtnfmac/qlink.h | 2 +
drivers/net/wireless/quantenna/qtnfmac/trans.c | 4 +-
drivers/net/wireless/realtek/rtlwifi/base.c | 208 ++++++++---
drivers/net/wireless/realtek/rtlwifi/base.h | 7 +-
.../realtek/rtlwifi/btcoexist/halbtc8723b2ant.c | 23 +-
drivers/net/wireless/realtek/rtlwifi/pci.c | 18 +-
.../net/wireless/realtek/rtlwifi/rtl8188ee/def.h | 32 --
.../net/wireless/realtek/rtlwifi/rtl8188ee/sw.c | 2 -
.../net/wireless/realtek/rtlwifi/rtl8188ee/trx.c | 7 -
.../net/wireless/realtek/rtlwifi/rtl8188ee/trx.h | 4 -
.../net/wireless/realtek/rtlwifi/rtl8192ce/def.h | 25 --
.../net/wireless/realtek/rtlwifi/rtl8192ee/def.h | 8 -
.../net/wireless/realtek/rtlwifi/rtl8192ee/fw.c | 78 +----
.../net/wireless/realtek/rtlwifi/rtl8192ee/fw.h | 16 +-
.../net/wireless/realtek/rtlwifi/rtl8192ee/sw.c | 3 +-
.../net/wireless/realtek/rtlwifi/rtl8192ee/trx.c | 29 +-
.../net/wireless/realtek/rtlwifi/rtl8192ee/trx.h | 3 -
.../net/wireless/realtek/rtlwifi/rtl8723ae/def.h | 25 --
.../wireless/realtek/rtlwifi/rtl8723ae/hal_btc.c | 6 +-
.../wireless/realtek/rtlwifi/rtl8723ae/hal_btc.h | 20 +-
.../net/wireless/realtek/rtlwifi/rtl8723ae/sw.c | 1 -
.../net/wireless/realtek/rtlwifi/rtl8723ae/trx.c | 7 -
.../net/wireless/realtek/rtlwifi/rtl8723ae/trx.h | 3 -
.../net/wireless/realtek/rtlwifi/rtl8723be/def.h | 8 -
.../net/wireless/realtek/rtlwifi/rtl8723be/fw.c | 69 ----
.../net/wireless/realtek/rtlwifi/rtl8723be/fw.h | 13 -
.../net/wireless/realtek/rtlwifi/rtl8723be/sw.c | 2 -
.../net/wireless/realtek/rtlwifi/rtl8723be/trx.c | 30 +-
.../net/wireless/realtek/rtlwifi/rtl8723be/trx.h | 3 -
.../net/wireless/realtek/rtlwifi/rtl8821ae/def.h | 33 --
.../net/wireless/realtek/rtlwifi/rtl8821ae/fw.c | 69 +---
.../net/wireless/realtek/rtlwifi/rtl8821ae/fw.h | 21 +-
.../net/wireless/realtek/rtlwifi/rtl8821ae/sw.c | 3 +-
.../net/wireless/realtek/rtlwifi/rtl8821ae/trx.c | 31 +-
.../net/wireless/realtek/rtlwifi/rtl8821ae/trx.h | 3 -
drivers/net/wireless/realtek/rtlwifi/wifi.h | 56 ++-
drivers/net/wireless/rsi/rsi_91x_mac80211.c | 3 +-
drivers/net/wireless/rsi/rsi_91x_mgmt.c | 1 +
drivers/net/wireless/ti/wlcore/sdio.c | 21 +-
133 files changed, 2282 insertions(+), 1157 deletions(-)
create mode 100644 drivers/net/wireless/ath/wcn36xx/testmode.c
create mode 100644 drivers/net/wireless/ath/wcn36xx/testmode.h
create mode 100644 drivers/net/wireless/ath/wcn36xx/testmode_i.h
--
Kalle Valo
^ permalink raw reply
* Re: [PATCH net-next] net: dsa: mv88e6xxx: Be explicit about DT or pdata
From: Florian Fainelli @ 2018-05-31 14:12 UTC (permalink / raw)
To: Andrew Lunn, David Miller; +Cc: Vivien Didelot, dan.carpenter, netdev
In-Reply-To: <1527718542-22658-1-git-send-email-andrew@lunn.ch>
On 05/30/2018 03:15 PM, Andrew Lunn wrote:
> Make it explicit that either device tree is used or platform data. If
> neither is available, abort the probe.
>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Fixes: 877b7cb0b6f2 ("net: dsa: mv88e6xxx: Add minimal platform_data support")
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply
* Re: [PATCH v2] net: dsa: b53: Add BCM5389 support
From: Florian Fainelli @ 2018-05-31 14:14 UTC (permalink / raw)
To: Damien Thébault, vivien.didelot@savoirfairelinux.com,
andrew@lunn.ch
Cc: davem@davemloft.net, netdev@vger.kernel.org
In-Reply-To: <1ce940f7dc9c2d57c53e93341629e1981755689a.camel@vitec.com>
On 05/31/2018 12:04 AM, Damien Thébault wrote:
> This patch adds support for the BCM5389 switch connected through MDIO.
>
> Signed-off-by: Damien Thébault <damien.thebault@vitec.com>
Looks great, thanks Damien.
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply
* [PATCH] net: virtio: simplify the virtnet_find_vqs
From: Tonghao Zhang @ 2018-05-31 14:16 UTC (permalink / raw)
To: netdev; +Cc: Tonghao Zhang
Use the common free functions while return successfully.
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
---
drivers/net/virtio_net.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 8f08a3e..0eee6d6 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -2609,12 +2609,8 @@ static int virtnet_find_vqs(struct virtnet_info *vi)
vi->sq[i].vq = vqs[txq2vq(i)];
}
- kfree(names);
- kfree(callbacks);
- kfree(vqs);
- kfree(ctx);
+ /* run here: ret == 0. */
- return 0;
err_find:
kfree(ctx);
--
1.8.3.1
^ permalink raw reply related
* [PATCH iproute2] ip: IFLA_NEW_NETNSID/IFLA_NEW_IFINDEX support
From: Nicolas Dichtel @ 2018-05-31 14:28 UTC (permalink / raw)
To: shemminger; +Cc: netdev, Nicolas Dichtel
Parse and display those attributes.
Example:
ip l a type dummy
ip netns add foo
ip monitor link&
ip l s dummy1 netns foo
Deleted 6: dummy1: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default
link/ether 66:af:3a:3f:a0:89 brd ff:ff:ff:ff:ff:ff new-nsid 0 new-ifindex 6
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
ip/ipaddress.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 00da14c6f97c..c7c7e7df4e81 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -964,6 +964,17 @@ int print_linkinfo(const struct sockaddr_nl *who,
}
}
+ if (tb[IFLA_NEW_NETNSID]) {
+ int id = rta_getattr_u32(tb[IFLA_NEW_NETNSID]);
+
+ print_int(PRINT_FP, NULL, " new-nsid %d", id);
+ }
+ if (tb[IFLA_NEW_IFINDEX]) {
+ int id = rta_getattr_u32(tb[IFLA_NEW_IFINDEX]);
+
+ print_int(PRINT_FP, NULL, " new-ifindex %d", id);
+ }
+
if (tb[IFLA_PROTO_DOWN]) {
if (rta_getattr_u8(tb[IFLA_PROTO_DOWN]))
print_bool(PRINT_ANY,
--
2.15.1
^ permalink raw reply related
* Re: [PATCH iproute2] ip: IFLA_NEW_NETNSID/IFLA_NEW_IFINDEX support
From: Nicolas Dichtel @ 2018-05-31 14:31 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
In-Reply-To: <20180531142848.377-1-nicolas.dichtel@6wind.com>
Oops, I use an old email for Stephen, sorry.
Regards,
Nicolas
Le 31/05/2018 à 16:28, Nicolas Dichtel a écrit :
> Parse and display those attributes.
> Example:
> ip l a type dummy
> ip netns add foo
> ip monitor link&
> ip l s dummy1 netns foo
> Deleted 6: dummy1: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default
> link/ether 66:af:3a:3f:a0:89 brd ff:ff:ff:ff:ff:ff new-nsid 0 new-ifindex 6
>
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> ---
> ip/ipaddress.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/ip/ipaddress.c b/ip/ipaddress.c
> index 00da14c6f97c..c7c7e7df4e81 100644
> --- a/ip/ipaddress.c
> +++ b/ip/ipaddress.c
> @@ -964,6 +964,17 @@ int print_linkinfo(const struct sockaddr_nl *who,
> }
> }
>
> + if (tb[IFLA_NEW_NETNSID]) {
> + int id = rta_getattr_u32(tb[IFLA_NEW_NETNSID]);
> +
> + print_int(PRINT_FP, NULL, " new-nsid %d", id);
> + }
> + if (tb[IFLA_NEW_IFINDEX]) {
> + int id = rta_getattr_u32(tb[IFLA_NEW_IFINDEX]);
> +
> + print_int(PRINT_FP, NULL, " new-ifindex %d", id);
> + }
> +
> if (tb[IFLA_PROTO_DOWN]) {
> if (rta_getattr_u8(tb[IFLA_PROTO_DOWN]))
> print_bool(PRINT_ANY,
>
^ permalink raw reply
* RE: [PATCH rdma-next v3 08/14] IB/core: Support passing uhw for create_flow
From: Ruhl, Michael J @ 2018-05-31 14:42 UTC (permalink / raw)
To: Leon Romanovsky, Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Boris Pismenny, Matan Barak,
Or Gerlitz, Raed Salem, Yishai Hadas, Saeed Mahameed,
linux-netdev
In-Reply-To: <20180531134341.18441-9-leon@kernel.org>
>-----Original Message-----
>From: Leon Romanovsky [mailto:leon@kernel.org]
>Sent: Thursday, May 31, 2018 9:44 AM
>To: Doug Ledford <dledford@redhat.com>; Jason Gunthorpe
><jgg@mellanox.com>
>Cc: Leon Romanovsky <leonro@mellanox.com>; RDMA mailing list <linux-
>rdma@vger.kernel.org>; Boris Pismenny <borisp@mellanox.com>; Matan
>Barak <matanb@mellanox.com>; Ruhl, Michael J <michael.j.ruhl@intel.com>;
>Or Gerlitz <ogerlitz@mellanox.com>; Raed Salem <raeds@mellanox.com>;
>Yishai Hadas <yishaih@mellanox.com>; Saeed Mahameed
><saeedm@mellanox.com>; linux-netdev <netdev@vger.kernel.org>
>Subject: [PATCH rdma-next v3 08/14] IB/core: Support passing uhw for
>create_flow
>
>From: Matan Barak <matanb@mellanox.com>
>
>This is required when user-space drivers need to pass extra information
>regarding how to handle this flow steering specification.
>
>Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
>Signed-off-by: Matan Barak <matanb@mellanox.com>
>Signed-off-by: Boris Pismenny <borisp@mellanox.com>
>Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
>---
> drivers/infiniband/core/uverbs_cmd.c | 7 ++++++-
> drivers/infiniband/core/verbs.c | 2 +-
> drivers/infiniband/hw/mlx4/main.c | 6 +++++-
> drivers/infiniband/hw/mlx5/main.c | 7 ++++++-
> include/rdma/ib_verbs.h | 3 ++-
> 5 files changed, 20 insertions(+), 5 deletions(-)
>
>diff --git a/drivers/infiniband/core/uverbs_cmd.c
>b/drivers/infiniband/core/uverbs_cmd.c
>index e74262ee104c..ddb9d79691be 100644
>--- a/drivers/infiniband/core/uverbs_cmd.c
>+++ b/drivers/infiniband/core/uverbs_cmd.c
>@@ -3542,11 +3542,16 @@ int ib_uverbs_ex_create_flow(struct
>ib_uverbs_file *file,
> err = -EINVAL;
> goto err_free;
> }
>- flow_id = ib_create_flow(qp, flow_attr, IB_FLOW_DOMAIN_USER);
>+
>+ flow_id = qp->device->create_flow(qp, flow_attr,
>+ IB_FLOW_DOMAIN_USER, uhw);
>+
If the create_flow() callback is not defined, won't this cause a problem?
ib_flow_create() checks for the NULL.
Mike
> if (IS_ERR(flow_id)) {
> err = PTR_ERR(flow_id);
> goto err_free;
> }
>+ atomic_inc(&qp->usecnt);
>+ flow_id->qp = qp;
> flow_id->uobject = uobj;
> uobj->object = flow_id;
> uflow = container_of(uobj, typeof(*uflow), uobject);
>diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
>index 6ddfb1fade79..0b56828c1319 100644
>--- a/drivers/infiniband/core/verbs.c
>+++ b/drivers/infiniband/core/verbs.c
>@@ -1983,7 +1983,7 @@ struct ib_flow *ib_create_flow(struct ib_qp *qp,
> if (!qp->device->create_flow)
> return ERR_PTR(-EOPNOTSUPP);
>
>- flow_id = qp->device->create_flow(qp, flow_attr, domain);
>+ flow_id = qp->device->create_flow(qp, flow_attr, domain, NULL);
> if (!IS_ERR(flow_id)) {
> atomic_inc(&qp->usecnt);
> flow_id->qp = qp;
>diff --git a/drivers/infiniband/hw/mlx4/main.c
>b/drivers/infiniband/hw/mlx4/main.c
>index bf12394c13c1..6fe5d5d1d1d9 100644
>--- a/drivers/infiniband/hw/mlx4/main.c
>+++ b/drivers/infiniband/hw/mlx4/main.c
>@@ -1848,7 +1848,7 @@ static int mlx4_ib_add_dont_trap_rule(struct
>mlx4_dev *dev,
>
> static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp,
> struct ib_flow_attr *flow_attr,
>- int domain)
>+ int domain, struct ib_udata *udata)
> {
> int err = 0, i = 0, j = 0;
> struct mlx4_ib_flow *mflow;
>@@ -1866,6 +1866,10 @@ static struct ib_flow *mlx4_ib_create_flow(struct
>ib_qp *qp,
> (flow_attr->type != IB_FLOW_ATTR_NORMAL))
> return ERR_PTR(-EOPNOTSUPP);
>
>+ if (udata &&
>+ udata->inlen && !ib_is_udata_cleared(udata, 0, udata->inlen))
>+ return ERR_PTR(-EOPNOTSUPP);
>+
> memset(type, 0, sizeof(type));
>
> mflow = kzalloc(sizeof(*mflow), GFP_KERNEL);
>diff --git a/drivers/infiniband/hw/mlx5/main.c
>b/drivers/infiniband/hw/mlx5/main.c
>index 92879d2d3026..fb31a719ee25 100644
>--- a/drivers/infiniband/hw/mlx5/main.c
>+++ b/drivers/infiniband/hw/mlx5/main.c
>@@ -3371,7 +3371,8 @@ static struct mlx5_ib_flow_handler
>*create_sniffer_rule(struct mlx5_ib_dev *dev,
>
> static struct ib_flow *mlx5_ib_create_flow(struct ib_qp *qp,
> struct ib_flow_attr *flow_attr,
>- int domain)
>+ int domain,
>+ struct ib_udata *udata)
> {
> struct mlx5_ib_dev *dev = to_mdev(qp->device);
> struct mlx5_ib_qp *mqp = to_mqp(qp);
>@@ -3383,6 +3384,10 @@ static struct ib_flow *mlx5_ib_create_flow(struct
>ib_qp *qp,
> int err;
> int underlay_qpn;
>
>+ if (udata &&
>+ udata->inlen && !ib_is_udata_cleared(udata, 0, udata->inlen))
>+ return ERR_PTR(-EOPNOTSUPP);
>+
> if (flow_attr->priority > MLX5_IB_FLOW_LAST_PRIO)
> return ERR_PTR(-ENOMEM);
>
>diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
>index ba49e874c841..84f412f7b8f3 100644
>--- a/include/rdma/ib_verbs.h
>+++ b/include/rdma/ib_verbs.h
>@@ -2459,7 +2459,8 @@ struct ib_device {
> struct ib_flow * (*create_flow)(struct ib_qp *qp,
> struct ib_flow_attr
> *flow_attr,
>- int domain);
>+ int domain,
>+ struct ib_udata *udata);
> int (*destroy_flow)(struct ib_flow *flow_id);
> int (*check_mr_status)(struct ib_mr *mr, u32
>check_mask,
> struct ib_mr_status
>*mr_status);
>--
>2.14.3
^ permalink raw reply
* RE: [PATCH rdma-next v3 10/14] IB/uverbs: Add support for flow counters
From: Ruhl, Michael J @ 2018-05-31 14:49 UTC (permalink / raw)
To: Leon Romanovsky, Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Boris Pismenny, Matan Barak,
Or Gerlitz, Raed Salem, Yishai Hadas, Saeed Mahameed,
linux-netdev
In-Reply-To: <20180531134341.18441-11-leon@kernel.org>
>-----Original Message-----
>From: Leon Romanovsky [mailto:leon@kernel.org]
>Sent: Thursday, May 31, 2018 9:44 AM
>To: Doug Ledford <dledford@redhat.com>; Jason Gunthorpe
><jgg@mellanox.com>
>Cc: Leon Romanovsky <leonro@mellanox.com>; RDMA mailing list <linux-
>rdma@vger.kernel.org>; Boris Pismenny <borisp@mellanox.com>; Matan
>Barak <matanb@mellanox.com>; Ruhl, Michael J <michael.j.ruhl@intel.com>;
>Or Gerlitz <ogerlitz@mellanox.com>; Raed Salem <raeds@mellanox.com>;
>Yishai Hadas <yishaih@mellanox.com>; Saeed Mahameed
><saeedm@mellanox.com>; linux-netdev <netdev@vger.kernel.org>
>Subject: [PATCH rdma-next v3 10/14] IB/uverbs: Add support for flow
>counters
>
>From: Raed Salem <raeds@mellanox.com>
>
>The struct ib_uverbs_flow_spec_action_count associates
>a counters object with the flow.
>
>Post this association the flow counters can be read via
>the counters object.
>
>Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
>Signed-off-by: Raed Salem <raeds@mellanox.com>
>Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
>---
> drivers/infiniband/core/uverbs.h | 1 +
> drivers/infiniband/core/uverbs_cmd.c | 81
>+++++++++++++++++++++++++++++++-----
> include/uapi/rdma/ib_user_verbs.h | 13 ++++++
> 3 files changed, 84 insertions(+), 11 deletions(-)
>
>diff --git a/drivers/infiniband/core/uverbs.h
>b/drivers/infiniband/core/uverbs.h
>index 5b2461fa634d..c0d40fc3a53a 100644
>--- a/drivers/infiniband/core/uverbs.h
>+++ b/drivers/infiniband/core/uverbs.h
>@@ -263,6 +263,7 @@ struct ib_uverbs_flow_spec {
> struct ib_uverbs_flow_spec_action_tag flow_tag;
> struct ib_uverbs_flow_spec_action_drop drop;
> struct ib_uverbs_flow_spec_action_handle action;
>+ struct ib_uverbs_flow_spec_action_count flow_count;
> };
> };
>
>diff --git a/drivers/infiniband/core/uverbs_cmd.c
>b/drivers/infiniband/core/uverbs_cmd.c
>index ddb9d79691be..3179a95c6f5e 100644
>--- a/drivers/infiniband/core/uverbs_cmd.c
>+++ b/drivers/infiniband/core/uverbs_cmd.c
>@@ -2748,43 +2748,82 @@ ssize_t ib_uverbs_detach_mcast(struct
>ib_uverbs_file *file,
> struct ib_uflow_resources {
> size_t max;
> size_t num;
>- struct ib_flow_action *collection[0];
>+ size_t collection_num;
>+ size_t counters_num;
>+ struct ib_counters **counters;
>+ struct ib_flow_action **collection;
> };
>
> static struct ib_uflow_resources *flow_resources_alloc(size_t num_specs)
> {
> struct ib_uflow_resources *resources;
>
>- resources =
>- kmalloc(sizeof(*resources) +
>- num_specs * sizeof(*resources->collection),
>GFP_KERNEL);
>+ resources = kzalloc(sizeof(*resources), GFP_KERNEL);
>
> if (!resources)
>- return NULL;
>+ goto err_res;
Why the new goto?
>+
>+ resources->counters =
>+ kcalloc(num_specs, sizeof(*resources->counters),
>GFP_KERNEL);
>+
>+ if (!resources->counters)
>+ goto err_cnt;
kcalloc() zeros stuff. Could you just have a single common goto for the
cleanup?
Mike
>+
>+ resources->collection =
>+ kcalloc(num_specs, sizeof(*resources->collection),
>GFP_KERNEL);
>+
>+ if (!resources->collection)
>+ goto err_collection;
>
>- resources->num = 0;
> resources->max = num_specs;
>
> return resources;
>+
>+err_collection:
>+ kfree(resources->counters);
>+err_cnt:
>+ kfree(resources);
>+err_res:
>+ return NULL;
> }
>
> void ib_uverbs_flow_resources_free(struct ib_uflow_resources *uflow_res)
> {
> unsigned int i;
>
>- for (i = 0; i < uflow_res->num; i++)
>+ for (i = 0; i < uflow_res->collection_num; i++)
> atomic_dec(&uflow_res->collection[i]->usecnt);
>
>+ for (i = 0; i < uflow_res->counters_num; i++)
>+ atomic_dec(&uflow_res->counters[i]->usecnt);
>+
>+ kfree(uflow_res->collection);
>+ kfree(uflow_res->counters);
> kfree(uflow_res);
> }
>
> static void flow_resources_add(struct ib_uflow_resources *uflow_res,
>- struct ib_flow_action *action)
>+ enum ib_flow_spec_type type,
>+ void *ibobj)
> {
> WARN_ON(uflow_res->num >= uflow_res->max);
>
>- atomic_inc(&action->usecnt);
>- uflow_res->collection[uflow_res->num++] = action;
>+ switch (type) {
>+ case IB_FLOW_SPEC_ACTION_HANDLE:
>+ atomic_inc(&((struct ib_flow_action *)ibobj)->usecnt);
>+ uflow_res->collection[uflow_res->collection_num++] =
>+ (struct ib_flow_action *)ibobj;
>+ break;
>+ case IB_FLOW_SPEC_ACTION_COUNT:
>+ atomic_inc(&((struct ib_counters *)ibobj)->usecnt);
>+ uflow_res->counters[uflow_res->counters_num++] =
>+ (struct ib_counters *)ibobj;
>+ break;
>+ default:
>+ WARN_ON(1);
>+ }
>+
>+ uflow_res->num++;
> }
>
> static int kern_spec_to_ib_spec_action(struct ib_ucontext *ucontext,
>@@ -2821,9 +2860,29 @@ static int kern_spec_to_ib_spec_action(struct
>ib_ucontext *ucontext,
> return -EINVAL;
> ib_spec->action.size =
> sizeof(struct ib_flow_spec_action_handle);
>- flow_resources_add(uflow_res, ib_spec->action.act);
>+ flow_resources_add(uflow_res,
>+ IB_FLOW_SPEC_ACTION_HANDLE,
>+ ib_spec->action.act);
> uobj_put_obj_read(ib_spec->action.act);
> break;
>+ case IB_FLOW_SPEC_ACTION_COUNT:
>+ if (kern_spec->flow_count.size !=
>+ sizeof(struct ib_uverbs_flow_spec_action_count))
>+ return -EINVAL;
>+ ib_spec->flow_count.counters =
>+ uobj_get_obj_read(counters,
>+ UVERBS_OBJECT_COUNTERS,
>+ kern_spec->flow_count.handle,
>+ ucontext);
>+ if (!ib_spec->flow_count.counters)
>+ return -EINVAL;
>+ ib_spec->flow_count.size =
>+ sizeof(struct ib_flow_spec_action_count);
>+ flow_resources_add(uflow_res,
>+ IB_FLOW_SPEC_ACTION_COUNT,
>+ ib_spec->flow_count.counters);
>+ uobj_put_obj_read(ib_spec->flow_count.counters);
>+ break;
> default:
> return -EINVAL;
> }
>diff --git a/include/uapi/rdma/ib_user_verbs.h
>b/include/uapi/rdma/ib_user_verbs.h
>index 409507f83b91..4f9991de8e3a 100644
>--- a/include/uapi/rdma/ib_user_verbs.h
>+++ b/include/uapi/rdma/ib_user_verbs.h
>@@ -998,6 +998,19 @@ struct ib_uverbs_flow_spec_action_handle {
> __u32 reserved1;
> };
>
>+struct ib_uverbs_flow_spec_action_count {
>+ union {
>+ struct ib_uverbs_flow_spec_hdr hdr;
>+ struct {
>+ __u32 type;
>+ __u16 size;
>+ __u16 reserved;
>+ };
>+ };
>+ __u32 handle;
>+ __u32 reserved1;
>+};
>+
> struct ib_uverbs_flow_tunnel_filter {
> __be32 tunnel_id;
> };
>--
>2.14.3
^ permalink raw reply
* [PATCH net-next 1/2] qed: Fix shared memory inconsistency between driver and the MFW.
From: Sudarsana Reddy Kalluru @ 2018-05-31 15:05 UTC (permalink / raw)
To: davem; +Cc: netdev, Ariel.Elior, Michal.Kalderon
In-Reply-To: <20180531150553.24334-1-sudarsana.kalluru@cavium.com>
The structure shared between driver and management firmware (MFW)
differ in sizes. The additional field defined by the MFW is not
relevant to the current driver. Add a dummy field to the structure.
Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>
Signed-off-by: Ariel Elior <ariel.elior@cavium.com>
---
drivers/net/ethernet/qlogic/qed/qed_hsi.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/qlogic/qed/qed_hsi.h b/drivers/net/ethernet/qlogic/qed/qed_hsi.h
index 8e1e6e1..beba930 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_hsi.h
+++ b/drivers/net/ethernet/qlogic/qed/qed_hsi.h
@@ -11996,6 +11996,7 @@ struct public_port {
#define EEE_REMOTE_TW_RX_MASK 0xffff0000
#define EEE_REMOTE_TW_RX_OFFSET 16
+ u32 reserved1;
u32 oem_cfg_port;
#define OEM_CFG_CHANNEL_TYPE_MASK 0x00000003
#define OEM_CFG_CHANNEL_TYPE_OFFSET 0
--
1.8.3.1
^ permalink raw reply related
* [PATCH net-next 0/2] qed: Fix issues in UFP feature commit 'cac6f691'.
From: Sudarsana Reddy Kalluru @ 2018-05-31 15:05 UTC (permalink / raw)
To: davem; +Cc: netdev, Ariel.Elior, Michal.Kalderon, Sudarsana Reddy Kalluru
From: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>
This patch series fixes couple of issues in the UFP feature commit,
cac6f691: Add support for Unified Fabric Port.
Please consider applying it to "net-next".
Sudarsana Reddy Kalluru (2):
qed: Fix shared memory inconsistency between driver and the MFW.
qed: Fix use of incorrect shmem address.
drivers/net/ethernet/qlogic/qed/qed_hsi.h | 1 +
drivers/net/ethernet/qlogic/qed/qed_mcp.c | 5 +++--
2 files changed, 4 insertions(+), 2 deletions(-)
--
1.8.3.1
^ permalink raw reply
* [PATCH net-next 2/2] qed: Fix use of incorrect shmem address.
From: Sudarsana Reddy Kalluru @ 2018-05-31 15:05 UTC (permalink / raw)
To: davem; +Cc: netdev, Ariel.Elior, Michal.Kalderon
In-Reply-To: <20180531150553.24334-1-sudarsana.kalluru@cavium.com>
Incorrect shared memory address is used while deriving the values
for tc and pri_type. Use shmem address corresponding to 'oem_cfg_func'
where the management firmare saves tc/pri_type values.
Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>
Signed-off-by: Ariel Elior <ariel.elior@cavium.com>
---
drivers/net/ethernet/qlogic/qed/qed_mcp.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/qed/qed_mcp.c b/drivers/net/ethernet/qlogic/qed/qed_mcp.c
index 2612e3e..6f9927d 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_mcp.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_mcp.c
@@ -1514,9 +1514,10 @@ void qed_mcp_read_ufp_config(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
}
qed_mcp_get_shmem_func(p_hwfn, p_ptt, &shmem_info, MCP_PF_ID(p_hwfn));
- val = (port_cfg & OEM_CFG_FUNC_TC_MASK) >> OEM_CFG_FUNC_TC_OFFSET;
+ val = (shmem_info.oem_cfg_func & OEM_CFG_FUNC_TC_MASK) >>
+ OEM_CFG_FUNC_TC_OFFSET;
p_hwfn->ufp_info.tc = (u8)val;
- val = (port_cfg & OEM_CFG_FUNC_HOST_PRI_CTRL_MASK) >>
+ val = (shmem_info.oem_cfg_func & OEM_CFG_FUNC_HOST_PRI_CTRL_MASK) >>
OEM_CFG_FUNC_HOST_PRI_CTRL_OFFSET;
if (val == OEM_CFG_FUNC_HOST_PRI_CTRL_VNIC) {
p_hwfn->ufp_info.pri_type = QED_UFP_PRI_VNIC;
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH rdma-next v3 08/14] IB/core: Support passing uhw for create_flow
From: Yishai Hadas @ 2018-05-31 15:09 UTC (permalink / raw)
To: Ruhl, Michael J
Cc: Leon Romanovsky, Doug Ledford, Jason Gunthorpe, Leon Romanovsky,
RDMA mailing list, Boris Pismenny, Matan Barak, Or Gerlitz,
Raed Salem, Yishai Hadas, Saeed Mahameed, linux-netdev
In-Reply-To: <14063C7AD467DE4B82DEDB5C278E8663B38F0635@FMSMSX108.amr.corp.intel.com>
On 5/31/2018 5:42 PM, Ruhl, Michael J wrote:
>> -----Original Message-----
>> From: Leon Romanovsky [mailto:leon@kernel.org]
>> Sent: Thursday, May 31, 2018 9:44 AM
>> To: Doug Ledford <dledford@redhat.com>; Jason Gunthorpe
>> <jgg@mellanox.com>
>> Cc: Leon Romanovsky <leonro@mellanox.com>; RDMA mailing list <linux-
>> rdma@vger.kernel.org>; Boris Pismenny <borisp@mellanox.com>; Matan
>> Barak <matanb@mellanox.com>; Ruhl, Michael J <michael.j.ruhl@intel.com>;
>> Or Gerlitz <ogerlitz@mellanox.com>; Raed Salem <raeds@mellanox.com>;
>> Yishai Hadas <yishaih@mellanox.com>; Saeed Mahameed
>> <saeedm@mellanox.com>; linux-netdev <netdev@vger.kernel.org>
>> Subject: [PATCH rdma-next v3 08/14] IB/core: Support passing uhw for
>> create_flow
>>
>> From: Matan Barak <matanb@mellanox.com>
>>
>> This is required when user-space drivers need to pass extra information
>> regarding how to handle this flow steering specification.
>>
>> Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
>> Signed-off-by: Matan Barak <matanb@mellanox.com>
>> Signed-off-by: Boris Pismenny <borisp@mellanox.com>
>> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
>> ---
>> drivers/infiniband/core/uverbs_cmd.c | 7 ++++++-
>> drivers/infiniband/core/verbs.c | 2 +-
>> drivers/infiniband/hw/mlx4/main.c | 6 +++++-
>> drivers/infiniband/hw/mlx5/main.c | 7 ++++++-
>> include/rdma/ib_verbs.h | 3 ++-
>> 5 files changed, 20 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/infiniband/core/uverbs_cmd.c
>> b/drivers/infiniband/core/uverbs_cmd.c
>> index e74262ee104c..ddb9d79691be 100644
>> --- a/drivers/infiniband/core/uverbs_cmd.c
>> +++ b/drivers/infiniband/core/uverbs_cmd.c
>> @@ -3542,11 +3542,16 @@ int ib_uverbs_ex_create_flow(struct
>> ib_uverbs_file *file,
>> err = -EINVAL;
>> goto err_free;
>> }
>> - flow_id = ib_create_flow(qp, flow_attr, IB_FLOW_DOMAIN_USER);
>> +
>> + flow_id = qp->device->create_flow(qp, flow_attr,
>> + IB_FLOW_DOMAIN_USER, uhw);
>> +
>
> If the create_flow() callback is not defined, won't this cause a problem?
>
> ib_flow_create() checks for the NULL.
>
We are fine here.
This function is called only if the device turned on the command mask
(i.e. IB_USER_VERBS_EX_CMD_CREATE_FLOW) which comes together with its
callback.
see:
https://elixir.bootlin.com/linux/latest/source/drivers/infiniband/core/uverbs_main.c#L709
>
>
>> if (IS_ERR(flow_id)) {
>> err = PTR_ERR(flow_id);
>> goto err_free;
>> }
>> + atomic_inc(&qp->usecnt);
>> + flow_id->qp = qp;
>> flow_id->uobject = uobj;
>> uobj->object = flow_id;
>> uflow = container_of(uobj, typeof(*uflow), uobject);
>> diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
>> index 6ddfb1fade79..0b56828c1319 100644
>> --- a/drivers/infiniband/core/verbs.c
>> +++ b/drivers/infiniband/core/verbs.c
>> @@ -1983,7 +1983,7 @@ struct ib_flow *ib_create_flow(struct ib_qp *qp,
>> if (!qp->device->create_flow)
>> return ERR_PTR(-EOPNOTSUPP);
>>
>> - flow_id = qp->device->create_flow(qp, flow_attr, domain);
>> + flow_id = qp->device->create_flow(qp, flow_attr, domain, NULL);
>> if (!IS_ERR(flow_id)) {
>> atomic_inc(&qp->usecnt);
>> flow_id->qp = qp;
>> diff --git a/drivers/infiniband/hw/mlx4/main.c
>> b/drivers/infiniband/hw/mlx4/main.c
>> index bf12394c13c1..6fe5d5d1d1d9 100644
>> --- a/drivers/infiniband/hw/mlx4/main.c
>> +++ b/drivers/infiniband/hw/mlx4/main.c
>> @@ -1848,7 +1848,7 @@ static int mlx4_ib_add_dont_trap_rule(struct
>> mlx4_dev *dev,
>>
>> static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp,
>> struct ib_flow_attr *flow_attr,
>> - int domain)
>> + int domain, struct ib_udata *udata)
>> {
>> int err = 0, i = 0, j = 0;
>> struct mlx4_ib_flow *mflow;
>> @@ -1866,6 +1866,10 @@ static struct ib_flow *mlx4_ib_create_flow(struct
>> ib_qp *qp,
>> (flow_attr->type != IB_FLOW_ATTR_NORMAL))
>> return ERR_PTR(-EOPNOTSUPP);
>>
>> + if (udata &&
>> + udata->inlen && !ib_is_udata_cleared(udata, 0, udata->inlen))
>> + return ERR_PTR(-EOPNOTSUPP);
>> +
>> memset(type, 0, sizeof(type));
>>
>> mflow = kzalloc(sizeof(*mflow), GFP_KERNEL);
>> diff --git a/drivers/infiniband/hw/mlx5/main.c
>> b/drivers/infiniband/hw/mlx5/main.c
>> index 92879d2d3026..fb31a719ee25 100644
>> --- a/drivers/infiniband/hw/mlx5/main.c
>> +++ b/drivers/infiniband/hw/mlx5/main.c
>> @@ -3371,7 +3371,8 @@ static struct mlx5_ib_flow_handler
>> *create_sniffer_rule(struct mlx5_ib_dev *dev,
>>
>> static struct ib_flow *mlx5_ib_create_flow(struct ib_qp *qp,
>> struct ib_flow_attr *flow_attr,
>> - int domain)
>> + int domain,
>> + struct ib_udata *udata)
>> {
>> struct mlx5_ib_dev *dev = to_mdev(qp->device);
>> struct mlx5_ib_qp *mqp = to_mqp(qp);
>> @@ -3383,6 +3384,10 @@ static struct ib_flow *mlx5_ib_create_flow(struct
>> ib_qp *qp,
>> int err;
>> int underlay_qpn;
>>
>> + if (udata &&
>> + udata->inlen && !ib_is_udata_cleared(udata, 0, udata->inlen))
>> + return ERR_PTR(-EOPNOTSUPP);
>> +
>> if (flow_attr->priority > MLX5_IB_FLOW_LAST_PRIO)
>> return ERR_PTR(-ENOMEM);
>>
>> diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
>> index ba49e874c841..84f412f7b8f3 100644
>> --- a/include/rdma/ib_verbs.h
>> +++ b/include/rdma/ib_verbs.h
>> @@ -2459,7 +2459,8 @@ struct ib_device {
>> struct ib_flow * (*create_flow)(struct ib_qp *qp,
>> struct ib_flow_attr
>> *flow_attr,
>> - int domain);
>> + int domain,
>> + struct ib_udata *udata);
>> int (*destroy_flow)(struct ib_flow *flow_id);
>> int (*check_mr_status)(struct ib_mr *mr, u32
>> check_mask,
>> struct ib_mr_status
>> *mr_status);
>> --
>> 2.14.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply
* Re: [PATCH 0/4] RFC CPSW switchdev mode
From: Ilias Apalodimas @ 2018-05-31 15:27 UTC (permalink / raw)
To: Andrew Lunn
Cc: Ivan Vecera, Jiri Pirko, netdev, grygorii.strashko,
ivan.khoronzhuk, nsekhar, francois.ozog, yogeshs, spatton
In-Reply-To: <20180525120938.GB20060@lunn.ch>
Sorry for the late response i had some time to take another look and do some
extra testing
> switchdev is about offloading what Linux can do to hardware to
> accelerate it. The switch is a block of accelerator hardware, like a
> GPU is for accelerating graphics. Linux can render OpenGL, but it is
> better to hand it over to the GPU accelerator.
>
> Same applies here. The Linux bridge can bridge multicast. Using the
> switchdev API, you can push that down to the accelerator, and let it
> do it.
>
> So you need to think about, how do you make the Linux bridge not pass
> multicast traffic to the host stack. Then how do you extend the
> switchdev API so you can push this down to the accelerator.
>
> To really get switchdev, you often need to pivot your point of view a
> bit. People often think, switchdev is about writing drivers for
> switches. Its not, its about how you offload networking which Linux
> can do down to a switch. And if the switch cannot accelerate it, you
> leave Linux to do it.
>
> When you get in the details, i think you will find the switchdev API
> actually already has what you need for this use case. What you need to
> figure out is how you make the Linux bridge not pass multicast to the
> host. Well, actually, not pass multicast it has not asked for. Then
> accelerate it.
The current driver is already working like that. The difference between the
modes of operation is this:
By registering the 'cpu port' we choose if the linux host is going to see the
br_ip4_multicast_igmp3_report or br_multicast_ipv4_rcv (by configuring the vlan
it participates) and trigger switchdev to add the MDBs
If the cpu port is member of that VLAN then the dynamic entry shows on 'bridge
mdb show' command i.e dev br0 port sw0p1 grp 239.1.1.1 temp offload vid 100
If not the user is able to add it manually.
Anyway i got the main points of the RFC, if Petr's patch get accepted i might be
able to respin this without registering a CPU port.
Regards
Ilias
^ permalink raw reply
* Re: [PATCH iproute2] ip: IFLA_NEW_NETNSID/IFLA_NEW_IFINDEX support
From: Stephen Hemminger @ 2018-05-31 15:46 UTC (permalink / raw)
To: Nicolas Dichtel; +Cc: shemminger, netdev
In-Reply-To: <20180531142848.377-1-nicolas.dichtel@6wind.com>
On Thu, 31 May 2018 16:28:48 +0200
Nicolas Dichtel <nicolas.dichtel@6wind.com> wrote:
> Parse and display those attributes.
> Example:
> ip l a type dummy
> ip netns add foo
> ip monitor link&
> ip l s dummy1 netns foo
> Deleted 6: dummy1: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default
> link/ether 66:af:3a:3f:a0:89 brd ff:ff:ff:ff:ff:ff new-nsid 0 new-ifindex 6
>
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> ---
> ip/ipaddress.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/ip/ipaddress.c b/ip/ipaddress.c
> index 00da14c6f97c..c7c7e7df4e81 100644
> --- a/ip/ipaddress.c
> +++ b/ip/ipaddress.c
> @@ -964,6 +964,17 @@ int print_linkinfo(const struct sockaddr_nl *who,
> }
> }
>
> + if (tb[IFLA_NEW_NETNSID]) {
> + int id = rta_getattr_u32(tb[IFLA_NEW_NETNSID]);
> +
> + print_int(PRINT_FP, NULL, " new-nsid %d", id);
> + }
> + if (tb[IFLA_NEW_IFINDEX]) {
> + int id = rta_getattr_u32(tb[IFLA_NEW_IFINDEX]);
> +
> + print_int(PRINT_FP, NULL, " new-ifindex %d", id);
> + }
> +
> if (tb[IFLA_PROTO_DOWN]) {
> if (rta_getattr_u8(tb[IFLA_PROTO_DOWN]))
> print_bool(PRINT_ANY,
This makes sense. All of linkinfo that is present should be displayed.
Both netns and ifindex are really unsigned values. Use __u32 and print_uint.
Also why not convert numeric values to names?
^ permalink raw reply
* Re: [PATCH iproute2] ip: IFLA_NEW_NETNSID/IFLA_NEW_IFINDEX support
From: Nicolas Dichtel @ 2018-05-31 15:51 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
In-Reply-To: <20180531114615.3f10766f@shemminger-XPS-13-9360>
Le 31/05/2018 à 17:46, Stephen Hemminger a écrit :
> On Thu, 31 May 2018 16:28:48 +0200
[snip]
> This makes sense. All of linkinfo that is present should be displayed.
>
> Both netns and ifindex are really unsigned values. Use __u32 and print_uint.
Ok.
> Also why not convert numeric values to names?
The only case where the ifname can change is when a netns is deleted and the
interface is put back in init_net. But at this stage, we don't know the new name.
For the nsid, you're right, it will be better to display the netns name. If you
agree, I will do this in a following patch, thus all places using nsid can be
converted at the same time.
Regards,
Nicolas
^ permalink raw reply
* Re: [PATCH net-next v2 0/2] net: phy: improve PHY suspend/resume
From: Heiner Kallweit @ 2018-05-31 15:58 UTC (permalink / raw)
To: Andrew Lunn; +Cc: Florian Fainelli, David Miller, netdev@vger.kernel.org
In-Reply-To: <20180530203512.GA16286@lunn.ch>
On 30.05.2018 22:35, Andrew Lunn wrote:
>> I think we need a better solution than spending the effort needed
>> to make the MDIO ops runtime-pm-aware. In general there seems to be
>> just one network driver using both phylib and runtime pm, so most
>> drivers aren't affected (yet).
>>
>> I will spend few more thoughts on a solution ..
>
> Hi Heiner
>
> Please keep in mind that MDIO is a generic bus. Many Ethernet switches
> are connected via MDIO. Some of those switches have MDIO busses of
> their own. Also, some Broadcom devices have USB-PHYs controlled over
> MDIO, etc.
>
> So you need a generic solution here.
>
> Andrew
>
The following proposed change (I combined three patches here) is quite
small, generic, and solves my problem. Another advantage is that it
doesn't impact existing code / drivers.
We just would have to see whether Rafael likes the idea of adding this
flag to the PM core.
Other bus subsystems would be free to adopt the same mechanism with
minimal effort.
Alternatively we could just add a flag to struct mii_bus and not touch
the PM core. But then the solution would be much less generic.
By the way: The problem is related to an experimental patch series for
splitting r8169/r8168 drivers and switching r8168 to phylib.
Therefore the change to r8168.c won't apply to existing kernel code.
Heiner
---
drivers/net/ethernet/realtek/r8168.c | 1 +
drivers/net/phy/phy_device.c | 9 ++++++++-
include/linux/pm.h | 6 ++++++
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/realtek/r8168.c b/drivers/net/ethernet/realtek/r8168.c
index 473a147e..2e1af844 100644
--- a/drivers/net/ethernet/realtek/r8168.c
+++ b/drivers/net/ethernet/realtek/r8168.c
@@ -5063,6 +5063,7 @@ static int r8168_mdio_register(struct rtl8169_private *tp)
new_bus->irq[0] = PHY_IGNORE_INTERRUPT;
snprintf(new_bus->id, MII_BUS_ID_SIZE, "r8168-%x",
PCI_DEVID(pdev->bus->number, pdev->devfn));
+ dev_pm_set_driver_flags(&new_bus->dev, DPM_FLAG_IGNORE_PM);
new_bus->read = r8168_mdio_read_reg;
new_bus->write = r8168_mdio_write_reg;
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 9e4ba8e8..459fd677 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -76,13 +76,20 @@ static LIST_HEAD(phy_fixup_list);
static DEFINE_MUTEX(phy_fixup_lock);
#ifdef CONFIG_PM
+static bool mdio_bus_ignore_pm(struct phy_device *phydev)
+{
+ struct mii_bus *bus = phydev->mdio.bus;
+
+ return dev_pm_test_driver_flags(&bus->dev, DPM_FLAG_IGNORE_PM);
+}
+
static bool mdio_bus_phy_may_suspend(struct phy_device *phydev)
{
struct device_driver *drv = phydev->mdio.dev.driver;
struct phy_driver *phydrv = to_phy_driver(drv);
struct net_device *netdev = phydev->attached_dev;
- if (!drv || !phydrv->suspend)
+ if (!drv || !phydrv->suspend || mdio_bus_ignore_pm(phydev))
return false;
/* PHY not attached? May suspend if the PHY has not already been
diff --git a/include/linux/pm.h b/include/linux/pm.h
index e723b78d..922d2ded 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -560,6 +560,7 @@ struct pm_subsys_data {
* SMART_PREPARE: Check the return value of the driver's ->prepare callback.
* SMART_SUSPEND: No need to resume the device from runtime suspend.
* LEAVE_SUSPENDED: Avoid resuming the device during system resume if possible.
+ * IGNORE_PM: Skip suspend/resume because the parent takes care.
*
* Setting SMART_PREPARE instructs bus types and PM domains which may want
* system suspend/resume callbacks to be skipped for the device to return 0 from
@@ -576,11 +577,16 @@ struct pm_subsys_data {
*
* Setting LEAVE_SUSPENDED informs the PM core and middle-layer code that the
* driver prefers the device to be left in suspend after system resume.
+ *
+ * Setting DPM_FLAG_IGNORE_PM instructs middle-layer code to skip suspending /
+ * resuming devices. This is meant for cases where the parent of a bus handles
+ * PM of the devices attached to the bus.
*/
#define DPM_FLAG_NEVER_SKIP BIT(0)
#define DPM_FLAG_SMART_PREPARE BIT(1)
#define DPM_FLAG_SMART_SUSPEND BIT(2)
#define DPM_FLAG_LEAVE_SUSPENDED BIT(3)
+#define DPM_FLAG_IGNORE_PM BIT(4)
struct dev_pm_info {
pm_message_t power_state;
^ permalink raw reply related
* Re: [bpf-next V2 PATCH 8/8] bpf/xdp: devmap can avoid calling ndo_xdp_flush
From: Song Liu @ 2018-05-31 16:06 UTC (permalink / raw)
To: Jesper Dangaard Brouer
Cc: Networking, Daniel Borkmann, Alexei Starovoitov, Song Liu,
John Fastabend
In-Reply-To: <152775722322.24817.6090081993515109790.stgit@firesoul>
On Thu, May 31, 2018 at 2:00 AM, Jesper Dangaard Brouer
<brouer@redhat.com> wrote:
> The XDP_REDIRECT map devmap can avoid using ndo_xdp_flush, by instead
> instructing ndo_xdp_xmit to flush via XDP_XMIT_FLUSH flag in
> appropriate places.
>
> Notice after this patch it is possible to remove ndo_xdp_flush
> completely, as this is the last user of ndo_xdp_flush. This is left
> for later patches, to keep driver changes separate.
>
> Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Song Liu <songliubraving@fb.com>
> ---
> kernel/bpf/devmap.c | 19 ++++++-------------
> 1 file changed, 6 insertions(+), 13 deletions(-)
>
> diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c
> index 04fbd75a5274..993b2dd07661 100644
> --- a/kernel/bpf/devmap.c
> +++ b/kernel/bpf/devmap.c
> @@ -217,7 +217,7 @@ void __dev_map_insert_ctx(struct bpf_map *map, u32 bit)
> }
>
> static int bq_xmit_all(struct bpf_dtab_netdev *obj,
> - struct xdp_bulk_queue *bq)
> + struct xdp_bulk_queue *bq, u32 flags)
> {
> struct net_device *dev = obj->dev;
> int sent = 0, drops = 0, err = 0;
> @@ -232,7 +232,7 @@ static int bq_xmit_all(struct bpf_dtab_netdev *obj,
> prefetch(xdpf);
> }
>
> - sent = dev->netdev_ops->ndo_xdp_xmit(dev, bq->count, bq->q, 0);
> + sent = dev->netdev_ops->ndo_xdp_xmit(dev, bq->count, bq->q, flags);
> if (sent < 0) {
> err = sent;
> sent = 0;
> @@ -276,7 +276,6 @@ void __dev_map_flush(struct bpf_map *map)
> for_each_set_bit(bit, bitmap, map->max_entries) {
> struct bpf_dtab_netdev *dev = READ_ONCE(dtab->netdev_map[bit]);
> struct xdp_bulk_queue *bq;
> - struct net_device *netdev;
>
> /* This is possible if the dev entry is removed by user space
> * between xdp redirect and flush op.
> @@ -287,10 +286,7 @@ void __dev_map_flush(struct bpf_map *map)
> __clear_bit(bit, bitmap);
>
> bq = this_cpu_ptr(dev->bulkq);
> - bq_xmit_all(dev, bq);
> - netdev = dev->dev;
> - if (likely(netdev->netdev_ops->ndo_xdp_flush))
> - netdev->netdev_ops->ndo_xdp_flush(netdev);
> + bq_xmit_all(dev, bq, XDP_XMIT_FLUSH);
> }
> }
>
> @@ -320,7 +316,7 @@ static int bq_enqueue(struct bpf_dtab_netdev *obj, struct xdp_frame *xdpf,
> struct xdp_bulk_queue *bq = this_cpu_ptr(obj->bulkq);
>
> if (unlikely(bq->count == DEV_MAP_BULK_SIZE))
> - bq_xmit_all(obj, bq);
> + bq_xmit_all(obj, bq, 0);
>
> /* Ingress dev_rx will be the same for all xdp_frame's in
> * bulk_queue, because bq stored per-CPU and must be flushed
> @@ -359,8 +355,7 @@ static void *dev_map_lookup_elem(struct bpf_map *map, void *key)
>
> static void dev_map_flush_old(struct bpf_dtab_netdev *dev)
> {
> - if (dev->dev->netdev_ops->ndo_xdp_flush) {
> - struct net_device *fl = dev->dev;
> + if (dev->dev->netdev_ops->ndo_xdp_xmit) {
> struct xdp_bulk_queue *bq;
> unsigned long *bitmap;
>
> @@ -371,9 +366,7 @@ static void dev_map_flush_old(struct bpf_dtab_netdev *dev)
> __clear_bit(dev->bit, bitmap);
>
> bq = per_cpu_ptr(dev->bulkq, cpu);
> - bq_xmit_all(dev, bq);
> -
> - fl->netdev_ops->ndo_xdp_flush(dev->dev);
> + bq_xmit_all(dev, bq, XDP_XMIT_FLUSH);
> }
> }
> }
>
^ permalink raw reply
* Re: [bpf-next V2 PATCH 3/8] ixgbe: implement flush flag for ndo_xdp_xmit
From: Song Liu @ 2018-05-31 16:14 UTC (permalink / raw)
To: Jesper Dangaard Brouer
Cc: Networking, Daniel Borkmann, Alexei Starovoitov, Song Liu,
John Fastabend
In-Reply-To: <152775719796.24817.11035788244128769860.stgit@firesoul>
On Thu, May 31, 2018 at 1:59 AM, Jesper Dangaard Brouer
<brouer@redhat.com> wrote:
> When passed the XDP_XMIT_FLUSH flag ixgbe_xdp_xmit now performs the
> same kind of ring tail update as in ixgbe_xdp_flush. The update tail
> code in ixgbe_xdp_flush is generalized and shared with ixgbe_xdp_xmit.
>
> Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Song Liu <songliubraving@fb.com>
> ---
> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 20 ++++++++++++++------
> 1 file changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> index 87f088f4af52..4fd77c9067f2 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> @@ -10022,6 +10022,15 @@ static int ixgbe_xdp(struct net_device *dev, struct netdev_bpf *xdp)
> }
> }
>
> +static void ixgbe_xdp_ring_update_tail(struct ixgbe_ring *ring)
> +{
> + /* Force memory writes to complete before letting h/w know there
> + * are new descriptors to fetch.
> + */
> + wmb();
> + writel(ring->next_to_use, ring->tail);
> +}
> +
> static int ixgbe_xdp_xmit(struct net_device *dev, int n,
> struct xdp_frame **frames, u32 flags)
> {
> @@ -10033,7 +10042,7 @@ static int ixgbe_xdp_xmit(struct net_device *dev, int n,
> if (unlikely(test_bit(__IXGBE_DOWN, &adapter->state)))
> return -ENETDOWN;
>
> - if (unlikely(flags & ~XDP_XMIT_FLAGS_NONE))
> + if (unlikely(flags & ~XDP_XMIT_FLAGS_MASK))
> return -EINVAL;
>
> /* During program transitions its possible adapter->xdp_prog is assigned
> @@ -10054,6 +10063,9 @@ static int ixgbe_xdp_xmit(struct net_device *dev, int n,
> }
> }
>
> + if (unlikely(flags & XDP_XMIT_FLUSH))
> + ixgbe_xdp_ring_update_tail(ring);
> +
> return n - drops;
> }
>
> @@ -10072,11 +10084,7 @@ static void ixgbe_xdp_flush(struct net_device *dev)
> if (unlikely(!ring))
> return;
>
> - /* Force memory writes to complete before letting h/w know there
> - * are new descriptors to fetch.
> - */
> - wmb();
> - writel(ring->next_to_use, ring->tail);
> + ixgbe_xdp_ring_update_tail(ring);
>
> return;
> }
>
^ permalink raw reply
* [PATCH net-next 0/3] selftests/net: various
From: Willem de Bruijn @ 2018-05-31 16:14 UTC (permalink / raw)
To: netdev; +Cc: davem, Willem de Bruijn
From: Willem de Bruijn <willemb@google.com>
A few odds and ends to network tests:
- msg_zerocopy: run as part of kselftest
- udp gso: add missing bounds test for minimal sizes
- psocket_snd: initial basic conformance test
Willem de Bruijn (3):
selftests/net: enable msg_zerocopy test
selftests/net: udpgso: test small gso_size boundary conditions
selftests/net: add packet socket packet_snd test
tools/testing/selftests/net/.gitignore | 1 +
tools/testing/selftests/net/Makefile | 4 +-
tools/testing/selftests/net/msg_zerocopy.sh | 8 +
tools/testing/selftests/net/psock_snd.c | 398 ++++++++++++++++++++
tools/testing/selftests/net/psock_snd.sh | 98 +++++
tools/testing/selftests/net/udpgso.c | 77 +++-
6 files changed, 582 insertions(+), 4 deletions(-)
create mode 100644 tools/testing/selftests/net/psock_snd.c
create mode 100755 tools/testing/selftests/net/psock_snd.sh
--
2.17.0.921.gf22659ad46-goog
^ permalink raw reply
* [PATCH net-next 1/3] selftests/net: enable msg_zerocopy test
From: Willem de Bruijn @ 2018-05-31 16:14 UTC (permalink / raw)
To: netdev; +Cc: davem, Willem de Bruijn
In-Reply-To: <20180531161440.89709-1-willemdebruijn.kernel@gmail.com>
From: Willem de Bruijn <willemb@google.com>
The existing msg_zerocopy test takes additional protocol arguments.
Add a variant that takes no arguments and runs all supported variants.
Call this from kselftest.
Signed-off-by: Willem de Bruijn <willemb@google.com>
---
tools/testing/selftests/net/Makefile | 2 +-
tools/testing/selftests/net/msg_zerocopy.sh | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile
index 7cb0f49efdb7..f39100b970af 100644
--- a/tools/testing/selftests/net/Makefile
+++ b/tools/testing/selftests/net/Makefile
@@ -6,7 +6,7 @@ CFLAGS += -I../../../../usr/include/
TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh netdevice.sh rtnetlink.sh
TEST_PROGS += fib_tests.sh fib-onlink-tests.sh pmtu.sh udpgso.sh
-TEST_PROGS += udpgso_bench.sh fib_rule_tests.sh
+TEST_PROGS += udpgso_bench.sh fib_rule_tests.sh msg_zerocopy.sh
TEST_PROGS_EXTENDED := in_netns.sh
TEST_GEN_FILES = socket
TEST_GEN_FILES += psock_fanout psock_tpacket msg_zerocopy
diff --git a/tools/testing/selftests/net/msg_zerocopy.sh b/tools/testing/selftests/net/msg_zerocopy.sh
index d571d213418d..c43c6debda06 100755
--- a/tools/testing/selftests/net/msg_zerocopy.sh
+++ b/tools/testing/selftests/net/msg_zerocopy.sh
@@ -21,6 +21,14 @@ readonly DADDR6='fd::2'
readonly path_sysctl_mem="net.core.optmem_max"
+# No arguments: automated test
+if [[ "$#" -eq "0" ]]; then
+ $0 4 tcp -t 1
+ $0 6 tcp -t 1
+ echo "OK. All tests passed"
+ exit 0
+fi
+
# Argument parsing
if [[ "$#" -lt "2" ]]; then
echo "Usage: $0 [4|6] [tcp|udp|raw|raw_hdrincl|packet|packet_dgram] <args>"
--
2.17.0.921.gf22659ad46-goog
^ permalink raw reply related
* [PATCH net-next 2/3] selftests/net: udpgso: test small gso_size boundary conditions
From: Willem de Bruijn @ 2018-05-31 16:14 UTC (permalink / raw)
To: netdev; +Cc: davem, Willem de Bruijn
In-Reply-To: <20180531161440.89709-1-willemdebruijn.kernel@gmail.com>
From: Willem de Bruijn <willemb@google.com>
Verify that udpgso can generate segments smaller than device mtu, down
to the extreme case of 1B gso_size.
Verify that irrespective of gso_size, udpgso restricts the number of
segments it will generate per call (UDP_MAX_SEGMENTS).
Signed-off-by: Willem de Bruijn <willemb@google.com>
---
tools/testing/selftests/net/udpgso.c | 77 +++++++++++++++++++++++++++-
1 file changed, 75 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/net/udpgso.c b/tools/testing/selftests/net/udpgso.c
index 48a0592db938..e279051bc631 100644
--- a/tools/testing/selftests/net/udpgso.c
+++ b/tools/testing/selftests/net/udpgso.c
@@ -34,6 +34,10 @@
#define UDP_SEGMENT 103
#endif
+#ifndef UDP_MAX_SEGMENTS
+#define UDP_MAX_SEGMENTS (1 << 6UL)
+#endif
+
#define CONST_MTU_TEST 1500
#define CONST_HDRLEN_V4 (sizeof(struct iphdr) + sizeof(struct udphdr))
@@ -135,6 +139,38 @@ struct testcase testcases_v4[] = {
.gso_len = CONST_MSS_V4,
.tfail = true,
},
+ {
+ /* send a single 1B MSS: will fail, see single MSS above */
+ .tlen = 1,
+ .gso_len = 1,
+ .tfail = true,
+ .r_num_mss = 1,
+ },
+ {
+ /* send 2 1B segments */
+ .tlen = 2,
+ .gso_len = 1,
+ .r_num_mss = 2,
+ },
+ {
+ /* send 2B + 2B + 1B segments */
+ .tlen = 5,
+ .gso_len = 2,
+ .r_num_mss = 2,
+ .r_len_last = 1,
+ },
+ {
+ /* send max number of min sized segments */
+ .tlen = UDP_MAX_SEGMENTS - CONST_HDRLEN_V4,
+ .gso_len = 1,
+ .r_num_mss = UDP_MAX_SEGMENTS - CONST_HDRLEN_V4,
+ },
+ {
+ /* send max number + 1 of min sized segments: fail */
+ .tlen = UDP_MAX_SEGMENTS - CONST_HDRLEN_V4 + 1,
+ .gso_len = 1,
+ .tfail = true,
+ },
{
/* EOL */
}
@@ -210,6 +246,38 @@ struct testcase testcases_v6[] = {
.gso_len = CONST_MSS_V6,
.tfail = true,
},
+ {
+ /* send a single 1B MSS: will fail, see single MSS above */
+ .tlen = 1,
+ .gso_len = 1,
+ .tfail = true,
+ .r_num_mss = 1,
+ },
+ {
+ /* send 2 1B segments */
+ .tlen = 2,
+ .gso_len = 1,
+ .r_num_mss = 2,
+ },
+ {
+ /* send 2B + 2B + 1B segments */
+ .tlen = 5,
+ .gso_len = 2,
+ .r_num_mss = 2,
+ .r_len_last = 1,
+ },
+ {
+ /* send max number of min sized segments */
+ .tlen = UDP_MAX_SEGMENTS - CONST_HDRLEN_V6,
+ .gso_len = 1,
+ .r_num_mss = UDP_MAX_SEGMENTS - CONST_HDRLEN_V6,
+ },
+ {
+ /* send max number + 1 of min sized segments: fail */
+ .tlen = UDP_MAX_SEGMENTS - CONST_HDRLEN_V6 + 1,
+ .gso_len = 1,
+ .tfail = true,
+ },
{
/* EOL */
}
@@ -375,7 +443,8 @@ static bool __send_one(int fd, struct msghdr *msg, int flags)
int ret;
ret = sendmsg(fd, msg, flags);
- if (ret == -1 && (errno == EMSGSIZE || errno == ENOMEM))
+ if (ret == -1 &&
+ (errno == EMSGSIZE || errno == ENOMEM || errno == EINVAL))
return false;
if (ret == -1)
error(1, errno, "sendmsg");
@@ -466,7 +535,11 @@ static void run_one(struct testcase *test, int fdt, int fdr,
if (!sent)
return;
- mss = addr->sa_family == AF_INET ? CONST_MSS_V4 : CONST_MSS_V6;
+ if (test->gso_len)
+ mss = test->gso_len;
+ else
+ mss = addr->sa_family == AF_INET ? CONST_MSS_V4 : CONST_MSS_V6;
+
/* Recv all full MSS datagrams */
for (i = 0; i < test->r_num_mss; i++) {
--
2.17.0.921.gf22659ad46-goog
^ permalink raw reply related
* [PATCH net-next 3/3] selftests/net: add packet socket packet_snd test
From: Willem de Bruijn @ 2018-05-31 16:14 UTC (permalink / raw)
To: netdev; +Cc: davem, Willem de Bruijn
In-Reply-To: <20180531161440.89709-1-willemdebruijn.kernel@gmail.com>
From: Willem de Bruijn <willemb@google.com>
Add regression tests for PF_PACKET transmission using packet_snd.
The TPACKET ring interface has tests for transmission and reception.
This is an initial stab at the same for the send call based interface.
Packets are sent over loopback, then read twice. The entire packet is
read from another packet socket and compared. The packet is also
verified to arrive at a UDP socket for protocol conformance.
The test sends a packet over loopback, testing the following options
(not the full cross-product):
- SOCK_DGRAM
- SOCK_RAW
- vlan tag
- qdisc bypass
- bind() and sendto()
- virtio_net_hdr
- csum offload (NOT actual csum feature, ignored on loopback)
- gso
Besides these basic functionality tests, the test runs from a set
of bounds checks, positive and negative. Running over loopback, which
has dev->min_header_len, it cannot generate variable length hhlen.
Signed-off-by: Willem de Bruijn <willemb@google.com>
---
tools/testing/selftests/net/.gitignore | 1 +
tools/testing/selftests/net/Makefile | 4 +-
tools/testing/selftests/net/psock_snd.c | 398 +++++++++++++++++++++++
tools/testing/selftests/net/psock_snd.sh | 98 ++++++
4 files changed, 499 insertions(+), 2 deletions(-)
create mode 100644 tools/testing/selftests/net/psock_snd.c
create mode 100755 tools/testing/selftests/net/psock_snd.sh
diff --git a/tools/testing/selftests/net/.gitignore b/tools/testing/selftests/net/.gitignore
index f0e6c35a93ae..128e548aa377 100644
--- a/tools/testing/selftests/net/.gitignore
+++ b/tools/testing/selftests/net/.gitignore
@@ -1,6 +1,7 @@
msg_zerocopy
socket
psock_fanout
+psock_snd
psock_tpacket
reuseport_bpf
reuseport_bpf_cpu
diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile
index f39100b970af..663e11e85727 100644
--- a/tools/testing/selftests/net/Makefile
+++ b/tools/testing/selftests/net/Makefile
@@ -6,11 +6,11 @@ CFLAGS += -I../../../../usr/include/
TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh netdevice.sh rtnetlink.sh
TEST_PROGS += fib_tests.sh fib-onlink-tests.sh pmtu.sh udpgso.sh
-TEST_PROGS += udpgso_bench.sh fib_rule_tests.sh msg_zerocopy.sh
+TEST_PROGS += udpgso_bench.sh fib_rule_tests.sh msg_zerocopy.sh psock_snd.sh
TEST_PROGS_EXTENDED := in_netns.sh
TEST_GEN_FILES = socket
TEST_GEN_FILES += psock_fanout psock_tpacket msg_zerocopy
-TEST_GEN_FILES += tcp_mmap tcp_inq
+TEST_GEN_FILES += tcp_mmap tcp_inq psock_snd
TEST_GEN_FILES += udpgso udpgso_bench_tx udpgso_bench_rx
TEST_GEN_PROGS = reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa
TEST_GEN_PROGS += reuseport_dualstack reuseaddr_conflict
diff --git a/tools/testing/selftests/net/psock_snd.c b/tools/testing/selftests/net/psock_snd.c
new file mode 100644
index 000000000000..3936d5c8adfc
--- /dev/null
+++ b/tools/testing/selftests/net/psock_snd.c
@@ -0,0 +1,398 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#define _GNU_SOURCE
+
+#include <arpa/inet.h>
+#include <errno.h>
+#include <error.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <linux/filter.h>
+#include <linux/bpf.h>
+#include <linux/if_packet.h>
+#include <linux/if_vlan.h>
+#include <linux/virtio_net.h>
+#include <net/if.h>
+#include <net/ethernet.h>
+#include <netinet/ip.h>
+#include <netinet/udp.h>
+#include <poll.h>
+#include <sched.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "psock_lib.h"
+
+static bool cfg_use_bind;
+static bool cfg_use_csum_off;
+static bool cfg_use_csum_off_bad;
+static bool cfg_use_dgram;
+static bool cfg_use_gso;
+static bool cfg_use_qdisc_bypass;
+static bool cfg_use_vlan;
+static bool cfg_use_vnet;
+
+static char *cfg_ifname = "lo";
+static int cfg_mtu = 1500;
+static int cfg_payload_len = DATA_LEN;
+static int cfg_truncate_len = INT_MAX;
+static uint16_t cfg_port = 8000;
+
+/* test sending up to max mtu + 1 */
+#define TEST_SZ (sizeof(struct virtio_net_hdr) + ETH_HLEN + ETH_MAX_MTU + 1)
+
+static char tbuf[TEST_SZ], rbuf[TEST_SZ];
+
+static unsigned long add_csum_hword(const uint16_t *start, int num_u16)
+{
+ unsigned long sum = 0;
+ int i;
+
+ for (i = 0; i < num_u16; i++)
+ sum += start[i];
+
+ return sum;
+}
+
+static uint16_t build_ip_csum(const uint16_t *start, int num_u16,
+ unsigned long sum)
+{
+ sum += add_csum_hword(start, num_u16);
+
+ while (sum >> 16)
+ sum = (sum & 0xffff) + (sum >> 16);
+
+ return ~sum;
+}
+
+static int build_vnet_header(void *header)
+{
+ struct virtio_net_hdr *vh = header;
+
+ vh->hdr_len = ETH_HLEN + sizeof(struct iphdr) + sizeof(struct udphdr);
+
+ if (cfg_use_csum_off) {
+ vh->flags |= VIRTIO_NET_HDR_F_NEEDS_CSUM;
+ vh->csum_start = ETH_HLEN + sizeof(struct iphdr);
+ vh->csum_offset = __builtin_offsetof(struct udphdr, check);
+
+ /* position check field exactly one byte beyond end of packet */
+ if (cfg_use_csum_off_bad)
+ vh->csum_start += sizeof(struct udphdr) + cfg_payload_len -
+ vh->csum_offset - 1;
+ }
+
+ if (cfg_use_gso) {
+ vh->gso_type = VIRTIO_NET_HDR_GSO_UDP;
+ vh->gso_size = cfg_mtu - sizeof(struct iphdr);
+ }
+
+ return sizeof(*vh);
+}
+
+static int build_eth_header(void *header)
+{
+ struct ethhdr *eth = header;
+
+ if (cfg_use_vlan) {
+ uint16_t *tag = header + ETH_HLEN;
+
+ eth->h_proto = htons(ETH_P_8021Q);
+ tag[1] = htons(ETH_P_IP);
+ return ETH_HLEN + 4;
+ }
+
+ eth->h_proto = htons(ETH_P_IP);
+ return ETH_HLEN;
+}
+
+static int build_ipv4_header(void *header, int payload_len)
+{
+ struct iphdr *iph = header;
+
+ iph->ihl = 5;
+ iph->version = 4;
+ iph->ttl = 8;
+ iph->tot_len = htons(sizeof(*iph) + sizeof(struct udphdr) + payload_len);
+ iph->id = htons(1337);
+ iph->protocol = IPPROTO_UDP;
+ iph->saddr = htonl((172 << 24) | (17 << 16) | 2);
+ iph->daddr = htonl((172 << 24) | (17 << 16) | 1);
+ iph->check = build_ip_csum((void *) iph, iph->ihl << 1, 0);
+
+ return iph->ihl << 2;
+}
+
+static int build_udp_header(void *header, int payload_len)
+{
+ const int alen = sizeof(uint32_t);
+ struct udphdr *udph = header;
+ int len = sizeof(*udph) + payload_len;
+
+ udph->source = htons(9);
+ udph->dest = htons(cfg_port);
+ udph->len = htons(len);
+
+ if (cfg_use_csum_off)
+ udph->check = build_ip_csum(header - (2 * alen), alen,
+ htons(IPPROTO_UDP) + udph->len);
+ else
+ udph->check = 0;
+
+ return sizeof(*udph);
+}
+
+static int build_packet(int payload_len)
+{
+ int off = 0;
+
+ off += build_vnet_header(tbuf);
+ off += build_eth_header(tbuf + off);
+ off += build_ipv4_header(tbuf + off, payload_len);
+ off += build_udp_header(tbuf + off, payload_len);
+
+ if (off + payload_len > sizeof(tbuf))
+ error(1, 0, "payload length exceeds max");
+
+ memset(tbuf + off, DATA_CHAR, payload_len);
+
+ return off + payload_len;
+}
+
+static void do_bind(int fd)
+{
+ struct sockaddr_ll laddr = {0};
+
+ laddr.sll_family = AF_PACKET;
+ laddr.sll_protocol = htons(ETH_P_IP);
+ laddr.sll_ifindex = if_nametoindex(cfg_ifname);
+ if (!laddr.sll_ifindex)
+ error(1, errno, "if_nametoindex");
+
+ if (bind(fd, (void *)&laddr, sizeof(laddr)))
+ error(1, errno, "bind");
+}
+
+static void do_send(int fd, char *buf, int len)
+{
+ int ret;
+
+ if (!cfg_use_vnet) {
+ buf += sizeof(struct virtio_net_hdr);
+ len -= sizeof(struct virtio_net_hdr);
+ }
+ if (cfg_use_dgram) {
+ buf += ETH_HLEN;
+ len -= ETH_HLEN;
+ }
+
+ if (cfg_use_bind) {
+ ret = write(fd, buf, len);
+ } else {
+ struct sockaddr_ll laddr = {0};
+
+ laddr.sll_protocol = htons(ETH_P_IP);
+ laddr.sll_ifindex = if_nametoindex(cfg_ifname);
+ if (!laddr.sll_ifindex)
+ error(1, errno, "if_nametoindex");
+
+ ret = sendto(fd, buf, len, 0, (void *)&laddr, sizeof(laddr));
+ }
+
+ if (ret == -1)
+ error(1, errno, "write");
+ if (ret != len)
+ error(1, 0, "write: %u %u", ret, len);
+
+ fprintf(stderr, "tx: %u\n", ret);
+}
+
+static int do_tx(void)
+{
+ const int one = 1;
+ int fd, len;
+
+ fd = socket(PF_PACKET, cfg_use_dgram ? SOCK_DGRAM : SOCK_RAW, 0);
+ if (fd == -1)
+ error(1, errno, "socket t");
+
+ if (cfg_use_bind)
+ do_bind(fd);
+
+ if (cfg_use_qdisc_bypass &&
+ setsockopt(fd, SOL_PACKET, PACKET_QDISC_BYPASS, &one, sizeof(one)))
+ error(1, errno, "setsockopt qdisc bypass");
+
+ if (cfg_use_vnet &&
+ setsockopt(fd, SOL_PACKET, PACKET_VNET_HDR, &one, sizeof(one)))
+ error(1, errno, "setsockopt vnet");
+
+ len = build_packet(cfg_payload_len);
+
+ if (cfg_truncate_len < len)
+ len = cfg_truncate_len;
+
+ do_send(fd, tbuf, len);
+
+ if (close(fd))
+ error(1, errno, "close t");
+
+ return len;
+}
+
+static int setup_rx(void)
+{
+ struct timeval tv = { .tv_usec = 100 * 1000 };
+ struct sockaddr_in raddr = {0};
+ int fd;
+
+ fd = socket(PF_INET, SOCK_DGRAM, 0);
+ if (fd == -1)
+ error(1, errno, "socket r");
+
+ if (setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)))
+ error(1, errno, "setsockopt rcv timeout");
+
+ raddr.sin_family = AF_INET;
+ raddr.sin_port = htons(cfg_port);
+ raddr.sin_addr.s_addr = htonl(INADDR_ANY);
+
+ if (bind(fd, (void *)&raddr, sizeof(raddr)))
+ error(1, errno, "bind r");
+
+ return fd;
+}
+
+static void do_rx(int fd, int expected_len, char *expected)
+{
+ int ret;
+
+ ret = recv(fd, rbuf, sizeof(rbuf), 0);
+ if (ret == -1)
+ error(1, errno, "recv");
+ if (ret != expected_len)
+ error(1, 0, "recv: %u != %u", ret, expected_len);
+
+ if (memcmp(rbuf, expected, ret))
+ error(1, 0, "recv: data mismatch");
+
+ fprintf(stderr, "rx: %u\n", ret);
+}
+
+static int setup_sniffer(void)
+{
+ struct timeval tv = { .tv_usec = 100 * 1000 };
+ int fd;
+
+ fd = socket(PF_PACKET, SOCK_RAW, 0);
+ if (fd == -1)
+ error(1, errno, "socket p");
+
+ if (setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)))
+ error(1, errno, "setsockopt rcv timeout");
+
+ pair_udp_setfilter(fd);
+ do_bind(fd);
+
+ return fd;
+}
+
+static void parse_opts(int argc, char **argv)
+{
+ int c;
+
+ while ((c = getopt(argc, argv, "bcCdgl:qt:vV")) != -1) {
+ switch (c) {
+ case 'b':
+ cfg_use_bind = true;
+ break;
+ case 'c':
+ cfg_use_csum_off = true;
+ break;
+ case 'C':
+ cfg_use_csum_off_bad = true;
+ break;
+ case 'd':
+ cfg_use_dgram = true;
+ break;
+ case 'g':
+ cfg_use_gso = true;
+ break;
+ case 'l':
+ cfg_payload_len = strtoul(optarg, NULL, 0);
+ break;
+ case 'q':
+ cfg_use_qdisc_bypass = true;
+ break;
+ case 't':
+ cfg_truncate_len = strtoul(optarg, NULL, 0);
+ break;
+ case 'v':
+ cfg_use_vnet = true;
+ break;
+ case 'V':
+ cfg_use_vlan = true;
+ break;
+ default:
+ error(1, 0, "%s: parse error", argv[0]);
+ }
+ }
+
+ if (cfg_use_vlan && cfg_use_dgram)
+ error(1, 0, "option vlan (-V) conflicts with dgram (-d)");
+
+ if (cfg_use_csum_off && !cfg_use_vnet)
+ error(1, 0, "option csum offload (-c) requires vnet (-v)");
+
+ if (cfg_use_csum_off_bad && !cfg_use_csum_off)
+ error(1, 0, "option csum bad (-C) requires csum offload (-c)");
+
+ if (cfg_use_gso && !cfg_use_csum_off)
+ error(1, 0, "option gso (-g) requires csum offload (-c)");
+}
+
+static void run_test(void)
+{
+ int fdr, fds, total_len;
+
+ fdr = setup_rx();
+ fds = setup_sniffer();
+
+ total_len = do_tx();
+
+ /* BPF filter accepts only this length, vlan changes MAC */
+ if (cfg_payload_len == DATA_LEN && !cfg_use_vlan)
+ do_rx(fds, total_len - sizeof(struct virtio_net_hdr),
+ tbuf + sizeof(struct virtio_net_hdr));
+
+ do_rx(fdr, cfg_payload_len, tbuf + total_len - cfg_payload_len);
+
+ if (close(fds))
+ error(1, errno, "close s");
+ if (close(fdr))
+ error(1, errno, "close r");
+}
+
+int main(int argc, char **argv)
+{
+ parse_opts(argc, argv);
+
+ if (system("ip link set dev lo mtu 1500"))
+ error(1, errno, "ip link set mtu");
+ if (system("ip addr add dev lo 172.17.0.1/24"))
+ error(1, errno, "ip addr add");
+
+ run_test();
+
+ fprintf(stderr, "OK\n\n");
+ return 0;
+}
+
diff --git a/tools/testing/selftests/net/psock_snd.sh b/tools/testing/selftests/net/psock_snd.sh
new file mode 100755
index 000000000000..6331d91b86a6
--- /dev/null
+++ b/tools/testing/selftests/net/psock_snd.sh
@@ -0,0 +1,98 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+#
+# Run a series of packet socket send regression tests
+
+set -e
+
+readonly mtu=1500
+readonly iphlen=20
+readonly udphlen=8
+
+readonly vnet_hlen=10
+readonly eth_hlen=14
+
+readonly mss="$((${mtu} - ${iphlen} - ${udphlen}))"
+readonly mss_exceeds="$((${mss} + 1))"
+
+readonly max_mtu=65535
+readonly max_mss="$((${max_mtu} - ${iphlen} - ${udphlen}))"
+readonly max_mss_exceeds="$((${max_mss} + 1))"
+
+# functional checks (not a full cross-product)
+
+echo "dgram"
+./in_netns.sh ./psock_snd -d
+
+echo "dgram bind"
+./in_netns.sh ./psock_snd -d -b
+
+echo "raw"
+./in_netns.sh ./psock_snd
+
+echo "raw bind"
+./in_netns.sh ./psock_snd -b
+
+echo "raw qdisc bypass"
+./in_netns.sh ./psock_snd -q
+
+echo "raw vlan"
+./in_netns.sh ./psock_snd -V
+
+echo "raw vnet hdr"
+./in_netns.sh ./psock_snd -v
+
+echo "raw csum_off"
+./in_netns.sh ./psock_snd -v -c
+
+echo "raw csum_off with bad offset (fails)"
+(! ./in_netns.sh ./psock_snd -v -c -C)
+
+
+# bounds check: send {max, max + 1, min, min - 1} lengths
+
+echo "raw min size"
+./in_netns.sh ./psock_snd -l 0
+
+echo "raw mtu size"
+./in_netns.sh ./psock_snd -l "${mss}"
+
+echo "raw mtu size + 1 (fails)"
+(! ./in_netns.sh ./psock_snd -l "${mss_exceeds}")
+
+# fails due to ARPHRD_ETHER check in packet_extra_vlan_len_allowed
+#
+# echo "raw vlan mtu size"
+# ./in_netns.sh ./psock_snd -V -l "${mss}"
+
+echo "raw vlan mtu size + 1 (fails)"
+(! ./in_netns.sh ./psock_snd -V -l "${mss_exceeds}")
+
+echo "dgram mtu size"
+./in_netns.sh ./psock_snd -d -l "${mss}"
+
+echo "dgram mtu size + 1 (fails)"
+(! ./in_netns.sh ./psock_snd -d -l "${mss_exceeds}")
+
+echo "raw truncate hlen (fails: does not arrive)"
+(! ./in_netns.sh ./psock_snd -t "$((${vnet_hlen} + ${eth_hlen}))")
+
+echo "raw truncate hlen - 1 (fails: EINVAL)"
+(! ./in_netns.sh ./psock_snd -t "$((${vnet_hlen} + ${eth_hlen} - 1))")
+
+
+# gso checks: implies -l, because with gso len must exceed gso_size
+
+echo "raw gso min size"
+./in_netns.sh ./psock_snd -v -c -g -l "${mss_exceeds}"
+
+echo "raw gso min size - 1 (fails)"
+(! ./in_netns.sh ./psock_snd -v -c -g -l "${mss}")
+
+echo "raw gso max size"
+./in_netns.sh ./psock_snd -v -c -g -l "${max_mss}"
+
+echo "raw gso max size + 1 (fails)"
+(! ./in_netns.sh ./psock_snd -v -c -g -l "${max_mss_exceeds}")
+
+echo "OK. All tests passed"
--
2.17.0.921.gf22659ad46-goog
^ permalink raw reply related
* Re: [bpf-next V2 PATCH 4/8] tun: implement flush flag for ndo_xdp_xmit
From: Song Liu @ 2018-05-31 16:14 UTC (permalink / raw)
To: Jesper Dangaard Brouer
Cc: Networking, Daniel Borkmann, Alexei Starovoitov, Song Liu,
John Fastabend
In-Reply-To: <152775720301.24817.4050947353101519726.stgit@firesoul>
On Thu, May 31, 2018 at 2:00 AM, Jesper Dangaard Brouer
<brouer@redhat.com> wrote:
> When passed the XDP_XMIT_FLUSH flag tun_xdp_xmit now performs the same
> kind of socket wake up as in tun_xdp_flush(). The wake up code from
> tun_xdp_flush is generalized and shared with tun_xdp_xmit.
>
> Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Song Liu <songliubraving@fb.com>
> ---
> drivers/net/tun.c | 19 +++++++++++++------
> 1 file changed, 13 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index b182b8cdd219..d82a05fb0594 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -1285,6 +1285,14 @@ static const struct net_device_ops tun_netdev_ops = {
> .ndo_get_stats64 = tun_net_get_stats64,
> };
>
> +static void __tun_xdp_flush_tfile(struct tun_file *tfile)
> +{
> + /* Notify and wake up reader process */
> + if (tfile->flags & TUN_FASYNC)
> + kill_fasync(&tfile->fasync, SIGIO, POLL_IN);
> + tfile->socket.sk->sk_data_ready(tfile->socket.sk);
> +}
> +
> static int tun_xdp_xmit(struct net_device *dev, int n,
> struct xdp_frame **frames, u32 flags)
> {
> @@ -1295,7 +1303,7 @@ static int tun_xdp_xmit(struct net_device *dev, int n,
> int cnt = n;
> int i;
>
> - if (unlikely(flags & ~XDP_XMIT_FLAGS_NONE))
> + if (unlikely(flags & ~XDP_XMIT_FLAGS_MASK))
> return -EINVAL;
>
> rcu_read_lock();
> @@ -1325,6 +1333,9 @@ static int tun_xdp_xmit(struct net_device *dev, int n,
> }
> spin_unlock(&tfile->tx_ring.producer_lock);
>
> + if (flags & XDP_XMIT_FLUSH)
> + __tun_xdp_flush_tfile(tfile);
> +
> rcu_read_unlock();
> return cnt - drops;
> }
> @@ -1353,11 +1364,7 @@ static void tun_xdp_flush(struct net_device *dev)
>
> tfile = rcu_dereference(tun->tfiles[smp_processor_id() %
> numqueues]);
> - /* Notify and wake up reader process */
> - if (tfile->flags & TUN_FASYNC)
> - kill_fasync(&tfile->fasync, SIGIO, POLL_IN);
> - tfile->socket.sk->sk_data_ready(tfile->socket.sk);
> -
> + __tun_xdp_flush_tfile(tfile);
> out:
> rcu_read_unlock();
> }
>
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox