port.c (42a62da0ae660e71c280bd8b287b994c1af1352c) port.c (022bba63c3ca02fc074c68b4e7b949bddcf320d6)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Handling of a single switch port
4 *
5 * Copyright (c) 2017 Savoir-faire Linux Inc.
6 * Vivien Didelot <vivien.didelot@savoirfairelinux.com>
7 */
8
9#include <linux/if_bridge.h>
10#include <linux/netdevice.h>
11#include <linux/notifier.h>
12#include <linux/of_mdio.h>
13#include <linux/of_net.h>
14
15#include "dsa_priv.h"
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Handling of a single switch port
4 *
5 * Copyright (c) 2017 Savoir-faire Linux Inc.
6 * Vivien Didelot <vivien.didelot@savoirfairelinux.com>
7 */
8
9#include <linux/if_bridge.h>
10#include <linux/netdevice.h>
11#include <linux/notifier.h>
12#include <linux/of_mdio.h>
13#include <linux/of_net.h>
14
15#include "dsa_priv.h"
16#include "port.h"
16
17/**
18 * dsa_port_notify - Notify the switching fabric of changes to a port
19 * @dp: port on which change occurred
20 * @e: event, must be of type DSA_NOTIFIER_*
21 * @v: event-specific value.
22 *
23 * Notify all switches in the DSA tree that this port's switch belongs to,

--- 1523 unchanged lines hidden (view full) ---

1547 of_node_put(phy_dn);
1548 return phydev;
1549}
1550
1551static void dsa_port_phylink_validate(struct phylink_config *config,
1552 unsigned long *supported,
1553 struct phylink_link_state *state)
1554{
17
18/**
19 * dsa_port_notify - Notify the switching fabric of changes to a port
20 * @dp: port on which change occurred
21 * @e: event, must be of type DSA_NOTIFIER_*
22 * @v: event-specific value.
23 *
24 * Notify all switches in the DSA tree that this port's switch belongs to,

--- 1523 unchanged lines hidden (view full) ---

1548 of_node_put(phy_dn);
1549 return phydev;
1550}
1551
1552static void dsa_port_phylink_validate(struct phylink_config *config,
1553 unsigned long *supported,
1554 struct phylink_link_state *state)
1555{
1555 struct dsa_port *dp = container_of(config, struct dsa_port, pl_config);
1556 struct dsa_switch *ds = dp->ds;
1557
1558 if (!ds->ops->phylink_validate) {
1559 if (config->mac_capabilities)
1560 phylink_generic_validate(config, supported, state);
1561 return;
1562 }
1563
1564 ds->ops->phylink_validate(ds, dp->index, supported, state);
1556 /* Skip call for drivers which don't yet set mac_capabilities,
1557 * since validating in that case would mean their PHY will advertise
1558 * nothing. In turn, skipping validation makes them advertise
1559 * everything that the PHY supports, so those drivers should be
1560 * converted ASAP.
1561 */
1562 if (config->mac_capabilities)
1563 phylink_generic_validate(config, supported, state);
1565}
1566
1567static void dsa_port_phylink_mac_pcs_get_state(struct phylink_config *config,
1568 struct phylink_link_state *state)
1569{
1570 struct dsa_port *dp = container_of(config, struct dsa_port, pl_config);
1571 struct dsa_switch *ds = dp->ds;
1572 int err;

--- 511 unchanged lines hidden ---
1564}
1565
1566static void dsa_port_phylink_mac_pcs_get_state(struct phylink_config *config,
1567 struct phylink_link_state *state)
1568{
1569 struct dsa_port *dp = container_of(config, struct dsa_port, pl_config);
1570 struct dsa_switch *ds = dp->ds;
1571 int err;

--- 511 unchanged lines hidden ---