CNDP 22.08.0
Loading...
Searching...
No Matches
netdev_funcs.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (c) 2019-2022 Intel Corporation
3 */
4
5#ifndef _NETDEV_FUNCS_H_
6#define _NETDEV_FUNCS_H_
7
12
13#include <stdint.h> // for uint32_t, uint16_t
14#include <cne_common.h> // for CNDP_API
15
16struct ether_addr;
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
25__extension__ struct netdev_link {
26 uint32_t link_speed;
27 uint16_t link_duplex : 1;
28 uint16_t link_autoneg : 1;
29 uint16_t link_status : 1;
30} __attribute__((aligned(8)));
31
32/* Utility constants */
33#define ETH_LINK_HALF_DUPLEX 0
34#define ETH_LINK_FULL_DUPLEX 1
35#define ETH_LINK_DOWN 0
36#define ETH_LINK_UP 1
37#define ETH_LINK_FIXED 0
38#define ETH_LINK_AUTONEG 1
39
43#define CNE_ETH_SPEED_NUM_NONE 0
44#define CNE_ETH_SPEED_NUM_10M 10
45#define CNE_ETH_SPEED_NUM_100M 100
46#define CNE_ETH_SPEED_NUM_1G 1000
47#define CNE_ETH_SPEED_NUM_2_5G 2500
48#define CNE_ETH_SPEED_NUM_5G 5000
49#define CNE_ETH_SPEED_NUM_10G 10000
50#define CNE_ETH_SPEED_NUM_20G 20000
51#define CNE_ETH_SPEED_NUM_25G 25000
52#define CNE_ETH_SPEED_NUM_40G 40000
53#define CNE_ETH_SPEED_NUM_50G 50000
54#define CNE_ETH_SPEED_NUM_56G 56000
55#define CNE_ETH_SPEED_NUM_100G 100000
56#define CNE_ETH_SPEED_NUM_200G 200000
57#define CNE_ETH_SPEED_NUM_400G 400000
58#define CNE_ETH_SPEED_NUM_UNKNOWN UINT32_MAX
59
63__extension__ struct offloads {
64 uint32_t tx_checksum_offload;
65 uint32_t rx_checksum_offload;
66};
67
80CNDP_API int netdev_change_flags(const char *if_name, uint32_t flags, uint32_t mask);
81
90CNDP_API int netdev_promiscuous_enable(const char *if_name);
91
100CNDP_API int netdev_promiscuous_disable(const char *if_name);
101
112CNDP_API int netdev_promiscuous_get(const char *if_name);
113
122CNDP_API int netdev_set_link_up(const char *if_name);
123
132CNDP_API int netdev_set_link_down(const char *if_name);
133
144CNDP_API int netdev_get_mac_addr(const char *ifname, struct ether_addr *eth_addr);
145
156CNDP_API int netdev_get_link(const char *ifname, struct netdev_link *link);
157
168CNDP_API int netdev_get_offloads(const char *ifname, struct offloads *off);
169
178CNDP_API int netdev_get_channels(const char *ifname);
179
193CNDP_API int netdev_get_ring_params(const char *ifname, uint32_t *rx_nb_desc, uint32_t *tx_nb_desc);
194
195#ifdef __cplusplus
196}
197#endif
198
199#endif /* _NETDEV_FUNCS_H_ */
CNDP_API int netdev_promiscuous_enable(const char *if_name)
CNDP_API int netdev_promiscuous_disable(const char *if_name)
CNDP_API int netdev_promiscuous_get(const char *if_name)
CNDP_API int netdev_get_ring_params(const char *ifname, uint32_t *rx_nb_desc, uint32_t *tx_nb_desc)
CNDP_API int netdev_set_link_down(const char *if_name)
CNDP_API int netdev_get_link(const char *ifname, struct netdev_link *link)
CNDP_API int netdev_set_link_up(const char *if_name)
CNDP_API int netdev_get_mac_addr(const char *ifname, struct ether_addr *eth_addr)
CNDP_API int netdev_get_channels(const char *ifname)
CNDP_API int netdev_change_flags(const char *if_name, uint32_t flags, uint32_t mask)
CNDP_API int netdev_get_offloads(const char *ifname, struct offloads *off)