build: force pkg-config for dependency detection
[dpdk.git] / drivers / common / mlx5 / linux / mlx5_nl.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2019 Mellanox Technologies, Ltd
3  */
4
5 #ifndef RTE_PMD_MLX5_NL_H_
6 #define RTE_PMD_MLX5_NL_H_
7
8 #include <linux/netlink.h>
9
10 #include <rte_ether.h>
11
12 #include "mlx5_common.h"
13
14
15 /* VLAN netdev for VLAN workaround. */
16 struct mlx5_nl_vlan_dev {
17         uint32_t refcnt;
18         uint32_t ifindex; /**< Own interface index. */
19 };
20
21 /*
22  * Array of VLAN devices created on the base of VF
23  * used for workaround in virtual environments.
24  */
25 struct mlx5_nl_vlan_vmwa_context {
26         int nl_socket;
27         uint32_t vf_ifindex;
28         rte_spinlock_t sl;
29         struct mlx5_nl_vlan_dev vlan_dev[4096];
30 };
31
32 __rte_internal
33 int mlx5_nl_init(int protocol);
34 __rte_internal
35 int mlx5_nl_mac_addr_add(int nlsk_fd, unsigned int iface_idx, uint64_t *mac_own,
36                          struct rte_ether_addr *mac, uint32_t index);
37 __rte_internal
38 int mlx5_nl_mac_addr_remove(int nlsk_fd, unsigned int iface_idx,
39                             uint64_t *mac_own, struct rte_ether_addr *mac,
40                             uint32_t index);
41 __rte_internal
42 void mlx5_nl_mac_addr_sync(int nlsk_fd, unsigned int iface_idx,
43                            struct rte_ether_addr *mac_addrs, int n);
44 __rte_internal
45 void mlx5_nl_mac_addr_flush(int nlsk_fd, unsigned int iface_idx,
46                             struct rte_ether_addr *mac_addrs, int n,
47                             uint64_t *mac_own);
48 __rte_internal
49 int mlx5_nl_promisc(int nlsk_fd, unsigned int iface_idx, int enable);
50 __rte_internal
51 int mlx5_nl_allmulti(int nlsk_fd, unsigned int iface_idx, int enable);
52 __rte_internal
53 unsigned int mlx5_nl_portnum(int nl, const char *name);
54 __rte_internal
55 unsigned int mlx5_nl_ifindex(int nl, const char *name, uint32_t pindex);
56 __rte_internal
57 int mlx5_nl_vf_mac_addr_modify(int nlsk_fd, unsigned int iface_idx,
58                                struct rte_ether_addr *mac, int vf_index);
59 __rte_internal
60 int mlx5_nl_switch_info(int nl, unsigned int ifindex,
61                         struct mlx5_switch_info *info);
62
63 __rte_internal
64 void mlx5_nl_vlan_vmwa_delete(struct mlx5_nl_vlan_vmwa_context *vmwa,
65                               uint32_t ifindex);
66 __rte_internal
67 uint32_t mlx5_nl_vlan_vmwa_create(struct mlx5_nl_vlan_vmwa_context *vmwa,
68                                   uint32_t ifindex, uint16_t tag);
69 __rte_internal
70 int mlx5_nl_devlink_family_id_get(int nlsk_fd);
71 __rte_internal
72 int mlx5_nl_enable_roce_get(int nlsk_fd, int family_id, const char *pci_addr,
73                             int *enable);
74 __rte_internal
75 int mlx5_nl_driver_reload(int nlsk_fd, int family_id, const char *pci_addr);
76 __rte_internal
77 int mlx5_nl_enable_roce_set(int nlsk_fd, int family_id, const char *pci_addr,
78                             int enable);
79
80 #endif /* RTE_PMD_MLX5_NL_H_ */