CNDP
22.08.0
|
#include <net/if.h>
#include <cne_atomic.h>
#include <pktdev.h>
#include <cne_inet.h>
#include <stddef.h>
#include <stdint.h>
#include "cne_common.h"
#include "cne_log.h"
#include "cne_lport.h"
#include "cne_vec.h"
#include "cnet_const.h"
#include "cnet_stk.h"
#include "mempool.h"
#include "pktmbuf.h"
Go to the source code of this file.
Macros | |
#define | _IFF_UP 0x00000001 |
#define | _IFF_BROADCAST 0x00000002 |
#define | _IFF_DEBUG 0x00000004 |
#define | _IFF_LOOPBACK 0x00000008 |
#define | _IFF_POINTOPOINT 0x00000010 |
#define | _IFF_SMART 0x00000020 |
#define | _IFF_RUNNING 0x00000040 |
#define | _IFF_NOARP 0x00000080 |
#define | _IFF_PROMISC 0x00000100 |
#define | _IFF_ALLMULTI 0x00000200 |
#define | _IFF_OACTIVE 0x00000400 |
#define | _IFF_SIMPLEX 0x00000800 |
#define | _IFF_LINK0 0x00001000 |
#define | _IFF_LINK1 0x00002000 |
#define | _IFF_LINK2 0x00004000 |
#define | _IFF_MULTICAST 0x00008000 |
#define | _IFF_NOTRAILERS 0x00020000 |
#define | _IFF_INET_UP 0x00040000 |
#define | _IFF_INET6_UP 0x00080000 |
#define | _IFF_RARP 0x00100000 |
#define | _IFF_DONT_FORWARD 0x00200000 |
Functions | |
static int | cnet_ipv4_broadcast (struct netif *netif, struct in_addr *ip) |
static struct netif * | cnet_netif_from_index (uint8_t idx) |
static struct netif * | cnet_netif_match_subnet (struct in_addr *ipaddr) |
static void | cnet_netif_free (struct netif *netif) |
static struct netif * | cnet_netif_alloc (uint16_t lpid) |
static int | cnet_netif_get_flags (struct netif *netif, uint32_t *flags) |
CNDP_API int | cnet_netif_register (uint16_t lpid, char *ifname, char *netdev) |
Register lport, ifname and netdev to create a netif structure. More... | |
CNDP_API int | cnet_netif_attach_ports (struct cnet *cnet) |
Attach ports to CNET and the netif structures. More... | |
CNDP_API struct netif * | cnet_netif_from_name (const char *name, int typ) |
Locate the netif for the given interface name. More... | |
CNDP_API int | cnet_netif_set_mtu (struct netif *netif, uint16_t mtu) |
Set the MTU for a given netif structure. More... | |
CNDP_API int | cnet_netif_foreach (int(*func)(struct netif *netif, void *arg), void *arg) |
look over all netif structures calling the specified function More... | |
CNDP_API struct inet4_addr * | cnet_ipv4_ipaddr_find (struct netif *netif, struct in_addr *ip) |
Find the given IPv4 address in a given netif structure. More... | |
CNDP_API int | cnet_ipv4_ipaddr_delete (struct netif *netif, struct in_addr *ip) |
Delete the given IPv4 address from the given netif structure. More... | |
CNDP_API int | cnet_ipv4_ipaddr_add (struct netif *netif, struct inet4_addr *ip) |
Add a new IPv4 address to the given netif structure. More... | |
CNDP_API int | cnet_netif_set_flags (struct netif *netif, uint32_t flags) |
Add flags or set the flags to a netif structure. More... | |
CNDP_API struct netif * | cnet_netif_find_by_name (char *ifname) |
Find the netif structure for the given interface name. More... | |
CNDP_API struct netif * | cnet_netif_find_by_ifindex (int ifindex) |
Locate the netif structure by the ifindex value. More... | |
CNDP_API struct netif * | cnet_netif_find_by_netdev (char *netdev_name) |
Find the netif structure by the netdev name. More... | |
CNDP_API struct netif * | cnet_netif_find_by_lport (int lport) |
Find the netif structure by the lport id. More... | |
CNDP_API int | cnet_is_ifname_valid (char *ifname) |
Is the ifname a valid interface name. More... | |
CNDP_API int | cnet_is_netdev_valid (char *netdev_name) |
Is the netdev name a valid netdev. More... | |
CNDP_API int | cnet_is_ifindex_valid (int ifindex) |
Is the ifindex valid interface index. More... | |
CNET Network Interface routines and constants.
Definition in file cnet_netif.h.
#define _IFF_UP 0x00000001 |
interface link is up
Definition at line 91 of file cnet_netif.h.
#define _IFF_BROADCAST 0x00000002 |
broadcast address valid
Definition at line 92 of file cnet_netif.h.
#define _IFF_DEBUG 0x00000004 |
turn on debugging
Definition at line 93 of file cnet_netif.h.
#define _IFF_LOOPBACK 0x00000008 |
is a loopback net
Definition at line 94 of file cnet_netif.h.
#define _IFF_POINTOPOINT 0x00000010 |
interface is p2p link
Definition at line 95 of file cnet_netif.h.
#define _IFF_SMART 0x00000020 |
interface manages own routes
Definition at line 96 of file cnet_netif.h.
#define _IFF_RUNNING 0x00000040 |
resources allocated
Definition at line 97 of file cnet_netif.h.
#define _IFF_NOARP 0x00000080 |
no address resolution protocol
Definition at line 98 of file cnet_netif.h.
#define _IFF_PROMISC 0x00000100 |
receive all packets
Definition at line 99 of file cnet_netif.h.
#define _IFF_ALLMULTI 0x00000200 |
receive all multicast packets
Definition at line 100 of file cnet_netif.h.
#define _IFF_OACTIVE 0x00000400 |
transmission in progress
Definition at line 101 of file cnet_netif.h.
#define _IFF_SIMPLEX 0x00000800 |
can't hear own transmissions
Definition at line 102 of file cnet_netif.h.
#define _IFF_LINK0 0x00001000 |
forwarding disabled
Definition at line 103 of file cnet_netif.h.
#define _IFF_LINK1 0x00002000 |
per link layer defined bit
Definition at line 104 of file cnet_netif.h.
#define _IFF_LINK2 0x00004000 |
per link layer defined bit
Definition at line 105 of file cnet_netif.h.
#define _IFF_MULTICAST 0x00008000 |
supports multicast
Definition at line 106 of file cnet_netif.h.
#define _IFF_NOTRAILERS 0x00020000 |
avoid use of trailers
Definition at line 107 of file cnet_netif.h.
#define _IFF_INET_UP 0x00040000 |
interface is up for ipv4
Definition at line 108 of file cnet_netif.h.
#define _IFF_INET6_UP 0x00080000 |
interface is up for ipv6
Definition at line 109 of file cnet_netif.h.
#define _IFF_RARP 0x00100000 |
RARP enabled on this interface
Definition at line 110 of file cnet_netif.h.
#define _IFF_DONT_FORWARD 0x00200000 |
Not allowed to forward packets
Definition at line 111 of file cnet_netif.h.
|
inlinestatic |
Check if an IP address matches one of the netif subnets.
Definition at line 125 of file cnet_netif.h.
|
inlinestatic |
Using the netif index return the netif structure pointer.
Definition at line 171 of file cnet_netif.h.
|
inlinestatic |
Locate the closest matching IP address in all of the netif structures.
Definition at line 180 of file cnet_netif.h.
|
inlinestatic |
Free the given netif pointer back to the netif free list.
Definition at line 195 of file cnet_netif.h.
|
inlinestatic |
Allocate a netif structure and return the pointer.
Definition at line 208 of file cnet_netif.h.
|
inlinestatic |
Get the flags for the given netif structure pointer.
Definition at line 228 of file cnet_netif.h.
CNDP_API int cnet_netif_register | ( | uint16_t | lpid, |
char * | ifname, | ||
char * | netdev | ||
) |
Register lport, ifname and netdev to create a netif structure.
lpid | The lport value to register |
ifname | The interface name |
netdev | The netdev name to assign to the netif structure |
CNDP_API int cnet_netif_attach_ports | ( | struct cnet * | cnet | ) |
Attach ports to CNET and the netif structures.
cnet | The CNET structure pointer |
CNDP_API struct netif* cnet_netif_from_name | ( | const char * | name, |
int | typ | ||
) |
Locate the netif for the given interface name.
name | The name of the interface to find |
typ | The type of netif to find. |
CNDP_API int cnet_netif_set_mtu | ( | struct netif * | netif, |
uint16_t | mtu | ||
) |
Set the MTU for a given netif structure.
netif | The netif structure pointer |
mtu | The MTU value to set |
CNDP_API int cnet_netif_foreach | ( | int(*)(struct netif *netif, void *arg) | func, |
void * | arg | ||
) |
look over all netif structures calling the specified function
func | The function to call |
arg | The argument to pass to the function |
CNDP_API struct inet4_addr* cnet_ipv4_ipaddr_find | ( | struct netif * | netif, |
struct in_addr * | ip | ||
) |
Find the given IPv4 address in a given netif structure.
netif | The netif structure to search for the giben IPv4 address |
ip | The IPv4 address to search |
CNDP_API int cnet_ipv4_ipaddr_delete | ( | struct netif * | netif, |
struct in_addr * | ip | ||
) |
Delete the given IPv4 address from the given netif structure.
netif | The netif structure to search for the giben IPv4 address |
ip | The IPv4 address to search |
CNDP_API int cnet_ipv4_ipaddr_add | ( | struct netif * | netif, |
struct inet4_addr * | ip | ||
) |
Add a new IPv4 address to the given netif structure.
netif | The netif structure to search for the giben IPv4 address |
ip | The IPv4 address to search |
CNDP_API int cnet_netif_set_flags | ( | struct netif * | netif, |
uint32_t | flags | ||
) |
Add flags or set the flags to a netif structure.
netif | The netif structure to search for the giben IPv4 address |
flags | The flags to set in the netif structure |
CNDP_API struct netif* cnet_netif_find_by_name | ( | char * | ifname | ) |
Find the netif structure for the given interface name.
ifname | The interface name to search for in the system |
CNDP_API struct netif* cnet_netif_find_by_ifindex | ( | int | ifindex | ) |
Locate the netif structure by the ifindex value.
ifindex | The ifindex value for the netif structure |
CNDP_API struct netif* cnet_netif_find_by_netdev | ( | char * | netdev_name | ) |
Find the netif structure by the netdev name.
netdev_name | The netdev name to search for in system |
CNDP_API struct netif* cnet_netif_find_by_lport | ( | int | lport | ) |
Find the netif structure by the lport id.
lport | The lport id value to help locate the netif pointer. |
CNDP_API int cnet_is_ifname_valid | ( | char * | ifname | ) |
Is the ifname a valid interface name.
ifname | Locate and see if the interface name is known |
CNDP_API int cnet_is_netdev_valid | ( | char * | netdev_name | ) |
Is the netdev name a valid netdev.
netdev_name | Locate and see if the netdev name is known |
CNDP_API int cnet_is_ifindex_valid | ( | int | ifindex | ) |
Is the ifindex valid interface index.
ifindex | The ifindex to validate |