Lines Matching +full:mac +full:- +full:mode

1 // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
2 /* Copyright (c) 2019-2020 Marvell International Ltd. All rights reserved */
235 u8 mac[ETH_ALEN]; member
254 __le32 mode; member
260 } mac; member
290 u8 mac[ETH_ALEN]; member
307 __le32 mode; member
315 __le32 mode; member
322 } mac; member
325 __le32 mode; member
391 u8 mac[ETH_ALEN]; member
556 u8 mac[ETH_ALEN]; member
567 u8 mac[ETH_ALEN]; member
656 u8 mode; member
678 u8 mac[ETH_ALEN]; member
734 u8 mac[ETH_ALEN]; member
741 u8 mac[ETH_ALEN]; member
810 static u8 prestera_hw_mdix_to_eth(u8 mode);
819 struct prestera_device *dev = sw->dev; in __prestera_cmd_ret()
822 cmd->type = __cpu_to_le32(type); in __prestera_cmd_ret()
824 err = dev->send_req(dev, 0, cmd, clen, ret, rlen, waitms); in __prestera_cmd_ret()
828 if (ret->cmd.type != __cpu_to_le32(PRESTERA_CMD_TYPE_ACK)) in __prestera_cmd_ret()
829 return -EBADE; in __prestera_cmd_ret()
830 if (ret->status != __cpu_to_le32(PRESTERA_CMD_ACK_OK)) in __prestera_cmd_ret()
831 return -EINVAL; in __prestera_cmd_ret()
868 evt->port_evt.port_id = __le32_to_cpu(hw_evt->port_id); in prestera_fw_parse_port_evt()
870 if (evt->id == PRESTERA_PORT_EVENT_MAC_STATE_CHANGED) { in prestera_fw_parse_port_evt()
871 evt->port_evt.data.mac.oper = hw_evt->param.mac.oper; in prestera_fw_parse_port_evt()
872 evt->port_evt.data.mac.mode = in prestera_fw_parse_port_evt()
873 __le32_to_cpu(hw_evt->param.mac.mode); in prestera_fw_parse_port_evt()
874 evt->port_evt.data.mac.speed = in prestera_fw_parse_port_evt()
875 __le32_to_cpu(hw_evt->param.mac.speed); in prestera_fw_parse_port_evt()
876 evt->port_evt.data.mac.duplex = hw_evt->param.mac.duplex; in prestera_fw_parse_port_evt()
877 evt->port_evt.data.mac.fc = hw_evt->param.mac.fc; in prestera_fw_parse_port_evt()
878 evt->port_evt.data.mac.fec = hw_evt->param.mac.fec; in prestera_fw_parse_port_evt()
880 return -EINVAL; in prestera_fw_parse_port_evt()
890 switch (hw_evt->dest_type) { in prestera_fw_parse_fdb_evt()
892 evt->fdb_evt.type = PRESTERA_FDB_ENTRY_TYPE_REG_PORT; in prestera_fw_parse_fdb_evt()
893 evt->fdb_evt.dest.port_id = __le32_to_cpu(hw_evt->dest.port_id); in prestera_fw_parse_fdb_evt()
896 evt->fdb_evt.type = PRESTERA_FDB_ENTRY_TYPE_LAG; in prestera_fw_parse_fdb_evt()
897 evt->fdb_evt.dest.lag_id = __le16_to_cpu(hw_evt->dest.lag_id); in prestera_fw_parse_fdb_evt()
900 return -EINVAL; in prestera_fw_parse_fdb_evt()
903 evt->fdb_evt.vid = __le32_to_cpu(hw_evt->vid); in prestera_fw_parse_fdb_evt()
905 ether_addr_copy(evt->fdb_evt.data.mac, hw_evt->param.mac); in prestera_fw_parse_fdb_evt()
923 list_for_each_entry_rcu(eh, &sw->event_handlers, list) { in __find_event_handler()
924 if (eh->type == type) in __find_event_handler()
943 err = -ENOENT; in prestera_find_event_handler()
951 struct prestera_switch *sw = dev->priv; in prestera_evt_recv()
958 msg_type = __le16_to_cpu(msg->type); in prestera_evt_recv()
960 return -EINVAL; in prestera_evt_recv()
962 return -ENOENT; in prestera_evt_recv()
968 evt.id = __le16_to_cpu(msg->id); in prestera_evt_recv()
981 struct prestera_switch *sw = dev->priv; in prestera_pkt_recv()
995 static u8 prestera_hw_mdix_to_eth(u8 mode) in prestera_hw_mdix_to_eth() argument
997 switch (mode) { in prestera_hw_mdix_to_eth()
1009 static u8 prestera_hw_mdix_from_eth(u8 mode) in prestera_hw_mdix_from_eth() argument
1011 switch (mode) { in prestera_hw_mdix_from_eth()
1027 .port = __cpu_to_le32(port->id), in prestera_hw_port_info_get()
1032 err = prestera_cmd_ret(port->sw, PRESTERA_CMD_TYPE_PORT_INFO_GET, in prestera_hw_port_info_get()
1044 int prestera_hw_switch_mac_set(struct prestera_switch *sw, const char *mac) in prestera_hw_switch_mac_set() argument
1050 ether_addr_copy(req.param.mac, mac); in prestera_hw_switch_mac_set()
1062 INIT_LIST_HEAD(&sw->event_handlers); in prestera_hw_switch_init()
1073 sw->dev->recv_msg = prestera_evt_recv; in prestera_hw_switch_init()
1074 sw->dev->recv_pkt = prestera_pkt_recv; in prestera_hw_switch_init()
1075 sw->port_count = __le32_to_cpu(resp.port_count); in prestera_hw_switch_init()
1076 sw->mtu_min = PRESTERA_MIN_MTU; in prestera_hw_switch_init()
1077 sw->mtu_max = __le32_to_cpu(resp.mtu_max); in prestera_hw_switch_init()
1078 sw->id = resp.switch_id; in prestera_hw_switch_init()
1079 sw->lag_member_max = resp.lag_member_max; in prestera_hw_switch_init()
1080 sw->lag_max = resp.lag_max; in prestera_hw_switch_init()
1081 sw->size_tbl_router_nexthop = in prestera_hw_switch_init()
1089 WARN_ON(!list_empty(&sw->event_handlers)); in prestera_hw_switch_fini()
1106 u32 *mode, u32 *speed, u8 *duplex, u8 *fec) in prestera_hw_port_mac_mode_get() argument
1111 .port = __cpu_to_le32(port->hw_id), in prestera_hw_port_mac_mode_get()
1112 .dev = __cpu_to_le32(port->dev_id) in prestera_hw_port_mac_mode_get()
1116 err = prestera_cmd_ret(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_GET, in prestera_hw_port_mac_mode_get()
1121 if (mode) in prestera_hw_port_mac_mode_get()
1122 *mode = __le32_to_cpu(resp.param.link_evt.mac.mode); in prestera_hw_port_mac_mode_get()
1125 *speed = __le32_to_cpu(resp.param.link_evt.mac.speed); in prestera_hw_port_mac_mode_get()
1128 *duplex = resp.param.link_evt.mac.duplex; in prestera_hw_port_mac_mode_get()
1131 *fec = resp.param.link_evt.mac.fec; in prestera_hw_port_mac_mode_get()
1137 bool admin, u32 mode, u8 inband, in prestera_hw_port_mac_mode_set() argument
1142 .port = __cpu_to_le32(port->hw_id), in prestera_hw_port_mac_mode_set()
1143 .dev = __cpu_to_le32(port->dev_id), in prestera_hw_port_mac_mode_set()
1146 .mac = { in prestera_hw_port_mac_mode_set()
1148 .reg_mode.mode = __cpu_to_le32(mode), in prestera_hw_port_mac_mode_set()
1158 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET, in prestera_hw_port_mac_mode_set()
1169 .port = __cpu_to_le32(port->hw_id), in prestera_hw_port_phy_mode_get()
1170 .dev = __cpu_to_le32(port->dev_id) in prestera_hw_port_phy_mode_get()
1174 err = prestera_cmd_ret(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_GET, in prestera_hw_port_phy_mode_get()
1193 bool admin, bool adv, u32 mode, u64 modes, in prestera_hw_port_phy_mode_set() argument
1198 .port = __cpu_to_le32(port->hw_id), in prestera_hw_port_phy_mode_set()
1199 .dev = __cpu_to_le32(port->dev_id), in prestera_hw_port_phy_mode_set()
1205 .mode = __cpu_to_le32(mode), in prestera_hw_port_phy_mode_set()
1214 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET, in prestera_hw_port_phy_mode_set()
1222 .port = __cpu_to_le32(port->hw_id), in prestera_hw_port_mtu_set()
1223 .dev = __cpu_to_le32(port->dev_id), in prestera_hw_port_mtu_set()
1229 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET, in prestera_hw_port_mtu_set()
1233 int prestera_hw_port_mac_set(const struct prestera_port *port, const char *mac) in prestera_hw_port_mac_set() argument
1237 .port = __cpu_to_le32(port->hw_id), in prestera_hw_port_mac_set()
1238 .dev = __cpu_to_le32(port->dev_id), in prestera_hw_port_mac_set()
1241 ether_addr_copy(req.param.mac, mac); in prestera_hw_port_mac_set()
1243 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET, in prestera_hw_port_mac_set()
1252 .port = __cpu_to_le32(port->hw_id), in prestera_hw_port_accept_frm_type()
1253 .dev = __cpu_to_le32(port->dev_id), in prestera_hw_port_accept_frm_type()
1259 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET, in prestera_hw_port_accept_frm_type()
1268 .port = __cpu_to_le32(port->hw_id), in prestera_hw_port_cap_get()
1269 .dev = __cpu_to_le32(port->dev_id), in prestera_hw_port_cap_get()
1274 err = prestera_cmd_ret(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_GET, in prestera_hw_port_cap_get()
1279 caps->supp_link_modes = __le64_to_cpu(resp.param.cap.link_mode); in prestera_hw_port_cap_get()
1280 caps->transceiver = resp.param.cap.transceiver; in prestera_hw_port_cap_get()
1281 caps->supp_fec = resp.param.cap.fec; in prestera_hw_port_cap_get()
1282 caps->type = resp.param.cap.type; in prestera_hw_port_cap_get()
1347 action->id = __cpu_to_le32(info->id); in prestera_acl_rule_add_put_action()
1349 switch (info->id) { in prestera_acl_rule_add_put_action()
1356 action->jump.index = __cpu_to_le32(info->jump.index); in prestera_acl_rule_add_put_action()
1359 action->police.id = __cpu_to_le32(info->police.id); in prestera_acl_rule_add_put_action()
1362 action->count.id = __cpu_to_le32(info->count.id); in prestera_acl_rule_add_put_action()
1365 return -EINVAL; in prestera_acl_rule_add_put_action()
1385 return -ENOMEM; in prestera_hw_vtcam_rule_add()
1387 req->n_act = __cpu_to_le32(n_act); in prestera_hw_vtcam_rule_add()
1390 memcpy(req->key, key, sizeof(req->key)); in prestera_hw_vtcam_rule_add()
1391 memcpy(req->keymask, keymask, sizeof(req->keymask)); in prestera_hw_vtcam_rule_add()
1395 err = prestera_acl_rule_add_put_action(&req->actions_msg[i], in prestera_hw_vtcam_rule_add()
1401 req->vtcam_id = __cpu_to_le32(vtcam_id); in prestera_hw_vtcam_rule_add()
1402 req->prio = __cpu_to_le32(prio); in prestera_hw_vtcam_rule_add()
1405 &req->cmd, size, &resp.ret, sizeof(resp)); in prestera_hw_vtcam_rule_add()
1433 .type = __cpu_to_le16(iface->type), in prestera_hw_vtcam_iface_bind()
1437 if (iface->type == PRESTERA_ACL_IFACE_TYPE_PORT) { in prestera_hw_vtcam_iface_bind()
1438 req.port.dev_id = __cpu_to_le32(iface->port->dev_id); in prestera_hw_vtcam_iface_bind()
1439 req.port.hw_id = __cpu_to_le32(iface->port->hw_id); in prestera_hw_vtcam_iface_bind()
1441 req.index = __cpu_to_le32(iface->index); in prestera_hw_vtcam_iface_bind()
1454 .type = __cpu_to_le16(iface->type) in prestera_hw_vtcam_iface_unbind()
1457 if (iface->type == PRESTERA_ACL_IFACE_TYPE_PORT) { in prestera_hw_vtcam_iface_unbind()
1458 req.port.dev_id = __cpu_to_le32(iface->port->dev_id); in prestera_hw_vtcam_iface_unbind()
1459 req.port.hw_id = __cpu_to_le32(iface->port->hw_id); in prestera_hw_vtcam_iface_unbind()
1461 req.index = __cpu_to_le32(iface->index); in prestera_hw_vtcam_iface_unbind()
1472 .port = __cpu_to_le32(port->hw_id), in prestera_hw_span_get()
1473 .dev = __cpu_to_le32(port->dev_id), in prestera_hw_span_get()
1477 err = prestera_cmd_ret(port->sw, PRESTERA_CMD_TYPE_SPAN_GET, in prestera_hw_span_get()
1491 .port = __cpu_to_le32(port->hw_id), in prestera_hw_span_bind()
1492 .dev = __cpu_to_le32(port->dev_id), in prestera_hw_span_bind()
1502 return prestera_cmd(port->sw, cmd_type, &req.cmd, sizeof(req)); in prestera_hw_span_bind()
1509 .port = __cpu_to_le32(port->hw_id), in prestera_hw_span_unbind()
1510 .dev = __cpu_to_le32(port->dev_id), in prestera_hw_span_unbind()
1519 return prestera_cmd(port->sw, cmd_type, &req.cmd, sizeof(req)); in prestera_hw_span_unbind()
1536 .port = __cpu_to_le32(port->hw_id), in prestera_hw_port_type_get()
1537 .dev = __cpu_to_le32(port->dev_id), in prestera_hw_port_type_get()
1542 err = prestera_cmd_ret(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_GET, in prestera_hw_port_type_get()
1556 .port = __cpu_to_le32(port->hw_id), in prestera_hw_port_speed_get()
1557 .dev = __cpu_to_le32(port->dev_id), in prestera_hw_port_speed_get()
1562 err = prestera_cmd_ret(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_GET, in prestera_hw_port_speed_get()
1577 .port = __cpu_to_le32(port->hw_id), in prestera_hw_port_autoneg_restart()
1578 .dev = __cpu_to_le32(port->dev_id), in prestera_hw_port_autoneg_restart()
1581 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET, in prestera_hw_port_autoneg_restart()
1590 .port = __cpu_to_le32(port->hw_id), in prestera_hw_port_stats_get()
1591 .dev = __cpu_to_le32(port->dev_id), in prestera_hw_port_stats_get()
1597 err = prestera_cmd_ret(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_GET, in prestera_hw_port_stats_get()
1602 st->good_octets_received = in prestera_hw_port_stats_get()
1604 st->bad_octets_received = in prestera_hw_port_stats_get()
1606 st->mac_trans_error = in prestera_hw_port_stats_get()
1608 st->broadcast_frames_received = in prestera_hw_port_stats_get()
1610 st->multicast_frames_received = in prestera_hw_port_stats_get()
1612 st->frames_64_octets = __le64_to_cpu(hw[PRESTERA_PORT_PKTS_64L_CNT]); in prestera_hw_port_stats_get()
1613 st->frames_65_to_127_octets = in prestera_hw_port_stats_get()
1615 st->frames_128_to_255_octets = in prestera_hw_port_stats_get()
1617 st->frames_256_to_511_octets = in prestera_hw_port_stats_get()
1619 st->frames_512_to_1023_octets = in prestera_hw_port_stats_get()
1621 st->frames_1024_to_max_octets = in prestera_hw_port_stats_get()
1623 st->excessive_collision = in prestera_hw_port_stats_get()
1625 st->multicast_frames_sent = in prestera_hw_port_stats_get()
1627 st->broadcast_frames_sent = in prestera_hw_port_stats_get()
1629 st->fc_sent = __le64_to_cpu(hw[PRESTERA_PORT_FC_SENT_CNT]); in prestera_hw_port_stats_get()
1630 st->fc_received = __le64_to_cpu(hw[PRESTERA_PORT_GOOD_FC_RCV_CNT]); in prestera_hw_port_stats_get()
1631 st->buffer_overrun = __le64_to_cpu(hw[PRESTERA_PORT_DROP_EVENTS_CNT]); in prestera_hw_port_stats_get()
1632 st->undersize = __le64_to_cpu(hw[PRESTERA_PORT_UNDERSIZE_PKTS_CNT]); in prestera_hw_port_stats_get()
1633 st->fragments = __le64_to_cpu(hw[PRESTERA_PORT_FRAGMENTS_PKTS_CNT]); in prestera_hw_port_stats_get()
1634 st->oversize = __le64_to_cpu(hw[PRESTERA_PORT_OVERSIZE_PKTS_CNT]); in prestera_hw_port_stats_get()
1635 st->jabber = __le64_to_cpu(hw[PRESTERA_PORT_JABBER_PKTS_CNT]); in prestera_hw_port_stats_get()
1636 st->rx_error_frame_received = in prestera_hw_port_stats_get()
1638 st->bad_crc = __le64_to_cpu(hw[PRESTERA_PORT_BAD_CRC_CNT]); in prestera_hw_port_stats_get()
1639 st->collisions = __le64_to_cpu(hw[PRESTERA_PORT_COLLISIONS_CNT]); in prestera_hw_port_stats_get()
1640 st->late_collision = in prestera_hw_port_stats_get()
1642 st->unicast_frames_received = in prestera_hw_port_stats_get()
1644 st->unicast_frames_sent = in prestera_hw_port_stats_get()
1646 st->sent_multiple = in prestera_hw_port_stats_get()
1648 st->sent_deferred = in prestera_hw_port_stats_get()
1650 st->good_octets_sent = in prestera_hw_port_stats_get()
1660 .port = __cpu_to_le32(port->hw_id), in prestera_hw_port_learning_set()
1661 .dev = __cpu_to_le32(port->dev_id), in prestera_hw_port_learning_set()
1667 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET, in prestera_hw_port_learning_set()
1675 .port = __cpu_to_le32(port->hw_id), in prestera_hw_port_uc_flood_set()
1676 .dev = __cpu_to_le32(port->dev_id), in prestera_hw_port_uc_flood_set()
1685 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET, in prestera_hw_port_uc_flood_set()
1693 .port = __cpu_to_le32(port->hw_id), in prestera_hw_port_mc_flood_set()
1694 .dev = __cpu_to_le32(port->dev_id), in prestera_hw_port_mc_flood_set()
1703 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET, in prestera_hw_port_mc_flood_set()
1712 .port = __cpu_to_le32(port->hw_id), in prestera_hw_port_br_locked_set()
1713 .dev = __cpu_to_le32(port->dev_id), in prestera_hw_port_br_locked_set()
1719 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET, in prestera_hw_port_br_locked_set()
1747 .port = __cpu_to_le32(port->hw_id), in prestera_hw_vlan_port_set()
1748 .dev = __cpu_to_le32(port->dev_id), in prestera_hw_vlan_port_set()
1754 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_VLAN_PORT_SET, in prestera_hw_vlan_port_set()
1761 .port = __cpu_to_le32(port->hw_id), in prestera_hw_vlan_port_vid_set()
1762 .dev = __cpu_to_le32(port->dev_id), in prestera_hw_vlan_port_vid_set()
1766 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_VLAN_PVID_SET, in prestera_hw_vlan_port_vid_set()
1773 .port = __cpu_to_le32(port->hw_id), in prestera_hw_vlan_port_stp_set()
1774 .dev = __cpu_to_le32(port->dev_id), in prestera_hw_vlan_port_stp_set()
1779 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_STP_PORT_SET, in prestera_hw_vlan_port_stp_set()
1783 int prestera_hw_fdb_add(struct prestera_port *port, const unsigned char *mac, in prestera_hw_fdb_add() argument
1788 .dev = __cpu_to_le32(port->dev_id), in prestera_hw_fdb_add()
1789 .port = __cpu_to_le32(port->hw_id), in prestera_hw_fdb_add()
1795 ether_addr_copy(req.mac, mac); in prestera_hw_fdb_add()
1797 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_FDB_ADD, in prestera_hw_fdb_add()
1801 int prestera_hw_fdb_del(struct prestera_port *port, const unsigned char *mac, in prestera_hw_fdb_del() argument
1806 .dev = __cpu_to_le32(port->dev_id), in prestera_hw_fdb_del()
1807 .port = __cpu_to_le32(port->hw_id), in prestera_hw_fdb_del()
1812 ether_addr_copy(req.mac, mac); in prestera_hw_fdb_del()
1814 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_FDB_DELETE, in prestera_hw_fdb_del()
1819 const unsigned char *mac, u16 vid, bool dynamic) in prestera_hw_lag_fdb_add() argument
1830 ether_addr_copy(req.mac, mac); in prestera_hw_lag_fdb_add()
1837 const unsigned char *mac, u16 vid) in prestera_hw_lag_fdb_del() argument
1847 ether_addr_copy(req.mac, mac); in prestera_hw_lag_fdb_del()
1853 int prestera_hw_fdb_flush_port(struct prestera_port *port, u32 mode) in prestera_hw_fdb_flush_port() argument
1857 .dev = __cpu_to_le32(port->dev_id), in prestera_hw_fdb_flush_port()
1858 .port = __cpu_to_le32(port->hw_id), in prestera_hw_fdb_flush_port()
1860 .flush_mode = __cpu_to_le32(mode), in prestera_hw_fdb_flush_port()
1863 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_FDB_FLUSH_PORT, in prestera_hw_fdb_flush_port()
1867 int prestera_hw_fdb_flush_vlan(struct prestera_switch *sw, u16 vid, u32 mode) in prestera_hw_fdb_flush_vlan() argument
1871 .flush_mode = __cpu_to_le32(mode), in prestera_hw_fdb_flush_vlan()
1879 u32 mode) in prestera_hw_fdb_flush_port_vlan() argument
1883 .dev = __cpu_to_le32(port->dev_id), in prestera_hw_fdb_flush_port_vlan()
1884 .port = __cpu_to_le32(port->hw_id), in prestera_hw_fdb_flush_port_vlan()
1887 .flush_mode = __cpu_to_le32(mode), in prestera_hw_fdb_flush_port_vlan()
1890 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_FDB_FLUSH_PORT_VLAN, in prestera_hw_fdb_flush_port_vlan()
1895 u32 mode) in prestera_hw_fdb_flush_lag() argument
1902 .flush_mode = __cpu_to_le32(mode), in prestera_hw_fdb_flush_lag()
1910 u16 lag_id, u16 vid, u32 mode) in prestera_hw_fdb_flush_lag_vlan() argument
1918 .flush_mode = __cpu_to_le32(mode), in prestera_hw_fdb_flush_lag_vlan()
1956 .port = __cpu_to_le32(port->hw_id), in prestera_hw_bridge_port_add()
1957 .dev = __cpu_to_le32(port->dev_id), in prestera_hw_bridge_port_add()
1960 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_BRIDGE_PORT_ADD, in prestera_hw_bridge_port_add()
1968 .port = __cpu_to_le32(port->hw_id), in prestera_hw_bridge_port_delete()
1969 .dev = __cpu_to_le32(port->dev_id), in prestera_hw_bridge_port_delete()
1972 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_BRIDGE_PORT_DELETE, in prestera_hw_bridge_port_delete()
1979 switch (iface->type) { in prestera_iface_to_msg()
1982 msg_if->port = __cpu_to_le32(iface->dev_port.port_num); in prestera_iface_to_msg()
1983 msg_if->dev = __cpu_to_le32(iface->dev_port.hw_dev_num); in prestera_iface_to_msg()
1986 msg_if->lag_id = __cpu_to_le16(iface->lag_id); in prestera_iface_to_msg()
1989 return -EOPNOTSUPP; in prestera_iface_to_msg()
1992 msg_if->vr_id = __cpu_to_le16(iface->vr_id); in prestera_iface_to_msg()
1993 msg_if->vid = __cpu_to_le16(iface->vlan_id); in prestera_iface_to_msg()
1994 msg_if->type = iface->type; in prestera_iface_to_msg()
1999 struct prestera_iface *iif, u8 *mac, u16 *rif_id) in prestera_hw_rif_create() argument
2005 memcpy(req.mac, mac, ETH_ALEN); in prestera_hw_rif_create()
2097 memcpy(&req.nh[i].mac, nhs[i].ha, ETH_ALEN); in prestera_hw_nh_entries_set()
2132 buf_size - buf_offset : PRESTERA_MSG_CHUNK_SIZE); in prestera_hw_nhgrp_blk_get()
2174 req.use_sdma = params->use_sdma; in prestera_hw_rxtx_init()
2181 params->map_addr = __le32_to_cpu(resp.map_addr); in prestera_hw_rxtx_init()
2189 .port = __cpu_to_le32(port->hw_id), in prestera_hw_lag_member_add()
2190 .dev = __cpu_to_le32(port->dev_id), in prestera_hw_lag_member_add()
2194 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_LAG_MEMBER_ADD, in prestera_hw_lag_member_add()
2201 .port = __cpu_to_le32(port->hw_id), in prestera_hw_lag_member_del()
2202 .dev = __cpu_to_le32(port->dev_id), in prestera_hw_lag_member_del()
2206 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_LAG_MEMBER_DELETE, in prestera_hw_lag_member_del()
2214 .port = __cpu_to_le32(port->hw_id), in prestera_hw_lag_member_enable()
2215 .dev = __cpu_to_le32(port->dev_id), in prestera_hw_lag_member_enable()
2223 return prestera_cmd(port->sw, cmd, &req.cmd, sizeof(req)); in prestera_hw_lag_member_enable()
2257 return -EEXIST; in prestera_hw_event_handler_register()
2261 return -ENOMEM; in prestera_hw_event_handler_register()
2263 eh->type = type; in prestera_hw_event_handler_register()
2264 eh->func = fn; in prestera_hw_event_handler_register()
2265 eh->arg = arg; in prestera_hw_event_handler_register()
2267 INIT_LIST_HEAD(&eh->list); in prestera_hw_event_handler_register()
2269 list_add_rcu(&eh->list, &sw->event_handlers); in prestera_hw_event_handler_register()
2284 list_del_rcu(&eh->list); in prestera_hw_event_handler_unregister()
2320 return -ENOMEM; in prestera_hw_counters_get()
2323 &req.cmd, sizeof(req), &resp->ret, size); in prestera_hw_counters_get()
2327 for (i = 0; i < __le32_to_cpu(resp->num_counters); i++) { in prestera_hw_counters_get()
2328 stats[i].packets += __le64_to_cpu(resp->stats[i].packets); in prestera_hw_counters_get()
2329 stats[i].bytes += __le64_to_cpu(resp->stats[i].bytes); in prestera_hw_counters_get()
2332 *len = __le32_to_cpu(resp->num_counters); in prestera_hw_counters_get()
2333 *done = __le32_to_cpu(resp->done); in prestera_hw_counters_get()
2418 .mode = PRESTERA_POLICER_MODE_SR_TCM, in prestera_hw_policer_sr_tcm_set()
2436 err = prestera_cmd_ret(domain->sw, in prestera_hw_flood_domain_create()
2442 domain->idx = __le32_to_cpu(resp.flood_domain_idx); in prestera_hw_flood_domain_create()
2450 .flood_domain_idx = __cpu_to_le32(domain->idx), in prestera_hw_flood_domain_destroy()
2453 return prestera_cmd(domain->sw, PRESTERA_CMD_TYPE_FLOOD_DOMAIN_DESTROY, in prestera_hw_flood_domain_destroy()
2461 struct prestera_switch *sw = domain->sw; in prestera_hw_flood_domain_ports_set()
2469 list_for_each_entry(flood_domain_port, &domain->flood_domain_port_list, in prestera_hw_flood_domain_ports_set()
2474 return -EINVAL; in prestera_hw_flood_domain_ports_set()
2479 return -ENOMEM; in prestera_hw_flood_domain_ports_set()
2481 req->flood_domain_idx = __cpu_to_le32(domain->idx); in prestera_hw_flood_domain_ports_set()
2482 req->ports_num = __cpu_to_le32(ports_num); in prestera_hw_flood_domain_ports_set()
2484 list_for_each_entry(flood_domain_port, &domain->flood_domain_port_list, in prestera_hw_flood_domain_ports_set()
2486 if (netif_is_lag_master(flood_domain_port->dev)) { in prestera_hw_flood_domain_ports_set()
2487 if (prestera_lag_id(sw, flood_domain_port->dev, in prestera_hw_flood_domain_ports_set()
2490 return -EINVAL; in prestera_hw_flood_domain_ports_set()
2493 req->ports[i].port_type = in prestera_hw_flood_domain_ports_set()
2495 req->ports[i].lag_id = __cpu_to_le16(lag_id); in prestera_hw_flood_domain_ports_set()
2497 port = prestera_port_dev_lower_find(flood_domain_port->dev); in prestera_hw_flood_domain_ports_set()
2499 req->ports[i].port_type = in prestera_hw_flood_domain_ports_set()
2501 req->ports[i].dev_num = __cpu_to_le32(port->dev_id); in prestera_hw_flood_domain_ports_set()
2502 req->ports[i].port_num = __cpu_to_le32(port->hw_id); in prestera_hw_flood_domain_ports_set()
2505 req->ports[i].vid = __cpu_to_le16(flood_domain_port->vid); in prestera_hw_flood_domain_ports_set()
2510 &req->cmd, buf_size); in prestera_hw_flood_domain_ports_set()
2520 .flood_domain_idx = __cpu_to_le32(domain->idx), in prestera_hw_flood_domain_ports_reset()
2523 return prestera_cmd(domain->sw, in prestera_hw_flood_domain_ports_reset()
2531 .flood_domain_idx = __cpu_to_le32(mdb->flood_domain->idx), in prestera_hw_mdb_create()
2532 .vid = __cpu_to_le16(mdb->vid), in prestera_hw_mdb_create()
2535 memcpy(req.mac, mdb->addr, ETH_ALEN); in prestera_hw_mdb_create()
2537 return prestera_cmd(mdb->sw, PRESTERA_CMD_TYPE_MDB_CREATE, &req.cmd, in prestera_hw_mdb_create()
2544 .flood_domain_idx = __cpu_to_le32(mdb->flood_domain->idx), in prestera_hw_mdb_destroy()
2545 .vid = __cpu_to_le16(mdb->vid), in prestera_hw_mdb_destroy()
2548 memcpy(req.mac, mdb->addr, ETH_ALEN); in prestera_hw_mdb_destroy()
2550 return prestera_cmd(mdb->sw, PRESTERA_CMD_TYPE_MDB_DESTROY, &req.cmd, in prestera_hw_mdb_destroy()