Lines Matching +refs:port +refs:id +refs:attrs

69 	int port = devlink_port_to_port(dlp);  in ocelot_devlink_sb_port_pool_get()  local
71 return ocelot_sb_port_pool_get(ocelot, port, sb_index, pool_index, in ocelot_devlink_sb_port_pool_get()
81 int port = devlink_port_to_port(dlp); in ocelot_devlink_sb_port_pool_set() local
83 return ocelot_sb_port_pool_set(ocelot, port, sb_index, pool_index, in ocelot_devlink_sb_port_pool_set()
94 int port = devlink_port_to_port(dlp); in ocelot_devlink_sb_tc_pool_bind_get() local
96 return ocelot_sb_tc_pool_bind_get(ocelot, port, sb_index, tc_index, in ocelot_devlink_sb_tc_pool_bind_get()
109 int port = devlink_port_to_port(dlp); in ocelot_devlink_sb_tc_pool_bind_set() local
111 return ocelot_sb_tc_pool_bind_set(ocelot, port, sb_index, tc_index, in ocelot_devlink_sb_tc_pool_bind_set()
138 int port = devlink_port_to_port(dlp); in ocelot_devlink_sb_occ_port_pool_get() local
140 return ocelot_sb_occ_port_pool_get(ocelot, port, sb_index, pool_index, in ocelot_devlink_sb_occ_port_pool_get()
151 int port = devlink_port_to_port(dlp); in ocelot_devlink_sb_occ_tc_port_bind_get() local
153 return ocelot_sb_occ_tc_port_bind_get(ocelot, port, sb_index, in ocelot_devlink_sb_occ_tc_port_bind_get()
171 int ocelot_port_devlink_init(struct ocelot *ocelot, int port, in ocelot_port_devlink_init() argument
174 struct devlink_port *dlp = &ocelot->devlink_ports[port]; in ocelot_port_devlink_init()
177 struct devlink_port_attrs attrs = {}; in ocelot_port_devlink_init() local
180 memcpy(attrs.switch_id.id, &ocelot->base_mac, id_len); in ocelot_port_devlink_init()
181 attrs.switch_id.id_len = id_len; in ocelot_port_devlink_init()
182 attrs.phys.port_number = port; in ocelot_port_devlink_init()
183 attrs.flavour = flavour; in ocelot_port_devlink_init()
185 devlink_port_attrs_set(dlp, &attrs); in ocelot_port_devlink_init()
187 return devlink_port_register(dl, dlp, port); in ocelot_port_devlink_init()
190 void ocelot_port_devlink_teardown(struct ocelot *ocelot, int port) in ocelot_port_devlink_teardown() argument
192 struct devlink_port *dlp = &ocelot->devlink_ports[port]; in ocelot_port_devlink_teardown()
201 struct ocelot *ocelot = priv->port.ocelot; in ocelot_setup_tc_cls_flower()
202 int port = priv->port.index; in ocelot_setup_tc_cls_flower() local
209 return ocelot_cls_flower_replace(ocelot, port, f, ingress); in ocelot_setup_tc_cls_flower()
211 return ocelot_cls_flower_destroy(ocelot, port, f, ingress); in ocelot_setup_tc_cls_flower()
213 return ocelot_cls_flower_stats(ocelot, port, f, ingress); in ocelot_setup_tc_cls_flower()
225 struct ocelot *ocelot = priv->port.ocelot; in ocelot_setup_tc_cls_matchall_police()
227 int port = priv->port.index; in ocelot_setup_tc_cls_matchall_police() local
248 err = ocelot_port_policer_add(ocelot, port, &pol); in ocelot_setup_tc_cls_matchall_police()
266 struct ocelot *ocelot = priv->port.ocelot; in ocelot_setup_tc_cls_matchall_mirred()
289 err = ocelot_port_mirror_add(ocelot, priv->port.index, in ocelot_setup_tc_cls_matchall_mirred()
290 other_priv->port.index, ingress, extack); in ocelot_setup_tc_cls_matchall_mirred()
306 struct ocelot *ocelot = priv->port.ocelot; in ocelot_del_tc_cls_matchall_police()
307 int port = priv->port.index; in ocelot_del_tc_cls_matchall_police() local
310 err = ocelot_port_policer_del(ocelot, port); in ocelot_del_tc_cls_matchall_police()
327 struct ocelot *ocelot = priv->port.ocelot; in ocelot_del_tc_cls_matchall_mirred()
328 int port = priv->port.index; in ocelot_del_tc_cls_matchall_mirred() local
330 ocelot_port_mirror_del(ocelot, port, ingress); in ocelot_del_tc_cls_matchall_mirred()
364 switch (action->id) { in ocelot_setup_tc_cls_matchall()
496 struct ocelot_port *ocelot_port = &priv->port; in ocelot_vlan_vid_add()
498 int port = priv->port.index; in ocelot_vlan_vid_add() local
501 ret = ocelot_vlan_add(ocelot, port, vid, pvid, untagged); in ocelot_vlan_vid_add()
515 struct ocelot *ocelot = priv->port.ocelot; in ocelot_vlan_vid_del()
516 int port = priv->port.index; in ocelot_vlan_vid_del() local
526 ret = ocelot_vlan_del(ocelot, port, vid); in ocelot_vlan_vid_del()
557 struct ocelot_port *ocelot_port = &priv->port; in ocelot_port_xmit()
559 int port = priv->port.index; in ocelot_port_xmit() local
570 if (ocelot_port_txtstamp_request(ocelot, port, skb, &clone)) { in ocelot_port_xmit()
582 ocelot_fdma_inject_frame(ocelot, port, rew_op, skb, dev); in ocelot_port_xmit()
584 ocelot_port_inject_frame(ocelot, port, 0, rew_op, skb); in ocelot_port_xmit()
658 struct ocelot_port *ocelot_port = &priv->port; in ocelot_mc_unsync()
672 struct ocelot_port *ocelot_port = &priv->port; in ocelot_mc_sync()
688 struct ocelot *ocelot = priv->port.ocelot; in ocelot_set_rx_mode()
706 struct ocelot_port *ocelot_port = &priv->port; in ocelot_port_set_mac_address()
724 struct ocelot *ocelot = priv->port.ocelot; in ocelot_get_stats64()
725 int port = priv->port.index; in ocelot_get_stats64() local
727 return ocelot_port_get_stats64(ocelot, port, stats); in ocelot_get_stats64()
737 struct ocelot_port *ocelot_port = &priv->port; in ocelot_port_fdb_add()
739 int port = priv->port.index; in ocelot_port_fdb_add() local
741 return ocelot_fdb_add(ocelot, port, addr, vid, ocelot_port->bridge); in ocelot_port_fdb_add()
750 struct ocelot_port *ocelot_port = &priv->port; in ocelot_port_fdb_del()
752 int port = priv->port.index; in ocelot_port_fdb_del() local
754 return ocelot_fdb_del(ocelot, port, addr, vid, ocelot_port->bridge); in ocelot_port_fdb_del()
806 struct ocelot *ocelot = priv->port.ocelot; in ocelot_port_fdb_dump()
813 int port = priv->port.index; in ocelot_port_fdb_dump() local
816 ret = ocelot_fdb_dump(ocelot, port, ocelot_port_fdb_do_dump, &dump); in ocelot_port_fdb_dump()
835 static void ocelot_vlan_mode(struct ocelot *ocelot, int port, in ocelot_vlan_mode() argument
843 val |= BIT(port); in ocelot_vlan_mode()
845 val &= ~BIT(port); in ocelot_vlan_mode()
854 struct ocelot *ocelot = priv->port.ocelot; in ocelot_set_features()
855 int port = priv->port.index; in ocelot_set_features() local
865 ocelot_vlan_mode(ocelot, port, features); in ocelot_set_features()
873 struct ocelot *ocelot = priv->port.ocelot; in ocelot_ioctl()
874 int port = priv->port.index; in ocelot_ioctl() local
882 return ocelot_hwstamp_set(ocelot, port, ifr); in ocelot_ioctl()
884 return ocelot_hwstamp_get(ocelot, port, ifr); in ocelot_ioctl()
894 struct ocelot_port *ocelot_port = &priv->port; in ocelot_change_mtu()
897 ocelot_port_set_maxlen(ocelot, priv->port.index, new_mtu); in ocelot_change_mtu()
921 struct net_device *ocelot_port_to_netdev(struct ocelot *ocelot, int port) in ocelot_port_to_netdev() argument
923 struct ocelot_port *ocelot_port = ocelot->ports[port]; in ocelot_port_to_netdev()
929 priv = container_of(ocelot_port, struct ocelot_port_private, port); in ocelot_port_to_netdev()
949 return priv->port.index; in ocelot_netdev_to_port()
956 struct ocelot *ocelot = priv->port.ocelot; in ocelot_port_get_strings()
957 int port = priv->port.index; in ocelot_port_get_strings() local
959 ocelot_get_strings(ocelot, port, sset, data); in ocelot_port_get_strings()
967 struct ocelot *ocelot = priv->port.ocelot; in ocelot_port_get_ethtool_stats()
968 int port = priv->port.index; in ocelot_port_get_ethtool_stats() local
970 ocelot_get_ethtool_stats(ocelot, port, data); in ocelot_port_get_ethtool_stats()
976 struct ocelot *ocelot = priv->port.ocelot; in ocelot_port_get_sset_count()
977 int port = priv->port.index; in ocelot_port_get_sset_count() local
979 return ocelot_get_sset_count(ocelot, port, sset); in ocelot_port_get_sset_count()
986 struct ocelot *ocelot = priv->port.ocelot; in ocelot_port_get_ts_info()
987 int port = priv->port.index; in ocelot_port_get_ts_info() local
992 return ocelot_get_ts_info(ocelot, port, info); in ocelot_port_get_ts_info()
1004 static void ocelot_port_attr_stp_state_set(struct ocelot *ocelot, int port, in ocelot_port_attr_stp_state_set() argument
1007 ocelot_bridge_stp_state_set(ocelot, port, state); in ocelot_port_attr_stp_state_set()
1010 static void ocelot_port_attr_ageing_set(struct ocelot *ocelot, int port, in ocelot_port_attr_ageing_set() argument
1019 static void ocelot_port_attr_mc_set(struct ocelot *ocelot, int port, bool mc) in ocelot_port_attr_mc_set() argument
1030 ANA_PORT_CPU_FWD_CFG, port); in ocelot_port_attr_mc_set()
1038 struct ocelot *ocelot = priv->port.ocelot; in ocelot_port_attr_set()
1039 int port = priv->port.index; in ocelot_port_attr_set() local
1045 switch (attr->id) { in ocelot_port_attr_set()
1047 ocelot_port_attr_stp_state_set(ocelot, port, attr->u.stp_state); in ocelot_port_attr_set()
1050 ocelot_port_attr_ageing_set(ocelot, port, attr->u.ageing_time); in ocelot_port_attr_set()
1053 ocelot_port_vlan_filtering(ocelot, port, attr->u.vlan_filtering, in ocelot_port_attr_set()
1057 ocelot_port_attr_mc_set(ocelot, port, !attr->u.mc_disabled); in ocelot_port_attr_set()
1060 err = ocelot_port_pre_bridge_flags(ocelot, port, in ocelot_port_attr_set()
1064 ocelot_port_bridge_flags(ocelot, port, attr->u.brport_flags); in ocelot_port_attr_set()
1078 struct ocelot_port *ocelot_port = &priv->port; in ocelot_vlan_vid_prepare()
1080 int port = priv->port.index; in ocelot_vlan_vid_prepare() local
1082 return ocelot_vlan_prepare(ocelot, port, vid, pvid, untagged, extack); in ocelot_vlan_vid_prepare()
1104 struct ocelot_port *ocelot_port = &priv->port; in ocelot_port_obj_add_mdb()
1106 int port = priv->port.index; in ocelot_port_obj_add_mdb() local
1108 return ocelot_port_mdb_add(ocelot, port, mdb, ocelot_port->bridge); in ocelot_port_obj_add_mdb()
1115 struct ocelot_port *ocelot_port = &priv->port; in ocelot_port_obj_del_mdb()
1117 int port = priv->port.index; in ocelot_port_obj_del_mdb() local
1119 return ocelot_port_mdb_del(ocelot, port, mdb, ocelot_port->bridge); in ocelot_port_obj_del_mdb()
1126 struct ocelot_port *ocelot_port = &priv->port; in ocelot_port_obj_mrp_add()
1128 int port = priv->port.index; in ocelot_port_obj_mrp_add() local
1130 return ocelot_mrp_add(ocelot, port, mrp); in ocelot_port_obj_mrp_add()
1137 struct ocelot_port *ocelot_port = &priv->port; in ocelot_port_obj_mrp_del()
1139 int port = priv->port.index; in ocelot_port_obj_mrp_del() local
1141 return ocelot_mrp_del(ocelot, port, mrp); in ocelot_port_obj_mrp_del()
1149 struct ocelot_port *ocelot_port = &priv->port; in ocelot_port_obj_mrp_add_ring_role()
1151 int port = priv->port.index; in ocelot_port_obj_mrp_add_ring_role() local
1153 return ocelot_mrp_add_ring_role(ocelot, port, mrp); in ocelot_port_obj_mrp_add_ring_role()
1161 struct ocelot_port *ocelot_port = &priv->port; in ocelot_port_obj_mrp_del_ring_role()
1163 int port = priv->port.index; in ocelot_port_obj_mrp_del_ring_role() local
1165 return ocelot_mrp_del_ring_role(ocelot, port, mrp); in ocelot_port_obj_mrp_del_ring_role()
1178 switch (obj->id) { in ocelot_port_obj_add()
1210 switch (obj->id) { in ocelot_port_obj_del()
1232 static void ocelot_inherit_brport_flags(struct ocelot *ocelot, int port, in ocelot_inherit_brport_flags() argument
1244 ocelot_port_bridge_flags(ocelot, port, flags); in ocelot_inherit_brport_flags()
1247 static void ocelot_clear_brport_flags(struct ocelot *ocelot, int port) in ocelot_clear_brport_flags() argument
1254 ocelot_port_bridge_flags(ocelot, port, flags); in ocelot_clear_brport_flags()
1257 static int ocelot_switchdev_sync(struct ocelot *ocelot, int port, in ocelot_switchdev_sync() argument
1265 ocelot_inherit_brport_flags(ocelot, port, brport_dev); in ocelot_switchdev_sync()
1268 ocelot_bridge_stp_state_set(ocelot, port, stp_state); in ocelot_switchdev_sync()
1271 ocelot_port_attr_ageing_set(ocelot, port, ageing_time); in ocelot_switchdev_sync()
1273 return ocelot_port_vlan_filtering(ocelot, port, in ocelot_switchdev_sync()
1278 static int ocelot_switchdev_unsync(struct ocelot *ocelot, int port) in ocelot_switchdev_unsync() argument
1282 err = ocelot_port_vlan_filtering(ocelot, port, false, NULL); in ocelot_switchdev_unsync()
1286 ocelot_clear_brport_flags(ocelot, port); in ocelot_switchdev_unsync()
1288 ocelot_bridge_stp_state_set(ocelot, port, BR_STATE_FORWARDING); in ocelot_switchdev_unsync()
1326 struct ocelot_port *ocelot_port = &priv->port; in ocelot_netdevice_bridge_join()
1328 int port = priv->port.index; in ocelot_netdevice_bridge_join() local
1333 err = ocelot_port_bridge_join(ocelot, port, bridge, bridge_num, in ocelot_netdevice_bridge_join()
1345 err = ocelot_switchdev_sync(ocelot, port, brport_dev, bridge, extack); in ocelot_netdevice_bridge_join()
1356 ocelot_port_bridge_leave(ocelot, port, bridge); in ocelot_netdevice_bridge_join()
1377 struct ocelot_port *ocelot_port = &priv->port; in ocelot_netdevice_bridge_leave()
1380 int port = priv->port.index; in ocelot_netdevice_bridge_leave() local
1383 err = ocelot_switchdev_unsync(ocelot, port); in ocelot_netdevice_bridge_leave()
1387 ocelot_port_bridge_leave(ocelot, port, bridge); in ocelot_netdevice_bridge_leave()
1399 struct ocelot_port *ocelot_port = &priv->port; in ocelot_netdevice_lag_join()
1402 int port = priv->port.index; in ocelot_netdevice_lag_join() local
1405 err = ocelot_port_lag_join(ocelot, port, bond, info, extack); in ocelot_netdevice_lag_join()
1421 ocelot_port_lag_leave(ocelot, port, bond); in ocelot_netdevice_lag_join()
1441 struct ocelot_port *ocelot_port = &priv->port; in ocelot_netdevice_lag_leave()
1444 int port = priv->port.index; in ocelot_netdevice_lag_leave() local
1446 ocelot_port_lag_leave(ocelot, port, bond); in ocelot_netdevice_lag_leave()
1500 struct ocelot_port *ocelot_port = &priv->port; in ocelot_netdevice_lag_changeupper()
1537 struct ocelot_port *ocelot_port = &priv->port; in ocelot_netdevice_lag_prechangeupper()
1556 struct ocelot_port *ocelot_port = &priv->port; in ocelot_netdevice_changelowerstate()
1558 int port = priv->port.index; in ocelot_netdevice_changelowerstate() local
1566 ocelot_port_lag_change(ocelot, port, is_active); in ocelot_netdevice_changelowerstate()
1678 struct ocelot *ocelot = priv->port.ocelot; in vsc7514_phylink_mac_config()
1679 int port = priv->port.index; in vsc7514_phylink_mac_config() local
1681 ocelot_phylink_mac_config(ocelot, port, link_an_mode, state); in vsc7514_phylink_mac_config()
1690 struct ocelot *ocelot = priv->port.ocelot; in vsc7514_phylink_mac_link_down()
1691 int port = priv->port.index; in vsc7514_phylink_mac_link_down() local
1693 ocelot_phylink_mac_link_down(ocelot, port, link_an_mode, interface, in vsc7514_phylink_mac_link_down()
1706 struct ocelot *ocelot = priv->port.ocelot; in vsc7514_phylink_mac_link_up()
1707 int port = priv->port.index; in vsc7514_phylink_mac_link_up() local
1709 ocelot_phylink_mac_link_up(ocelot, port, phydev, link_an_mode, in vsc7514_phylink_mac_link_up()
1720 static int ocelot_port_phylink_create(struct ocelot *ocelot, int port, in ocelot_port_phylink_create() argument
1723 struct ocelot_port *ocelot_port = ocelot->ports[port]; in ocelot_port_phylink_create()
1741 phy_modes(phy_mode), port); in ocelot_port_phylink_create()
1747 err = ocelot_port_configure_serdes(ocelot, port, portnp); in ocelot_port_phylink_create()
1751 priv = container_of(ocelot_port, struct ocelot_port_private, port); in ocelot_port_phylink_create()
1783 int ocelot_probe_port(struct ocelot *ocelot, int port, struct regmap *target, in ocelot_probe_port() argument
1797 ocelot_port = &priv->port; in ocelot_probe_port()
1799 ocelot_port->index = port; in ocelot_probe_port()
1801 ocelot->ports[port] = ocelot_port; in ocelot_probe_port()
1813 eth_hw_addr_gen(dev, ocelot->base_mac, port); in ocelot_probe_port()
1818 ocelot_init_port(ocelot, port); in ocelot_probe_port()
1820 err = ocelot_port_phylink_create(ocelot, port, portnp); in ocelot_probe_port()
1827 SET_NETDEV_DEVLINK_PORT(dev, &ocelot->devlink_ports[port]); in ocelot_probe_port()
1840 ocelot->ports[port] = NULL; in ocelot_probe_port()
1850 port); in ocelot_release_port()