X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fsoftnic%2Frte_eth_softnic.c;h=4bda2f2b024715386c3effe070e94d03118859d2;hb=6d13ea8e8e49ab957deae2bba5ecf4a4bfe747d1;hp=148b82ecb29362ce9e45147485f34ca2de31d74b;hpb=8364aa4734210806aced02525c06d52bc3162375;p=dpdk.git diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c index 148b82ecb2..4bda2f2b02 100644 --- a/drivers/net/softnic/rte_eth_softnic.c +++ b/drivers/net/softnic/rte_eth_softnic.c @@ -14,6 +14,7 @@ #include #include #include +#include #include "rte_eth_softnic.h" #include "rte_eth_softnic_internals.h" @@ -21,16 +22,18 @@ #define PMD_PARAM_FIRMWARE "firmware" #define PMD_PARAM_CONN_PORT "conn_port" #define PMD_PARAM_CPU_ID "cpu_id" +#define PMD_PARAM_SC "sc" #define PMD_PARAM_TM_N_QUEUES "tm_n_queues" #define PMD_PARAM_TM_QSIZE0 "tm_qsize0" #define PMD_PARAM_TM_QSIZE1 "tm_qsize1" #define PMD_PARAM_TM_QSIZE2 "tm_qsize2" #define PMD_PARAM_TM_QSIZE3 "tm_qsize3" -static const char *pmd_valid_args[] = { +static const char * const pmd_valid_args[] = { PMD_PARAM_FIRMWARE, PMD_PARAM_CONN_PORT, PMD_PARAM_CPU_ID, + PMD_PARAM_SC, PMD_PARAM_TM_N_QUEUES, PMD_PARAM_TM_QSIZE0, PMD_PARAM_TM_QSIZE1, @@ -46,7 +49,7 @@ static const char welcome[] = static const char prompt[] = "softnic> "; -struct softnic_conn_params conn_params_default = { +static const struct softnic_conn_params conn_params_default = { .welcome = welcome, .prompt = prompt, .addr = "0.0.0.0", @@ -58,23 +61,6 @@ struct softnic_conn_params conn_params_default = { .msg_handle_arg = NULL, }; -static const struct rte_eth_dev_info pmd_dev_info = { - .min_rx_bufsize = 0, - .max_rx_pktlen = UINT32_MAX, - .max_rx_queues = UINT16_MAX, - .max_tx_queues = UINT16_MAX, - .rx_desc_lim = { - .nb_max = UINT16_MAX, - .nb_min = 0, - .nb_align = 1, - }, - .tx_desc_lim = { - .nb_max = UINT16_MAX, - .nb_min = 0, - .nb_align = 1, - }, -}; - static int pmd_softnic_logtype; #define PMD_LOG(level, fmt, args...) \ @@ -85,7 +71,9 @@ static void pmd_dev_infos_get(struct rte_eth_dev *dev __rte_unused, struct rte_eth_dev_info *dev_info) { - memcpy(dev_info, &pmd_dev_info, sizeof(*dev_info)); + dev_info->max_rx_pktlen = UINT32_MAX; + dev_info->max_rx_queues = UINT16_MAX; + dev_info->max_tx_queues = UINT16_MAX; } static int @@ -189,6 +177,7 @@ pmd_dev_stop(struct rte_eth_dev *dev) softnic_mempool_free(p); tm_hierarchy_free(p); + softnic_mtr_free(p); } static void @@ -227,6 +216,14 @@ pmd_tm_ops_get(struct rte_eth_dev *dev __rte_unused, void *arg) return 0; } +static int +pmd_mtr_ops_get(struct rte_eth_dev *dev __rte_unused, void *arg) +{ + *(const struct rte_mtr_ops **)arg = &pmd_mtr_ops; + + return 0; +} + static const struct eth_dev_ops pmd_ops = { .dev_configure = pmd_dev_configure, .dev_start = pmd_dev_start, @@ -238,6 +235,7 @@ static const struct eth_dev_ops pmd_ops = { .tx_queue_setup = pmd_tx_queue_setup, .filter_ctrl = pmd_filter_ctrl, .tm_ops_get = pmd_tm_ops_get, + .mtr_ops_get = pmd_mtr_ops_get, }; static uint16_t @@ -280,12 +278,14 @@ pmd_init(struct pmd_params *params) /* Resources */ tm_hierarchy_init(p); + softnic_mtr_init(p); softnic_mempool_init(p); softnic_swq_init(p); softnic_link_init(p); softnic_tmgr_init(p); softnic_tap_init(p); + softnic_cryptodev_init(p); softnic_port_in_action_profile_init(p); softnic_table_action_profile_init(p); softnic_pipeline_init(p); @@ -334,11 +334,12 @@ pmd_free(struct pmd_internals *p) softnic_mempool_free(p); tm_hierarchy_free(p); + softnic_mtr_free(p); rte_free(p); } -static struct ether_addr eth_addr = { +static struct rte_ether_addr eth_addr = { .addr_bytes = {0}, }; @@ -427,6 +428,7 @@ pmd_parse_args(struct pmd_params *p, const char *params) memset(p, 0, sizeof(*p)); p->firmware = SOFTNIC_FIRMWARE; p->cpu_id = SOFTNIC_CPU_ID; + p->sc = SOFTNIC_SC; p->tm.n_queues = SOFTNIC_TM_N_QUEUES; p->tm.qsize[0] = SOFTNIC_TM_QUEUE_SIZE; p->tm.qsize[1] = SOFTNIC_TM_QUEUE_SIZE; @@ -457,6 +459,14 @@ pmd_parse_args(struct pmd_params *p, const char *params) goto out_free; } + /* Service cores (optional) */ + if (rte_kvargs_count(kvlist, PMD_PARAM_SC) == 1) { + ret = rte_kvargs_process(kvlist, PMD_PARAM_SC, + &get_uint32, &p->sc); + if (ret < 0) + goto out_free; + } + /* TM number of queues (optional) */ if (rte_kvargs_count(kvlist, PMD_PARAM_TM_N_QUEUES) == 1) { ret = rte_kvargs_process(kvlist, PMD_PARAM_TM_N_QUEUES, @@ -543,7 +553,6 @@ static int pmd_remove(struct rte_vdev_device *vdev) { struct rte_eth_dev *dev = NULL; - struct pmd_internals *p; if (!vdev) return -EINVAL; @@ -554,12 +563,12 @@ pmd_remove(struct rte_vdev_device *vdev) dev = rte_eth_dev_allocated(rte_vdev_device_name(vdev)); if (dev == NULL) return -ENODEV; - p = dev->data->dev_private; /* Free device data structures*/ - rte_free(dev->data); + pmd_free(dev->data->dev_private); + dev->data->dev_private = NULL; /* already freed */ + dev->data->mac_addrs = NULL; /* statically allocated */ rte_eth_dev_release_port(dev); - pmd_free(p); return 0; }