net: phy: mscc: Stop clearing the the UDPv4 checksum for L2 framesWe have noticed that when PHY timestamping is enabled, L2 frames seemsto be modified by changing two 2 bytes with a value of 0. Th
net: phy: mscc: Stop clearing the the UDPv4 checksum for L2 framesWe have noticed that when PHY timestamping is enabled, L2 frames seemsto be modified by changing two 2 bytes with a value of 0. The place werethese 2 bytes seems to be random(or I couldn't find a pattern). In mostof the cases the userspace can ignore these frames but if for examplethose 2 bytes are in the correction field there is nothing to do. Thisseems to happen when configuring the HW for IPv4 even that the flow isnot enabled.These 2 bytes correspond to the UDPv4 checksum and once we don't enableclearing the checksum when using L2 frames then the frame doesn't seemto be changed anymore.Fixes: 7d272e63e0979d ("net: phy: mscc: timestamping and PHC support")Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>Link: https://patch.msgid.link/20250523082716.2935895-1-horatiu.vultur@microchip.comSigned-off-by: Paolo Abeni <pabeni@redhat.com>
show more ...
net: phy: mscc: Fix memory leak when using one step timestampingFix memory leak when running one-step timestamping. When runningone-step sync timestamping, the HW is configured to insert the TX ti
net: phy: mscc: Fix memory leak when using one step timestampingFix memory leak when running one-step timestamping. When runningone-step sync timestamping, the HW is configured to insert the TX timeinto the frame, so there is no reason to keep the skb anymore. As inthis case the HW will never generate an interrupt to say that the framewas timestamped, then the frame will never released.Fix this by freeing the frame in case of one-step timestamping.Fixes: 7d272e63e0979d ("net: phy: mscc: timestamping and PHC support")Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>Link: https://patch.msgid.link/20250522115722.2827199-1-horatiu.vultur@microchip.comSigned-off-by: Jakub Kicinski <kuba@kernel.org>
net: phy: move PHY package related code from phy.h to phy_package.cMove PHY package related inline functions from phy.h to phy_package.c.While doing so remove locked versions phy_package_read() an
net: phy: move PHY package related code from phy.h to phy_package.cMove PHY package related inline functions from phy.h to phy_package.c.While doing so remove locked versions phy_package_read() andphy_package_write() which have no user.Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>Link: https://patch.msgid.link/a4518379-7a5d-45f3-831c-b7fde6512c65@gmail.comSigned-off-by: Jakub Kicinski <kuba@kernel.org>
net: phy: mscc: use new phy_package_shared gettersUse the new getters for members of struct phy_package_shared.Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>Link: https://patch.msgid.link
net: phy: mscc: use new phy_package_shared gettersUse the new getters for members of struct phy_package_shared.Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>Link: https://patch.msgid.link/61ee43ec-be20-4be1-bfad-d18d2a4fae2b@gmail.comSigned-off-by: Jakub Kicinski <kuba@kernel.org>
net: phy: Constify struct mdio_device_id'struct mdio_device_id' is not modified in these drivers.Constifying these structures moves some data to a read-only section, soincrease overall security.
net: phy: Constify struct mdio_device_id'struct mdio_device_id' is not modified in these drivers.Constifying these structures moves some data to a read-only section, soincrease overall security.On a x86_64, with allmodconfig, as an example:Before:====== text data bss dec hex filename 27014 12792 0 39806 9b7e drivers/net/phy/broadcom.oAfter:===== text data bss dec hex filename 27206 12600 0 39806 9b7e drivers/net/phy/broadcom.oSigned-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>Reviewed-by: Andrew Lunn <andrew@lunn.ch>Link: https://patch.msgid.link/403c381b7d9156b67ad68ffc44b8eee70c5e86a9.1736691226.git.christophe.jaillet@wanadoo.frSigned-off-by: Jakub Kicinski <kuba@kernel.org>
net: phy: use ethtool string helpersThese are the preferred way to copy ethtool strings.Avoids incrementing pointers all over the place.Signed-off-by: Rosen Penev <rosenp@gmail.com>Link: https
net: phy: use ethtool string helpersThese are the preferred way to copy ethtool strings.Avoids incrementing pointers all over the place.Signed-off-by: Rosen Penev <rosenp@gmail.com>Link: https://patch.msgid.link/20241029234641.11448-1-rosenp@gmail.comSigned-off-by: Jakub Kicinski <kuba@kernel.org>
move asm/unaligned.h to linux/unaligned.hasm/unaligned.h is always an include of asm-generic/unaligned.h;might as well move that thing to linux/unaligned.h and includethat - there's nothing arch-
move asm/unaligned.h to linux/unaligned.hasm/unaligned.h is always an include of asm-generic/unaligned.h;might as well move that thing to linux/unaligned.h and includethat - there's nothing arch-specific in that header.auto-generated by the following:for i in `git grep -l -w asm/unaligned.h`; do sed -i -e "s/asm\/unaligned.h/linux\/unaligned.h/" $idonefor i in `git grep -l -w asm-generic/unaligned.h`; do sed -i -e "s/asm-generic\/unaligned.h/linux\/unaligned.h/" $idonegit mv include/asm-generic/unaligned.h include/linux/unaligned.hgit mv tools/include/asm-generic/unaligned.h tools/include/linux/unaligned.hsed -i -e "/unaligned.h/d" include/asm-generic/Kbuildsed -i -e "s/__ASM_GENERIC/__LINUX/" include/linux/unaligned.h tools/include/linux/unaligned.h
net: Add struct kernel_ethtool_ts_infoIn prevision to add new UAPI for hwtstamp we will be limited to the structethtool_ts_info that is currently passed in fixed binary format through theETHTOOL_
net: Add struct kernel_ethtool_ts_infoIn prevision to add new UAPI for hwtstamp we will be limited to the structethtool_ts_info that is currently passed in fixed binary format through theETHTOOL_GET_TS_INFO ethtool ioctl. It would be good if new kernel codealready started operating on an extensible kernel variant of thatstructure, similar in concept to struct kernel_hwtstamp_config vs structhwtstamp_config.Since struct ethtool_ts_info is in include/uapi/linux/ethtool.h, herewe introduce the kernel-only structure in include/linux/ethtool.h.The manual copy is then made in the function called by ETHTOOL_GET_TS_INFO.Acked-by: Shannon Nelson <shannon.nelson@amd.com>Acked-by: Alexandra Winter <wintera@linux.ibm.com>Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>Link: https://patch.msgid.link/20240709-feature_ptp_netnext-v17-6-b5317f50df2a@bootlin.comSigned-off-by: Jakub Kicinski <kuba@kernel.org>
net: Change the API of PHY default timestamp to MACChange the API to select MAC default time stamping instead of the PHY.Indeed the PHY is closer to the wire therefore theoretically it has lessde
net: Change the API of PHY default timestamp to MACChange the API to select MAC default time stamping instead of the PHY.Indeed the PHY is closer to the wire therefore theoretically it has lessdelay than the MAC timestamping but the reality is different. Due to lowertime stamping clock frequency, latency in the MDIO bus and no PHC hardwaresynchronization between different PHY, the PHY PTP is often less precisethan the MAC. The exception is for PHY designed specially for PTP case butthese devices are not very widespread. For not breaking the compatibilitydefault_timestamp flag has been introduced in phy_device that is set bythe phy driver to know we are using the old API behavior.Reviewed-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>Link: https://patch.msgid.link/20240709-feature_ptp_netnext-v17-4-b5317f50df2a@bootlin.comSigned-off-by: Jakub Kicinski <kuba@kernel.org>
net: phy: extend PHY package API to support multiple global addressCurrent API for PHY package are limited to single address to configureglobal settings for the PHY package.It was found that som
net: phy: extend PHY package API to support multiple global addressCurrent API for PHY package are limited to single address to configureglobal settings for the PHY package.It was found that some PHY package (for example the qca807x, a PHYpackage that is shipped with a bundle of 5 PHY) requires multiple PHYaddress to configure global settings. An example scenario is a PHY thathave a dedicated PHY for PSGMII/serdes calibrarion and have a specificPHY in the package where the global PHY mode is set and affects everyother PHY in the package.Change the API in the following way:- Change phy_package_join() to take the base addr of the PHY package instead of the global PHY addr.- Make __/phy_package_write/read() require an additional arg that select what global PHY address to use by passing the offset from the base addr passed on phy_package_join().Each user of this API is updated to follow this new implementationfollowing a pattern where an enum is defined to declare the offset of theaddr.We also drop the check if shared is defined as any user of thephy_package_read/write is expected to use phy_package_join first. Misuseof this will correctly trigger a kernel panic for NULL pointerexception.Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>Signed-off-by: David S. Miller <davem@davemloft.net>
net: partial revert of the "Make timestamping selectable: seriesRevert following commits:commit acec05fb78ab ("net_tstamp: Add TIMESTAMPING SOFTWARE and HARDWARE mask")commit 11d55be06df0 ("net:
net: partial revert of the "Make timestamping selectable: seriesRevert following commits:commit acec05fb78ab ("net_tstamp: Add TIMESTAMPING SOFTWARE and HARDWARE mask")commit 11d55be06df0 ("net: ethtool: Add a command to expose current time stamping layer")commit bb8645b00ced ("netlink: specs: Introduce new netlink command to get current timestamp")commit d905f9c75329 ("net: ethtool: Add a command to list available time stamping layers")commit aed5004ee7a0 ("netlink: specs: Introduce new netlink command to list available time stamping layers")commit 51bdf3165f01 ("net: Replace hwtstamp_source by timestamping layer")commit 0f7f463d4821 ("net: Change the API of PHY default timestamp to MAC")commit 091fab122869 ("net: ethtool: ts: Update GET_TS to reply the current selected timestamp")commit 152c75e1d002 ("net: ethtool: ts: Let the active time stamping layer be selectable")commit ee60ea6be0d3 ("netlink: specs: Introduce time stamping set command")They need more time for reviews.Link: https://lore.kernel.org/all/20231118183529.6e67100c@kernel.org/Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net: Change the API of PHY default timestamp to MACChange the API to select MAC default time stamping instead of the PHY.Indeed the PHY is closer to the wire therefore theoretically it has lessdelay than the MAC timestamping but the reality is different. Due to lowertime stamping clock frequency, latency in the MDIO bus and no PHC hardwaresynchronization between different PHY, the PHY PTP is often less precisethan the MAC. The exception is for PHY designed specially for PTP case butthese devices are not very widespread. For not breaking the compatibility Iintroduce a default_timestamp flag in phy_device that is set by the phydriver to know we are using the old API behavior.The phy_set_timestamp function is called at each call of phy_attach_direct.In case of MAC driver using phylink this function is called when theinterface is turned up. Then if the interface goes down and up again thelast choice of timestamp will be overwritten by the default choice.A solution could be to cache the timestamp status but it can bring otherissues. In case of SFP, if we change the module, it doesn't make sense toblindly re-set the timestamp back to PHY, if the new module has a PHY withmediocre timestamping capabilities.Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>Signed-off-by: David S. Miller <davem@davemloft.net>
net: Convert PHYs hwtstamp callback to use kernel_hwtstamp_configThe PHYs hwtstamp callback are still getting the timestamp config fromifreq and using copy_from/to_user.Get rid of these functions
net: Convert PHYs hwtstamp callback to use kernel_hwtstamp_configThe PHYs hwtstamp callback are still getting the timestamp config fromifreq and using copy_from/to_user.Get rid of these functions by using timestamp configuration in parameter.This also allow to move on to kernel_hwtstamp_config and be similar tonet devices using the new ndo_hwstamp_get/set.This adds the possibility to manipulate the timestamp configurationfrom the kernel which was not possible with the copy_from/to_user.Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>Signed-off-by: David S. Miller <davem@davemloft.net>
net: phy: mscc: macsec: reject PN update requestsUpdating the PN is not supported.Return -EINVAL if update_pn is true.The following command succeeded, but it should fail because the driverdoes
net: phy: mscc: macsec: reject PN update requestsUpdating the PN is not supported.Return -EINVAL if update_pn is true.The following command succeeded, but it should fail because the driverdoes not update the PN:ip macsec set macsec0 tx sa 0 pn 232 onFixes: 28c5107aa904 ("net: phy: mscc: macsec support")Signed-off-by: Radu Pirea (NXP OSS) <radu-nicolae.pirea@oss.nxp.com>Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net: phy: mscc: fix packet loss due to RGMII delaysTwo deadly typos break RX and TX traffic on the VSC8502 PHY using RGMIIif phy-mode = "rgmii-id" or "rgmii-txid", and no "tx-internal-delay-ps"ov
net: phy: mscc: fix packet loss due to RGMII delaysTwo deadly typos break RX and TX traffic on the VSC8502 PHY using RGMIIif phy-mode = "rgmii-id" or "rgmii-txid", and no "tx-internal-delay-ps"override exists. The negative error code from phy_get_internal_delay()does not get overridden with the delay deduced from the phy-mode, andlater gets committed to hardware. Also, the rx_delay gets overridden bywhat should have been the tx_delay.Fixes: dbb050d2bfc8 ("phy: mscc: Add support for RGMII delay configuration")Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>Reviewed-by: Harini Katakam <harini.katakam@amd.com>Reviewed-by: Simon Horman <simon.horman@corigine.com>Link: https://lore.kernel.org/r/20230627134235.3453358-1-vladimir.oltean@nxp.comSigned-off-by: Jakub Kicinski <kuba@kernel.org>
phy: mscc: Add support for RGMII delay configurationAdd support for optional rx/tx-internal-delay-ps from devicetree.- When rx/tx-internal-delay-ps is/are specified, these take priority- When eit
phy: mscc: Add support for RGMII delay configurationAdd support for optional rx/tx-internal-delay-ps from devicetree.- When rx/tx-internal-delay-ps is/are specified, these take priority- When either is absent,1) use 2ns for respective settings if rgmii-id/rxid/txid is/are present2) use 0.2ns for respective settings if mode is rgmiiSigned-off-by: Harini Katakam <harini.katakam@amd.com>Signed-off-by: Jakub Kicinski <kuba@kernel.org>
phy: mscc: Use PHY_ID_MATCH_VENDOR to minimize PHY ID tableAll the PHY devices variants specified have the same mask andhence can be simplified to one vendor look up for 0x00070400.Any individual
phy: mscc: Use PHY_ID_MATCH_VENDOR to minimize PHY ID tableAll the PHY devices variants specified have the same mask andhence can be simplified to one vendor look up for 0x00070400.Any individual config can be identified by PHY_ID_MATCH_EXACTin the respective structure.Signed-off-by: Harini Katakam <harini.katakam@amd.com>Reviewed-by: Andrew Lunn <andrew@lunn.ch>Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net: phy: mscc: enable VSC8501/2 RGMII RX clockBy default the VSC8501 and VSC8502 RGMII/GMII/MII RX_CLK output isdisabled. To allow packet forwarding towards the MAC it needs to beenabled.For o
net: phy: mscc: enable VSC8501/2 RGMII RX clockBy default the VSC8501 and VSC8502 RGMII/GMII/MII RX_CLK output isdisabled. To allow packet forwarding towards the MAC it needs to beenabled.For other PHYs supported by this driver the clock output is enabledby default.Fixes: d3169863310d ("net: phy: mscc: add support for VSC8502")Signed-off-by: David Epping <david.epping@missinglinkelectronics.com>Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>Reviewed-by: Vladimir Oltean <olteanv@gmail.com>Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net: phy: mscc: remove unnecessary phydev lockingHolding the struct phy_device (phydev) lock is unnecessary whenaccessing phydev->interface in the PHY driver .config_init method,which is the only
net: phy: mscc: remove unnecessary phydev lockingHolding the struct phy_device (phydev) lock is unnecessary whenaccessing phydev->interface in the PHY driver .config_init method,which is the only place that vsc85xx_rgmii_set_skews() is called from.The phy_modify_paged() function implements required MDIO bus levellocking, which can not be achieved by a phydev lock.Signed-off-by: David Epping <david.epping@missinglinkelectronics.com>Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net: phy: mscc: add support for VSC8501The VSC8501 PHY can use the same driver implementation as the VSC8502.Adding the PHY ID and copying the handler functions of VSC8502 issufficient to operate
net: phy: mscc: add support for VSC8501The VSC8501 PHY can use the same driver implementation as the VSC8502.Adding the PHY ID and copying the handler functions of VSC8502 issufficient to operate it.Signed-off-by: David Epping <david.epping@missinglinkelectronics.com>Reviewed-by: Vladimir Oltean <olteanv@gmail.com>Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net: phy: mscc: add VSC8502 to MODULE_DEVICE_TABLEThe mscc driver implements support for VSC8502, so its ID should be inthe MODULE_DEVICE_TABLE for automatic loading.Signed-off-by: David Epping
net: phy: mscc: add VSC8502 to MODULE_DEVICE_TABLEThe mscc driver implements support for VSC8502, so its ID should be inthe MODULE_DEVICE_TABLE for automatic loading.Signed-off-by: David Epping <david.epping@missinglinkelectronics.com>Fixes: d3169863310d ("net: phy: mscc: add support for VSC8502")Reviewed-by: Vladimir Oltean <olteanv@gmail.com>Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net: phy: mscc: fix deadlock in phy_ethtool_{get,set}_wol()Since the blamed commit, phy_ethtool_get_wol() and phy_ethtool_set_wol()acquire phydev->lock, but the mscc phy driver implementations,vs
net: phy: mscc: fix deadlock in phy_ethtool_{get,set}_wol()Since the blamed commit, phy_ethtool_get_wol() and phy_ethtool_set_wol()acquire phydev->lock, but the mscc phy driver implementations,vsc85xx_wol_get() and vsc85xx_wol_set(), acquire the same lock as well,resulting in a deadlock.$ ip link set swp3 down============================================WARNING: possible recursive locking detectedmscc_felix 0000:00:00.5 swp3: Link is Down--------------------------------------------ip/375 is trying to acquire lock:ffff3d7e82e987a8 (&dev->lock){+.+.}-{4:4}, at: vsc85xx_wol_get+0x2c/0xf4but task is already holding lock:ffff3d7e82e987a8 (&dev->lock){+.+.}-{4:4}, at: phy_ethtool_get_wol+0x3c/0x6cother info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&dev->lock); lock(&dev->lock); *** DEADLOCK *** May be due to missing lock nesting notation2 locks held by ip/375: #0: ffffd43b2a955788 (rtnl_mutex){+.+.}-{4:4}, at: rtnetlink_rcv_msg+0x144/0x58c #1: ffff3d7e82e987a8 (&dev->lock){+.+.}-{4:4}, at: phy_ethtool_get_wol+0x3c/0x6cCall trace: __mutex_lock+0x98/0x454 mutex_lock_nested+0x2c/0x38 vsc85xx_wol_get+0x2c/0xf4 phy_ethtool_get_wol+0x50/0x6c phy_suspend+0x84/0xcc phy_state_machine+0x1b8/0x27c phy_stop+0x70/0x154 phylink_stop+0x34/0xc0 dsa_port_disable_rt+0x2c/0xa4 dsa_slave_close+0x38/0xec __dev_close_many+0xc8/0x16c __dev_change_flags+0xdc/0x218 dev_change_flags+0x24/0x6c do_setlink+0x234/0xea4 __rtnl_newlink+0x46c/0x878 rtnl_newlink+0x50/0x7c rtnetlink_rcv_msg+0x16c/0x58cRemoving the mutex_lock(&phydev->lock) calls from the driver restoresthe functionality.Fixes: 2f987d486610 ("net: phy: Add locks to ethtool functions")Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>Reviewed-by: Simon Horman <simon.horman@corigine.com>Reviewed-by: Andrew Lunn <andrew@lunn.ch>Link: https://lore.kernel.org/r/20230314153025.2372970-1-vladimir.oltean@nxp.comSigned-off-by: Jakub Kicinski <kuba@kernel.org>
net: phy: mscc: macsec: do not copy encryption keysFollowing 1b16b3fdf675 ("net: phy: mscc: macsec: clear encryption keys when freeing a flow"),go one step further and instead of calling memzero_e
net: phy: mscc: macsec: do not copy encryption keysFollowing 1b16b3fdf675 ("net: phy: mscc: macsec: clear encryption keys when freeing a flow"),go one step further and instead of calling memzero_explicit on the keywhen freeing a flow, simply not copy the key in the first place as it'sonly used when a new flow is set up.Signed-off-by: Antoine Tenart <atenart@kernel.org>Signed-off-by: David S. Miller <davem@davemloft.net>
net: phy: mscc: macsec: clear encryption keys when freeing a flowCommit aaab73f8fba4 ("macsec: clear encryption keys from the stack aftersetting up offload") made sure to clean encryption keys fro
net: phy: mscc: macsec: clear encryption keys when freeing a flowCommit aaab73f8fba4 ("macsec: clear encryption keys from the stack aftersetting up offload") made sure to clean encryption keys from the stackafter setting up offloading, but the MSCC PHY driver made a copy, keptit in the flow data and did not clear it when freeing a flow. Fix this.Fixes: 28c5107aa904 ("net: phy: mscc: macsec support")Signed-off-by: Antoine Tenart <atenart@kernel.org>Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net: phy: mscc: macsec: remove checks on the prepare phaseRemove checks on the prepare phase as it is now unused by the MACseccore implementation.Signed-off-by: Antoine Tenart <atenart@kernel.or
net: phy: mscc: macsec: remove checks on the prepare phaseRemove checks on the prepare phase as it is now unused by the MACseccore implementation.Signed-off-by: Antoine Tenart <atenart@kernel.org>Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1234