summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2020-07-30Merge branch 'l2tp-tidy-up-l2tp-core-API'David S. Miller4-111/+154
Tom Parkin says: ==================== l2tp: tidy up l2tp core API This short series makes some minor tidyup changes to the L2TP core API. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-30l2tp: improve API documentation in l2tp_core.hTom Parkin1-14/+72
* Improve the description of the key l2tp subsystem data structures. * Add high-level description of the main APIs for interacting with l2tp core. * Add documentation for the l2tp netlink session command callbacks. * Document the session pseudowire callbacks. Signed-off-by: Tom Parkin <tparkin@katalix.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-30l2tp: tweak exports for l2tp_recv_common and l2tp_ioctlTom Parkin2-2/+2
All of the l2tp subsystem's exported symbols are exported using EXPORT_SYMBOL_GPL, except for l2tp_recv_common and l2tp_ioctl. These functions alone are not useful without the rest of the l2tp infrastructure, so there's no practical benefit to these symbols using a different export policy. Change these exports to use EXPORT_SYMBOL_GPL for consistency with the rest of l2tp. Signed-off-by: Tom Parkin <tparkin@katalix.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-30l2tp: remove build_header callback in struct l2tp_sessionTom Parkin2-7/+4
The structure of an L2TP data packet header varies depending on the version of the L2TP protocol being used. struct l2tp_session used to have a build_header callback to abstract this difference away. It's clearer to simply choose the correct function to use when building the data packet (and we save on the function pointer in the session structure). This approach does mean dereferencing the parent tunnel structure in order to determine the tunnel version, but we're doing that in the transmit path in any case. Signed-off-by: Tom Parkin <tparkin@katalix.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-30l2tp: return void from l2tp_session_deleteTom Parkin3-10/+5
l2tp_session_delete is used to schedule a session instance for deletion. The function itself always returns zero, and none of its direct callers check its return value, so have the function return void. This change de-facto changes the l2tp netlink session_delete callback prototype since all pseudowires currently use l2tp_session_delete for their implementation of that operation. Signed-off-by: Tom Parkin <tparkin@katalix.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-30l2tp: don't export tunnel and session free functionsTom Parkin2-47/+46
Tunnel and session instances are reference counted, and shouldn't be directly freed by pseudowire code. Rather than exporting l2tp_tunnel_free and l2tp_session_free, make them private to l2tp_core.c, and export the refcount functions instead. In order to do this, the refcount functions cannot be declared as inline. Since the codepaths which take and drop tunnel and session references are not directly in the datapath this shouldn't cause performance issues. Signed-off-by: Tom Parkin <tparkin@katalix.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-30l2tp: don't export __l2tp_session_unhashTom Parkin2-32/+26
When __l2tp_session_unhash was first added it was used outside of l2tp_core.c, but that's no longer the case. As such, there's no longer a need to export the function. Make it private inside l2tp_core.c, and relocate it to avoid having to declare the function prototype in l2tp_core.h. Since the function is no longer used outside l2tp_core.c, remove the "__" prefix since we don't need to indicate anything special about its expected use to callers. Signed-off-by: Tom Parkin <tparkin@katalix.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-30selftests: txtimestamp: add flag for timestamp validation tolerance.Jian Yang1-2/+8
The txtimestamp selftest sets a fixed 500us tolerance. This value was arrived at experimentally. Some platforms have higher variances. Make this adjustable by adding the following flag: -t N: tolerance (usec) for timestamp validation. Signed-off-by: Jian Yang <jianyang@google.com> Acked-by: Willem de Bruijn <willemb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-30Merge branch 'master' of ↵David S. Miller12-69/+338
git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next Steffen Klassert says: ==================== pull request (net-next): ipsec-next 2020-07-30 Please note that I did the first time now --no-ff merges of my testing branch into the master branch to include the [PATCH 0/n] message of a patchset. Please let me know if this is desirable, or if I should do it any different. 1) Introduce a oseq-may-wrap flag to disable anti-replay protection for manually distributed ICVs as suggested in RFC 4303. From Petr Vaněk. 2) Patchset to fully support IPCOMP for vti4, vti6 and xfrm interfaces. From Xin Long. 3) Switch from a linear list to a hash list for xfrm interface lookups. From Eyal Birger. 4) Fixes to not register one xfrm(6)_tunnel object twice. From Xin Long. 5) Fix two compile errors that were introduced with the IPCOMP support for vti and xfrm interfaces. Also from Xin Long. 6) Make the policy hold queue work with VTI. This was forgotten when VTI was implemented. Please pull or let me know if there are problems. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-29fib: fix fib_rules_ops indirect calls wrappersBrian Vazquez1-13/+20
This patch fixes: commit b9aaec8f0be5 ("fib: use indirect call wrappers in the most common fib_rules_ops") which didn't consider the case when CONFIG_IPV6_MULTIPLE_TABLES is not set. Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Fixes: b9aaec8f0be5 ("fib: use indirect call wrappers in the most common fib_rules_ops") Signed-off-by: Brian Vazquez <brianvv@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-29Merge branch '100GbE' of ↵David S. Miller15-78/+346
git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue Tony Nguyen says: ==================== 100GbE Intel Wired LAN Driver Updates 2020-07-29 This series contains updates to the ice driver only. Dave works around LFC settings not being preserved through link events. Fixes link issues with GLOBR reset and handling of multiple link events. Nick restores VF MSI-X after PCI reset. Kiran corrects the error code returned in ice_aq_sw_rules if the rule does not exist. Paul prevents overwriting of user set descriptors. Tarun adds masking before accessing rate limiting profile types and corrects queue bandwidth configuration. Victor modifies Tx queue scheduler distribution to spread more evenly across queue group nodes. Krzysztof sets need_wakeup flag for Tx AF_XDP. Brett allows VLANs in safe mode. Marcin cleans up VSIs on probe failure. Bruce reduces the scope of a variable. Ben removes a FW workaround. Tony fixes an unused parameter warning. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-29net: mvneta: fix comment about phylink_speed_downJisheng Zhang1-1/+1
mvneta has switched to phylink, so the comment should look like "We may have called phylink_speed_down before". Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Reviewed-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-29ice: fix unused parameter warningTony Nguyen1-2/+2
Depending on PAGE_SIZE, the following unused parameter warning can be reported: drivers/net/ethernet/intel/ice/ice_txrx.c: In function ‘ice_rx_frame_truesize’: drivers/net/ethernet/intel/ice/ice_txrx.c:513:21: warning: unused parameter ‘size’ [-Wunused-parameter] unsigned int size) The 'size' variable is used only when PAGE_SIZE >= 8192. Add __maybe_unused to remove the warning. Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
2020-07-29ice: disable no longer needed workaround for FW loggingBen Shelton1-2/+0
For the FW logging info AQ command, we currently set the ICE_AQ_FLAG_RD in order to work around a FW issue. This issue has been fixed so remove the workaround. Signed-off-by: Ben Shelton <benjamin.h.shelton@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2020-07-29ice: reduce scope of variableBruce Allan1-2/+4
The scope of the macro local variable 'i' can be reduced. Do so to avoid static analysis tools from complaining. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2020-07-29ice: cleanup VSI on probe failMarcin Szycik1-5/+7
As part of ice_setup_pf_sw() a PF VSI is setup; release the VSI in case of failure. Signed-off-by: Marcin Szycik <marcin.szycik@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2020-07-29ice: Allow all VLANs in safe modeBrett Creeley1-2/+57
Currently the PF VSI's context parameters are left in a bad state when going into safe mode. This is causing VLAN traffic to not pass. Fix this by configuring the PF VSI to allow all VLAN tagged traffic. Also, remove redundant comment explaining the safe mode flow in ice_probe(). Signed-off-by: Brett Creeley <brett.creeley@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2020-07-29ice: need_wakeup flag might not be set for TxKrzysztof Kazimierczak1-8/+2
This is a port of i40e commit 705639572e8c ("i40e: need_wakeup flag might not be set for Tx"). Quoting the original commit message: "The need_wakeup flag for Tx might not be set for AF_XDP sockets that are only used to send packets. This happens if there is at least one outstanding packet that has not been completed by the hardware and we get that corresponding completion (which will not generate an interrupt since interrupts are disabled in the napi poll loop) between the time we stopped processing the Tx completions and interrupts are enabled again. In this case, the need_wakeup flag will have been cleared at the end of the Tx completion processing as we believe we will get an interrupt from the outstanding completion at a later point in time. But if this completion interrupt occurs before interrupts are enable, we lose it and should at that point really have set the need_wakeup flag since there are no more outstanding completions that can generate an interrupt to continue the processing. When this happens, user space will see a Tx queue need_wakeup of 0 and skip issuing a syscall, which means will never get into the Tx processing again and we have a deadlock." As a result, packet processing stops. This patch introduces a fix for this issue, by always setting the need_wakeup flag at the end of an interrupt processing. This ensures that the deadlock will not happen. Signed-off-by: Krzysztof Kazimierczak <krzysztof.kazimierczak@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2020-07-29ice: distribute Tx queues evenlyVictor Raj1-4/+51
Distribute the Tx queues evenly across all queue groups. This will help the queues to get more equal sharing among the queues when all are in use. In the previous algorithm, the next queue group node will be picked up only after the previous one filled with max children. For example: if VSI is configured with 9 queues, the first 8 queues will be assigned to queue group 1 and the 9th queue will be assigned to queue group 2. The 2 queue groups split the bandwidth between them equally (50:50). The first queue group node will share the 50% bandwidth with all of its children (8 queues). And the second queue group node will share the entire 50% bandwidth with its only children. The new algorithm will fix this issue. Signed-off-by: Victor Raj <victor.raj@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2020-07-29ice: Adjust scheduler default BW weightTarun Singh2-2/+13
By default the queues are configured in legacy mode. The default BW settings for legacy/advanced modes are different. The existing code was using the advanced mode default value of 1 which was incorrect. This caused the unbalanced BW sharing among siblings. The recommended default value is applied. Signed-off-by: Tarun Singh <tarun.k.singh@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2020-07-29ice: Add RL profile bit mask checkTarun Singh1-5/+6
Mask bits before accessing the profile type field. Signed-off-by: Tarun Singh <tarun.k.singh@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2020-07-29ice: fix overwriting TX/RX descriptor values when rebuilding VSIPaul M Stillwell Jr1-2/+8
If a user sets the value of the TX or RX descriptors to some non-default value using 'ethtool -G' then we need to not overwrite the values when we rebuild the VSI. The VSI rebuild could happen as a result of a user setting the number of queues via the 'ethtool -L' command. Fix this by checking to see if the value we have stored is non-zero and if it is then don't change the value. Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2020-07-29ice: return correct error code from ice_aq_sw_rulesKiran Patil1-1/+7
Return ICE_ERR_DOES_NOT_EXIST return code if admin command error code is ICE_AQ_RC_ENOENT (not exist). ice_aq_sw_rules is used when switch rule is getting added/deleted/updated. In case of delete/update switch rule, admin command can return ICE_AQ_RC_ENOENT error code if such rule does not exist, hence return ICE_ERR_DOES_NOT_EXIST error code from ice_aq_sw_rule, so that caller of this function can decide how to handle ICE_ERR_DOES_NOT_EXIST. Signed-off-by: Kiran Patil <kiran.patil@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2020-07-29ice: restore VF MSI-X state during PCI resetNick Nunley3-0/+34
During a PCI FLR the MSI-X Enable flag in the VF PCI MSI-X capability register will be cleared. This can lead to issues when a VF is assigned to a VM because in these cases the VF driver receives no indication of the PF PCI error/reset and additionally it is incapable of restoring the cleared flag in the hypervisor configuration space without fully reinitializing the driver interrupt functionality. Since the VF driver is unable to easily resolve this condition on its own, restore the VF MSI-X flag during the PF PCI reset handling. Signed-off-by: Nick Nunley <nicholas.d.nunley@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2020-07-29ice: fix link event handling timingDave Ertman2-1/+7
When the driver experiences a link event (especially link up) there can be multiple events generated. Some of these are link fault and still have a state of DOWN set. The problem happens when the link comes UP during the PF driver handling one of the LINK DOWN events. The status of the link is updated and is now seen as UP, so when the actual LINK UP event comes, the port information has already been updated to be seen as UP, even though none of the UP activities have been completed. After the link information has been updated in the link handler and evaluated for MEDIA PRESENT, if the state of the link has been changed to UP, treat the DOWN event as an UP event since the link is now UP. Signed-off-by: Dave Ertman <david.m.ertman@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2020-07-29ice: Fix link broken after GLOBR resetDave Ertman1-4/+0
After a GLOBR, the link was broken so that a link up situation was being seen as a link down. The problem was that the rebuild process was updating the port_info link status without doing any of the other things that need to be done when link changes. This was causing the port_info struct to have current "UP" information so that any further UP interrupts were skipped as redundant. The rebuild flow should *not* be updating the port_info struct link information, so eliminate this and leave it to the link event handling code. Signed-off-by: Dave Ertman <david.m.ertman@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2020-07-29ice: Implement LFC workaroundDave Ertman6-38/+148
There is a bug where the LFC settings are not being preserved through a link event. The registers in question are the ones that are touched (and restored) when a set_local_mib AQ command is performed. On a link-up event, make sure that a set_local_mib is being performed. Move the function ice_aq_set_lldp_mib() from the DCB specific ice_dcb.c to ice_common.c so that the driver always has access to this AQ command. Signed-off-by: Dave Ertman <david.m.ertman@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2020-07-28Merge branch 'net-stmmac-improve-WOL'David S. Miller2-6/+31
Jisheng Zhang says: ==================== net: stmmac: improve WOL Currently, stmmac driver relies on the HW PMT to support WOL. We want to support phy based WOL. patch1 is a small improvement to disable WAKE_MAGIC for PMT case if no pmt_magic_frame. patch2 and patch3 are two prepation patches. patch4 implement the phy based WOL patch5 tries to save a bit energy if WOL is enabled. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-28net: stmmac: Speed down the PHY if WoL to save energyJisheng Zhang1-0/+8
When WoL is enabled and the machine is powered off, the PHY remains waiting for wakeup events at max speed, which is a waste of energy. Slow down the PHY speed before stopping the ethernet if WoL is enabled, Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-28net: stmmac: Support WOL with phyJisheng Zhang2-0/+15
Currently, the stmmac driver WOL implementation relies on MAC's PMT feature. We have a case: the MAC HW doesn't enable PMT, instead, we rely on the phy to support WOL. Implement the support for this case. Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-28net: stmmac: only call pmt() during suspend/resume if HW enables PMTJisheng Zhang1-3/+3
This is to prepare WOL support with phy. Compared with WOL implementation which relies on the MAC's PMT features, in phy supported WOL case, device_may_wakeup() may also be true, but we should not call mac's pmt() function if HW doesn't enable PMT. And during resume, we should call phylink_start() if PMT is disabled. Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-28net: stmmac: Move device_can_wakeup() check earlier in set_wolJisheng Zhang1-3/+3
If !device_can_wakeup(), there's no need to futher check. And return -EOPNOTSUPP rather than -EINVAL if !device_can_wakeup(). Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-28net: stmmac: Remove WAKE_MAGIC if HW shows no pmt_magic_frameJisheng Zhang1-0/+2
Remove WAKE_MAGIC from supported modes if the HW capability register shows no support for pmt_magic_frame. Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-28Merge branch 'RTL8366-VLAN-callback-fixes'David S. Miller1-11/+24
Linus Walleij says: ==================== RTL8366 VLAN callback fixes While we are pondering how to make the core set up the VLANs the right way, let's merge the uncontroversial fixes. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-28net: dsa: rtl8366: Fix VLAN set-upLinus Walleij1-7/+7
Alter the rtl8366_vlan_add() to call rtl8366_set_vlan() inside the loop that goes over all VIDs since we now properly support calling that function more than once. Augment the loop to postincrement as this is more intuitive. The loop moved past the last VID but called rtl8366_set_vlan() with the port number instead of the VID, assuming a 1-to-1 correspondence between ports and VIDs. This was also a bug. Cc: DENG Qingfang <dqfext@gmail.com> Cc: Mauri Sandberg <sandberg@mailfence.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Fixes: d8652956cf37 ("net: dsa: realtek-smi: Add Realtek SMI driver") Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-28net: dsa: rtl8366: Fix VLAN semanticsLinus Walleij1-4/+17
The RTL8366 would not handle adding new members (ports) to a VLAN: the code assumed that ->port_vlan_add() was only called once for a single port. When intializing the switch with .configure_vlan_while_not_filtering set to true, the function is called numerous times for adding all ports to VLAN1, which was something the code could not handle. Alter rtl8366_set_vlan() to just |= new members and untagged flags to 4k and MC VLAN table entries alike. This makes it possible to just add new ports to a VLAN. Put in some helpful debug code that can be used to find any further bugs here. Cc: DENG Qingfang <dqfext@gmail.com> Cc: Mauri Sandberg <sandberg@mailfence.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Fixes: d8652956cf37 ("net: dsa: realtek-smi: Add Realtek SMI driver") Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-28fib: use indirect call wrappers in the most common fib_rules_opsBrian Vazquez4-12/+48
This avoids another inderect call per RX packet which save us around 20-40 ns. Changelog: v1 -> v2: - Move declaraions to fib_rules.h to remove warnings Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Brian Vazquez <brianvv@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-28net_sched: initialize timer earlier in red_init()Cong Wang1-4/+4
When red_init() fails, red_destroy() is called to clean up. If the timer is not initialized yet, del_timer_sync() will complain. So we have to move timer_setup() before any failure. Reported-and-tested-by: syzbot+6e95a4fabf88dc217145@syzkaller.appspotmail.com Fixes: aee9caa03fc3 ("net: sched: sch_red: Add qevents "early_drop" and "mark"") Cc: Petr Machata <petrm@mellanox.com> Cc: Jamal Hadi Salim <jhs@mojatatu.com> Cc: Jiri Pirko <jiri@resnulli.us> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Reviewed-by: Petr Machata <petrm@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-28Merge branch 'hinic-add-some-error-messages-for-debug'David S. Miller21-81/+855
Luo bin says: ==================== hinic: add some error messages for debug patch #1: support to handle hw abnormal event patch #2: improve the error messages when functions return failure and dump relevant registers in some exception handling processes ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-28hinic: add log in exception handling processesLuo bin13-45/+151
improve the error message when functions return failure and dump relevant registers in some exception handling processes Signed-off-by: Luo bin <luobin9@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-28hinic: add support to handle hw abnormal eventLuo bin10-36/+704
add support to handle hw abnormal event such as hardware failure, cable unplugged,link error Signed-off-by: Luo bin <luobin9@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-28Merge branch 'introduce-PLDM-firmware-update-library'David S. Miller24-3/+2953
Jacob Keller says: ==================== introduce PLDM firmware update library This series goal is to enable support for updating the ice hardware flash using the devlink flash command. The ice firmware update files are distributed using the file format described by the "PLDM for Firmware Update" standard: https://www.dmtf.org/documents/pmci/pldm-firmware-update-specification-100 Because this file format is standard, this series introduces a new library that handles the generic logic for parsing the PLDM file header. The library uses a design that is very similar to the Mellanox mlxfw module. That is, a simple ops table is setup and device drivers instantiate an instance of the pldmfw library with the device specific operations. Doing so allows for each device to implement the low level behavior for how to interact with its firmware. This series includes the library and an implementation for the ice hardware. I've removed all of the parameters, and the proposed changes to support overwrite mode. I'll be working on the overwrite mask suggestion from Jakub as a follow-up series. Because the PLDM file format is a standard and not something that is specific to the Intel hardware, I opted to place this update library in lib/pldmfw. I should note that while I tried to make the library generic, it does not attempt to mimic the complete "Update Agent" as defined in the standard. This is mostly due to the fact that the actual interfaces exposed to software for the ice hardware would not allow this. This series depends on some work just recently and is based on top of the patch series sent by Tony published at: https://lore.kernel.org/netdev/20200723234720.1547308-1-anthony.l.nguyen@intel.com/T/#t Changes since v2 RFC * Removed overwrite mode patches, as this can become a follow up series with a separate discussion * Fixed a minor bug in the pldm_timestamp structure not being packed. * Dropped Cc for other driver maintainers, as this series no longer includes changes to the core flash update command. * Re-ordered patches slightly. Changes since v1 RFC * Removed the "allow_downgrade_on_flash_update" parameter. Instead, the driver will always attempt to flash the device, even when firmware indicates that it would be a downgrade. A dev_warn is used to indicate when this occurs. * Removed the "ignore_pending_flash_update". Instead, the driver will always check for and cancel any previous pending update. A devlink flash status message will be sent when this cancellation occurs. * Removed the "reset_after_flash_update" parameter. This will instead be implemented as part of a devlink reset interface, work left for a future change. * Replaced the "flash_update_preservation_level" parameter with a new "overwrite" mode attribute on the flash update command. For ice, this mode will select the preservation level. For all other drivers, I modified them to check that the mode is "OVERWRITE_NOTHING", and have Cc'd the maintainers to get their input. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-28ice: implement device flash update via devlinkJacob Keller9-1/+1007
Use the newly added pldmfw library to implement device flash update for the Intel ice networking device driver. This support uses the devlink flash update interface. The main parts of the flash include the Option ROM, the netlist module, and the main NVM data. The PLDM firmware file contains modules for each of these components. Using the pldmfw library, the provided firmware file will be scanned for the three major components, "fw.undi" for the Option ROM, "fw.mgmt" for the main NVM module containing the primary device firmware, and "fw.netlist" containing the netlist module. The flash is separated into two banks, the active bank containing the running firmware, and the inactive bank which we use for update. Each module is updated in a staged process. First, the inactive bank is erased, preparing the device for update. Second, the contents of the component are copied to the inactive portion of the flash. After all components are updated, the driver signals the device to switch the active bank during the next EMP reset (which would usually occur during the next reboot). Although the firmware AdminQ interface does report an immediate status for each command, the NVM erase and NVM write commands receive status asynchronously. The driver must not continue writing until previous erase and write commands have finished. The real status of the NVM commands is returned over the receive AdminQ. Implement a simple interface that uses a wait queue so that the main update thread can sleep until the completion status is reported by firmware. For erasing the inactive banks, this can take quite a while in practice. To help visualize the process to the devlink application and other applications based on the devlink netlink interface, status is reported via the devlink_flash_update_status_notify. While we do report status after each 4k block when writing, there is no real status we can report during erasing. We simply must wait for the complete module erasure to finish. With this implementation, basic flash update for the ice hardware is supported. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-28ice: add flags indicating pending update of firmware moduleJacob Keller3-0/+24
After a flash update, the pending status of the update can be determined from the device capabilities. Read the appropriate device capability and store whether there is a pending update awaiting a reboot. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-28ice: Add AdminQ commands for FW updateCudzilo, Szymon T5-2/+281
Add structures, identifiers, and helper functions for several AdminQ commands related to performing a firmware update for the ice hardware. These will be used in future code for implementing the devlink .flash_update handler. Signed-off-by: Cudzilo, Szymon T <szymon.t.cudzilo@intel.com> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-28ice: Add support for unified NVM update flow capabilityJacek Naczyk3-0/+11
Extends function parsing response from Discover Device Capability AQC to check if the device supports unified NVM update flow. Signed-off-by: Jacek Naczyk <jacek.naczyk@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-28Add pldmfw library for PLDM firmware updateJacob Keller11-0/+1630
The pldmfw library is used to implement common logic needed to flash devices based on firmware files using the format described by the PLDM for Firmware Update standard. This library consists of logic to parse the PLDM file format from a firmware file object, as well as common logic for sending the relevant PLDM header data to the device firmware. A simple ops table is provided so that device drivers can implement device specific hardware interactions while keeping the common logic to the pldmfw library. This library will be used by the Intel ice networking driver as part of implementing device flash update via devlink. The library aims to be vendor and device agnostic. For this reason, it has been placed in lib/pldmfw, in the hopes that other devices which use the PLDM firmware file format may benefit from it in the future. However, do note that not all features defined in the PLDM standard have been implemented. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-28Merge branch 'mptcp-Exchange-MPTCP-DATA_FIN-DATA_ACK-before-TCP-FIN'David S. Miller4-66/+306
Mat Martineau says: ==================== mptcp: Exchange MPTCP DATA_FIN/DATA_ACK before TCP FIN This series allows the MPTCP-level connection to be closed with the peers exchanging DATA_FIN and DATA_ACK according to the state machine in appendix D of RFC 8684. The process is very similar to the TCP disconnect state machine. The prior code sends DATA_FIN only when TCP FIN packets are sent, and does not allow for the MPTCP-level connection to be half-closed. Patch 8 ("mptcp: Use full MPTCP-level disconnect state machine") is the core of the series. Earlier patches in the series have some small fixes and helpers in preparation, and the final four small patches do some cleanup. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-28mptcp: Safely store sequence number when sending dataMat Martineau1-1/+1
The MPTCP socket's write_seq member can be read without the msk lock held, so use WRITE_ONCE() to store it. Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-07-28mptcp: Safely read sequence number when lock isn't heldMat Martineau1-1/+1
The MPTCP socket's write_seq member should be read with READ_ONCE() when the msk lock is not held. Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>