Commit 11d8f3dd authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller

net: dsa: Add PHYLINK switch operations

In preparation for adding support for PHYLINK within DSA, define a number of
operations that we will need and that switch drivers can start implementing.
Proper integration with PHYLINK will follow in subsequent patches.

We start selecting PHYLINK (which implies PHYLIB) in net/dsa/Kconfig
such that drivers can be guaranteed that this dependency is properly
taken care of and can start referencing PHYLINK helper functions without
requiring stubs or anything.
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9cd00a8a
...@@ -20,12 +20,14 @@ ...@@ -20,12 +20,14 @@
#include <linux/of.h> #include <linux/of.h>
#include <linux/ethtool.h> #include <linux/ethtool.h>
#include <linux/net_tstamp.h> #include <linux/net_tstamp.h>
#include <linux/phy.h>
#include <net/devlink.h> #include <net/devlink.h>
#include <net/switchdev.h> #include <net/switchdev.h>
struct tc_action; struct tc_action;
struct phy_device; struct phy_device;
struct fixed_phy_status; struct fixed_phy_status;
struct phylink_link_state;
enum dsa_tag_protocol { enum dsa_tag_protocol {
DSA_TAG_PROTO_NONE = 0, DSA_TAG_PROTO_NONE = 0,
...@@ -353,6 +355,27 @@ struct dsa_switch_ops { ...@@ -353,6 +355,27 @@ struct dsa_switch_ops {
void (*fixed_link_update)(struct dsa_switch *ds, int port, void (*fixed_link_update)(struct dsa_switch *ds, int port,
struct fixed_phy_status *st); struct fixed_phy_status *st);
/*
* PHYLINK integration
*/
void (*phylink_validate)(struct dsa_switch *ds, int port,
unsigned long *supported,
struct phylink_link_state *state);
int (*phylink_mac_link_state)(struct dsa_switch *ds, int port,
struct phylink_link_state *state);
void (*phylink_mac_config)(struct dsa_switch *ds, int port,
unsigned int mode,
const struct phylink_link_state *state);
void (*phylink_mac_an_restart)(struct dsa_switch *ds, int port);
void (*phylink_mac_link_down)(struct dsa_switch *ds, int port,
unsigned int mode,
phy_interface_t interface);
void (*phylink_mac_link_up)(struct dsa_switch *ds, int port,
unsigned int mode,
phy_interface_t interface,
struct phy_device *phydev);
void (*phylink_fixed_state)(struct dsa_switch *ds, int port,
struct phylink_link_state *state);
/* /*
* ethtool hardware statistics. * ethtool hardware statistics.
*/ */
...@@ -595,5 +618,6 @@ static inline int call_dsa_notifiers(unsigned long val, struct net_device *dev, ...@@ -595,5 +618,6 @@ static inline int call_dsa_notifiers(unsigned long val, struct net_device *dev,
int dsa_port_get_phy_strings(struct dsa_port *dp, uint8_t *data); int dsa_port_get_phy_strings(struct dsa_port *dp, uint8_t *data);
int dsa_port_get_ethtool_phy_stats(struct dsa_port *dp, uint64_t *data); int dsa_port_get_ethtool_phy_stats(struct dsa_port *dp, uint64_t *data);
int dsa_port_get_phy_sset_count(struct dsa_port *dp); int dsa_port_get_phy_sset_count(struct dsa_port *dp);
void dsa_port_phylink_mac_change(struct dsa_switch *ds, int port, bool up);
#endif #endif
...@@ -9,7 +9,7 @@ config NET_DSA ...@@ -9,7 +9,7 @@ config NET_DSA
depends on HAVE_NET_DSA && MAY_USE_DEVLINK depends on HAVE_NET_DSA && MAY_USE_DEVLINK
depends on BRIDGE || BRIDGE=n depends on BRIDGE || BRIDGE=n
select NET_SWITCHDEV select NET_SWITCHDEV
select PHYLIB select PHYLINK
---help--- ---help---
Say Y if you want to enable support for the hardware switches supported Say Y if you want to enable support for the hardware switches supported
by the Distributed Switch Architecture. by the Distributed Switch Architecture.
......
...@@ -1119,6 +1119,11 @@ static int dsa_slave_phy_connect(struct net_device *slave_dev, int addr) ...@@ -1119,6 +1119,11 @@ static int dsa_slave_phy_connect(struct net_device *slave_dev, int addr)
dsa_slave_adjust_link, p->phy_interface); dsa_slave_adjust_link, p->phy_interface);
} }
void dsa_port_phylink_mac_change(struct dsa_switch *ds, int port, bool up)
{
}
EXPORT_SYMBOL_GPL(dsa_port_phylink_mac_change);
static int dsa_slave_phy_setup(struct net_device *slave_dev) static int dsa_slave_phy_setup(struct net_device *slave_dev)
{ {
struct dsa_port *dp = dsa_slave_to_port(slave_dev); struct dsa_port *dp = dsa_slave_to_port(slave_dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment