aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/files/drivers/net/phy/swconfig.c
Commit message (Collapse)AuthorAgeFilesLines
* target: remove obsolete kernel version switches for 4.19Adrian Schmutzler2020-10-301-61/+0
| | | | | | | This removes unneeded kernel version switches from the targets after kernel 4.19 has been dropped. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* generic: drop outdated kernel version switches in local driversAdrian Schmutzler2020-05-171-14/+2
| | | | | | | This drops the obsolete version switches for non-supported kernels from local drivers in generic target. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* kernel: swconfig: make compatible with kernel 5.2Mathias Kresin2020-02-121-6/+41
| | | | | | | | | | | | | | | | | | | | | Since kernel 5.2 within netlink messages the NLA_F_NESTED nested flag is validated. But swconfig/swlib doesn't set the flag for SWITCH_ATTR_OP_VALUE_PORTS related netlink messages and assigning ports to vlans via swconfig dev switch0 vlan 1 set ports '0 1 2 3 4 6t' Errors put with "Failed to set attribute: Invalid input data or parameter". Relax the validation rules and use the deprecated functions, to use the same level of validation as it was till kernel 5.1. Depending on who has swconfig related netlink messages implemented, there might be more broken tools out there and we should keep backward compatibility if possible. Signed-off-by: Mathias Kresin <dev@kresin.me> Tested-by: Rafał Miłecki <rafal@milecki.pl>
* swconfig: fix Broadcom b53 supportTobias Schramm2020-01-121-0/+1
| | | | | | | | | This commit fixes a bug in the main swconfig patch where a function needed by the b53 driver is not exported. Additionally it adds OF support to the b53_mdio driver for devicetree- based probing Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
* kernel: fix swconfig compilation with kernels 5.2+Rafał Miłecki2019-10-281-0/+23
| | | | | | | This is related to the upstream kernel change 3b0f31f2b8c9 ("genetlink: make policy common to family"). Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* swconfig: convert swdevs_lock from spinlock to mutexFelix Fietkau2018-03-121-3/+3
| | | | | | Should fix some sleep-while-atomic issues Signed-off-by: Felix Fietkau <nbd@nbd.name>
* kernel: generic: Add kernel 4.14 supportHauke Mehrtens2017-12-161-8/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds initial support for kernel 4.14 based on the patches for kernel 4.9. In the configuration I deactivated some of the new possible security features like: CONFIG_REFCOUNT_FULL CONFIG_SLAB_FREELIST_HARDENED CONFIG_SOFTLOCKUP_DETECTOR CONFIG_WARN_ALL_UNSEEDED_RANDOM And these overlay FS options are also deactivated: CONFIG_OVERLAY_FS_INDEX CONFIG_OVERLAY_FS_REDIRECT_DIR I activated this: CONFIG_FORTIFY_SOURCE CONFIG_POSIX_TIMERS CONFIG_SLAB_MERGE_DEFAULT CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED I am not sure if I did the porting correct for the following patches: target/linux/generic/backport-4.14/020-backport_netfilter_rtcache.patch target/linux/generic/hack-4.14/220-gc_sections.patch target/linux/generic/hack-4.14/321-powerpc_crtsavres_prereq.patch target/linux/generic/pending-4.14/305-mips_module_reloc.patch target/linux/generic/pending-4.14/611-netfilter_match_bypass_default_table.patch target/linux/generic/pending-4.14/680-NET-skip-GRO-for-foreign-MAC-addresses.patch Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* linux/swconfig_get_attr: fix leak of msg in case of errorAlexander Couzens2017-06-111-1/+1
| | | | | Found-by: Coverity Scan #1330102 Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
* net: ar8216: address security vulnerabilities in swconfig & ar8216Pavel Kubelun2016-12-011-3/+9
| | | | | | | | | | | | | | | | | | | | | | | Imported from https://chromium.googlesource.com/chromiumos/third_party/kernel/+/e1aaf7ec008a97311867f0a7d0418e4693fecfd4%5E%21/#F0 Signed-off-by: Pavel Kubelun <be.dissent@gmail.com> CHROMIUM: net: ar8216: address security vulnerabilities in swconfig & ar8216 This patch does the following changes: *address the security vulnerabilities in both swconfig framework and in ar8216 driver (many bound check additions, and turned swconfig structure signed element into unsigned when applicable) *address a couple of whitespaces and indendation issues BUG=chrome-os-partner:33096 TEST=none Change-Id: I94ea78fcce8c1932cc584d1508c6e3b5dfb93ce9 Signed-off-by: Mathieu Olivari <mathieu@codeaurora.org> Reviewed-on: https://chromium-review.googlesource.com/236490 Reviewed-by: Toshi Kikuchi <toshik@chromium.org> Commit-Queue: Toshi Kikuchi <toshik@chromium.org> Tested-by: Toshi Kikuchi <toshik@chromium.org>
* swconfig: revert the portmapping patches, they seem to cause a segfaultJohn Crispin2016-08-161-0/+76
| | | | | | | | | | | | Revert "kernel/swconfig: remove obsolete portmapping feature from swconfig" This reverts commit 675407baa44a8700de20b6b2857009a552a807ba. Revert "swconfig: remove obsolete portmapping feature" This reverts commit fca1eb349ef31b133a62880cbd562d6bf17500aa. Signed-off-by: John Crispin <john@phrozen.org>
* kernel/swconfig: remove obsolete portmapping feature from swconfigJohn Crispin2016-08-151-76/+0
| | | | Signed-off-by: John Crispin <john@phrozen.org>
* kernel: require admin permissions for swconfig set operationsFelix Fietkau2016-06-121-0/+3
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* kernel: deny swconfig set requests for unprivileged usersJo-Philipp Wich2016-06-111-0/+3
| | | | | | | | | | | | | | | | | The swconfig kernel infrastructure fails to do any permissions checks when changing settings. As such an ordinary user account on a device with a switch can change switch settings without any special permissions. Routers generally have few non-admin users so this isn't a big hole, but it is a security hole. Likely the greatest danger is for multifunction devices which have a lot of extra daemons, compromising a low-security daemon would allow one to modify switch settings and cause the router/switch to appear to lock-up (or cause other sorts of troublesome nyetwork behavior). Implement a check for CAP_NET_ADMIN in swconfig_set_attr() and deny any requests originating from user contexts lacking this capability. Reported-by: Elliott Mitchell <ehem+openwrt@m5p.com> Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* treewide: replace nbd@openwrt.org with nbd@nbd.nameFelix Fietkau2016-06-071-2/+2
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* swconfig: add (PHY) generic helper setting port linkRafał Miłecki2016-02-031-0/+36
| | | | | | | | | | It's quite common for switches to have PHY per port so adding a generic helper setting link state will help many drivers. It just needs an API to access PHYs which this patch also adds. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 48621
* swconfig: simplify init codeJonas Gorski2016-01-241-6/+1
| | | | | | | | | Directly return the return value of genl_register_family_with_ops() instead of storing it in a temporary variable, then returning it. Signed-off-by: Jonas Gorski <jogo@openwrt.org> SVN-Revision: 48472
* swconfig: drop linux < 3.13 code pathsJonas Gorski2016-01-241-20/+0
| | | | | | | | | The oldest kernel we support is 3.18, no need to keep code paths for older kernels. Signed-off-by: Jonas Gorski <jogo@openwrt.org> SVN-Revision: 48471
* swconfig: add API for setting port link speedRafał Miłecki2016-01-061-1/+48
| | | | | | | | | Some switches can force link speed for a port. Let's add API that will allow drivers to export this feature. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 48142
* swconfig: switch kernel PORT_LINK support to SWITCH_TYPE_LINKJohn Crispin2015-12-231-47/+4
| | | | | | | | | As explained earlier, using SWITCH_TYPE_LINK gives more flexibility, it doesn't require e.g. string parsing to read some data. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 47999
* swconfig: add SWITCH_TYPE_LINK and support sending link info to user spaceJohn Crispin2015-12-231-0/+56
| | | | | | | | | | | | | So far we were sending link data as a string. It got some drawbacks: 1) Didn't allow writing clean user space apps reading link state. It was needed to do some screen scraping. 2) Forced whole PORT_LINK communication to be string based. Adding support for *setting* port link required passing string and parting it in the kernel space. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 47997
* swconfig: fix build with linux 4.0John Crispin2015-03-061-3/+6
| | | | | | Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> SVN-Revision: 44617
* ar8216: add 802.3az EEE info to swconfig get_link attributeFelix Fietkau2015-01-181-1/+3
| | | | | | | | | | | | | AR8327/AR8337 allow to read the result of EEE autonegotiation. If EEE is autonegotiated between the link partners, display this as part of the swconfig get_link attribute. eee100: 100MBit EEE supported by both link partners eee1000: 1GBit EEE supported by both link partners Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> SVN-Revision: 44022
* swconfig: last vs tailJohn Crispin2014-10-291-1/+1
| | | | | | | | sorry ..... Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 43107
* swconfig: "swconfig list" shows devices in reverse orderJohn Crispin2014-10-291-1/+1
| | | | | | | | | Boards that have more than one swconfig enabled switch will show the devices in reverse order when call swconfig list. Fix this by using list_add_tail(). Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 43106
* kernel: fix warning in swconfig.c with kernel 3.14Hauke Mehrtens2014-05-081-6/+10
| | | | | | Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> SVN-Revision: 40733
* modules: swconfig.c: update the error path on 3.13, and behave nicely with ↵Zoltan Herpai2014-01-211-3/+2
| | | | | | | | return Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu> SVN-Revision: 39360
* modules: update swconfig.c to compile on 3.13 (compile-tested)Zoltan Herpai2014-01-211-0/+8
| | | | | | Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu> SVN-Revision: 39359
* kernel: make swconfig checkpath compliantFlorian Fainelli2013-10-241-35/+40
| | | | | | | | Fix the warnings and errors reported by checkpatch on swconfig.c Signed-off-by: Florian Fainelli <florian@openwrt.org> SVN-Revision: 38523
* unbreak portmapping - typo fixJohn Crispin2013-04-091-1/+1
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 36293
* allow loading port maps from OFJohn Crispin2013-04-091-0/+73
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 36283
* swconfig: make it compatible with 3.7Gabor Juhos2012-11-211-3/+3
| | | | | | | | | | | | | | | | | | | swconfig does not compile with 3.7 because struct netlink_notify->pid has been renamed to struct netlink_notify->portid and struct genl_info->snd_pid has been renamed to struct genl_info->snd_portid Use the new names and add compatibility patches to 3.3 and 3.6. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 34288
* swconfig: get rid of the NLA_PUT_* macrosFlorian Fainelli2012-10-241-17/+33
| | | | | | | Upstream kernel 3.6 has removed this usage, use the plain functions directly as intended. SVN-Revision: 33906
* swconfig: use a mutex instead of a spinlock, many swconfig calls sleepFelix Fietkau2012-03-151-5/+5
| | | | SVN-Revision: 30952
* generic: swconfig: add a generic get_port_link implementationGabor Juhos2012-03-071-0/+79
| | | | SVN-Revision: 30839
* kernel: swconfig: introduce a generic switch LED triggerGabor Juhos2011-12-311-0/+8
| | | | SVN-Revision: 29627
* kernel: swconfig: add a missing unlock in error pathGabor Juhos2011-11-041-1/+3
| | | | SVN-Revision: 28753
* swconfig: Add generic switch identifiersJonas Gorski2011-07-271-5/+30
| | | | | | | | Also make switches available under a generic name "switch<num>" for device name agnostic access. The old device name is used as an alias for backward compatibility. SVN-Revision: 27800
* swconfig: Replace SPIN_LOCK_UNLOCKED with DEFINE_SPINLOCKFelix Fietkau2011-04-261-1/+1
| | | | | | | | | SPIN_LOCK_UNLOCKED has been deprecated since 2.6.19 and will get removed in 2.6.39, so replace it with DEFINE_SPINLOCK(). Signed-off-by: Jonas Gorski <jonas.gorski+openwrt@gmail.com> SVN-Revision: 26770
* swconfig: cleanup of kernel drivers and interface - add some comments to a ↵Felix Fietkau2010-08-041-25/+29
| | | | | | few data structures - add a switch_dev_ops data structure for attributes and callback to replace the stupid template memcpy - get rid of the switch_dev.priv pointer - using container_of() is better SVN-Revision: 22476
* rename target/linux/generic-2.6 to genericFelix Fietkau2010-06-261-0/+925
SVN-Revision: 21952