Lines Matching refs:macsec_device

29 static void cleanup_macsec_device(struct mlx5_macsec_device *macsec_device)  in cleanup_macsec_device()  argument
31 if (!list_empty(&macsec_device->tx_rules_list) || in cleanup_macsec_device()
32 !list_empty(&macsec_device->rx_rules_list) || in cleanup_macsec_device()
33 !list_empty(&macsec_device->macsec_roce_gids)) in cleanup_macsec_device()
36 list_del(&macsec_device->macsec_devices_list_entry); in cleanup_macsec_device()
37 kfree(macsec_device); in cleanup_macsec_device()
43 struct mlx5_macsec_device *iter, *macsec_device = NULL; in get_macsec_device() local
47 macsec_device = iter; in get_macsec_device()
52 if (macsec_device) in get_macsec_device()
53 return macsec_device; in get_macsec_device()
55 macsec_device = kzalloc(sizeof(*macsec_device), GFP_KERNEL); in get_macsec_device()
56 if (!macsec_device) in get_macsec_device()
59 macsec_device->macdev = macdev; in get_macsec_device()
60 INIT_LIST_HEAD(&macsec_device->tx_rules_list); in get_macsec_device()
61 INIT_LIST_HEAD(&macsec_device->rx_rules_list); in get_macsec_device()
62 INIT_LIST_HEAD(&macsec_device->macsec_roce_gids); in get_macsec_device()
63 list_add(&macsec_device->macsec_devices_list_entry, macsec_devices_list); in get_macsec_device()
65 return macsec_device; in get_macsec_device()
68 static void mlx5_macsec_del_roce_gid(struct mlx5_macsec_device *macsec_device, u16 gid_idx) in mlx5_macsec_del_roce_gid() argument
72 list_for_each_entry_safe(current_gid, next_gid, &macsec_device->macsec_roce_gids, in mlx5_macsec_del_roce_gid()
80 static void mlx5_macsec_save_roce_gid(struct mlx5_macsec_device *macsec_device, in mlx5_macsec_save_roce_gid() argument
95 list_add_tail(&roce_gids->roce_gid_list_entry, &macsec_device->macsec_roce_gids); in mlx5_macsec_save_roce_gid()
101 struct mlx5_macsec_device *macsec_device; in handle_macsec_gids() local
104 macsec_device = get_macsec_device(data->macdev, macsec_devices_list); in handle_macsec_gids()
105 if (!macsec_device) in handle_macsec_gids()
108 list_for_each_entry(gid, &macsec_device->macsec_roce_gids, roce_gid_list_entry) { in handle_macsec_gids()
110 gid->gid_idx, &macsec_device->tx_rules_list, in handle_macsec_gids()
111 &macsec_device->rx_rules_list, data->macsec_fs, in handle_macsec_gids()
119 struct mlx5_macsec_device *macsec_device; in del_sa_roce_rule() local
121 macsec_device = get_macsec_device(data->macdev, macsec_devices_list); in del_sa_roce_rule()
122 WARN_ON(!macsec_device); in del_sa_roce_rule()
125 &macsec_device->tx_rules_list, in del_sa_roce_rule()
126 &macsec_device->rx_rules_list, data->is_tx); in del_sa_roce_rule()
221 struct mlx5_macsec_device *macsec_device; in mlx5r_add_gid_macsec_operations() local
254 macsec_device = get_macsec_device(ndev, &dev->macsec.macsec_devices_list); in mlx5r_add_gid_macsec_operations()
255 if (!macsec_device) { in mlx5r_add_gid_macsec_operations()
278 &macsec_device->tx_rules_list, in mlx5r_add_gid_macsec_operations()
279 &macsec_device->rx_rules_list, dev->mdev->macsec_fs); in mlx5r_add_gid_macsec_operations()
283 mlx5_macsec_save_roce_gid(macsec_device, (struct sockaddr *)&addr, attr->index); in mlx5r_add_gid_macsec_operations()
295 cleanup_macsec_device(macsec_device); in mlx5r_add_gid_macsec_operations()
305 struct mlx5_macsec_device *macsec_device; in mlx5r_del_gid_macsec_operations() local
356 macsec_device = get_macsec_device(ndev, &dev->macsec.macsec_devices_list); in mlx5r_del_gid_macsec_operations()
358 &macsec_device->tx_rules_list, &macsec_device->rx_rules_list); in mlx5r_del_gid_macsec_operations()
359 mlx5_macsec_del_roce_gid(macsec_device, attr->index); in mlx5r_del_gid_macsec_operations()
360 cleanup_macsec_device(macsec_device); in mlx5r_del_gid_macsec_operations()