ocelot.c (aac80140dc31963d818a65a522c2e2da81979857) ocelot.c (403ffc2c34de5297d007e0e169bf022094d444c2)
1// SPDX-License-Identifier: (GPL-2.0 OR MIT)
2/*
3 * Microsemi Ocelot Switch driver
4 *
5 * Copyright (c) 2017 Microsemi Corporation
6 */
7#include <linux/dsa/ocelot.h>
8#include <linux/if_bridge.h>

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

1001 ocelot_port_writel(ocelot_port, DEV_MAC_ENA_CFG_RX_ENA |
1002 DEV_MAC_ENA_CFG_TX_ENA, DEV_MAC_ENA_CFG);
1003
1004 /* If the port supports cut-through forwarding, update the masks before
1005 * enabling forwarding on the port.
1006 */
1007 if (ocelot->ops->cut_through_fwd) {
1008 mutex_lock(&ocelot->fwd_domain_lock);
1// SPDX-License-Identifier: (GPL-2.0 OR MIT)
2/*
3 * Microsemi Ocelot Switch driver
4 *
5 * Copyright (c) 2017 Microsemi Corporation
6 */
7#include <linux/dsa/ocelot.h>
8#include <linux/if_bridge.h>

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

1001 ocelot_port_writel(ocelot_port, DEV_MAC_ENA_CFG_RX_ENA |
1002 DEV_MAC_ENA_CFG_TX_ENA, DEV_MAC_ENA_CFG);
1003
1004 /* If the port supports cut-through forwarding, update the masks before
1005 * enabling forwarding on the port.
1006 */
1007 if (ocelot->ops->cut_through_fwd) {
1008 mutex_lock(&ocelot->fwd_domain_lock);
1009 ocelot->ops->cut_through_fwd(ocelot);
1009 /* Workaround for hardware bug - FP doesn't work
1010 * at all link speeds for all PHY modes. The function
1011 * below also calls ocelot->ops->cut_through_fwd(),
1012 * so we don't need to do it twice.
1013 */
1014 ocelot_port_update_active_preemptible_tcs(ocelot, port);
1010 mutex_unlock(&ocelot->fwd_domain_lock);
1011 }
1012
1013 /* Core: Enable port for frame transfer */
1014 ocelot_fields_write(ocelot, port,
1015 QSYS_SWITCH_PORT_MODE_PORT_ENA, 1);
1016}
1017EXPORT_SYMBOL_GPL(ocelot_phylink_mac_link_up);

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

2700}
2701EXPORT_SYMBOL_GPL(ocelot_port_mirror_del);
2702
2703static void ocelot_port_reset_mqprio(struct ocelot *ocelot, int port)
2704{
2705 struct net_device *dev = ocelot->ops->port_to_netdev(ocelot, port);
2706
2707 netdev_reset_tc(dev);
1015 mutex_unlock(&ocelot->fwd_domain_lock);
1016 }
1017
1018 /* Core: Enable port for frame transfer */
1019 ocelot_fields_write(ocelot, port,
1020 QSYS_SWITCH_PORT_MODE_PORT_ENA, 1);
1021}
1022EXPORT_SYMBOL_GPL(ocelot_phylink_mac_link_up);

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

2705}
2706EXPORT_SYMBOL_GPL(ocelot_port_mirror_del);
2707
2708static void ocelot_port_reset_mqprio(struct ocelot *ocelot, int port)
2709{
2710 struct net_device *dev = ocelot->ops->port_to_netdev(ocelot, port);
2711
2712 netdev_reset_tc(dev);
2713 ocelot_port_change_fp(ocelot, port, 0);
2708}
2709
2710int ocelot_port_mqprio(struct ocelot *ocelot, int port,
2711 struct tc_mqprio_qopt_offload *mqprio)
2712{
2713 struct net_device *dev = ocelot->ops->port_to_netdev(ocelot, port);
2714 struct netlink_ext_ack *extack = mqprio->extack;
2715 struct tc_mqprio_qopt *qopt = &mqprio->qopt;

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

2736 if (err)
2737 goto err_reset_tc;
2738 }
2739
2740 err = netif_set_real_num_tx_queues(dev, num_tc);
2741 if (err)
2742 goto err_reset_tc;
2743
2714}
2715
2716int ocelot_port_mqprio(struct ocelot *ocelot, int port,
2717 struct tc_mqprio_qopt_offload *mqprio)
2718{
2719 struct net_device *dev = ocelot->ops->port_to_netdev(ocelot, port);
2720 struct netlink_ext_ack *extack = mqprio->extack;
2721 struct tc_mqprio_qopt *qopt = &mqprio->qopt;

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

2742 if (err)
2743 goto err_reset_tc;
2744 }
2745
2746 err = netif_set_real_num_tx_queues(dev, num_tc);
2747 if (err)
2748 goto err_reset_tc;
2749
2750 ocelot_port_change_fp(ocelot, port, mqprio->preemptible_tcs);
2751
2744 return 0;
2745
2746err_reset_tc:
2747 ocelot_port_reset_mqprio(ocelot, port);
2748 return err;
2749}
2750EXPORT_SYMBOL_GPL(ocelot_port_mqprio);
2751

--- 324 unchanged lines hidden ---
2752 return 0;
2753
2754err_reset_tc:
2755 ocelot_port_reset_mqprio(ocelot, port);
2756 return err;
2757}
2758EXPORT_SYMBOL_GPL(ocelot_port_mqprio);
2759

--- 324 unchanged lines hidden ---