Lines Matching refs:mlxsw_sp

66 	struct mlxsw_sp *mlxsw_sp;  member
136 err = mlxsw_sp_ipv6_addr_kvdl_index_get(mc_record->mlxsw_sp, in mlxsw_sp_nve_mc_record_ipv6_entry_add()
150 mlxsw_sp_ipv6_addr_put(mc_record->mlxsw_sp, in mlxsw_sp_nve_mc_record_ipv6_entry_del()
187 int mlxsw_sp_nve_learned_ip_resolve(struct mlxsw_sp *mlxsw_sp, u32 uip, in mlxsw_sp_nve_learned_ip_resolve() argument
202 mlxsw_sp_nve_mc_list_find(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_nve_mc_list_find() argument
205 struct mlxsw_sp_nve *nve = mlxsw_sp->nve; in mlxsw_sp_nve_mc_list_find()
212 mlxsw_sp_nve_mc_list_create(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_nve_mc_list_create() argument
215 struct mlxsw_sp_nve *nve = mlxsw_sp->nve; in mlxsw_sp_nve_mc_list_create()
238 static void mlxsw_sp_nve_mc_list_destroy(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_nve_mc_list_destroy() argument
241 struct mlxsw_sp_nve *nve = mlxsw_sp->nve; in mlxsw_sp_nve_mc_list_destroy()
250 mlxsw_sp_nve_mc_list_get(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_nve_mc_list_get() argument
255 mc_list = mlxsw_sp_nve_mc_list_find(mlxsw_sp, key); in mlxsw_sp_nve_mc_list_get()
259 return mlxsw_sp_nve_mc_list_create(mlxsw_sp, key); in mlxsw_sp_nve_mc_list_get()
263 mlxsw_sp_nve_mc_list_put(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_nve_mc_list_put() argument
268 mlxsw_sp_nve_mc_list_destroy(mlxsw_sp, mc_list); in mlxsw_sp_nve_mc_list_put()
272 mlxsw_sp_nve_mc_record_create(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_nve_mc_record_create() argument
276 unsigned int num_max_entries = mlxsw_sp->nve->num_max_mc_entries[proto]; in mlxsw_sp_nve_mc_record_create()
285 err = mlxsw_sp_kvdl_alloc(mlxsw_sp, MLXSW_SP_KVDL_ENTRY_TYPE_TNUMT, 1, in mlxsw_sp_nve_mc_record_create()
291 mc_record->mlxsw_sp = mlxsw_sp; in mlxsw_sp_nve_mc_record_create()
306 struct mlxsw_sp *mlxsw_sp = mc_record->mlxsw_sp; in mlxsw_sp_nve_mc_record_destroy() local
309 mlxsw_sp_kvdl_free(mlxsw_sp, MLXSW_SP_KVDL_ENTRY_TYPE_TNUMT, 1, in mlxsw_sp_nve_mc_record_destroy()
316 mlxsw_sp_nve_mc_record_get(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_nve_mc_record_get() argument
324 struct mlxsw_sp_nve *nve = mlxsw_sp->nve; in mlxsw_sp_nve_mc_record_get()
331 return mlxsw_sp_nve_mc_record_create(mlxsw_sp, mc_list, proto); in mlxsw_sp_nve_mc_record_get()
346 struct mlxsw_sp_nve *nve = mc_record->mlxsw_sp->nve; in mlxsw_sp_nve_mc_free_entry_find()
365 struct mlxsw_sp *mlxsw_sp = mc_record->mlxsw_sp; in mlxsw_sp_nve_mc_record_refresh() local
385 num_max_entries = mlxsw_sp->nve->num_max_mc_entries[mc_record->proto]; in mlxsw_sp_nve_mc_record_refresh()
398 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(tnumt), tnumt_pl); in mlxsw_sp_nve_mc_record_refresh()
417 struct mlxsw_sp_nve *nve = mc_record->mlxsw_sp->nve; in mlxsw_sp_nve_mc_entry_find()
554 static int mlxsw_sp_nve_mc_list_ip_add(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_nve_mc_list_ip_add() argument
562 mc_record = mlxsw_sp_nve_mc_record_get(mlxsw_sp, mc_list, proto); in mlxsw_sp_nve_mc_list_ip_add()
577 static void mlxsw_sp_nve_mc_list_ip_del(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_nve_mc_list_ip_del() argument
633 int mlxsw_sp_nve_flood_ip_add(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_nve_flood_ip_add() argument
643 mc_list = mlxsw_sp_nve_mc_list_get(mlxsw_sp, &key); in mlxsw_sp_nve_flood_ip_add()
647 err = mlxsw_sp_nve_mc_list_ip_add(mlxsw_sp, mc_list, proto, addr); in mlxsw_sp_nve_flood_ip_add()
658 mlxsw_sp_nve_mc_list_ip_del(mlxsw_sp, mc_list, proto, addr); in mlxsw_sp_nve_flood_ip_add()
660 mlxsw_sp_nve_mc_list_put(mlxsw_sp, mc_list); in mlxsw_sp_nve_flood_ip_add()
664 void mlxsw_sp_nve_flood_ip_del(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_nve_flood_ip_del() argument
673 mc_list = mlxsw_sp_nve_mc_list_find(mlxsw_sp, &key); in mlxsw_sp_nve_flood_ip_del()
678 mlxsw_sp_nve_mc_list_ip_del(mlxsw_sp, mc_list, proto, addr); in mlxsw_sp_nve_flood_ip_del()
679 mlxsw_sp_nve_mc_list_put(mlxsw_sp, mc_list); in mlxsw_sp_nve_flood_ip_del()
685 struct mlxsw_sp_nve *nve = mc_record->mlxsw_sp->nve; in mlxsw_sp_nve_mc_record_delete()
702 static void mlxsw_sp_nve_flood_ip_flush(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_nve_flood_ip_flush() argument
715 mc_list = mlxsw_sp_nve_mc_list_find(mlxsw_sp, &key); in mlxsw_sp_nve_flood_ip_flush()
723 mlxsw_sp_nve_mc_list_put(mlxsw_sp, mc_list); in mlxsw_sp_nve_flood_ip_flush()
726 static int mlxsw_sp_nve_tunnel_init(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_nve_tunnel_init() argument
729 struct mlxsw_sp_nve *nve = mlxsw_sp->nve; in mlxsw_sp_nve_tunnel_init()
738 err = mlxsw_sp_kvdl_alloc(mlxsw_sp, MLXSW_SP_KVDL_ENTRY_TYPE_ADJ, 1, in mlxsw_sp_nve_tunnel_init()
751 mlxsw_sp_kvdl_free(mlxsw_sp, MLXSW_SP_KVDL_ENTRY_TYPE_ADJ, 1, in mlxsw_sp_nve_tunnel_init()
759 static void mlxsw_sp_nve_tunnel_fini(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_nve_tunnel_fini() argument
761 struct mlxsw_sp_nve *nve = mlxsw_sp->nve; in mlxsw_sp_nve_tunnel_fini()
766 if (mlxsw_sp->nve->num_nve_tunnels == 1) { in mlxsw_sp_nve_tunnel_fini()
768 mlxsw_sp_kvdl_free(mlxsw_sp, MLXSW_SP_KVDL_ENTRY_TYPE_ADJ, 1, in mlxsw_sp_nve_tunnel_fini()
775 static void mlxsw_sp_nve_fdb_flush_by_fid(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_nve_fdb_flush_by_fid() argument
782 mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sfdf), sfdf_pl); in mlxsw_sp_nve_fdb_flush_by_fid()
785 static void mlxsw_sp_nve_fdb_clear_offload(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_nve_fdb_clear_offload() argument
796 ops = mlxsw_sp->nve->nve_ops_arr[type]; in mlxsw_sp_nve_fdb_clear_offload()
818 int mlxsw_sp_nve_ipv6_addr_kvdl_set(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_nve_ipv6_addr_kvdl_set() argument
822 return mlxsw_sp_ipv6_addr_kvdl_index_get(mlxsw_sp, addr6, p_kvdl_index); in mlxsw_sp_nve_ipv6_addr_kvdl_set()
825 void mlxsw_sp_nve_ipv6_addr_kvdl_unset(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_nve_ipv6_addr_kvdl_unset() argument
828 mlxsw_sp_ipv6_addr_put(mlxsw_sp, addr6); in mlxsw_sp_nve_ipv6_addr_kvdl_unset()
832 mlxsw_sp_nve_ipv6_ht_node_lookup(struct mlxsw_sp *mlxsw_sp, const char *mac, in mlxsw_sp_nve_ipv6_ht_node_lookup() argument
839 return rhashtable_lookup_fast(&mlxsw_sp->nve->ipv6_ht, &key, in mlxsw_sp_nve_ipv6_ht_node_lookup()
843 static int mlxsw_sp_nve_ipv6_ht_insert(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_nve_ipv6_ht_insert() argument
848 struct mlxsw_sp_nve *nve = mlxsw_sp->nve; in mlxsw_sp_nve_ipv6_ht_insert()
874 mlxsw_sp_nve_ipv6_ht_remove(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_nve_ipv6_ht_remove() argument
877 struct mlxsw_sp_nve *nve = mlxsw_sp->nve; in mlxsw_sp_nve_ipv6_ht_remove()
886 mlxsw_sp_nve_ipv6_addr_map_replace(struct mlxsw_sp *mlxsw_sp, const char *mac, in mlxsw_sp_nve_ipv6_addr_map_replace() argument
894 ipv6_ht_node = mlxsw_sp_nve_ipv6_ht_node_lookup(mlxsw_sp, mac, in mlxsw_sp_nve_ipv6_addr_map_replace()
897 return mlxsw_sp_nve_ipv6_ht_insert(mlxsw_sp, mac, fid_index, in mlxsw_sp_nve_ipv6_addr_map_replace()
900 mlxsw_sp_ipv6_addr_put(mlxsw_sp, &ipv6_ht_node->addr6); in mlxsw_sp_nve_ipv6_addr_map_replace()
905 void mlxsw_sp_nve_ipv6_addr_map_del(struct mlxsw_sp *mlxsw_sp, const char *mac, in mlxsw_sp_nve_ipv6_addr_map_del() argument
912 ipv6_ht_node = mlxsw_sp_nve_ipv6_ht_node_lookup(mlxsw_sp, mac, in mlxsw_sp_nve_ipv6_addr_map_del()
917 mlxsw_sp_nve_ipv6_ht_remove(mlxsw_sp, ipv6_ht_node); in mlxsw_sp_nve_ipv6_addr_map_del()
920 static void mlxsw_sp_nve_ipv6_addr_flush_by_fid(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_nve_ipv6_addr_flush_by_fid() argument
924 struct mlxsw_sp_nve *nve = mlxsw_sp->nve; in mlxsw_sp_nve_ipv6_addr_flush_by_fid()
931 mlxsw_sp_ipv6_addr_put(mlxsw_sp, &ipv6_ht_node->addr6); in mlxsw_sp_nve_ipv6_addr_flush_by_fid()
932 mlxsw_sp_nve_ipv6_ht_remove(mlxsw_sp, ipv6_ht_node); in mlxsw_sp_nve_ipv6_addr_flush_by_fid()
936 int mlxsw_sp_nve_fid_enable(struct mlxsw_sp *mlxsw_sp, struct mlxsw_sp_fid *fid, in mlxsw_sp_nve_fid_enable() argument
940 struct mlxsw_sp_nve *nve = mlxsw_sp->nve; in mlxsw_sp_nve_fid_enable()
958 err = mlxsw_sp_nve_tunnel_init(mlxsw_sp, &config); in mlxsw_sp_nve_fid_enable()
980 mlxsw_sp_nve_tunnel_fini(mlxsw_sp); in mlxsw_sp_nve_fid_enable()
984 void mlxsw_sp_nve_fid_disable(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_nve_fid_disable() argument
992 mlxsw_sp_nve_flood_ip_flush(mlxsw_sp, fid); in mlxsw_sp_nve_fid_disable()
993 mlxsw_sp_nve_fdb_flush_by_fid(mlxsw_sp, fid_index); in mlxsw_sp_nve_fid_disable()
994 mlxsw_sp_nve_ipv6_addr_flush_by_fid(mlxsw_sp, fid_index); in mlxsw_sp_nve_fid_disable()
1000 nve_dev = dev_get_by_index(mlxsw_sp_net(mlxsw_sp), nve_ifindex); in mlxsw_sp_nve_fid_disable()
1004 mlxsw_sp_nve_fdb_clear_offload(mlxsw_sp, fid, nve_dev, vni); in mlxsw_sp_nve_fid_disable()
1011 mlxsw_sp_nve_tunnel_fini(mlxsw_sp); in mlxsw_sp_nve_fid_disable()
1016 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_nve_init() local
1020 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(tnqdr), tnqdr_pl); in mlxsw_sp_port_nve_init()
1027 static int mlxsw_sp_nve_qos_init(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_nve_qos_init() argument
1032 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(tnqcr), tnqcr_pl); in mlxsw_sp_nve_qos_init()
1035 static int mlxsw_sp_nve_ecn_encap_init(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_nve_ecn_encap_init() argument
1046 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(tneem), in mlxsw_sp_nve_ecn_encap_init()
1055 static int __mlxsw_sp_nve_ecn_decap_init(struct mlxsw_sp *mlxsw_sp, in __mlxsw_sp_nve_ecn_decap_init() argument
1066 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(tndem), tndem_pl); in __mlxsw_sp_nve_ecn_decap_init()
1069 static int mlxsw_sp_nve_ecn_decap_init(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_nve_ecn_decap_init() argument
1081 err = __mlxsw_sp_nve_ecn_decap_init(mlxsw_sp, i, j); in mlxsw_sp_nve_ecn_decap_init()
1090 static int mlxsw_sp_nve_ecn_init(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_nve_ecn_init() argument
1094 err = mlxsw_sp_nve_ecn_encap_init(mlxsw_sp); in mlxsw_sp_nve_ecn_init()
1098 return mlxsw_sp_nve_ecn_decap_init(mlxsw_sp); in mlxsw_sp_nve_ecn_init()
1101 static int mlxsw_sp_nve_resources_query(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_nve_resources_query() argument
1105 if (!MLXSW_CORE_RES_VALID(mlxsw_sp->core, MAX_NVE_MC_ENTRIES_IPV4) || in mlxsw_sp_nve_resources_query()
1106 !MLXSW_CORE_RES_VALID(mlxsw_sp->core, MAX_NVE_MC_ENTRIES_IPV6)) in mlxsw_sp_nve_resources_query()
1108 max = MLXSW_CORE_RES_GET(mlxsw_sp->core, MAX_NVE_MC_ENTRIES_IPV4); in mlxsw_sp_nve_resources_query()
1109 mlxsw_sp->nve->num_max_mc_entries[MLXSW_SP_L3_PROTO_IPV4] = max; in mlxsw_sp_nve_resources_query()
1110 max = MLXSW_CORE_RES_GET(mlxsw_sp->core, MAX_NVE_MC_ENTRIES_IPV6); in mlxsw_sp_nve_resources_query()
1111 mlxsw_sp->nve->num_max_mc_entries[MLXSW_SP_L3_PROTO_IPV6] = max; in mlxsw_sp_nve_resources_query()
1116 int mlxsw_sp_nve_init(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_nve_init() argument
1121 nve = kzalloc(sizeof(*mlxsw_sp->nve), GFP_KERNEL); in mlxsw_sp_nve_init()
1124 mlxsw_sp->nve = nve; in mlxsw_sp_nve_init()
1125 nve->mlxsw_sp = mlxsw_sp; in mlxsw_sp_nve_init()
1126 nve->nve_ops_arr = mlxsw_sp->nve_ops_arr; in mlxsw_sp_nve_init()
1139 err = mlxsw_sp_nve_qos_init(mlxsw_sp); in mlxsw_sp_nve_init()
1143 err = mlxsw_sp_nve_ecn_init(mlxsw_sp); in mlxsw_sp_nve_init()
1147 err = mlxsw_sp_nve_resources_query(mlxsw_sp); in mlxsw_sp_nve_init()
1160 mlxsw_sp->nve = NULL; in mlxsw_sp_nve_init()
1165 void mlxsw_sp_nve_fini(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_nve_fini() argument
1167 WARN_ON(mlxsw_sp->nve->num_nve_tunnels); in mlxsw_sp_nve_fini()
1168 WARN_ON(!list_empty(&mlxsw_sp->nve->ipv6_addr_list)); in mlxsw_sp_nve_fini()
1169 rhashtable_destroy(&mlxsw_sp->nve->ipv6_ht); in mlxsw_sp_nve_fini()
1170 rhashtable_destroy(&mlxsw_sp->nve->mc_list_ht); in mlxsw_sp_nve_fini()
1171 kfree(mlxsw_sp->nve); in mlxsw_sp_nve_fini()
1172 mlxsw_sp->nve = NULL; in mlxsw_sp_nve_fini()