aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/dsa.h
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2018-05-11 12:03:06 -0400
committerDavid S. Miller <davem@davemloft.net>2018-05-11 12:03:06 -0400
commit4cbd7a7d3c0fb1373bf981c5498b51c050668acc (patch)
tree83d6a6dbfffe50ab2e7c4c1d073a461b5ca1da5e /include/net/dsa.h
parentec9efb523cb8daf7b9d2e5c9cb80b255b716a777 (diff)
parent58d56fcc3964f9be0a9ca42fd126bcd9dc7afc90 (diff)
Merge branch 'dsa-Plug-in-PHYLINK-support'
Florian Fainelli says: ==================== net: dsa: Plug in PHYLINK support This patch series adds PHYLINK support to DSA which is necessary to support more complex PHY and pluggable modules setups. Patch series can be found here: https://github.com/ffainelli/linux/commits/dsa-phylink-v2 This was tested on: - dsa-loop - bcm_sf2 - mv88e6xxx - b53 With a variety of test cases: - internal & external MDIO PHYs - MoCA with link notification through interrupt/MMIO register - built-in PHYs - ifconfig up/down for several cycles works - bind/unbind of the drivers Changes in v2: - fixed link configuration for mv88e6xxx (Andrew) after introducing polling This is technically v2 of what was posted back in March 2018, changes from last time: - fixed probe/remove of drivers - fixed missing gpiod_put() for link GPIOs - fixed polling of link GPIOs (Russell I would need your SoB on the patch you provided offline initially, added some modifications to it) - tested across a wider set of platforms And everything should still work as expected. Please be aware of the following: - switch drivers (like bcm_sf2) which may have user-facing network ports using fixed links would need to implement phylink_mac_ops to remain functional. PHYLINK does not create a phy_device for fixed links, therefore our call to adjust_link() from phylink_mac_link_{up,down} would not be calling into the driver. This *should not* affect CPU/DSA ports which are configured through adjust_link() but have no network devices - support for SFP/SFF is now possible, but switch drivers will still need some modifications to properly support those, including, but not limited to using the correct binding information. This will be submitted on top of this series Please do test on your respective platforms/switches and let me know if you find any issues, hopefully everything still works like before. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/dsa.h')
-rw-r--r--include/net/dsa.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 462e9741b210..fdbd6082945d 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -20,12 +20,14 @@
20#include <linux/of.h> 20#include <linux/of.h>
21#include <linux/ethtool.h> 21#include <linux/ethtool.h>
22#include <linux/net_tstamp.h> 22#include <linux/net_tstamp.h>
23#include <linux/phy.h>
23#include <net/devlink.h> 24#include <net/devlink.h>
24#include <net/switchdev.h> 25#include <net/switchdev.h>
25 26
26struct tc_action; 27struct tc_action;
27struct phy_device; 28struct phy_device;
28struct fixed_phy_status; 29struct fixed_phy_status;
30struct phylink_link_state;
29 31
30enum dsa_tag_protocol { 32enum dsa_tag_protocol {
31 DSA_TAG_PROTO_NONE = 0, 33 DSA_TAG_PROTO_NONE = 0,
@@ -199,6 +201,7 @@ struct dsa_port {
199 u8 stp_state; 201 u8 stp_state;
200 struct net_device *bridge_dev; 202 struct net_device *bridge_dev;
201 struct devlink_port devlink_port; 203 struct devlink_port devlink_port;
204 struct phylink *pl;
202 /* 205 /*
203 * Original copy of the master netdev ethtool_ops 206 * Original copy of the master netdev ethtool_ops
204 */ 207 */
@@ -354,6 +357,27 @@ struct dsa_switch_ops {
354 struct fixed_phy_status *st); 357 struct fixed_phy_status *st);
355 358
356 /* 359 /*
360 * PHYLINK integration
361 */
362 void (*phylink_validate)(struct dsa_switch *ds, int port,
363 unsigned long *supported,
364 struct phylink_link_state *state);
365 int (*phylink_mac_link_state)(struct dsa_switch *ds, int port,
366 struct phylink_link_state *state);
367 void (*phylink_mac_config)(struct dsa_switch *ds, int port,
368 unsigned int mode,
369 const struct phylink_link_state *state);
370 void (*phylink_mac_an_restart)(struct dsa_switch *ds, int port);
371 void (*phylink_mac_link_down)(struct dsa_switch *ds, int port,
372 unsigned int mode,
373 phy_interface_t interface);
374 void (*phylink_mac_link_up)(struct dsa_switch *ds, int port,
375 unsigned int mode,
376 phy_interface_t interface,
377 struct phy_device *phydev);
378 void (*phylink_fixed_state)(struct dsa_switch *ds, int port,
379 struct phylink_link_state *state);
380 /*
357 * ethtool hardware statistics. 381 * ethtool hardware statistics.
358 */ 382 */
359 void (*get_strings)(struct dsa_switch *ds, int port, 383 void (*get_strings)(struct dsa_switch *ds, int port,
@@ -595,5 +619,6 @@ static inline int call_dsa_notifiers(unsigned long val, struct net_device *dev,
595int dsa_port_get_phy_strings(struct dsa_port *dp, uint8_t *data); 619int dsa_port_get_phy_strings(struct dsa_port *dp, uint8_t *data);
596int dsa_port_get_ethtool_phy_stats(struct dsa_port *dp, uint64_t *data); 620int dsa_port_get_ethtool_phy_stats(struct dsa_port *dp, uint64_t *data);
597int dsa_port_get_phy_sset_count(struct dsa_port *dp); 621int dsa_port_get_phy_sset_count(struct dsa_port *dp);
622void dsa_port_phylink_mac_change(struct dsa_switch *ds, int port, bool up);
598 623
599#endif 624#endif