1133c2c65SJasvinder Singh /* SPDX-License-Identifier: BSD-3-Clause 2133c2c65SJasvinder Singh * Copyright(c) 2010-2018 Intel Corporation 3133c2c65SJasvinder Singh */ 4133c2c65SJasvinder Singh 5133c2c65SJasvinder Singh #ifndef _INCLUDE_LINK_H_ 6133c2c65SJasvinder Singh #define _INCLUDE_LINK_H_ 7133c2c65SJasvinder Singh 8133c2c65SJasvinder Singh #include <stdint.h> 9133c2c65SJasvinder Singh #include <sys/queue.h> 10133c2c65SJasvinder Singh 11133c2c65SJasvinder Singh #include "common.h" 12133c2c65SJasvinder Singh 13133c2c65SJasvinder Singh #ifndef LINK_RXQ_RSS_MAX 14133c2c65SJasvinder Singh #define LINK_RXQ_RSS_MAX 16 15133c2c65SJasvinder Singh #endif 16133c2c65SJasvinder Singh 17133c2c65SJasvinder Singh struct link { 18133c2c65SJasvinder Singh TAILQ_ENTRY(link) node; 19133c2c65SJasvinder Singh char name[NAME_SIZE]; 20133c2c65SJasvinder Singh uint16_t port_id; 21133c2c65SJasvinder Singh uint32_t n_rxq; 22133c2c65SJasvinder Singh uint32_t n_txq; 23133c2c65SJasvinder Singh }; 24133c2c65SJasvinder Singh 25133c2c65SJasvinder Singh TAILQ_HEAD(link_list, link); 26133c2c65SJasvinder Singh 27133c2c65SJasvinder Singh int 28133c2c65SJasvinder Singh link_init(void); 29133c2c65SJasvinder Singh 30133c2c65SJasvinder Singh struct link * 31133c2c65SJasvinder Singh link_find(const char *name); 32133c2c65SJasvinder Singh 33*ecfc2b1cSKevin Laatz struct link * 34*ecfc2b1cSKevin Laatz link_next(struct link *link); 35*ecfc2b1cSKevin Laatz 36133c2c65SJasvinder Singh struct link_params_rss { 37133c2c65SJasvinder Singh uint32_t queue_id[LINK_RXQ_RSS_MAX]; 38133c2c65SJasvinder Singh uint32_t n_queues; 39133c2c65SJasvinder Singh }; 40133c2c65SJasvinder Singh 41133c2c65SJasvinder Singh struct link_params { 42133c2c65SJasvinder Singh const char *dev_name; 43133c2c65SJasvinder Singh uint16_t port_id; /**< Valid only when *dev_name* is NULL. */ 44133c2c65SJasvinder Singh 45133c2c65SJasvinder Singh struct { 46133c2c65SJasvinder Singh uint32_t n_queues; 47133c2c65SJasvinder Singh uint32_t queue_size; 48133c2c65SJasvinder Singh const char *mempool_name; 49133c2c65SJasvinder Singh struct link_params_rss *rss; 50133c2c65SJasvinder Singh } rx; 51133c2c65SJasvinder Singh 52133c2c65SJasvinder Singh struct { 53133c2c65SJasvinder Singh uint32_t n_queues; 54133c2c65SJasvinder Singh uint32_t queue_size; 55133c2c65SJasvinder Singh } tx; 56133c2c65SJasvinder Singh 57133c2c65SJasvinder Singh int promiscuous; 58133c2c65SJasvinder Singh }; 59133c2c65SJasvinder Singh 60133c2c65SJasvinder Singh struct link * 61133c2c65SJasvinder Singh link_create(const char *name, struct link_params *params); 62133c2c65SJasvinder Singh 63133c2c65SJasvinder Singh int 64133c2c65SJasvinder Singh link_is_up(const char *name); 65133c2c65SJasvinder Singh 66133c2c65SJasvinder Singh #endif /* _INCLUDE_LINK_H_ */ 67