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;
160 if (pp2_bpool_get_buff
164 pp2_bpool_deinit (inq->
bpool);
182 struct pp2_bpool_params bpool_params = { 0 };
183 struct pp2_ppio_params ppio_params = { 0 };
184 struct pp2_ppio_inq_params inq_params = { 0 };
187 u8 pp2_id, port_id, *s = 0;
189 u8 n_outqs, n_inqs = 1;
194 args->
rv = VNET_API_ERROR_INIT_FAILED;
196 " is bigger than number of output " 197 "queues (%u)", PP2_PPIO_MAX_NUM_OUTQS);
210 args->
rv = VNET_API_ERROR_INIT_FAILED;
216 memset (ppif, 0,
sizeof (*ppif));
222 for (i = 0; i < n_inqs; i++)
227 for (i = 0; i < n_outqs; i++)
234 if (pp2_netdev_get_ppio_info ((
char *) args->
name, &pp2_id, &port_id))
236 args->
rv = VNET_API_ERROR_INVALID_INTERFACE;
243 s =
format (s,
"pool-%d:%d%c", pp2_id, pp2_id + 8, 0);
244 bpool_params.match = (
char *) s;
247 if (pp2_bpool_init (&bpool_params, &ppif->
inqs[0].
bpool))
249 args->
rv = VNET_API_ERROR_INIT_FAILED;
255 s =
format (s,
"ppio-%d:%d%c", pp2_id, port_id, 0);
256 ppio_params.match = (
char *) s;
257 ppio_params.type = PP2_PPIO_T_NIC;
258 inq_params.size = 2048;
259 ppio_params.inqs_params.num_tcs = 1;
260 ppio_params.inqs_params.tcs_params[0].pkt_offset = 0;
261 ppio_params.inqs_params.tcs_params[0].num_in_qs = n_inqs;
262 ppio_params.inqs_params.tcs_params[0].inqs_params = &inq_params;
263 ppio_params.inqs_params.tcs_params[0].pools[0] = ppif->
inqs[0].
bpool;
264 ppio_params.outqs_params.num_outqs = n_outqs;
265 for (i = 0; i < n_outqs; i++)
267 ppio_params.outqs_params.outqs_params[
i].weight = 1;
268 ppio_params.outqs_params.outqs_params[
i].size = args->
tx_q_sz;
270 if (pp2_ppio_init (&ppio_params, &ppif->
ppio))
272 args->
rv = VNET_API_ERROR_INIT_FAILED;
278 if (pp2_ppio_get_mac_addr (ppif->
ppio, mac_addr))
280 args->
rv = VNET_API_ERROR_INIT_FAILED;
293 args->
rv = VNET_API_ERROR_INVALID_REGISTRATION;
327 rv = pp2_ppio_enable (ppif->
ppio);
329 rv = pp2_ppio_disable (ppif->
ppio);
333 is_up ?
"enable" :
"disable");
348 struct pp2_ppio_statistics stats;
350 pp2_ppio_get_statistics (ppif->
ppio, &stats, 1);
362 if (node_index == ~0)
382 .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.
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
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)
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 VNET_HW_INTERFACE_FLAG_LINK_UP
#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
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
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 VLIB_BUFFER_DEFAULT_FREE_LIST_BYTES
#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.
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)
#define VNET_SW_INTERFACE_FLAG_ADMIN_UP
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)
clib_error_t * ethernet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, u8 *address, u32 *hw_if_index_return, ethernet_flag_change_function_t flag_change)
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)
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.