aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2019-06-09net: dsa: sja1105: Export the sja1105_inhibit_tx functionVladimir Oltean2-6/+10
This will be used to stop egress traffic in .phylink_mac_link_up. Signed-off-by: Vladimir Oltean <olteanv@gmail.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09net: dsa: sja1105: Update some comments about PHYLIBVladimir Oltean2-5/+3
Since the driver is now using PHYLINK exclusively, it makes sense to remove all references to it and replace them with PHYLINK. Signed-off-by: Vladimir Oltean <olteanv@gmail.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09net: dsa: sja1105: Use SPEED_{10, 100, 1000, UNKNOWN} macrosVladimir Oltean1-11/+11
This is a cosmetic patch that replaces the link speed numbers used in the driver with the corresponding ethtool macros. Signed-off-by: Vladimir Oltean <olteanv@gmail.com> Suggested-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09af_key: make use of BUG_ON macroHariprasad Kelam1-4/+2
fix below warnings reported by coccicheck net/key/af_key.c:932:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG. net/key/af_key.c:948:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG. Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09ipv6: tcp: fix potential NULL deref in tcp_v6_send_reset()Eric Dumazet1-1/+1
syzbot found a crash in tcp_v6_send_reset() caused by my latest change. Problem is that if an skb has been queued to socket prequeue, skb_dst(skb)->dev can not anymore point to the device. Fortunately in this case the socket pointer is not NULL. A similar issue has been fixed in commit 0f85feae6b71 ("tcp: fix more NULL deref after prequeue changes"), I should have known better. Fixes: 323a53c41292 ("ipv6: tcp: enable flowlabel reflection in some RST packets") Signed-off-by: Eric Dumazet <edumazet@google.com> Reported-by: syzbot <syzkaller@googlegroups.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09Merge branch 'Avoid-local_irq_save-and-use-napi_alloc_frag-where-possible'David S. Miller8-60/+50
Sebastian Andrzej says: ==================== Avoid local_irq_save() and use napi_alloc_frag() where possible The first two patches remove local_irq_save() around `netdev_alloc_cache' which does not work on -RT. Besides helping -RT it whould benefit the users of the function since they can avoid disabling interrupts and save a few cycles. The remaining patches are from a time when I tried to remove `netdev_alloc_cache' but then noticed that we still have non-NAPI drivers using netdev_alloc_skb() and I dropped that idea. Using napi_alloc_frag() over netdev_alloc_frag() would skip the not required local_bh_disable() around the allocation. v1…v2: - 1/7 + 2/7 use now "(in_irq() || irqs_disabled())" instead just "irqs_disabled()" to align with __dev_kfree_skb_any(). Pointed out by Eric Dumazet. - 6/7 has a typo less. Pointed out by Sergei Shtylyov. - 3/7 + 4/7 added acks from Ioana Radulescu. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09net: hwbm: Make the hwbm_pool lock a mutexSebastian Andrzej Siewior4-14/+13
Based on review, `lock' is only acquired in hwbm_pool_add() which is invoked via ->probe(), ->resume() and ->ndo_change_mtu(). Based on this the lock can become a mutex and there is no need to disable interrupts during the procedure. Now that the lock is a mutex, hwbm_pool_add() no longer invokes hwbm_pool_refill() in an atomic context so we can pass GFP_KERNEL to hwbm_pool_refill() and remove the `gfp' argument from hwbm_pool_add(). Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09tg3: Use napi_alloc_frag()Sebastian Andrzej Siewior1-1/+1
tg3_alloc_rx_data() uses netdev_alloc_frag() for skb allocation. All callers of tg3_alloc_rx_data() either hold tp->lock (which is held with BH disabled) or run in NAPI context. Use napi_alloc_frag() for skb allocations. Cc: Siva Reddy Kallam <siva.kallam@broadcom.com> Cc: Prashant Sreedharan <prashant@broadcom.com> Cc: Michael Chan <mchan@broadcom.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09bnx2x: Use napi_alloc_frag()Sebastian Andrzej Siewior1-1/+1
SKB allocation via bnx2x_frag_alloc() is always performed in NAPI context. Preemptible context passes GFP_KERNEL and bnx2x_frag_alloc() uses then __get_free_page() for the allocation. Use napi_alloc_frag() for memory allocation. Cc: Ariel Elior <aelior@marvell.com> Cc: Sudarsana Kalluru <skalluru@marvell.com> Cc: GR-everest-linux-l2@marvell.com Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09dpaa2-eth: Use napi_alloc_frag()Sebastian Andrzej Siewior1-1/+1
The driver is using netdev_alloc_frag() for allocation in the ->ndo_start_xmit() path. That one is always invoked in a BH disabled region so we could also use napi_alloc_frag(). Use napi_alloc_frag() for skb allocation. Cc: Ioana Radulescu <ruxandra.radulescu@nxp.com> Acked-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09dpaa2-eth: Remove preempt_disable() from seed_pool()Sebastian Andrzej Siewior1-9/+0
According to the comment, the preempt_disable() statement is required due to synchronisation in napi_alloc_frag(). The awful truth is that local_bh_disable() is required because otherwise the NAPI poll callback can be invoked while the open function setup buffers. This isn't unlikely since the dpaa2 provides multiple devices. The usage of napi_alloc_frag() has been removed in commit 27c874867c4e9 ("dpaa2-eth: Use a single page per Rx buffer") which means that the comment is not accurate and the preempt_disable() statement is not required. Remove the outdated comment and the no longer required preempt_disable(). Cc: Ioana Radulescu <ruxandra.radulescu@nxp.com> Acked-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09net: Don't disable interrupts in __netdev_alloc_skb()Sebastian Andrzej Siewior1-8/+11
__netdev_alloc_skb() can be used from any context and is used by NAPI and non-NAPI drivers. Non-NAPI drivers use it in interrupt context and NAPI drivers use it during initial allocation (->ndo_open() or ->ndo_change_mtu()). Some NAPI drivers share the same function for the initial allocation and the allocation in their NAPI callback. The interrupts are disabled in order to ensure locked access from every context to `netdev_alloc_cache'. Let __netdev_alloc_skb() check if interrupts are disabled. If they are, use `netdev_alloc_cache'. Otherwise disable BH and use `napi_alloc_cache.page'. The IRQ check is cheaper compared to disabling & enabling interrupts and memory allocation with disabled interrupts does not work on -RT. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09net: Don't disable interrupts in napi_alloc_frag()Sebastian Andrzej Siewior1-26/+23
netdev_alloc_frag() can be used from any context and is used by NAPI and non-NAPI drivers. Non-NAPI drivers use it in interrupt context and NAPI drivers use it during initial allocation (->ndo_open() or ->ndo_change_mtu()). Some NAPI drivers share the same function for the initial allocation and the allocation in their NAPI callback. The interrupts are disabled in order to ensure locked access from every context to `netdev_alloc_cache'. Let netdev_alloc_frag() check if interrupts are disabled. If they are, use `netdev_alloc_cache' otherwise disable BH and invoke __napi_alloc_frag() for the allocation. The IRQ check is cheaper compared to disabling & enabling interrupts and memory allocation with disabled interrupts does not work on -RT. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09Merge branch 'SFP-polling-fixes'David S. Miller1-6/+31
Robert Hancock says: ==================== SFP polling fixes This has an updated version of an earlier patch to ensure that SFP operations are stopped during shutdown, and another patch suggested by Russell King to address a potential concurrency issue with SFP state checks. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09net: sfp: add mutex to prevent concurrent state checksRobert Hancock1-1/+5
sfp_check_state can potentially be called by both a threaded IRQ handler and delayed work. If it is concurrently called, it could result in incorrect state management. Add a st_mutex to protect the state - this lock gets taken outside of code that checks and handle state changes, and the existing sm_mutex nests inside of it. Suggested-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Robert Hancock <hancock@sedsystems.ca> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09net: sfp: Stop SFP polling and interrupt handling during shutdownRobert Hancock1-5/+26
SFP device polling can cause problems during the shutdown process if the parent devices of the network controller have been shut down already. This problem was seen on the iMX6 platform with PCIe devices, where accessing the device after the bus is shut down causes a hang. Free any acquired GPIO interrupts and stop all delayed work in the SFP driver during the shutdown process, so that we ensure that no pending operations are still occurring after the SFP shutdown completes. Signed-off-by: Robert Hancock <hancock@sedsystems.ca> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09nexthop: off by one in nexthop_mpath_select()Dan Carpenter1-1/+1
The nhg->nh_entries[] array is allocated in nexthop_grp_alloc() and it has nhg->num_nh elements so this check should be >= instead of >. Fixes: 430a049190de ("nexthop: Add support for nexthop groups") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09Merge branch 'bonding-clean-up-and-standarize-logging-printks'David S. Miller5-307/+293
Jarod Wilson says: ==================== bonding: clean up and standarize logging printks This set improves a few somewhat terse bonding debug messages, fixes some errors in others, and then standarizes the majority of them, using new slave_* printk macros that wrap around netdev_* to ensure both master and slave information is provided consistently, where relevant. This set proves very useful in debugging issues on hosts with multiple bonds. I've run an array of LNST tests over this set, creating and destroying quite a few different bonds of the course of testing, fixed the little gotchas here and there, and everything looks stable and reasonable to me, but I can't guarantee I've tested every possible message and scenario to catch every possible "slave could be NULL" case. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09bonding/options: convert to using slave printk macrosJarod Wilson1-18/+12
All of these printk instances benefit from having both master and slave device information included, so convert to using a standardized macro format and remove redundant information. Suggested-by: Joe Perches <joe@perches.com> CC: Jay Vosburgh <j.vosburgh@gmail.com> CC: Veaceslav Falico <vfalico@gmail.com> CC: Andy Gospodarek <andy@greyhouse.net> CC: netdev@vger.kernel.org Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09bonding/alb: convert to using slave printk macrosJarod Wilson1-15/+15
All of these printk instances benefit from having both master and slave device information included, so convert to using a standardized macro format and remove redundant information. Suggested-by: Joe Perches <joe@perches.com> CC: Jay Vosburgh <j.vosburgh@gmail.com> CC: Veaceslav Falico <vfalico@gmail.com> CC: Andy Gospodarek <andy@greyhouse.net> CC: netdev@vger.kernel.org Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09bonding/802.3ad: convert to using slave printk macrosJarod Wilson1-106/+116
All of these printk instances benefit from having both master and slave device information included, so convert to using a standardized macro format and remove redundant information. Suggested-by: Joe Perches <joe@perches.com> CC: Jay Vosburgh <j.vosburgh@gmail.com> CC: Veaceslav Falico <vfalico@gmail.com> CC: Andy Gospodarek <andy@greyhouse.net> CC: netdev@vger.kernel.org Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09bonding/main: convert to using slave printk macrosJarod Wilson1-167/+139
All of these printk instances benefit from having both master and slave device information included, so convert to using a standardized macro format and remove redundant information. Suggested-by: Joe Perches <joe@perches.com> CC: Jay Vosburgh <j.vosburgh@gmail.com> CC: Veaceslav Falico <vfalico@gmail.com> CC: Andy Gospodarek <andy@greyhouse.net> CC: netdev@vger.kernel.org Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09bonding: add slave_foo printk macrosJarod Wilson1-0/+9
Where possible, we generally want both the bond master and the relevant slave information in message output. Standardize the format using new slave_* printk macros. Suggested-by: Joe Perches <joe@perches.com> CC: Jay Vosburgh <j.vosburgh@gmail.com> CC: Veaceslav Falico <vfalico@gmail.com> CC: Andy Gospodarek <andy@greyhouse.net> CC: netdev@vger.kernel.org Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09bonding: fix error messages in bond_do_fail_over_macJarod Wilson1-5/+5
Passing the bond name again to debug output when referencing slave is wrong. We're trying to set the bond's MAC to that of the new_active slave, so adjust the error message slightly and pass in the slave's name, not the bond's. Then we're trying to set the MAC on the old active slave, but putting the new active slave's name in the output. While we're at it, clarify the error messages so you know which one actually triggered. CC: Jay Vosburgh <j.vosburgh@gmail.com> CC: Veaceslav Falico <vfalico@gmail.com> CC: Andy Gospodarek <andy@greyhouse.net> CC: netdev@vger.kernel.org Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09bonding: improve event debug usabilityJarod Wilson1-1/+2
Seeing bonding debug log data along the lines of "event: 5" is a bit spartan, and often requires a lookup table if you don't remember what every event is. Make use of netdev_cmd_to_name for an improved debugging experience, so for the prior example, you'll see: "bond_netdev_event received NETDEV_REGISTER" instead (both are prefixed with the device for which the event pertains). CC: Jay Vosburgh <j.vosburgh@gmail.com> CC: Veaceslav Falico <vfalico@gmail.com> CC: Andy Gospodarek <andy@greyhouse.net> CC: netdev@vger.kernel.org Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09net: fec_main: Use dev_err() instead of pr_err()Fabio Estevam1-4/+5
dev_err() is more appropriate for printing error messages inside drivers, so switch to dev_err(). Signed-off-by: Fabio Estevam <festevam@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09cxgb4: Set initial IRQ affinity hintsNirranjan Kirubaharan3-15/+69
Spread initial IRQ affinity hints across the device node CPUs, for nic queue and uld queue IRQs, to load balance and avoid all interrupts on CPU0. Signed-off-by: Nirranjan Kirubaharan <nirranjan@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09Merge branch 'hns3-next'David S. Miller16-480/+658
Huazhong Tan says: ==================== net: hns3: some code optimizations & cleanups & bugfixes This patch-set includes code optimizations, cleanups and bugfixes for the HNS3 ethernet controller driver. [patch 1/12] logs more detail error info for ROCE RAS errors. [patch 2/12] fixes a wrong size issue for mailbox responding. [patch 3/12] makes HW GRO handing compliant with SW one. [patch 4/12] refactors hns3_get_new_int_gl. [patch 5/12] adds handling for VF's over_8bd_nfe_err. [patch 6/12 - 12/12] adds some code optimizations and cleanups, to make the code more readable and compliant with some static code analysis tools, these modifications do not change the logic of the code. Change log: V1->V2: fixes comment from David Miller. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09net: hns3: fix some coding style issuesWeihang Li8-130/+96
This patch fixes some coding style issues reported by some static code analysis tools and code review, such as modify some comments, rename some variables, log some errors in detail, and fixes some alignment errors. BTW, these cleanups do not change the logic of code. Signed-off-by: Weihang Li <liweihang@hisilicon.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Yonglong Liu <liuyonglong@huawei.com> Signed-off-by: HuiSong Li <lihuisong@huawei.com> Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09net: hns3: some modifications to simplify and optimize codeYufeng Mo5-110/+130
This patch deletes some redundant code and refactors some bloated functions. Signed-off-by: Yufeng Mo <moyufeng@huawei.com> Signed-off-by: Weihang Li <liweihang@hisilicon.com> Signed-off-by: Yonglong Liu <liuyonglong@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09net: hns3: refactor PF/VF RSS hash key configurationYufeng Mo2-16/+14
In order to make it more readable, this patch modifies PF/VF's RSS hash key configuring function. Signed-off-by: Yufeng Mo <moyufeng@huawei.com> Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Weihang Li <liweihang@hisilicon.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09net: hns3: use macros instead of magic numbersYufeng Mo8-34/+75
This patch adds some macros instead of magic numbers in serval places Signed-off-by: Yufeng Mo <moyufeng@huawei.com> Signed-off-by: Weihang Li <liweihang@hisilicon.com> Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09net: hns3: small changes for magic numbersJian Shen2-63/+79
In order to improve readability, this patch uses macros to replace some magic numbers, and adds some comments for some others. Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09net: hns3: delete the redundant user NIC codesYonglong Liu5-69/+10
Since HNAE3_CLIENT_UNIC and HNAE3_DEV_UNIC is not used any more, this patch removes the redundant codes. Signed-off-by: Yonglong Liu <liuyonglong@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09net: hns3: trigger VF reset if a VF has an over_8bd_nfe_errWeihang Li4-2/+99
We trigger PF reset when a RAS error of NIC named over_8bd_nfe_err occurred before. But it is possible that a VF causes that error, it's reasonable to trigger VF reset instead of PF reset in this case. This patch add detection of vf_id if a over_8bd_nfe_err occurs, if vf_id is 0, we trigger PF reset. Otherwise, we will trigger VF reset on the VF with error. Signed-off-by: Weihang Li <liweihang@hisilicon.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09net: hns3: refactor hns3_get_new_int_gl functionYunsheng Lin1-32/+45
This patch adds a new hns3_get_new_flow_lvl function to calculate the packet flow level, which is used to decide the interrupt coalescence parameter, in order to make the flow level calculation code more readable and make the future calculation ajdustment easier. Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09net: hns3: replace numa_node_id with numa_mem_id for buffer reusingYunsheng Lin1-2/+2
This patch replaces numa_node_id with numa_mem_id when doing buffer reusing checking, because the buffer still can be reused when the buffer is from the nearest node and the local node has no memory attached. Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09net: hns3: make HW GRO handling compliant with SW GROYunsheng Lin1-14/+30
Currently when a GRO packet is assembled by HW, the checksum is modified to reflect the entire packet by HW and skb->ip_summed is set to CHECKSUM_UNNECESSARY, which is not compliant with SW GRO. This patch sets up skb's network and transport header, sets the GRO packet's checksum according to pseudo header and set the skb->ip_summed to CHECKSUM_PARTIAL. This patch also use gso_size to distinguish GRO packet from normal packet, use eth_type_vlan to check the VLAN type and set the SKB_GSO_TCP_FIXEDID according to BD info during HW GRO info processing. Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09net: hns3: fix wrong size of mailbox responding dataZhongzhu Liu1-1/+1
According to user manual, the maximum size of mailbox responding data is 8 bytes, the macro HCLGE_MBX_MAX_RESP_DATA_SIZE should be defined as 8 instead of 16. Fixes: 9194d18b0577 ("net: hns3: fix the problem that the supported port is empty") Signed-off-by: Zhongzhu Liu <liuzhongzhu@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09net: hns3: log detail error info of ROCEE ECC and AXI errorsXiaofei Tan3-7/+77
This patch logs detail error info of ROCEE ECC and AXI errors for debug purpose, and remove unnecessary reset for ROCEE overflow errors. Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09Merge branch 'net-ethernet-ti-netcp-update-and-enable-cpts-support'David S. Miller4-6/+137
Grygorii Strashko says: ==================== net: ethernet: ti: netcp: update and enable cpts support The Keystone 2 66AK2HK/E/L 1G Ethernet Switch Subsystems contains The Common Platform Time Sync (CPTS) module which is in general compatible with CPTS module found on TI AM3/4/5 SoCs. So, the basic support for Keystone 2 CPTS is available by default, but not documented and has never been enabled inconfig files. The Keystone 2 CPTS module supports also some additional features like time sync reference (RFTCLK) clock selection through CPTS_RFTCLK_SEL register (offset: x08) in CPTS module, which can modelled as multiplexer clock (this was discussed some time ago [1]). This series adds missed binding documentation for Keystone 2 66AK2HK/E/L CPTS module and enables CPTS for TI Keystone 2 66AK2HK/E/L SoCs with possiblity to select CPTS reference clock. Patch 1: adds the CPTS binding documentation. CPTS bindings are defined in the way that allows CPTS properties to be grouped under "cpts" sub-node. It also defines "cpts-refclk-mux" clock for CPTS RFTCLK selection. Patches 2-3: implement CPTS properties grouping under "cpts" sub-node with backward compatibility support. Patch 4: adds support for time sync reference (RFTCLK) clock selection from DT by adding support for "cpts-refclk-mux" multiplexer clock. Patches 5-9: DT CPTS nodes update for TI Keystone 2 66AK2HK/E/L SoCs. Patch 10: enables CPTS for TI Keystone 2 66AK2HK/E/L SoCs. I grouped all patches in one series for better illustration of the changes, but in general Pateches 1-4 are netdev matarieal (first) and other patches are platform specific. Series can be found at: git@git.ti.com:~gragst/ti-linux-kernel/gragsts-ti-linux-kernel.git branch: net-next-k2e-cpts-refclk Changes in v2: - do reverse christmas tree in cpts_of_mux_clk_setup() - add ack from Richard Cochran v1: https://lkml.org/lkml/2019/6/1/77 [1] https://www.spinics.net/lists/netdev/msg408931.html ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09net: ethernet: ti: cpts: add support for ext rftclk selectionGrygorii Strashko2-2/+79
Some CPTS instances, which can be found on KeyStone 2 1G Ethernet Switch Subsystems, can control an external multiplexer that selects one of up to 32 clocks as time sync reference (RFTCLK) clock. This feature can be configured through CPTS_RFTCLK_SEL register (offset: x08) in CPTS module and can be represented as multiplexer clock. Hence, introduce support for optional cpts-refclk-mux clock, which, once defined will allow to select required CPTS RFTCLK by using assigned-clock-parents DT property in board files. Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Acked-by: Richard Cochran <richardcochran@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09net: ethernet: ti: netcp_ethss: add support for child cpts nodeGrygorii Strashko1-2/+7
Allow to place CPTS properties in the child "cpts" DT node. For backward compatibility - roll-back and read CPTS DT properties from parent node if "cpts" node is not present. Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Acked-by: Richard Cochran <richardcochran@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09net: ethernet: ti: cpts: use devm_get_clk_from_childGrygorii Strashko1-2/+7
Use devm_get_clk_from_child() instead of devm_clk_get() and this way allow to group CPTS DT properties in sub-node for better code readability and maintenance. Roll-back to devm_clk_get() if devm_get_clk_from_child() fails for backward compatibility. Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Acked-by: Richard Cochran <richardcochran@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-09dt-bindings: doc: net: keystone-netcp: document cptsGrygorii Strashko1-0/+44
The Keystone 2 66AK2HK/E/L 1G Ethernet Switch Subsystems contains The Common Platform Time Sync (CPTS) module which is in general compatible with CPTS module found on "legacy" TI AM3/4/5 SoCs. So, the basic support for Keystone 2 CPTS is available by default, but not documented. The Keystone 2 CPTS module supports also some additional features like time sync reference (RFTCLK) clock selection through CPTS_RFTCLK_SEL register (offset: x08) in CPTS module, which is modelled as multiplexer clock. This patch adds missed binding documentation for Keystone 2 66AK2HK/E/L CPTS module. Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Acked-by: Richard Cochran <richardcochran@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-08Merge branch 'PTP-support-for-the-SJA1105-DSA-driver'David S. Miller17-73/+1184
Vladimir Oltean says: ==================== PTP support for the SJA1105 DSA driver This patchset adds the following: - A timecounter/cyclecounter based PHC for the free-running timestamping clock of this switch. - A state machine implemented in the DSA tagger for SJA1105, which keeps track of metadata follow-up Ethernet frames (the switch's way of transmitting RX timestamps). Clock manipulations on the actual hardware PTP clock will have to be implemented anyway, for the TTEthernet block and the time-based ingress policer. v3 patchset can be found at: https://lkml.org/lkml/2019/6/4/954 Changes from v3: - Made it compile with the SJA1105 DSA driver and PTP driver as modules. - Reworked/simplified/fixed some issues in 03/17 (dsa_8021q_remove_header) and added an ASCII image that illustrates the transformation that is taking place. - Removed a useless check for sja1105_is_link_local from 16/17 (RX timestamping) which also made previous 08/17 patch ("Move sja1105_is_link_local to include/linux") useless and therefore dropped. v2 patchset can be found at: https://lkml.org/lkml/2019/6/2/146 Changes from v2: - Broke previous 09/10 patch (timestamping) into multiple smaller patches. - Every patch in the series compiles. v1 patchset can be found at: https://lkml.org/lkml/2019/5/28/1093 Changes from v1: - Removed the addition of the DSA .can_timestamp callback. - Waiting for meta frames is done completely inside the tagger, and all frames emitted on RX are already partially timestamped. - Added a global data structure for the tagger common to all ports. - Made PTP work with ports in standalone mode, by limiting use of the DMAC-mangling "incl_srcpt" mode only when ports are bridged, aka when the DSA master is already promiscuous and can receive anything. Also changed meta frames to be sent at the 01-80-C2-00-00-0E DMAC. - Made some progress w.r.t. observed negative path delay. Apparently it only appears when the delay mechanism is the delay request-response (end-to-end) one. If peer delay is used (-P), the path delay is positive and appears reasonable for an 1000Base-T link (485 ns in steady state). SJA1105 as PTP slave (OC) with E2E path delay: ptp4l[55.600]: master offset 8 s2 freq +83677 path delay -2390 ptp4l[56.600]: master offset 17 s2 freq +83688 path delay -2391 ptp4l[57.601]: master offset 6 s2 freq +83682 path delay -2391 ptp4l[58.601]: master offset -1 s2 freq +83677 path delay -2391 SJA1105 as PTP slave (OC) with P2P path delay: ptp4l[48.343]: master offset 5 s2 freq +83715 path delay 484 ptp4l[48.468]: master offset -3 s2 freq +83705 path delay 485 ptp4l[48.593]: master offset 0 s2 freq +83708 path delay 485 ptp4l[48.718]: master offset 1 s2 freq +83710 path delay 485 ptp4l[48.844]: master offset 1 s2 freq +83710 path delay 485 ptp4l[48.969]: master offset -5 s2 freq +83702 path delay 485 ptp4l[49.094]: master offset 3 s2 freq +83712 path delay 485 ptp4l[49.219]: master offset 4 s2 freq +83714 path delay 485 ptp4l[49.344]: master offset -5 s2 freq +83702 path delay 485 ptp4l[49.469]: master offset 3 s2 freq +83713 path delay 487 ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-08net: dsa: sja1105: Expose PTP timestamping ioctls to userspaceVladimir Oltean2-2/+100
This enables the PTP support towards userspace applications such as linuxptp. The switches can timestamp only trapped multicast MAC frames, and therefore only the profiles of 1588 over L2 are supported. TX timestamping can be enabled per port, but RX timestamping is enabled globally. As long as RX timestamping is enabled, the switch will emit metadata follow-up frames that will be processed by the tagger. It may be a problem that linuxptp does not restore the RX timestamping settings when exiting. Signed-off-by: Vladimir Oltean <olteanv@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-08net: dsa: sja1105: Add a state machine for RX timestampingVladimir Oltean3-1/+189
Meta frame reception relies on the hardware keeping its promise that it will send no other traffic towards the CPU port between a link-local frame and a meta frame. Otherwise there is no other way to associate the meta frame with the link-local frame it's holding a timestamp of. The receive function is made stateful, and buffers a timestampable frame until its meta frame arrives, then merges the two, drops the meta and releases the link-local frame up the stack. Signed-off-by: Vladimir Oltean <olteanv@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-08net: dsa: sja1105: Increase priority of CPU-trapped framesVladimir Oltean1-1/+1
Without noticing any particular issue, this patch ensures that management traffic is treated with the maximum priority on RX by the switch. This is generally desirable, as the driver keeps a state machine that waits for metadata follow-up frames as soon as a management frame is received. Increasing the priority helps expedite the reception (and further reconstruction) of the RX timestamp to the driver after the MAC has generated it. Signed-off-by: Vladimir Oltean <olteanv@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-08net: dsa: sja1105: Add a global sja1105_tagger_data structureVladimir Oltean3-0/+21
This will be used to keep state for RX timestamping. It is global because the switch serializes timestampable and meta frames when trapping them towards the CPU port (lower port indices have higher priority) and therefore having one state machine per port would create unnecessary complications. Signed-off-by: Vladimir Oltean <olteanv@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>