aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2015-10-09net/ieee80211: ieee80211_is_* can be booleanYaowei Bai1-38/+38
This patch makes ieee80211_is_* return bool to improve readability due to these particular functions only using either one or zero as their return value. No functional change. Signed-off-by: Yaowei Bai <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-10-09net/netlink: lockdep_genl_is_held can be booleanYaowei Bai2-2/+2
This patch makes lockdep_genl_is_held return bool to improve readability due to this particular function only using either one or zero as its return value. No functional change. Signed-off-by: Yaowei Bai <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-10-09Merge branch 'mlx-next'David S. Miller8-150/+194
Or Gerlitz says: ============================== Mellanox driver update for net-next Some small fixes and small enhancements from the team. Series applies over net-next commit acb4a6b "tcp: ensure prior synack rtx behavior with small backlogs". ============================== Signed-off-by: David S. Miller <[email protected]>
2015-10-09net/mlx4_core: Fix resource tracker error flow in add_res_rangeSaeed Mahameed1-1/+3
The 'for' loop when undoing rb-tree insertions and list-adds in the error flow in add_res_range had errors, fix them. Signed-off-by: Saeed Mahameed <[email protected]> Signed-off-by: Jack Morgenstein <[email protected]> Signed-off-by: Or Gerlitz <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-10-09net/mlx4_core: Fix mailbox leak in error flow when performing update qpJack Morgenstein1-3/+3
The procedure mlx4_update_qp leaks mailboxes in its error-flow, fix that. Signed-off-by: Jack Morgenstein <[email protected]> Signed-off-by: Or Gerlitz <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-10-09net/mlx4_en: Add steering rules after RSS creationIdo Shamay1-64/+80
Changed the receive control flow in a way that steering rules are added only when the RSS object is already in RTR/RTS mode. Some optimization features, which are enabled by the device firmware, require this condition in order to be effective. Signed-off-by: Ido Shamay <[email protected]> Signed-off-by: Or Gerlitz <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-10-09net/mlx5_core: Use private health thread for each deviceEli Cohen3-55/+52
Use a single threaded work queue for each device in the system instead of using one thread for any device. This is required so we can concurrently process system error handling for all the devices that need that. Signed-off-by: Eli Cohen <[email protected]> Signed-off-by: Or Gerlitz <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-10-09net/mlx5_core: Use accessor functions to read from device memoryEli Cohen1-13/+22
Use ioread function to read health buffer data. In addition, print the firmware version as a string for readability and also use dev_err to have the device string to be printed. Signed-off-by: Eli Cohen <[email protected]> Signed-off-by: Or Gerlitz <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-10-09net/mlx5_core: Prepare cmd interface to system errors handlingEli Cohen2-3/+23
In preparation to handling system errors at the mlx5_core level, change the interface of cmd_work_handler to accept a 64 bit argument for the vector. This allows to encode a flag that signifies when the handler is called as a result of a driver logic that wishes to terminate commands that the hardware may not be able to terminate. Such command completions are detected at the handler and proper return status is encoded. To be able to terminate page handler commands, we make sure to set the corresponding bit in the bitmask. Signed-off-by: Eli Cohen <[email protected]> Signed-off-by: Or Gerlitz <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-10-09net/mlx5_core: Improve mlx5 messagesEli Cohen1-11/+11
Improve the messages printed by the mlx5 macros to include the device string. In addition, prefix names used by the macros with two underscores to avoid possible name collisions. Signed-off-by: Eli Cohen <[email protected]> Signed-off-by: Or Gerlitz <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-10-09Merge branch 'master' of ↵David S. Miller23-227/+567
git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue Jeff Kirsher says: ==================== Intel Wired LAN Driver Updates 2015-10-08 This series contains updates to i40e and i40evf only (again). Jesse fixes an issue where the driver was issuing a WARN_ON during ring size changes because the code was cloning the rx_ring struct but not zeroing out the pointers before allocating new memory, so simply zero out the pointers. Also reduced the function call overhead by moving the interrupt enable function by moving it to the header file, which it in turn allows us to inline it. Also does a thorough job of code cleanup to fix spaces after declarations, remove unnecessary braces and breaks, remove another __func__ use and general code tidiness. Mitch adds mover verbose error messages when the number of supported VFs is reported in driver init and it different from the number reported in config space. Updated the VF driver to now detect a reset with the VF_ARQLEN register since the enable bit is cleared when the VF is reset and it stays cleared until the VF driver processes the reset and re-enables the admin queue which is more reliable than using the VFGEN_RSTAT as previously. Neerav adds parsing for CEE DCBx TLVs from the LLDP MIB since there is a need to get the CEE DesiredCfg Tx by firmware and DCB configuration Rx from peer for debug and other application purposes. Carolyn fixes a problem where the PF's Flow Director filter table would have an entry that the hardware was unable to add, when this occurs an invalid entry gets replayed and a valid one is lost. Matt fixes an issue where multiple link up messages can be logged resulting from admin queue link status timing when link properties are changed. Shannon adds the ability to control the period link polling through ethtool to be able to switch it off and on for debugging link issues. Serey explicitly assigns the enum index for each VSI type so that the PF and VF always reference to the same VSI type event if the enum lists are different. ==================== Signed-off-by: David S. Miller <[email protected]>
2015-10-09ath6kl: drop unlikely behind WARN_ON()Geliang Tang1-2/+2
WARN_ON() already contain an unlikely compiler flag. Drop it. Signed-off-by: Geliang Tang <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
2015-10-09ath: fix DFS timestamp wraparound reset conditionZefir Kurtisi1-1/+1
The DFS pattern detector ought to reset the detector lines when a pulse is added with lower time stamp than the previous (which indicates a TSF restart). This did not work so far and is fixed with this patch. The modification does not change detection performance within the driver, since it only ensures early reset (which is later performed by the PRI detectors anyway). It is relevant for synthetic tests and statistical evaluations, where millions of pulse patterns are processed and an early reset helps reducing load. Signed-off-by: Zefir Kurtisi <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
2015-10-09ath6kl: remove redundant null pointer check on send_pktColin Ian King1-3/+1
The check for send_pkt being NULL is redundant before the call to htc_reclaim_txctrl_buf, therefore it should be removed. This was detected by static analysis by cppcheck. Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
2015-10-09wil6210: Do no schedule firmware recovery during reset flowHamad Kadmany2-0/+9
During reset flow, ignore firmware errors detected prior to the actual hardware reset as the recovery flow would make additional unnecessary reset. Signed-off-by: Hamad Kadmany <[email protected]> Signed-off-by: Vladimir Kondratiev <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
2015-10-09wil6210: dump firmware memory when firmware crashesVladimir Kondratiev5-1/+121
When firmware crashes, just before firmware recovery, dump the firmware memory to a devcoredump device. The resulting dump can be read from user space to be used in offline crash analysis. Signed-off-by: Lior David <[email protected]> Signed-off-by: Vladimir Kondratiev <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
2015-10-09wil6210: ratelimit Tx error messageVladimir Kondratiev1-1/+1
Situations observed when IP stack schedules lots of frames for Tx while no connection (connection lost, for example). In this case, dmesg bloated with error message "FW not connected", printed for every frame. Ratelimit this error message to avoid dmesg pollution. Signed-off-by: Vladimir Kondratiev <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
2015-10-09wil6210: capture all frames in sniffer modeVladimir Kondratiev1-1/+1
For the sniffer (monitor) mode, capture either control only or both control and data PHY. It used to be control only or data only PHY due to firmware issues with configuration for PHY auto-detection; but now it is resolved. Signed-off-by: Vladimir Kondratiev <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
2015-10-09wil6210: support BAR (BlockAck Req)Vladimir Kondratiev3-6/+67
BAR frames delivered to the host via Rx path; whole BAR frame get delivered. Advance sequence in the reorder buffer and release old frames, as per IEEE802.11 spec. Firmware will reply to BAR, driver responsibility is only reorder buffer management. Signed-off-by: Vladimir Kondratiev <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
2015-10-09wil6210: treat broadcast bssid as "disconnect all"Vladimir Kondratiev1-2/+4
Hostapd request disconnect for broadcast bssid when it wants to disconnect all stations from the AP. Detect this and really disconnect all connected stations. Signed-off-by: Vladimir Kondratiev <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
2015-10-09wil6210: pmc logger bug fixVladimir Shulman1-1/+1
When allocating pmc descriptor, the structure is initially created on stack and later copied to the physical ring (device) memory. The descriptor structure must be initialized to zero to avoid garbage configuration, which may result in pmc mechanism malfunctioning. Signed-off-by: Vladimir Shulman <[email protected]> Signed-off-by: Vladimir Kondratiev <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
2015-10-09wil6210: log firmware crash informationVladimir Kondratiev2-1/+10
Print firmware and ucode assert codes when firmware crashed. Signed-off-by: Lior David <[email protected]> Signed-off-by: Vladimir Kondratiev <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
2015-10-09wil6210: Add proper handling for invalid frames on RxVladimir Kondratiev3-7/+22
On Rx, when invalid frame is received and dropped, reaping of next frames from Rx ring is stopped. This stops NAPI polling and re-enables the Rx interrupt. However, in cases where no more frames received, interrupt will not be triggered and rest of Rx frames will not be processed. Skip bad frames and continue to reap Rx packets when such frames are encountered, and add statistics for such frames for debug. Signed-off-by: Hamad Kadmany <[email protected]> Signed-off-by: Vladimir Kondratiev <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
2015-10-09wil6210: fix warning in system power management codeVladimir Kondratiev1-1/+1
Fix compilation warning where CONFIG_PM defined while CONFIG_PM_SLEEP is not defined Report follows: tree: git://github.com/kvalo/ath pending head: 941145fc5e5afbb120271e5dfaf37213ddb55807 commit: df596be39294d9712e5d568063a48448031e0a9f [37/39] wil6210: system power management config: xtensa-allyesconfig (attached as .config) reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout df596be39294d9712e5d568063a48448031e0a9f # save the attached .config to linux build tree make.cross ARCH=xtensa All warnings (new ones prefixed by >>): >> drivers/net/wireless/ath/wil6210/pcie_bus.c:264:12: warning: 'wil6210_suspend' defined but not used [-Wunused-function] static int wil6210_suspend(struct device *dev, bool is_runtime) ^ >> drivers/net/wireless/ath/wil6210/pcie_bus.c:291:12: warning: 'wil6210_resume' defined but not used [-Wunused-function] static int wil6210_resume(struct device *dev, bool is_runtime) ^ Reported-by: kbuild test robot <[email protected]> Signed-off-by: Vladimir Kondratiev <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
2015-10-09ath10k: use station's current operating mode from assoc requestVivek Natarajan1-2/+3
The current number of spatial streams used by the client is advertised as a separate IE in assoc request. Use this information to set the NSS operating mode. Fixes: 45c9abc059fa ("ath10k: implement more versatile set_bitrate_mask"). Signed-off-by: Vivek Natarajan <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
2015-10-09ath10k: optimize ce_lock on post rx buffer processingRajkumar Manoharan2-20/+9
After processing received packets from copy engine, host will allocate new buffer and queue them back to copy engine ring for further packet reception. On post rx processing path, skb allocation and dma mapping are unnecessarily handled within ce_lock. This is affecting peak throughput and also causing more CPU consumption. Optimize this by acquiring ce_lock only when accessing copy engine ring and moving skb allocation out of ce_lock. In AP148 platform with QCA99x0 in conducted environment, UDP uplink peak throughput is improved from ~1320 Mbps to ~1450 Mbps and TCP uplink peak throughput is increased from ~1240 Mbps (70% host CPU load) to ~1300 Mbps (71% CPU load). Similarly ~40Mbps improvement is observed in downlink path. Signed-off-by: Rajkumar Manoharan <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
2015-10-09ath10k: increase pci wakeup timeout to 30 msMaharaja Kennadyrajan2-2/+7
It is noticed that pci wakeup time is exceeding current timeout (10ms) randomly which is tested on QCA988x. So, the wake up time is increased to 30 ms and added debug prints to log total timeout. Signed-off-by: Maharaja Kennadyrajan <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
2015-10-08i40e: print neato new featuresJesse Brandeburg1-0/+3
To help users and developers know what compile options and hardware features are enabled at compile time, print VxLAN is available. Change-ID: I3162f3b7678dc725a597f964217920eb218b480b Signed-off-by: Jesse Brandeburg <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2015-10-08i40e/i40evf: pass QOS handle to VFMitch Williams3-2/+6
The VF really doesn't care about the QOS handle but it will in the future. Since the VF only uses TC0, send it that handle. On the VF side, save the handle and use it to populate the QOS params when we call into the client interface. Change-ID: I76f41b070baeaa09b19383e9168bc677837e0761 Signed-off-by: Mitch Williams <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2015-10-08i40evf: use capabilities flags properlyMitch Williams1-2/+7
Use the capabilities passed to us by the PF driver to control VF driver behavior. In the process, clean up the VLAN add/remove code so it's not a horrible morass of ifdefs. Change-ID: I1050eaf12b658a26fea6813047c9964163c70a73 Signed-off-by: Mitch Williams <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2015-10-08i40e: refactor code to remove indentJesse Brandeburg1-40/+42
I found a code indent that was avoidable because a whole function is inside an if block, reverse the if and move the code back a tab. Change-ID: I9989c8750ee61678fbf96a3b0fd7bf7cc7ef300a Signed-off-by: Jesse Brandeburg <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2015-10-08i40e/i40evf: clean up some codeJesse Brandeburg17-103/+124
Add missings spaces after declarations, remove another __func__ use, remove uncessary braces, remove unneeded breaks, and useless returns, and generally fix up some code. Change-ID: Ie715d6b64976c50e1c21531685fe0a2bd38c4244 Signed-off-by: Jesse Brandeburg <[email protected]> Signed-off-by: Shannon Nelson <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2015-10-08i40evf: detect reset more reliablyMitch Williams1-20/+16
Using VFGEN_RSTAT to detect a VF reset is an endeavor that is fraught with peril. It's entirely too easy to miss a reset because none of the bits are sticky. By the time the VF driver reads the register, the reset may have been processed and cleaned up by the PF driver, leaving the register in the same state that it was before the reset. Instead, detect a reset with the VF_ARQLEN register. When the VF is reset, the enable bit in this register is cleared, and it stays cleared until the VF driver processes the reset and re-enables the admin queue. Because we now deal with multiple registers in the reset and watchdog tasks, rename the rstat_val variable to reg_val. Change-ID: Id1df17045c0992e607da0162d31807f7fc20d199 Signed-off-by: Mitch Williams <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2015-10-08i40e: Support FW CEE DCB UP to TC map nibble swapGreg Bowers1-5/+8
Changes parsing of AQ command Get CEE DCBX OPER CFG (0x0A07). Change is required because FW creates the oper_prio_tc nibbles reversed from those in the CEE Priority Group sub-TLV. Change-ID: I7d9d8641bb430d30e286fc3fac909866ef8a0de8 Signed-off-by: Greg Bowers <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2015-10-08i40e/i40evf: Explicitly assign enum index for VSI typeSerey Kong2-16/+16
Ran into an issue where PF's VSI type list was different from VF's, which was resulted in different enum index. The VSI type list can be different depending on what build flag is used for PF and VF. The change is to explicitly assign enum index for each VSI type so that PF and VF always reference to the same VSI type event if the enum lists are different. Change-ID: I8c0e5fdb515f324f7964df863a458073cf467e57 Signed-off-by: Serey Kong <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2015-10-08i40e: add switch for link pollingShannon Nelson3-3/+29
There's been some need for controlling the periodic link polling for debugging link issues. This patch enables switching it off and on through an ethtool private flag. The link poll remains on by default, but can be turned off with ethtool --set-priv-flags p261p1 LinkPolling off and later turned back on with ethtool --set-priv-flags p261p1 LinkPolling on To check the current status, use ethtool --show-priv-flags p261p1 Change-ID: I32e4ab654ff3eec90a06cf144899971b82d71c40 Signed-off-by: Shannon Nelson <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2015-10-08i40e: Fix multiple link up messagesMatt Jared3-3/+8
This patch addresses an issue where multiple link up messages can be logged resulting from aq link status timing when link properties are changed (fc, speed, etc.); solved by using a single function to handle status printing and adding a mechanism to track whether link state (up or down) has actually changed. Change-ID: Ied6ed6e49dc397c77d992adc0bc9ed3767152b9d Signed-off-by: Matt Jared <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2015-10-08i40e: Fix for extra Flow Director filter in table after errorCarolyn Wyborny3-1/+17
This patch fixes a problem where the PF's fdir filter table would have an entry that the hw was unable to add. This notification happens in the hot path, so instead of trying to fix it then, we note the location in the failure case and delete it during regular fdir subtask callback. Without this patch, a case can occur where an invalid entry gets replayed and a valid one is not. Change-ID: I67831c183b5d0309876de807cc434809b74c9cb7 Signed-off-by: Carolyn Wyborny <[email protected]> Signed-off-by: Shannon Nelson <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2015-10-08i40e/i40evf: Store CEE DCBX DesiredCfg and RemoteCfgNeerav Parikh3-12/+42
This patch adds capability to query and store the CEE DCBX DesiredCfg and RemoteCfg data from the LLDP MIB. Added new member "desired_dcbx_config" in the i40e_hw data structure to hold CEE only DesiredCfg data. Change-ID: I19c550369594384eaff4cc63e690ca740231195d Signed-off-by: Neerav Parikh <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2015-10-08i40e: Add parsing for CEE DCBX TLVsNeerav Parikh2-0/+218
This patch adds parsing for CEE DCBX TLVs from the LLDP MIB. While the driver gets the DCB CEE operational configuration from Firmware using the "Get CEE DCBX Oper Config" AQ command there is a need to get the CEE DesiredCfg Tx by firmware and DCB configuration Rx from peer; for debug and other application purposes. Change-ID: I9140edf1a25a2852c7eff805d81e5eff6266178d Signed-off-by: Neerav Parikh <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2015-10-08i40e: add more verbose error messagesMitch Williams1-1/+3
Under certain circumstances, the device may not have enough resources to enable all of the VFs that it advertises in config space. Although the number of supported VFs is reported upon driver init, it is not obvious when this is different from the number reported in config space. To eliminate this confusion, add an error message explaining the problem. Additionally, move the 'Allocating VFs' message down below the error checks so as to prevent further confusion. Change-ID: I45b7efca53a7aebf7777be33a8bc9d615ae48ea1 Signed-off-by: Mitch Williams <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2015-10-08i40e: inline interrupt enableJesse Brandeburg2-19/+18
The interrupt enable function can be inlined by moving it to the header file, which decreases the function call overhead for a frequently called function. Change-ID: I3214cc99593725768642680e7b8ce7e9bba7e44d Signed-off-by: Jesse Brandeburg <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2015-10-08i40e: fix erroneous WARN_ONJesse Brandeburg1-0/+10
The driver was issuing a WARN_ON during ring size changes because the code was cloning the rx_ring struct but not zeroing out the pointers before allocating new memory. Zero out the pointers in the cloned copy before allocating new memory for them. In this case the code was correctly avoiding memory leaks but still triggering the warning. Change-ID: I186dd493948e9b7254ab0593d4aad8b68808918d Signed-off-by: Jesse Brandeburg <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
2015-10-08Bluetooth: Fix basic debugfs entries for unconfigured controllersMarcel Holtmann1-14/+15
When the controller is unconfigured (for example it does not have a valid Bluetooth address), then the basic debugfs entries for dut_mode and vendor_diag are not creates. Ensure they are created in __hci_init and also __hci_unconf_init functions. One of them is called during setup stage of a new controller. Signed-off-by: Marcel Holtmann <[email protected]> Signed-off-by: Johan Hedberg <[email protected]>
2015-10-08Merge branch 'bpf_random32'David S. Miller12-96/+187
Daniel Borkmann says: ==================== BPF/random32 updates BPF update to split the prandom state apart, and to move the *once helpers to the core. For details, please see individual patches. Given the changes and since it's in the tree for quite some time, net-next is a better choice in our opinion. v1 -> v2: - Make DO_ONCE() type-safe, remove the kvec helper. Credits go to Alexei Starovoitov for the __VA_ARGS__ hint, thanks! - Add a comment to the DO_ONCE() helper as suggested by Alexei. - Rework prandom_init_once() helper to the new API. - Keep Alexei's Acked-by on the last patch. ==================== Signed-off-by: David S. Miller <[email protected]>
2015-10-08bpf: split state from prandom_u32() and consolidate {c, e}BPF prngsDaniel Borkmann5-13/+35
While recently arguing on a seccomp discussion that raw prandom_u32() access shouldn't be exposed to unpriviledged user space, I forgot the fact that SKF_AD_RANDOM extension actually already does it for some time in cBPF via commit 4cd3675ebf74 ("filter: added BPF random opcode"). Since prandom_u32() is being used in a lot of critical networking code, lets be more conservative and split their states. Furthermore, consolidate eBPF and cBPF prandom handlers to use the new internal PRNG. For eBPF, bpf_get_prandom_u32() was only accessible for priviledged users, but should that change one day, we also don't want to leak raw sequences through things like eBPF maps. One thought was also to have own per bpf_prog states, but due to ABI reasons this is not easily possible, i.e. the program code currently cannot access bpf_prog itself, and copying the rnd_state to/from the stack scratch space whenever a program uses the prng seems not really worth the trouble and seems too hacky. If needed, taus113 could in such cases be implemented within eBPF using a map entry to keep the state space, or get_random_bytes() could become a second helper in cases where performance would not be critical. Both sides can trigger a one-time late init via prandom_init_once() on the shared state. Performance-wise, there should even be a tiny gain as bpf_user_rnd_u32() saves one function call. The PRNG needs to live inside the BPF core since kernels could have a NET-less config as well. Signed-off-by: Daniel Borkmann <[email protected]> Acked-by: Hannes Frederic Sowa <[email protected]> Acked-by: Alexei Starovoitov <[email protected]> Cc: Chema Gonzalez <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-10-08random32: add prandom_init_once helper for own rngsDaniel Borkmann2-1/+7
Add a prandom_init_once() facility that works on the rnd_state, so that users that are keeping their own state independent from prandom_u32() can initialize their taus113 per cpu states. The motivation here is similar to net_get_random_once(): initialize the state as late as possible in the hope that enough entropy has been collected for the seeding. prandom_init_once() makes use of the recently introduced prandom_seed_full_state() helper and is generic enough so that it could also be used on fast-paths due to the DO_ONCE(). Signed-off-by: Daniel Borkmann <[email protected]> Acked-by: Hannes Frederic Sowa <[email protected]> Acked-by: Alexei Starovoitov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-10-08random32: add prandom_seed_full_state helperDaniel Borkmann1-16/+21
Factor out the full reseed handling code that populates the state through get_random_bytes() and runs prandom_warmup(). The resulting prandom_seed_full_state() will be used later on in more than the current __prandom_reseed() user. Fix also two minor whitespace issues along the way. Signed-off-by: Daniel Borkmann <[email protected]> Acked-by: Hannes Frederic Sowa <[email protected]> Acked-by: Alexei Starovoitov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-10-08once: make helper generic for calling functions onceHannes Frederic Sowa2-35/+76
Make the get_random_once() helper generic enough, so that functions in general would only be called once, where one user of this is then net_get_random_once(). The only implementation specific call is to get_random_bytes(), all the rest of this *_once() facility would be duplicated among different subsystems otherwise. The new DO_ONCE() helper will be used by prandom() later on, but might also be useful for other scenarios/subsystems as well where a one-time initialization in often-called, possibly fast path code could occur. Signed-off-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Acked-by: Alexei Starovoitov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2015-10-08net: move net_get_random_once to libHannes Frederic Sowa5-67/+84
There's no good reason why users outside of networking should not be using this facility, f.e. for initializing their seeds. Therefore, make it accessible from there as get_random_once(). Signed-off-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Acked-by: Alexei Starovoitov <[email protected]> Signed-off-by: David S. Miller <[email protected]>