MCPcopy Create free account
hub / github.com/F-Stack/f-stack / cpfl_cfgq_setup

Function cpfl_cfgq_setup

dpdk/drivers/net/cpfl/cpfl_ethdev.c:2011–2063  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2009#define CPFL_CFGQ_RING_SIZE 512
2010
2011static int
2012cpfl_cfgq_setup(struct cpfl_adapter_ext *adapter)
2013{
2014 struct cpfl_ctlq_create_info *create_cfgq_info;
2015 struct cpfl_vport *vport;
2016 int i, err;
2017 uint32_t ring_size = CPFL_CFGQ_RING_SIZE * sizeof(struct idpf_ctlq_desc);
2018 uint32_t buf_size = CPFL_CFGQ_RING_SIZE * CPFL_CFGQ_BUFFER_SIZE;
2019
2020 vport = &adapter->ctrl_vport;
2021 create_cfgq_info = adapter->cfgq_info;
2022
2023 for (i = 0; i < CPFL_CFGQ_NUM; i++) {
2024 if (i % 2 == 0) {
2025 /* Setup Tx config queue */
2026 create_cfgq_info[i].id = vport->base.chunks_info.tx_start_qid + i / 2;
2027 create_cfgq_info[i].type = IDPF_CTLQ_TYPE_CONFIG_TX;
2028 create_cfgq_info[i].len = CPFL_CFGQ_RING_SIZE;
2029 create_cfgq_info[i].buf_size = CPFL_CFGQ_BUFFER_SIZE;
2030 memset(&create_cfgq_info[i].reg, 0, sizeof(struct idpf_ctlq_reg));
2031 create_cfgq_info[i].reg.tail = vport->base.chunks_info.tx_qtail_start +
2032 i / 2 * vport->base.chunks_info.tx_qtail_spacing;
2033 } else {
2034 /* Setup Rx config queue */
2035 create_cfgq_info[i].id = vport->base.chunks_info.rx_start_qid + i / 2;
2036 create_cfgq_info[i].type = IDPF_CTLQ_TYPE_CONFIG_RX;
2037 create_cfgq_info[i].len = CPFL_CFGQ_RING_SIZE;
2038 create_cfgq_info[i].buf_size = CPFL_CFGQ_BUFFER_SIZE;
2039 memset(&create_cfgq_info[i].reg, 0, sizeof(struct idpf_ctlq_reg));
2040 create_cfgq_info[i].reg.tail = vport->base.chunks_info.rx_qtail_start +
2041 i / 2 * vport->base.chunks_info.rx_qtail_spacing;
2042 if (!idpf_alloc_dma_mem(&adapter->base.hw, &create_cfgq_info[i].buf_mem,
2043 buf_size)) {
2044 err = -ENOMEM;
2045 goto free_mem;
2046 }
2047 }
2048 if (!idpf_alloc_dma_mem(&adapter->base.hw, &create_cfgq_info[i].ring_mem,
2049 ring_size)) {
2050 err = -ENOMEM;
2051 goto free_mem;
2052 }
2053 }
2054 return 0;
2055free_mem:
2056 for (i = 0; i < CPFL_CFGQ_NUM; i++) {
2057 if (create_cfgq_info[i].ring_mem.va)
2058 idpf_free_dma_mem(&adapter->base.hw, &create_cfgq_info[i].ring_mem);
2059 if (create_cfgq_info[i].buf_mem.va)
2060 idpf_free_dma_mem(&adapter->base.hw, &create_cfgq_info[i].buf_mem);
2061 }
2062 return err;
2063}
2064
2065static int
2066cpfl_init_ctrl_vport(struct cpfl_adapter_ext *adapter)

Callers 1

cpfl_ctrl_path_openFunction · 0.85

Calls 3

memsetFunction · 0.85
idpf_alloc_dma_memFunction · 0.85
idpf_free_dma_memFunction · 0.85

Tested by

no test coverage detected