aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2018-10-02tcp: do not release socket ownership in tcp_close()Eric Dumazet3-9/+5
syzkaller was able to hit the WARN_ON(sock_owned_by_user(sk)); in tcp_close() While a socket is being closed, it is very possible other threads find it in rtnetlink dump. tcp_get_info() will acquire the socket lock for a short amount of time (slow = lock_sock_fast(sk)/unlock_sock_fast(sk, slow);), enough to trigger the warning. Fixes: 67db3e4bfbc9 ("tcp: no longer hold ehash lock while calling tcp_get_info()") Signed-off-by: Eric Dumazet <edumazet@google.com> Reported-by: syzbot <syzkaller@googlegroups.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-02net: inet6_rtm_getroute() - use new style struct initializer instead of memsetMaciej Żenczykowski1-2/+1
Signed-off-by: Maciej Żenczykowski <maze@google.com> Reviewed-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-02net: rtm_to_fib6_config() - use new style struct initializer instead of memsetMaciej Żenczykowski1-11/+12
(allows for better compiler optimization) Signed-off-by: Maciej Żenczykowski <maze@google.com> Reviewed-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-02net: rtmsg_to_fib6_config() - use new style struct initializer instead of memsetMaciej Żenczykowski1-16/+16
(allows for better compiler optimization) Signed-off-by: Maciej Żenczykowski <maze@google.com> Reviewed-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-02net: ip6_update_pmtu() - use new style struct initializer instead of memsetMaciej Żenczykowski1-9/+8
(allows for better compiler optimization) Signed-off-by: Maciej Żenczykowski <maze@google.com> Reviewed-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-02net: remove 1 always zero parameter from ip6_redirect_no_header()Maciej Żenczykowski3-6/+3
(the parameter in question is mark) Signed-off-by: Maciej Żenczykowski <maze@google.com> Reviewed-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-02net: ip6_redirect_no_header() - use new style struct initializer instead of memsetMaciej Żenczykowski1-9/+8
(allows for better compiler optimization) Signed-off-by: Maciej Żenczykowski <maze@google.com> Reviewed-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-02net: ip6_redirect() - use new style struct initializer instead of memsetMaciej Żenczykowski1-10/+9
(allows for better compiler optimization) Signed-off-by: Maciej Żenczykowski <maze@google.com> Reviewed-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-02net: inet_rtm_getroute() - use new style struct initializer instead of memsetMaciej Żenczykowski1-2/+1
Signed-off-by: Maciej Żenczykowski <maze@google.com> Reviewed-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-02net: ip_rt_get_source() - use new style struct initializer instead of memsetMaciej Żenczykowski1-12/+9
(allows for better compiler optimization) Signed-off-by: Maciej Żenczykowski <maze@google.com> Reviewed-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-02Merge tag 'wireless-drivers-next-for-davem-2018-10-02' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-nextDavid S. Miller276-9949/+8620
Kalle Valo says: ==================== wireless-drivers-next patches for 4.20 First set of new features for 4.20. mt76 driver is going through major refactoring and that's why there are so many mt76 patches. iwlwifi is also under heavy development and smaller changes to other drivers. Also wireless-drivers was merged to fix a conflict between the two trees. Major changes: ath10k * limit available channels via DT ieee80211-freq-limit wil6210 * add 802.11r Fast Roaming support for AP and station modes * add support for channel 4 iwlwifi * new FW API handling * some improvements in the PCI recovery mechanism * enable a new scanning feature; * continued work on HE (mostly radiotap) * TKIP implementation in new devices * work continues for new 22560 hardware mt76 * add support for Alfa AWUS036ACM * lots of refactoring to make it easier to add new hardware support * prepare for adding mt76x0e (pci-e variant) support * add CONFIG_MT76x0E kconfig symbol brcmfmac * add support CYW89342 mini-PCIe device * add 4-way handshake offload detection for FT-802.1X * enable NL80211_EXT_FEATURE_CQM_RSSI_LIST * fix for proper support of 160MHz bandwidth rtl8xxxu * add rtl8188ctv support ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-02Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queueDavid S. Miller13-507/+952
Jeff Kirsher says: ==================== 100GbE Intel Wired LAN Driver Updates 2018-10-02 This series contains updates to ice driver only. Anirudh expands the use of VSI handles across the rest of the driver, which includes refactoring the code to correctly use VSI handles. After a reset, ensure that all configurations for a VSI get re-applied before moving on to rebuilding the next VSI. Dave fixed the driver to check the current link state after reset to ensure that the correct link state of a port is reported. Fixed an issue where if the driver is unloaded when traffic is in progress, errors are generated. Preethi breaks up the IRQ tracker into a software and hardware IRQ tracker, where the software IRQ tracker tracks only the PF's IRQ requests and does not play any role in the VF initialization. The hardware IRQ tracker represents the device's interrupt space and will be looked up to see if the device has run our of interrupts when a interrupt has to be allocated in the device for either PF or VF. Md Fahad adds support for enabling/disabling RSS via ethtool. Brett aligns the ice_reset_req enum values to the values that the hardware understands. Also added initial support for dynamic interrupt moderation in the ice driver. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-02Merge branch 'qed-20g'David S. Miller5-4/+30
Sudarsana Reddy Kalluru says: ==================== qed*: Driver support for 20G link speed. The patch series adds driver support for configuring/reading the 20G link speed. Please consider applying this to "net-next". ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-02qede: Add driver support for 20G link speed.Sudarsana Reddy Kalluru1-0/+9
Add driver support for reading/configuring the 20G link speed via ethtool. Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com> Signed-off-by: Michal Kalderon <Michal.Kalderon@cavium.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-02qed: Add driver support for 20G link speed.Sudarsana Reddy Kalluru4-4/+21
Add driver support for configuring/reading the 20G link speed. Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com> Signed-off-by: Michal Kalderon <Michal.Kalderon@cavium.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-02isdn/hisax: Fix fall-through annotationGustavo A. R. Silva1-1/+1
Replace "fallthru" with a proper "fall through" annotation. This fix is part of the ongoing efforts to enabling -Wimplicit-fallthrough Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-02net: drop unused skb_append_datato_frags()Paolo Abeni2-63/+0
This helper is unused since commit 988cf74deb45 ("inet: Stop generating UFO packets.") Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-02ice: Fix error on driver removeDave Ertman1-0/+6
If the driver is unloaded when traffic is in progress, errors are generated. Fix this by releasing qvectors and NAPI handler on remove. Signed-off-by: Dave Ertman <david.m.ertman@intel.com> Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2018-10-02ice: Add support for dynamic interrupt moderationBrett Creeley7-24/+102
Currently there is no support for dynamic interrupt moderation. This patch adds some initial code to support this. The following changes were made: 1. Currently we are using multiple members to store the interrupt granularity (itr_gran_25/50/100/200). This is not necessary because we can query the device to determine what the interrupt granularity should be set to, done by a new function ice_get_itr_intrl_gran. 2. Added intrl to ice_q_vector structure to support interrupt rate limiting. 3. Added the function ice_intrl_usecs_to_reg for converting to a value in usecs that the device understands. 4. Added call to write to the GLINT_RATE register. Disable intrl by default for now. 5. Changed rx/tx_itr_setting to itr_setting because having both seems redundant because a ring is either Tx or Rx. 6. Initialize itr_setting for both Tx/Rx rings in ice_vsi_alloc_rings() Signed-off-by: Brett Creeley <brett.creeley@intel.com> Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2018-10-02ice: Align ice_reset_req enum values to hardware reset valuesBrett Creeley2-5/+14
Currently the ice_reset_req enum values have to be translated into a different set of values that the hardware understands for the same reset types. Avoid this translation by aligning ice_reset_req enum values to the ones that the hardware understands. Also add and else if block to check for ICE_RESET_EMPR and put a dev_dbg message in the else case. Signed-off-by: Brett Creeley <brett.creeley@intel.com> Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2018-10-02ice: Implement ethtool hook for RSS switchMd Fahad Iqbal Polash3-0/+40
This patch implements ethtool hook for enabling/disabling RSS. While disabling RSS, the LUT should be cleared. And the LUT should be reconfigured while enabling RSS. Signed-off-by: Md Fahad Iqbal Polash <md.fahad.iqbal.polash@intel.com> Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2018-10-02ice: Split irq_tracker into sw_irq_tracker and hw_irq_trackerPreethi Banala3-64/+148
For the PF driver, when mapping interrupts to queues, we need to request IRQs from the kernel and we also have to allocate interrupts from the device. Similarly, when the VF driver (iavf.ko) initializes, it requests the kernel IRQs that it needs but it can't directly allocate interrupts in the device. Instead, it sends a mailbox message to the ice driver, which then allocates interrupts in the device on the VF driver's behalf. Currently both these cases end up having to reserve entries in pf->irq_tracker but irq_tracker itself is sized based on how many vectors the PF driver needs. Under the right circumstances, the VF driver can fail to get entries in irq_tracker, which will result in the VF driver failing probe. To fix this, sw_irq_tracker and hw_irq_tracker are introduced. The sw_irq_tracker tracks only the PF's IRQ request and doesn't play any role in VF init. hw_irq_tracker represents the device's interrupt space. When interrupts have to be allocated in the device for either PF or VF, hw_irq_tracker will be looked up to see if the device has run out of interrupts. Signed-off-by: Preethi Banala <preethi.banala@intel.com> Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2018-10-02ice: Check for actual link state of port after resetDave Ertman3-2/+6
We are currently replaying the link state of a port after a reset, but it is possible that the link state of a port can change during the reset process. So check for the current link state of a port during the rebuild process of a reset. Signed-off-by: Dave Ertman <david.m.ertman@intel.com> Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2018-10-02ice: Implement VSI replay frameworkAnirudh Venkataramanan6-51/+178
Currently, switch filters get replayed after reset. In addition to filters, other VSI attributes (like RSS configuration, Tx scheduler configuration, etc.) also need to be replayed after reset. Thus, instead of replaying based on functional blocks (i.e. replay all filters for all VSIs, followed by RSS configuration replay for all VSIs, and so on), it makes more sense to have the replay centered around a VSI. In other words, replay all configurations for a VSI before moving on to rebuilding the next VSI. To that effect, this patch introduces a VSI replay framework in a new function ice_vsi_replay_all. Currently it only replays switch filters, but it will be expanded in the future to replay additional VSI attributes. Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2018-10-02ice: Expand use of VSI handles part 2/2Anirudh Venkataramanan9-163/+132
This patch is a continuation of the previous patch where VSI handles are used instead of VSI numbers. Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2018-10-02ice: Expand use of VSI handles part 1/2Anirudh Venkataramanan4-200/+328
A VSI handle is just a number the driver maintains to uniquely identify a VSI. A VSI handle is backed by a VSI number in the hardware. When interacting when the hardware, VSI handles are converted into VSI numbers. In commit 0f9d5027a749 ("ice: Refactor VSI allocation, deletion and rebuild flow"), VSI handles were introduced but it was used only when creating and deleting VSIs. This patch is part one of two patches that expands the use of VSI handles across the rest of the driver. Also in this patch, certain parts of the code had to be refactored to correctly use VSI handles. Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2018-10-01Merge branch 'ibmvnic-Implement-driver-defined-queue-limits'David S. Miller2-36/+102
Thomas Falcon says: ==================== ibmvnic: Implement driver-defined queue limits In this patch series, update the ibmvnic driver to use driver-defined queue limits instead of limits imposed by the Virtual I/O server management partition. For some deviced, initial max queue size and amount limits, despite their definition, can actually be exceeded if the client driver requests it. With this in mind, define a private ethtool flag that toggles the use of driver-defined limits. These limits are currently more than what supported hardware will likely allow, so the driver will attempt to get as close as possible to the user request but may not fully succeed. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-01ibmvnic: Add ethtool private flag for driver-defined queue limitsThomas Falcon2-35/+100
When choosing channel amounts and ring sizes, the maximums in the ibmvnic driver are defined by the virtual i/o server management partition. Even though they are defined as maximums, the client driver may in fact successfully request resources that exceed these limits, which are mostly dependent on a user's hardware With this in mind, provide an ethtool flag that when enabled will allow the user to request resources limited by driver-defined maximums instead of limits defined by the management partition. The driver will try to honor the user's request but may not allowed by the management partition. In this case, the driver requests as close as it can get to the desired amount until it succeeds. Signed-off-by: Thomas Falcon <tlfalcon@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-01ibmvnic: Introduce driver limits for ring sizesThomas Falcon1-0/+1
Introduce driver-defined maximums for queue ring sizes. Devices available for IBM vNIC today will likely not allow this amount, but this should give us some leeway for future devices that may support larger ring sizes. Signed-off-by: Thomas Falcon <tlfalcon@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-01ibmvnic: Increase maximum queue size limitThomas Falcon1-1/+1
Increase queue size limit to 16. Devices available for IBM vNIC today will not allow this amount, but this should give us some leeway for future devices that may support more RX or TX queues. Signed-off-by: Thomas Falcon <tlfalcon@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-01net: phy: Convert to using %pOFn instead of device_node.nameRob Herring1-2/+2
In preparation to remove the node name pointer from struct device_node, convert printf users to use the %pOFn format specifier. Cc: Andrew Lunn <andrew@lunn.ch> Cc: "David S. Miller" <davem@davemloft.net> Cc: netdev@vger.kernel.org Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-01tcp/fq: move back to CLOCK_MONOTONICEric Dumazet3-5/+5
In the recent TCP/EDT patch series, I switched TCP and sch_fq clocks from MONOTONIC to TAI, in order to meet the choice done earlier for sch_etf packet scheduler. But sure enough, this broke some setups were the TAI clock jumps forward (by almost 50 year...), as reported by Leonard Crestez. If we want to converge later, we'll probably need to add an skb field to differentiate the clock bases, or a socket option. In the meantime, an UDP application will need to use CLOCK_MONOTONIC base for its SCM_TXTIME timestamps if using fq packet scheduler. Fixes: 72b0094f9182 ("tcp: switch tcp_clock_ns() to CLOCK_TAI base") Fixes: 142537e41923 ("net_sched: sch_fq: switch to CLOCK_TAI") Fixes: fd2bca2aa789 ("tcp: switch internal pacing timer to CLOCK_TAI") Signed-off-by: Eric Dumazet <edumazet@google.com> Reported-by: Leonard Crestez <leonard.crestez@nxp.com> Tested-by: Leonard Crestez <leonard.crestez@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-01selftests/tls: Fix recv(MSG_PEEK) & splice() test casesVakul Garg1-10/+10
TLS test cases splice_from_pipe, send_and_splice & recv_peek_multiple_records expect to receive a given nummber of bytes and then compare them against the number of bytes which were sent. Therefore, system call recv() must not return before receiving the requested number of bytes, otherwise the subsequent memcmp() fails. This patch passes MSG_WAITALL flag to recv() so that it does not return prematurely before requested number of bytes are copied to receive buffer. Signed-off-by: Vakul Garg <vakul.garg@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-01hv_netvsc: Fix rndis_per_packet_info internal field initializationHaiyang Zhang1-0/+1
The RSC feature -- a bit field "internal" was added here with total size unchanged: struct rndis_per_packet_info { u32 size; u32 type:31; u32 internal:1; u32 ppi_offset; }; On TX path, we put rndis msg into skb head room, which is not zeroed before passing to us. We do not use the "internal" field in TX path, but it may impact older hosts which use the entire 32 bits as "type". To fix the bug, this patch sets the field "internal" to zero. Fixes: c8e4eff4675f ("hv_netvsc: Add support for LRO/RSC in the vSwitch") Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-01net: phy: improve handling delayed workHeiner Kallweit2-15/+16
Using mod_delayed_work() allows to simplify handling delayed work and removes the need for the sync parameter in phy_trigger_machine(). Also introduce a helper phy_queue_state_machine() to encapsulate the low-level delayed work calls. No functional change intended. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-01Merge branch 'net-systemport-Turn-on-offloads-by-default'David S. Miller2-34/+35
Florian Fainelli says: ==================== net: systemport: Turn on offloads by default Up until now, we had added all the code necessary to turn on RX/TX checksum offloads at runtime, but there is no reason why they have to be disabled by default given that this gives a slight performance improvement. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-01net: systemport: Add software counters to track reallocationsFlorian Fainelli2-0/+7
When inserting the TSB, keep track of how many times we had to do it and if there was a failure in doing so, this helps profile the driver for possibly incorrect headroom settings. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-01net: systemport: Be drop monitor friendly while re-allocating headroomFlorian Fainelli1-1/+2
During bcm_sysport_insert_tsb() make sure we differentiate a SKB headroom re-allocation failure from the normal swap and replace path. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-01net: systemport: Turn on offloads by defaultFlorian Fainelli1-3/+4
We can turn on the RX/TX checksum offloads by default and make sure that those are properly reflected back to e.g: stacked devices such as VLAN or DSA. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-01net: systemport: Utilize bcm_sysport_set_features() during resume/openFlorian Fainelli1-7/+7
During driver resume and open, the HW may have lost its context/state, utilize bcm_sysport_set_features() to make sure we do restore the correct set of features that were previously configured. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-01net: systemport: Refactor bcm_sysport_set_features()Florian Fainelli1-23/+15
In preparation for unconditionally enabling TX and RX checksum offloads, refactor bcm_sysport_set_features() a bit such that __netdev_update_features() during register_netdev() can make sure that features are correctly programmed during network device registration. Since we can now be called during register_netdev() with clocks gated, we need to temporarily turn them on/off in order to have a successful register programming. We also move the CRC forward setting read into bcm_sysport_set_features() since priv->crc_fwd matters while turning on RX checksum offload, that way we are guaranteed they are in sync in case we ever add support for NETIF_F_RXFCS at some point in the future. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-01net_sched: fix a crash in tc_new_tfilter()Cong Wang1-1/+3
When tcf_block_find() fails, it already rollbacks the qdisc refcnt, so its caller doesn't need to clean up this again. Avoid calling qdisc_put() again by resetting qdisc to NULL for callers. Reported-by: syzbot+37b8770e6d5a8220a039@syzkaller.appspotmail.com Fixes: e368fdb61d8e ("net: sched: use Qdisc rcu API instead of relying on rtnl lock") Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-01Merge branch 'netlink-extended-attribute-validation'David S. Miller2-3/+165
Johannes Berg says: ==================== netlink: extended attribute validation This adds further netlink attribute validation: * min/max/range validation * validation through a custom function pointer This is useful to * reduce boilerplate code in command handling code, if attributes are used commonly across different commands * get more extended ACK error messages/attribute pointers * ensure attributes are valid even when ignored (though this might be a problem when converting existing code) Changes since v1: * split off validate_type from type and use that for min/max/range and function; this is better because the range is limited to the range of s16 and so things like "u16 with minimum value 1" couldn't be expressed earlier * add macros for this, e.g. NLA_POLICY_MIN(NLA_U16, 1) for the case mentioned in the previous bullet Using this pretty much in all places where applicable in nl80211 reduces the code size there by about 1.8KiB, with just a minimal code increase in lib/nlattr.o. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-01netlink: add validation function to policyJohannes Berg2-1/+30
Add the ability to have an arbitrary validation function attached to a netlink policy that doesn't already use the validation_data pointer in another way. This can be useful to validate for example the content of a binary attribute, like in nl80211 the "(information) elements", which must be valid streams of "u8 type, u8 length, u8 value[length]". Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-01netlink: add attribute range validation to policyJohannes Berg2-3/+136
Without further bloating the policy structs, we can overload the `validation_data' pointer with a struct of s16 min, max and use those to validate ranges in NLA_{U,S}{8,16,32,64} attributes. It may sound strange to validate NLA_U32 with a s16 max, but in many cases NLA_U32 is used for enums etc. since there's no size benefit in using a smaller attribute width anyway, due to netlink attribute alignment; in cases like that it's still useful, particularly when the attribute really transports an enum value. Doing so lets us remove quite a bit of validation code, if we can be sure that these attributes aren't used by userspace in places where they're ignored today. To achieve all this, split the 'type' field and introduce a new 'validation_type' field which indicates what further validation (beyond the validation prescribed by the type of the attribute) is done. This currently allows for no further validation (the default), as well as min, max and range checks. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-01Merge branch 'Support-of-Flow-Director-in-HNS3-Ethernet-Driver-for-HiP08-Rev2-SoC'David S. Miller7-9/+1721
Salil Mehta says: ==================== Support of Flow Director in HNS3 Ethernet Driver for HiP08 Rev2 SoC This patch-set adds the support of FD(Flow Director) in the HNS3 PF driver for HiP08 Rev2(0x21) SoC of Hisilicon. FD can be used in filtering the flows and deciding to drop the flow or forward it to paricular queue. Configuration consists of rules with input keys and actions. The rules are stored in TCAM. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-01net: hns3: Add support for enable/disable flow directorJian Shen3-1/+28
This patch adds switch for flow director with ethtool command Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Salil Mehta <salil.mehta@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-01net: hns3: Remove all flow director rules when unload hns3 driverJian Shen1-0/+2
This patch removes all flow director rules when unload hns3 driver. Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Salil Mehta <salil.mehta@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-01net: hns3: Add reset handle for flow directorJian Shen4-0/+103
When doing reset, remove all entries in TCAM block, and keep flow director rules list. After finishing reset, restore all entries. Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Salil Mehta <salil.mehta@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2018-10-01net: hns3: Add support for rule query of flow directorJian Shen3-6/+264
This patch adds support for querying rule number and rule details by ethtool commands. Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Salil Mehta <salil.mehta@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>