|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
34 cdp_tlv_t *t = (cdp_tlv_t *) * t0p;
36 t->t = htons (CDP_TLV_device_name);
37 t->l = htons (3 +
sizeof (*t));
46 cdp_tlv_t *t = (cdp_tlv_t *) * t0p;
48 t->t = htons (CDP_TLV_port_id);
57 cdp_tlv_t *t = (cdp_tlv_t *) * t0p;
59 t->t = htons (CDP_TLV_version);
60 t->l = htons (12 +
sizeof (*t));
68 cdp_tlv_t *t = (cdp_tlv_t *) * t0p;
70 t->t = htons (CDP_TLV_platform);
71 t->l = htons (2 +
sizeof (*t));
79 cdp_tlv_t *t = (cdp_tlv_t *) * t0p;
82 t->t = htons (CDP_TLV_capabilities);
83 t->l = htons (4 +
sizeof (*t));
85 capabilities = htonl (capabilities);
86 clib_memcpy (&t->v, &capabilities, sizeof (capabilities));
107 ethernet_llc_snap_and_cdp_header_t *h0;
113 int nbytes_to_checksum;
137 t0 = (
u8 *) & h0->cdp.data;
143 nbytes_to_checksum = t0 - (
u8 *) & h0->cdp;
145 h0->cdp.checksum = htons (checksum);
150 -
sizeof (cdp_hdr_t);
177 hdlc_and_cdp_header_t *h0;
183 int nbytes_to_checksum;
203 t0 = (
u8 *) & h0->cdp.data;
209 nbytes_to_checksum = t0 - (
u8 *) & h0->cdp;
211 h0->cdp.checksum = htons (checksum);
216 -
sizeof (cdp_hdr_t);
236 srp_and_cdp_header_t *h0;
242 int nbytes_to_checksum;
262 t0 = (
u8 *) & h0->cdp.data;
272 nbytes_to_checksum = t0 - (
u8 *) & h0->cdp;
274 h0->cdp.checksum = htons (checksum);
279 -
sizeof (cdp_hdr_t);
356 static u32 *delete_list = 0;
397 _vec_len (delete_list) = 0;
399 _vec_len (n_list) = 0;
409 ethernet_llc_snap_and_cdp_header_t
h;
414 h.ethernet.dst_address[0] = 0x01;
416 h.ethernet.dst_address[2] = 0x0C;
417 h.ethernet.dst_address[3] = 0xCC;
418 h.ethernet.dst_address[4] = 0xCC;
419 h.ethernet.dst_address[5] = 0xCC;
426 h.llc.dst_sap =
h.llc.src_sap = 0xAA;
427 h.llc.control = 0x03;
432 h.snap.oui[2] = 0x0C;
433 h.snap.protocol = htons (0x2000);
451 hdlc_and_cdp_header_t
h;
455 h.hdlc.address = 0x0f;
457 h.hdlc.protocol = htons (0x2000);
473 srp_and_cdp_header_t
h;
478 h.ethernet.dst_address[0] = 0x01;
480 h.ethernet.dst_address[2] = 0x0C;
481 h.ethernet.dst_address[3] = 0xCC;
482 h.ethernet.dst_address[4] = 0xCC;
483 h.ethernet.dst_address[5] = 0xCC;
490 h.srp.mode = SRP_MODE_data;
495 h.ethernet.type = htons (0x2000);
static void send_ethernet_hello(cdp_main_t *cm, cdp_neighbor_t *n, int count)
#define clib_memcpy(d, s, n)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
@ CDP_PACKET_TEMPLATE_SRP
static void add_capability_tlv(vnet_hw_interface_t *hw, u8 **t0p)
@ VNET_SW_INTERFACE_FLAG_ADMIN_UP
#define pool_put(P, E)
Free an object E in pool P.
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
static void add_version_tlv(vnet_hw_interface_t *hw, u8 **t0p)
vnet_sw_interface_flags_t flags
static void add_tlvs(cdp_main_t *cm, vnet_hw_interface_t *hw, u8 **t0p)
static void send_hello(cdp_main_t *cm, cdp_neighbor_t *n, int count)
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
#define pool_foreach(VAR, POOL)
Iterate through pool.
@ CDP_PACKET_TEMPLATE_HDLC
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static void add_port_id_tlv(vnet_hw_interface_t *hw, u8 **t0p)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
PCAP utility definitions.
sll srl srl sll sra u16x4 i
vnet_feature_config_main_t * cm
static void srp_header_compute_parity(srp_header_t *h)
static clib_error_t * cdp_periodic_init(vlib_main_t *vm)
u16 current_length
Nbytes between current data and the end of this buffer.
static void send_hdlc_hello(cdp_main_t *cm, cdp_neighbor_t *n, int count)
#define vec_free(V)
Free vector's memory (no header).
void * vlib_packet_template_get_packet(vlib_main_t *vm, vlib_packet_template_t *t, u32 *bi_result)
#define CDP_ROUTER_DEVICE
#define VLIB_INIT_FUNCTION(x)
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
static void add_device_name_tlv(vnet_hw_interface_t *hw, u8 **t0p)
static void send_srp_hello(cdp_main_t *cm, cdp_neighbor_t *n, int count)
#define hash_unset(h, key)
static void add_platform_tlv(vnet_hw_interface_t *hw, u8 **t0p)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
@ CDP_PACKET_TEMPLATE_ETHERNET
void vlib_packet_template_init(vlib_main_t *vm, vlib_packet_template_t *t, void *packet_data, uword n_packet_data_bytes, uword min_n_buffers_each_alloc, char *fmt,...)
static f64 vlib_time_now(vlib_main_t *vm)
u16 cdp_checksum(void *p, int count)
static int pick_packet_template(cdp_main_t *cm, cdp_neighbor_t *n)
void cdp_periodic(vlib_main_t *vm)
static void delete_neighbor(cdp_main_t *cm, cdp_neighbor_t *n, int want_broadcast)
VLIB buffer representation.