
VPP
冷钦街
近20年嵌入式软件开发工程师,大学讲师,开源鸿蒙研究者
对一切IT技术(开发,测试,运维)都比较感兴趣
主要工作为IT开发和IT人才教育。
展开
-
VPP代码阅读中文注解--bitops.h
/* Population count from Hacker's Delight. */always_inline uwordcount_set_bits (uword x){#ifdef __POPCNT__#if uword_bits == 64 return __builtin_popcountll (x);#else return __builtin_popcoun...原创 2018-10-18 20:19:53 · 351 阅读 · 0 评论 -
VPP代码阅读中文注解---clib_error.h
#include <vppinfra/types.h>typedef struct{ /* Error message. */ u8 *what; /* Where error occurred (e.g. __FUNCTION__ __LINE__) */ const u8 *where; uword flags; /* Error code (...原创 2018-10-19 13:43:22 · 534 阅读 · 0 评论 -
VPP代码阅读中文注解---cpu.h
#include <vppinfra/format.h>/* * multiarchitecture support. Adding new entry will produce * new graph node function variant optimized for specific cpu * microarchitecture. * Order is impo...原创 2018-10-19 14:46:10 · 1057 阅读 · 0 评论 -
VPP代码阅读中文注解--cpu.c
#define foreach_x86_cpu_uarch \ _(0x06, 0x9e, "Kaby Lake", "Kaby Lake DT/H/S/X") \ _(0x06, 0x8e, "Kaby Lake", "Kaby Lake Y/U") \ _(0x06, 0x85, "Knights Mill", "Knights Mill") \ _(0x06, 0x5f,原创 2018-10-19 15:14:49 · 568 阅读 · 0 评论 -
VPP代码阅读中文注解--crc32.h
static_always_inline u32clib_crc32c (u8 * s, int len){ u32 v = 0;#if __x86_64__ for (; len >= 8; len -= 8, s += 8) v = _mm_crc32_u64 (v, *((u64 *) s));#else /* workaround weird GCC ...原创 2018-10-19 15:26:29 · 502 阅读 · 0 评论 -
VPP代码阅读中文注解--dlist.h
双向链表算法。本双向链表的所有元素存储在一个pool中,根据pool中内存块的序号进行索引。typedef struct{ u32 next; u32 prev; u32 value;} dlist_elt_t;本双向链表中每一个元素的结构。value指的是元素的值。next, prev分别代表前一个和后一个元素。它们的语义是元素在内存池中的编号,通俗的说,就是数...原创 2018-10-19 15:59:37 · 1284 阅读 · 0 评论 -
VPP代码阅读中文注解---dlmalloc.h
* Quickstart This library is all in one file to simplify the most common usage: ftp it, compile it (-O3), and link it into another program. All of the compile-time options default to reasonabl...原创 2018-10-19 18:10:47 · 1116 阅读 · 0 评论 -
VPP代码阅读中文注解--vec.h
/** \file CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers". Many CLIB data structures (e.g. hash, heap, pool) are vectors with various different header...原创 2018-10-17 11:37:19 · 2837 阅读 · 0 评论 -
VPP代码阅读中文注解--vec.c
#include <vppinfra/vec.h>#include <vppinfra/mem.h>/* Vector resize operator. Called as needed by various macros such as vec_add1() when we need to allocate memory. */void *vec_re...原创 2018-10-17 12:50:28 · 1464 阅读 · 0 评论 -
VPP代码阅读中文注解--cache.h
/* * Allow CFLAGS to override the configured / deduced cache line size */#ifndef CLIB_LOG2_CACHE_LINE_BYTES/* Default cache line size of 64 bytes. */#ifndef CLIB_LOG2_CACHE_LINE_BYTES#define C...原创 2018-10-19 13:00:59 · 703 阅读 · 0 评论 -
VPP代码阅读中文注解--byte_order.h
处理字节序相关的头文件。比如IP地址 192.168.10.20 这个IP地址。在X86 CPU中处理时,长这样: 0x140aa8c0在网络上传输时,长这样:0xc0a80a14由于网络传输是按照低地址代表most significant byte的语义。这个与x86 这类的CPU刚好相反。所以软件中需要做相应的处理,实际上就是在内存中做字节交换。 #include ...原创 2018-10-19 11:44:19 · 613 阅读 · 0 评论 -
VPP代码阅读中文注解---bitmap.h
/** \file Bitmaps built as vectors of machine words*/#include <vppinfra/vec.h>#include <vppinfra/random.h>#include <vppinfra/error.h>#include <vppinfra/bitops.h> /* ...原创 2018-10-18 22:50:01 · 1323 阅读 · 0 评论 -
VPP代码阅读中文注解(一)
一、入口函数位置:/src/vpp/vnet/main.c中的main函数开始。二、代码注解intmain (int argc, char *argv[]){ int i; vlib_main_t *vm = &vlib_global_main; void vl_msg_api_set_first_available_msg_id (u16); uword...原创 2018-10-16 11:07:53 · 2197 阅读 · 0 评论 -
VPP代码阅读中文注解(二)
clib_mem_init_thread_safe有2个版本。其中一个在mem_mheap.c中void *clib_mem_init_thread_safe (void *memory, uword memory_size){ mheap_t *h; u8 *heap; clib_mem_init (memory, memory_size); heap = cl...原创 2018-10-16 11:21:27 · 1278 阅读 · 0 评论 -
VPP代码阅读中文注解(三)
static voidvpe_main_init (vlib_main_t * vm){ void vat_plugin_hash_create (void); if (CLIB_DEBUG > 0) vlib_unix_cli_set_prompt ("DBGvpp# "); else vlib_unix_cli_set_prompt ("vpp# ")...原创 2018-10-16 11:27:43 · 835 阅读 · 0 评论 -
VPP代码阅读中文注解--clib.h
#ifndef included_clib_h#define included_clib_h#include <vppinfra/config.h>#define宏定义用于在头文件多次被包含时出现问题此#include暂时不理会它 。 /* Standalone means to not assume we are running on a Unix box....原创 2018-10-16 17:17:28 · 1123 阅读 · 0 评论 -
VPP代码阅读中文注解--vec_bootstrap.h
/** \file Vector bootstrap header file*//* Bootstrap include so that #include <vppinfra/mem.h> can include e.g. <vppinfra/mheap.h> which depends on <vppinfra/vec.h>. *//...原创 2018-10-16 17:57:44 · 897 阅读 · 0 评论 -
VPP代码阅读中文注解--pool.h
/** @file * @brief Fixed length block allocator. Pools are built from clib vectors and bitmaps. Use pools when repeatedly allocating and freeing fixed-size data. Pools are fast, and avoid m...原创 2018-10-19 11:00:45 · 3130 阅读 · 0 评论 -
VPP代码阅读中文注解--pool.c
#include <vppinfra/pool.h>void_pool_init_fixed (void **pool_ptr, u32 elt_size, u32 max_elts){ u8 *mmap_base; u64 vector_size; u64 free_index_size; u64 total_size; u64 page_size; ...原创 2018-10-19 11:18:37 · 1058 阅读 · 2 评论 -
VPP-BIHASH实现分析
/vppinfa/bihash_template.h本文件为本数据结构的核心头文件概念一key-value-pair 键-值-对。 组成HASH表的各元素,在C语言中,一般定义成一个struct,其中一部分是key, 另一部分是value。每1个key在hash表中只能出现1次通过key用来计算hash值。不同的key可能计算出相同的hash值,如果表中存在2个这样的表...原创 2018-12-06 15:04:00 · 2510 阅读 · 0 评论