18 #include <sys/types.h> 21 #include <sys/ioctl.h> 30 #define MV_SYS_DMA_MEM_SZ (2 << 20) 32 #define NUM_HIFS_RSVD 4 34 #define NUM_BPOOLS_RSVD 7 49 pp2_hif_deinit (ptd->
hif);
54 mv_sys_dma_mem_destroy ();
63 struct pp2_init_params init_params = { 0 };
73 rv = pp2_init (&init_params);
87 struct pp2_hif_params hif_params = { 0 };
90 hif_params.match = (
char *) s;
91 hif_params.out_size = 2048;
92 if (pp2_hif_init (&hif_params, &ptd->
hif))
133 pp2_ppio_disable (ppif->
ppio);
134 pp2_ppio_deinit (ppif->
ppio);
156 pp2_bpool_get_num_buffs (inq->
bpool, &n_bufs);
159 struct pp2_buff_inf binf;
163 u32 bi = binf.cookie;
167 pp2_bpool_deinit (inq->
bpool);
185 struct pp2_bpool_params bpool_params = { 0 };
186 struct pp2_ppio_params ppio_params = { 0 };
187 struct pp2_ppio_inq_params inq_params = { 0 };
190 u8 pp2_id, port_id, *s = 0;
192 u8 n_outqs, n_inqs = 1;
197 args->
rv = VNET_API_ERROR_INIT_FAILED;
199 " is bigger than number of output " 200 "queues (%u)", PP2_PPIO_MAX_NUM_OUTQS);
213 args->
rv = VNET_API_ERROR_INIT_FAILED;
224 for (i = 0; i < n_inqs; i++)
229 for (i = 0; i < n_outqs; i++)
236 if (pp2_netdev_get_ppio_info ((
char *) args->
name, &pp2_id, &port_id))
238 args->
rv = VNET_API_ERROR_INVALID_INTERFACE;
245 s =
format (s,
"pool-%d:%d%c", pp2_id, pp2_id + 8, 0);
246 bpool_params.match = (
char *) s;
249 if (pp2_bpool_init (&bpool_params, &ppif->
inqs[0].
bpool))
251 args->
rv = VNET_API_ERROR_INIT_FAILED;
257 s =
format (s,
"ppio-%d:%d%c", pp2_id, port_id, 0);
258 ppio_params.match = (
char *) s;
259 ppio_params.type = PP2_PPIO_T_NIC;
260 inq_params.size = args->
rx_q_sz;
261 ppio_params.inqs_params.num_tcs = 1;
262 ppio_params.inqs_params.tcs_params[0].pkt_offset = 0;
263 ppio_params.inqs_params.tcs_params[0].num_in_qs = n_inqs;
264 ppio_params.inqs_params.tcs_params[0].inqs_params = &inq_params;
265 ppio_params.inqs_params.tcs_params[0].pools[0][0] = ppif->
inqs[0].
bpool;
266 ppio_params.outqs_params.num_outqs = n_outqs;
267 for (i = 0; i < n_outqs; i++)
269 ppio_params.outqs_params.outqs_params[
i].weight = 1;
270 ppio_params.outqs_params.outqs_params[
i].size = args->
tx_q_sz;
272 if (pp2_ppio_init (&ppio_params, &ppif->
ppio))
274 args->
rv = VNET_API_ERROR_INIT_FAILED;
280 if (pp2_ppio_get_mac_addr (ppif->
ppio, mac_addr))
282 args->
rv = VNET_API_ERROR_INIT_FAILED;
295 args->
rv = VNET_API_ERROR_INVALID_REGISTRATION;
329 rv = pp2_ppio_enable (ppif->
ppio);
331 rv = pp2_ppio_disable (ppif->
ppio);
335 is_up ?
"enable" :
"disable");
350 struct pp2_ppio_statistics stats;
352 pp2_ppio_get_statistics (ppif->
ppio, &stats, 1);
364 if (node_index == ~0)
384 .name =
"Marvell PPv2 interface",
static u32 mrvl_pp2_eth_flag_change(vnet_main_t *vnm, vnet_hw_interface_t *hi, u32 flags)
#define vec_foreach_index(var, v)
Iterate over vector indices.
static void vlib_buffer_free(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Free buffers Frees the entire buffer chain for each buffer.
void ethernet_delete_interface(vnet_main_t *vnm, u32 hw_if_index)
vnet_main_t * vnet_get_main(void)
#define pool_get_zero(P, E)
Allocate an object E from a pool P and zero it.
struct pp2_ppio_desc * descs
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
u32 per_interface_next_index
mrvl_pp2_main_t mrvl_pp2_main
vnet_device_class_t mrvl_pp2_device_class
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
#define MV_SYS_DMA_MEM_SZ
static clib_error_t * mrvl_pp2_main_init()
struct _vnet_device_class vnet_device_class_t
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
static vnet_sw_interface_t * vnet_get_hw_sw_interface(vnet_main_t *vnm, u32 hw_if_index)
static clib_error_t * mrvl_pp2_init(vlib_main_t *vm)
static char * mrvl_pp2_tx_func_error_strings[]
#define VLIB_INIT_FUNCTION(x)
#define foreach_mrvl_pp2_tx_func_error
format_function_t format_mrvl_pp2_interface
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
#define clib_error_return(e, args...)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static clib_error_t * mrvl_pp2_interface_admin_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
#define pool_put(P, E)
Free an object E in pool P.
static_always_inline u32 vlib_buffer_get_default_data_size(vlib_main_t *vm)
VNET_DEVICE_CLASS(mrvl_pp2_device_class,)
#define vec_free(V)
Free vector's memory (no header).
void mrvl_pp2_delete_if(mrvl_pp2_if_t *ppif)
void vnet_hw_interface_assign_rx_thread(vnet_main_t *vnm, u32 hw_if_index, u16 queue_id, uword thread_index)
static void mrvl_pp2_clear_interface_counters(u32 instance)
void mrvl_pp2_create_if(mrvl_pp2_create_if_args_t *args)
static void mrvl_pp2_set_interface_next_node(vnet_main_t *vnm, u32 hw_if_index, u32 node_index)
static vlib_main_t * vlib_get_main(void)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
clib_error_t * ethernet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, const u8 *address, u32 *hw_if_index_return, ethernet_flag_change_function_t flag_change)
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, vnet_hw_interface_flags_t flags)
format_function_t format_mrvl_pp2_interface_name
uword mrvl_pp2_interface_tx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
int vnet_hw_interface_unassign_rx_thread(vnet_main_t *vnm, u32 hw_if_index, u16 queue_id)
static vlib_thread_main_t * vlib_get_thread_main()
#define vec_foreach(var, vec)
Vector iterator.
int vnet_hw_interface_set_rx_mode(vnet_main_t *vnm, u32 hw_if_index, u16 queue_id, vnet_hw_interface_rx_mode mode)
mrvl_pp2_if_t * interfaces
mrvl_pp2_per_thread_data_t * per_thread_data
static void mrvl_pp2_main_deinit()
#define CLIB_CACHE_LINE_BYTES
vnet_device_class_t ppa2_device_class
static void vnet_hw_interface_set_input_node(vnet_main_t *vnm, u32 hw_if_index, u32 node_index)
#define MRVL_PP2_IF_F_ADMIN_UP
static uword pool_elts(void *v)
Number of active elements in a pool.