* [PATCH] i40e: improve message grepability
From: Michał Mirosław @ 2017-01-11 9:49 UTC (permalink / raw)
To: dev
In-Reply-To: <39ceb2bf1e5aa61e3957a8d8f9e5b2df28d6d2ad.1481590851.git.mirq-linux@rere.qmqm.pl>
Join message lines for easier grepping.
PRIxXX are left glued to strings as they are in other parts of the file.
Signed-off-by: Michał Mirosław <michal.miroslaw@atendesoftware.pl>
---
drivers/net/i40e/i40e_ethdev.c | 308 +++++++++++++++++++++--------------------
1 file changed, 160 insertions(+), 148 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index db2aebdb..00c15f87 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -764,8 +764,8 @@ i40e_add_tx_flow_control_drop_filter(struct i40e_pf *pf)
pf->main_vsi_seid, 0,
TRUE, NULL, NULL);
if (ret)
- PMD_INIT_LOG(ERR, "Failed to add filter to drop flow control "
- " frames from VSIs.");
+ PMD_INIT_LOG(ERR,
+ "Failed to add filter to drop flow control frames from VSIs.");
}
static int
@@ -967,8 +967,8 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
hw->back = I40E_PF_TO_ADAPTER(pf);
hw->hw_addr = (uint8_t *)(pci_dev->mem_resource[0].addr);
if (!hw->hw_addr) {
- PMD_INIT_LOG(ERR, "Hardware is not available, "
- "as address is NULL");
+ PMD_INIT_LOG(ERR,
+ "Hardware is not available, as address is NULL");
return -ENODEV;
}
@@ -1104,8 +1104,8 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
/* Set the global registers with default ether type value */
ret = i40e_vlan_tpid_set(dev, ETH_VLAN_TYPE_OUTER, ETHER_TYPE_VLAN);
if (ret != I40E_SUCCESS) {
- PMD_INIT_LOG(ERR, "Failed to set the default outer "
- "VLAN ether type");
+ PMD_INIT_LOG(ERR,
+ "Failed to set the default outer VLAN ether type");
goto err_setup_pf_switch;
}
@@ -1141,8 +1141,8 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)
/* Should be after VSI initialized */
dev->data->mac_addrs = rte_zmalloc("i40e", len, 0);
if (!dev->data->mac_addrs) {
- PMD_INIT_LOG(ERR, "Failed to allocated memory "
- "for storing mac address");
+ PMD_INIT_LOG(ERR,
+ "Failed to allocated memory for storing mac address");
goto err_mac_alloc;
}
ether_addr_copy((struct ether_addr *)hw->mac.perm_addr,
@@ -1714,8 +1714,9 @@ i40e_dev_start(struct rte_eth_dev *dev)
dev->data->nb_rx_queues * sizeof(int),
0);
if (!intr_handle->intr_vec) {
- PMD_INIT_LOG(ERR, "Failed to allocate %d rx_queues"
- " intr_vec\n", dev->data->nb_rx_queues);
+ PMD_INIT_LOG(ERR,
+ "Failed to allocate %d rx_queues intr_vec\n",
+ dev->data->nb_rx_queues);
return -ENOMEM;
}
}
@@ -1788,8 +1789,8 @@ i40e_dev_start(struct rte_eth_dev *dev)
i40e_pf_enable_irq0(hw);
if (dev->data->dev_conf.intr_conf.lsc != 0)
- PMD_INIT_LOG(INFO, "lsc won't enable because of"
- " no intr multiplex\n");
+ PMD_INIT_LOG(INFO,
+ "lsc won't enable because of no intr multiplex\n");
} else if (dev->data->dev_conf.intr_conf.lsc != 0) {
ret = i40e_aq_set_phy_int_mask(hw,
~(I40E_AQ_EVENT_LINK_UPDOWN |
@@ -2740,13 +2741,15 @@ i40e_vlan_tpid_set(struct rte_eth_dev *dev,
ret = i40e_aq_debug_read_register(hw, I40E_GL_SWT_L2TAGCTRL(reg_id),
®_r, NULL);
if (ret != I40E_SUCCESS) {
- PMD_DRV_LOG(ERR, "Fail to debug read from "
- "I40E_GL_SWT_L2TAGCTRL[%d]", reg_id);
+ PMD_DRV_LOG(ERR,
+ "Fail to debug read from I40E_GL_SWT_L2TAGCTRL[%d]",
+ reg_id);
ret = -EIO;
return ret;
}
- PMD_DRV_LOG(DEBUG, "Debug read from I40E_GL_SWT_L2TAGCTRL[%d]: "
- "0x%08"PRIx64"", reg_id, reg_r);
+ PMD_DRV_LOG(DEBUG,
+ "Debug read from I40E_GL_SWT_L2TAGCTRL[%d]: 0x%08"PRIx64,
+ reg_id, reg_r);
reg_w = reg_r & (~(I40E_GL_SWT_L2TAGCTRL_ETHERTYPE_MASK));
reg_w |= ((uint64_t)tpid << I40E_GL_SWT_L2TAGCTRL_ETHERTYPE_SHIFT);
@@ -2760,12 +2763,14 @@ i40e_vlan_tpid_set(struct rte_eth_dev *dev,
reg_w, NULL);
if (ret != I40E_SUCCESS) {
ret = -EIO;
- PMD_DRV_LOG(ERR, "Fail to debug write to "
- "I40E_GL_SWT_L2TAGCTRL[%d]", reg_id);
+ PMD_DRV_LOG(ERR,
+ "Fail to debug write to I40E_GL_SWT_L2TAGCTRL[%d]",
+ reg_id);
return ret;
}
- PMD_DRV_LOG(DEBUG, "Debug write 0x%08"PRIx64" to "
- "I40E_GL_SWT_L2TAGCTRL[%d]", reg_w, reg_id);
+ PMD_DRV_LOG(DEBUG,
+ "Debug write 0x%08"PRIx64" to I40E_GL_SWT_L2TAGCTRL[%d]",
+ reg_w, reg_id);
return ret;
}
@@ -2909,8 +2914,9 @@ i40e_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
max_high_water = I40E_RXPBSIZE >> I40E_KILOSHIFT;
if ((fc_conf->high_water > max_high_water) ||
(fc_conf->high_water < fc_conf->low_water)) {
- PMD_INIT_LOG(ERR, "Invalid high/low water setup value in KB, "
- "High_water must <= %d.", max_high_water);
+ PMD_INIT_LOG(ERR,
+ "Invalid high/low water setup value in KB, High_water must be <= %d.",
+ max_high_water);
return -EINVAL;
}
@@ -3082,8 +3088,8 @@ i40e_macaddr_remove(struct rte_eth_dev *dev, uint32_t index)
/* No VMDQ pool enabled or configured */
if (!(pf->flags & I40E_FLAG_VMDQ) ||
(i > pf->nb_cfg_vmdq_vsi)) {
- PMD_DRV_LOG(ERR, "No VMDQ pool enabled"
- "/configured");
+ PMD_DRV_LOG(ERR,
+ "No VMDQ pool enabled/configured");
return;
}
vsi = pf->vmdq[i - 1].vsi;
@@ -3284,9 +3290,9 @@ i40e_dev_rss_reta_update(struct rte_eth_dev *dev,
if (reta_size != lut_size ||
reta_size > ETH_RSS_RETA_SIZE_512) {
- PMD_DRV_LOG(ERR, "The size of hash lookup table configured "
- "(%d) doesn't match the number hardware can supported "
- "(%d)\n", reta_size, lut_size);
+ PMD_DRV_LOG(ERR,
+ "The size of hash lookup table configured (%d) doesn't match the number hardware can supported (%d)\n",
+ reta_size, lut_size);
return -EINVAL;
}
@@ -3325,9 +3331,9 @@ i40e_dev_rss_reta_query(struct rte_eth_dev *dev,
if (reta_size != lut_size ||
reta_size > ETH_RSS_RETA_SIZE_512) {
- PMD_DRV_LOG(ERR, "The size of hash lookup table configured "
- "(%d) doesn't match the number hardware can supported "
- "(%d)\n", reta_size, lut_size);
+ PMD_DRV_LOG(ERR,
+ "The size of hash lookup table configured (%d) doesn't match the number hardware can supported (%d)\n",
+ reta_size, lut_size);
return -EINVAL;
}
@@ -3382,8 +3388,9 @@ i40e_allocate_dma_mem_d(__attribute__((unused)) struct i40e_hw *hw,
mem->va = mz->addr;
mem->pa = rte_mem_phy2mch(mz->memseg_id, mz->phys_addr);
mem->zone = (const void *)mz;
- PMD_DRV_LOG(DEBUG, "memzone %s allocated with physical address: "
- "%"PRIu64, mz->name, mem->pa);
+ PMD_DRV_LOG(DEBUG,
+ "memzone %s allocated with physical address: %"PRIu64,
+ mz->name, mem->pa);
return I40E_SUCCESS;
}
@@ -3400,9 +3407,9 @@ i40e_free_dma_mem_d(__attribute__((unused)) struct i40e_hw *hw,
if (!mem)
return I40E_ERR_PARAM;
- PMD_DRV_LOG(DEBUG, "memzone %s to be freed with physical address: "
- "%"PRIu64, ((const struct rte_memzone *)mem->zone)->name,
- mem->pa);
+ PMD_DRV_LOG(DEBUG,
+ "memzone %s to be freed with physical address: %"PRIu64,
+ ((const struct rte_memzone *)mem->zone)->name, mem->pa);
rte_memzone_free((const struct rte_memzone *)mem->zone);
mem->zone = NULL;
mem->va = NULL;
@@ -3561,8 +3568,9 @@ i40e_pf_parameter_init(struct rte_eth_dev *dev)
pf->flags |= I40E_FLAG_SRIOV;
pf->vf_nb_qps = RTE_LIBRTE_I40E_QUEUE_NUM_PER_VF;
pf->vf_num = pci_dev->max_vfs;
- PMD_DRV_LOG(DEBUG, "%u VF VSIs, %u queues per VF VSI, "
- "in total %u queues", pf->vf_num, pf->vf_nb_qps,
+ PMD_DRV_LOG(DEBUG,
+ "%u VF VSIs, %u queues per VF VSI, in total %u queues",
+ pf->vf_num, pf->vf_nb_qps,
pf->vf_nb_qps * pf->vf_num);
} else {
pf->vf_nb_qps = 0;
@@ -3591,14 +3599,14 @@ i40e_pf_parameter_init(struct rte_eth_dev *dev)
if (pf->max_nb_vmdq_vsi) {
pf->flags |= I40E_FLAG_VMDQ;
pf->vmdq_nb_qps = pf->vmdq_nb_qp_max;
- PMD_DRV_LOG(DEBUG, "%u VMDQ VSIs, %u queues "
- "per VMDQ VSI, in total %u queues",
+ PMD_DRV_LOG(DEBUG,
+ "%u VMDQ VSIs, %u queues per VMDQ VSI, in total %u queues",
pf->max_nb_vmdq_vsi,
pf->vmdq_nb_qps, pf->vmdq_nb_qps *
pf->max_nb_vmdq_vsi);
} else {
- PMD_DRV_LOG(INFO, "No enough queues left for "
- "VMDq");
+ PMD_DRV_LOG(INFO,
+ "No enough queues left for VMDq");
}
} else {
PMD_DRV_LOG(INFO, "No queue or VSI left for VMDq");
@@ -3611,15 +3619,15 @@ i40e_pf_parameter_init(struct rte_eth_dev *dev)
pf->flags |= I40E_FLAG_DCB;
if (qp_count > hw->func_caps.num_tx_qp) {
- PMD_DRV_LOG(ERR, "Failed to allocate %u queues, which exceeds "
- "the hardware maximum %u", qp_count,
- hw->func_caps.num_tx_qp);
+ PMD_DRV_LOG(ERR,
+ "Failed to allocate %u queues, which exceeds the hardware maximum %u",
+ qp_count, hw->func_caps.num_tx_qp);
return -EINVAL;
}
if (vsi_count > hw->func_caps.num_vsis) {
- PMD_DRV_LOG(ERR, "Failed to allocate %u VSIs, which exceeds "
- "the hardware maximum %u", vsi_count,
- hw->func_caps.num_vsis);
+ PMD_DRV_LOG(ERR,
+ "Failed to allocate %u VSIs, which exceeds the hardware maximum %u",
+ vsi_count, hw->func_caps.num_vsis);
return -EINVAL;
}
@@ -3865,8 +3873,8 @@ i40e_res_pool_alloc(struct i40e_res_pool_info *pool,
*/
entry = rte_zmalloc("res_pool", sizeof(*entry), 0);
if (entry == NULL) {
- PMD_DRV_LOG(ERR, "Failed to allocate memory for "
- "resource pool");
+ PMD_DRV_LOG(ERR,
+ "Failed to allocate memory for resource pool");
return -ENOMEM;
}
entry->base = valid_entry->base;
@@ -3906,9 +3914,9 @@ validate_tcmap_parameter(struct i40e_vsi *vsi, uint8_t enabled_tcmap)
}
if (!bitmap_is_subset(hw->func_caps.enabled_tcmap, enabled_tcmap)) {
- PMD_DRV_LOG(ERR, "Enabled TC map 0x%x not applicable to "
- "HW support 0x%x", hw->func_caps.enabled_tcmap,
- enabled_tcmap);
+ PMD_DRV_LOG(ERR,
+ "Enabled TC map 0x%x not applicable to HW support 0x%x",
+ hw->func_caps.enabled_tcmap, enabled_tcmap);
return I40E_NOT_SUPPORTED;
}
return I40E_SUCCESS;
@@ -4250,8 +4258,8 @@ i40e_update_default_filter_setting(struct i40e_vsi *vsi)
struct i40e_mac_filter *f;
struct ether_addr *mac;
- PMD_DRV_LOG(WARNING, "Cannot remove the default "
- "macvlan filter");
+ PMD_DRV_LOG(WARNING,
+ "Cannot remove the default macvlan filter");
/* It needs to add the permanent mac into mac list */
f = rte_zmalloc("macv_filter", sizeof(*f), 0);
if (f == NULL) {
@@ -4301,8 +4309,9 @@ i40e_vsi_get_bw_config(struct i40e_vsi *vsi)
ret = i40e_aq_query_vsi_ets_sla_config(hw, vsi->seid,
&ets_sla_config, NULL);
if (ret != I40E_SUCCESS) {
- PMD_DRV_LOG(ERR, "VSI failed to get TC bandwdith "
- "configuration %u", hw->aq.asq_last_status);
+ PMD_DRV_LOG(ERR,
+ "VSI failed to get TC bandwdith configuration %u",
+ hw->aq.asq_last_status);
return ret;
}
@@ -4390,14 +4399,14 @@ i40e_vsi_setup(struct i40e_pf *pf,
if (type != I40E_VSI_MAIN && type != I40E_VSI_SRIOV &&
uplink_vsi == NULL) {
- PMD_DRV_LOG(ERR, "VSI setup failed, "
- "VSI link shouldn't be NULL");
+ PMD_DRV_LOG(ERR,
+ "VSI setup failed, VSI link shouldn't be NULL");
return NULL;
}
if (type == I40E_VSI_MAIN && uplink_vsi != NULL) {
- PMD_DRV_LOG(ERR, "VSI setup failed, MAIN VSI "
- "uplink VSI should be NULL");
+ PMD_DRV_LOG(ERR,
+ "VSI setup failed, MAIN VSI uplink VSI should be NULL");
return NULL;
}
@@ -4548,8 +4557,8 @@ i40e_vsi_setup(struct i40e_pf *pf,
ret = i40e_vsi_config_tc_queue_mapping(vsi, &ctxt.info,
I40E_DEFAULT_TCMAP);
if (ret != I40E_SUCCESS) {
- PMD_DRV_LOG(ERR, "Failed to configure "
- "TC queue mapping");
+ PMD_DRV_LOG(ERR,
+ "Failed to configure TC queue mapping");
goto fail_msix_alloc;
}
ctxt.seid = vsi->seid;
@@ -4619,8 +4628,8 @@ i40e_vsi_setup(struct i40e_pf *pf,
ret = i40e_vsi_config_tc_queue_mapping(vsi, &ctxt.info,
I40E_DEFAULT_TCMAP);
if (ret != I40E_SUCCESS) {
- PMD_DRV_LOG(ERR, "Failed to configure "
- "TC queue mapping");
+ PMD_DRV_LOG(ERR,
+ "Failed to configure TC queue mapping");
goto fail_msix_alloc;
}
ctxt.info.up_enable_bits = I40E_DEFAULT_TCMAP;
@@ -4662,8 +4671,8 @@ i40e_vsi_setup(struct i40e_pf *pf,
ret = i40e_vsi_config_tc_queue_mapping(vsi, &ctxt.info,
I40E_DEFAULT_TCMAP);
if (ret != I40E_SUCCESS) {
- PMD_DRV_LOG(ERR, "Failed to configure "
- "TC queue mapping");
+ PMD_DRV_LOG(ERR,
+ "Failed to configure TC queue mapping");
goto fail_msix_alloc;
}
ctxt.info.up_enable_bits = I40E_DEFAULT_TCMAP;
@@ -4680,8 +4689,8 @@ i40e_vsi_setup(struct i40e_pf *pf,
ret = i40e_vsi_config_tc_queue_mapping(vsi, &ctxt.info,
I40E_DEFAULT_TCMAP);
if (ret != I40E_SUCCESS) {
- PMD_DRV_LOG(ERR, "Failed to configure "
- "TC queue mapping.");
+ PMD_DRV_LOG(ERR,
+ "Failed to configure TC queue mapping.");
goto fail_msix_alloc;
}
ctxt.info.up_enable_bits = I40E_DEFAULT_TCMAP;
@@ -4944,8 +4953,9 @@ i40e_pf_setup(struct i40e_pf *pf)
/* make queue allocated first, let FDIR use queue pair 0*/
ret = i40e_res_pool_alloc(&pf->qp_pool, I40E_DEFAULT_QP_NUM_FDIR);
if (ret != I40E_FDIR_QUEUE_ID) {
- PMD_DRV_LOG(ERR, "queue allocation fails for FDIR :"
- " ret =%d", ret);
+ PMD_DRV_LOG(ERR,
+ "queue allocation fails for FDIR: ret =%d",
+ ret);
pf->flags &= ~I40E_FLAG_FDIR;
}
}
@@ -4968,8 +4978,8 @@ i40e_pf_setup(struct i40e_pf *pf)
hw->func_caps.rss_table_size);
return I40E_ERR_PARAM;
}
- PMD_DRV_LOG(INFO, "Hardware capability of hash lookup table "
- "size: %u\n", hw->func_caps.rss_table_size);
+ PMD_DRV_LOG(INFO, "Hardware capability of hash lookup table size: %u\n",
+ hw->func_caps.rss_table_size);
pf->hash_lut_size = hw->func_caps.rss_table_size;
/* Enable ethtype and macvlan filters */
@@ -5219,8 +5229,8 @@ i40e_dev_rx_init(struct i40e_pf *pf)
ret = i40e_rx_queue_init(rxq);
if (ret != I40E_SUCCESS) {
- PMD_DRV_LOG(ERR, "Failed to do RX queue "
- "initialization");
+ PMD_DRV_LOG(ERR,
+ "Failed to do RX queue initialization");
break;
}
}
@@ -5504,8 +5514,9 @@ i40e_dev_handle_aq_msg(struct rte_eth_dev *dev)
ret = i40e_clean_arq_element(hw, &info, &pending);
if (ret != I40E_SUCCESS) {
- PMD_DRV_LOG(INFO, "Failed to read msg from AdminQ, "
- "aq_err: %u", hw->aq.asq_last_status);
+ PMD_DRV_LOG(INFO,
+ "Failed to read msg from AdminQ, aq_err: %u",
+ hw->aq.asq_last_status);
break;
}
opcode = rte_le_to_cpu_16(info.desc.opcode);
@@ -5822,8 +5833,8 @@ i40e_find_all_vlan_for_mac(struct i40e_vsi *vsi,
for (k = 0; k < I40E_UINT32_BIT_SIZE; k++) {
if (vsi->vfta[j] & (1 << k)) {
if (i > num - 1) {
- PMD_DRV_LOG(ERR, "vlan number "
- "not match");
+ PMD_DRV_LOG(ERR,
+ "vlan number doesn't match");
return I40E_ERR_PARAM;
}
(void)rte_memcpy(&mv_f[i].macaddr,
@@ -6304,8 +6315,7 @@ i40e_set_rss_key(struct i40e_vsi *vsi, uint8_t *key, uint8_t key_len)
ret = i40e_aq_set_rss_key(hw, vsi->vsi_id, key_dw);
if (ret)
- PMD_INIT_LOG(ERR, "Failed to configure RSS key "
- "via AQ");
+ PMD_INIT_LOG(ERR, "Failed to configure RSS key via AQ");
} else {
uint32_t *hash_key = (uint32_t *)key;
uint16_t i;
@@ -6569,8 +6579,9 @@ i40e_add_vxlan_port(struct i40e_pf *pf, uint16_t port)
/* Now check if there is space to add the new port */
idx = i40e_get_vxlan_port_idx(pf, 0);
if (idx < 0) {
- PMD_DRV_LOG(ERR, "Maximum number of UDP ports reached,"
- "not adding port %d", port);
+ PMD_DRV_LOG(ERR,
+ "Maximum number of UDP ports reached, not adding port %d",
+ port);
return -ENOSPC;
}
@@ -6941,15 +6952,15 @@ i40e_set_symmetric_hash_enable_per_port(struct i40e_hw *hw, uint8_t enable)
if (enable > 0) {
if (reg & I40E_PRTQF_CTL_0_HSYM_ENA_MASK) {
- PMD_DRV_LOG(INFO, "Symmetric hash has already "
- "been enabled");
+ PMD_DRV_LOG(INFO,
+ "Symmetric hash has already been enabled");
return;
}
reg |= I40E_PRTQF_CTL_0_HSYM_ENA_MASK;
} else {
if (!(reg & I40E_PRTQF_CTL_0_HSYM_ENA_MASK)) {
- PMD_DRV_LOG(INFO, "Symmetric hash has already "
- "been disabled");
+ PMD_DRV_LOG(INFO,
+ "Symmetric hash has already been disabled");
return;
}
reg &= ~I40E_PRTQF_CTL_0_HSYM_ENA_MASK;
@@ -7073,16 +7084,16 @@ i40e_set_hash_filter_global_config(struct i40e_hw *hw,
if (g_cfg->hash_func == RTE_ETH_HASH_FUNCTION_TOEPLITZ) {
/* Toeplitz */
if (reg & I40E_GLQF_CTL_HTOEP_MASK) {
- PMD_DRV_LOG(DEBUG, "Hash function already set to "
- "Toeplitz");
+ PMD_DRV_LOG(DEBUG,
+ "Hash function already set to Toeplitz");
goto out;
}
reg |= I40E_GLQF_CTL_HTOEP_MASK;
} else if (g_cfg->hash_func == RTE_ETH_HASH_FUNCTION_SIMPLE_XOR) {
/* Simple XOR */
if (!(reg & I40E_GLQF_CTL_HTOEP_MASK)) {
- PMD_DRV_LOG(DEBUG, "Hash function already set to "
- "Simple XOR");
+ PMD_DRV_LOG(DEBUG,
+ "Hash function already set to Simple XOR");
goto out;
}
reg &= ~I40E_GLQF_CTL_HTOEP_MASK;
@@ -8030,13 +8041,14 @@ i40e_ethertype_filter_set(struct i40e_pf *pf,
}
if (filter->ether_type == ETHER_TYPE_IPv4 ||
filter->ether_type == ETHER_TYPE_IPv6) {
- PMD_DRV_LOG(ERR, "unsupported ether_type(0x%04x) in"
- " control packet filter.", filter->ether_type);
+ PMD_DRV_LOG(ERR,
+ "unsupported ether_type(0x%04x) in control packet filter.",
+ filter->ether_type);
return -EINVAL;
}
if (filter->ether_type == ETHER_TYPE_VLAN)
- PMD_DRV_LOG(WARNING, "filter vlan ether_type in first tag is"
- " not supported.");
+ PMD_DRV_LOG(WARNING,
+ "filter vlan ether_type in first tag is not supported.");
if (!(filter->flags & RTE_ETHTYPE_FLAGS_MAC))
flags |= I40E_AQC_ADD_CONTROL_PACKET_FLAGS_IGNORE_MAC;
@@ -8051,11 +8063,10 @@ i40e_ethertype_filter_set(struct i40e_pf *pf,
pf->main_vsi->seid,
filter->queue, add, &stats, NULL);
- PMD_DRV_LOG(INFO, "add/rem control packet filter, return %d,"
- " mac_etype_used = %u, etype_used = %u,"
- " mac_etype_free = %u, etype_free = %u\n",
- ret, stats.mac_etype_used, stats.etype_used,
- stats.mac_etype_free, stats.etype_free);
+ PMD_DRV_LOG(INFO,
+ "add/rem control packet filter, return %d, mac_etype_used = %u, etype_used = %u, mac_etype_free = %u, etype_free = %u\n",
+ ret, stats.mac_etype_used, stats.etype_used,
+ stats.mac_etype_free, stats.etype_free);
if (ret < 0)
return -ENOSYS;
return 0;
@@ -8364,9 +8375,9 @@ i40e_configure_registers(struct i40e_hw *hw)
ret = i40e_aq_debug_write_register(hw, reg_table[i].addr,
reg_table[i].val, NULL);
if (ret < 0) {
- PMD_DRV_LOG(ERR, "Failed to write 0x%"PRIx64" to the "
- "address of 0x%"PRIx32, reg_table[i].val,
- reg_table[i].addr);
+ PMD_DRV_LOG(ERR,
+ "Failed to write 0x%"PRIx64" to the address of 0x%"PRIx32,
+ reg_table[i].val, reg_table[i].addr);
break;
}
PMD_DRV_LOG(DEBUG, "Write 0x%"PRIx64" to the address of "
@@ -8411,8 +8422,9 @@ i40e_config_qinq(struct i40e_hw *hw, struct i40e_vsi *vsi)
I40E_VSI_L2TAGSTXVALID(
vsi->vsi_id), reg, NULL);
if (ret < 0) {
- PMD_DRV_LOG(ERR, "Failed to update "
- "VSI_L2TAGSTXVALID[%d]", vsi->vsi_id);
+ PMD_DRV_LOG(ERR,
+ "Failed to update VSI_L2TAGSTXVALID[%d]",
+ vsi->vsi_id);
return I40E_ERR_CONFIG;
}
}
@@ -8463,11 +8475,10 @@ i40e_aq_add_mirror_rule(struct i40e_hw *hw,
rte_memcpy(&desc.params.raw, &cmd, sizeof(cmd));
status = i40e_asq_send_command(hw, &desc, entries, buff_len, NULL);
- PMD_DRV_LOG(INFO, "i40e_aq_add_mirror_rule, aq_status %d,"
- "rule_id = %u"
- " mirror_rules_used = %u, mirror_rules_free = %u,",
- hw->aq.asq_last_status, resp->rule_id,
- resp->mirror_rules_used, resp->mirror_rules_free);
+ PMD_DRV_LOG(INFO,
+ "i40e_aq_add_mirror_rule, aq_status %d, rule_id = %u mirror_rules_used = %u, mirror_rules_free = %u,",
+ hw->aq.asq_last_status, resp->rule_id,
+ resp->mirror_rules_used, resp->mirror_rules_free);
*rule_id = rte_le_to_cpu_16(resp->rule_id);
return status;
@@ -8545,8 +8556,8 @@ i40e_mirror_rule_set(struct rte_eth_dev *dev,
PMD_DRV_LOG(DEBUG, "i40e_mirror_rule_set: sw_id = %d.", sw_id);
if (pf->main_vsi->veb == NULL || pf->vfs == NULL) {
- PMD_DRV_LOG(ERR, "mirror rule can not be configured"
- " without veb or vfs.");
+ PMD_DRV_LOG(ERR,
+ "mirror rule can not be configured without veb or vfs.");
return -ENOSYS;
}
if (pf->nb_mirror_rule > I40E_MAX_MIRROR_RULES) {
@@ -8578,9 +8589,9 @@ i40e_mirror_rule_set(struct rte_eth_dev *dev,
mirr_rule->entries,
mirr_rule->num_entries, mirr_rule->id);
if (ret < 0) {
- PMD_DRV_LOG(ERR, "failed to remove mirror rule:"
- " ret = %d, aq_err = %d.",
- ret, hw->aq.asq_last_status);
+ PMD_DRV_LOG(ERR,
+ "failed to remove mirror rule: ret = %d, aq_err = %d.",
+ ret, hw->aq.asq_last_status);
return -ENOSYS;
}
TAILQ_REMOVE(&pf->mirror_list, mirr_rule, rules);
@@ -8669,9 +8680,9 @@ i40e_mirror_rule_set(struct rte_eth_dev *dev,
mirr_rule->rule_type, mirr_rule->entries,
j, &rule_id);
if (ret < 0) {
- PMD_DRV_LOG(ERR, "failed to add mirror rule:"
- " ret = %d, aq_err = %d.",
- ret, hw->aq.asq_last_status);
+ PMD_DRV_LOG(ERR,
+ "failed to add mirror rule: ret = %d, aq_err = %d.",
+ ret, hw->aq.asq_last_status);
rte_free(mirr_rule);
return -ENOSYS;
}
@@ -8723,9 +8734,9 @@ i40e_mirror_rule_reset(struct rte_eth_dev *dev, uint8_t sw_id)
mirr_rule->entries,
mirr_rule->num_entries, mirr_rule->id);
if (ret < 0) {
- PMD_DRV_LOG(ERR, "failed to remove mirror rule:"
- " status = %d, aq_err = %d.",
- ret, hw->aq.asq_last_status);
+ PMD_DRV_LOG(ERR,
+ "failed to remove mirror rule: status = %d, aq_err = %d.",
+ ret, hw->aq.asq_last_status);
return -ENOSYS;
}
TAILQ_REMOVE(&pf->mirror_list, mirr_rule, rules);
@@ -9157,9 +9168,9 @@ i40e_config_switch_comp_tc(struct i40e_veb *veb, uint8_t tc_map)
ret = i40e_aq_config_switch_comp_bw_config(hw, veb->seid,
&veb_bw, NULL);
if (ret) {
- PMD_INIT_LOG(ERR, "AQ command Config switch_comp BW allocation"
- " per TC failed = %d",
- hw->aq.asq_last_status);
+ PMD_INIT_LOG(ERR,
+ "AQ command Config switch_comp BW allocation per TC failed = %d",
+ hw->aq.asq_last_status);
return ret;
}
@@ -9167,16 +9178,18 @@ i40e_config_switch_comp_tc(struct i40e_veb *veb, uint8_t tc_map)
ret = i40e_aq_query_switch_comp_ets_config(hw, veb->seid,
&ets_query, NULL);
if (ret != I40E_SUCCESS) {
- PMD_DRV_LOG(ERR, "Failed to get switch_comp ETS"
- " configuration %u", hw->aq.asq_last_status);
+ PMD_DRV_LOG(ERR,
+ "Failed to get switch_comp ETS configuration %u",
+ hw->aq.asq_last_status);
return ret;
}
memset(&bw_query, 0, sizeof(bw_query));
ret = i40e_aq_query_switch_comp_bw_config(hw, veb->seid,
&bw_query, NULL);
if (ret != I40E_SUCCESS) {
- PMD_DRV_LOG(ERR, "Failed to get switch_comp bandwidth"
- " configuration %u", hw->aq.asq_last_status);
+ PMD_DRV_LOG(ERR,
+ "Failed to get switch_comp bandwidth configuration %u",
+ hw->aq.asq_last_status);
return ret;
}
@@ -9241,9 +9254,9 @@ i40e_vsi_config_tc(struct i40e_vsi *vsi, uint8_t tc_map)
}
ret = i40e_aq_config_vsi_tc_bw(hw, vsi->seid, &bw_data, NULL);
if (ret) {
- PMD_INIT_LOG(ERR, "AQ command Config VSI BW allocation"
- " per TC failed = %d",
- hw->aq.asq_last_status);
+ PMD_INIT_LOG(ERR,
+ "AQ command Config VSI BW allocation per TC failed = %d",
+ hw->aq.asq_last_status);
goto out;
}
for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++)
@@ -9263,9 +9276,8 @@ i40e_vsi_config_tc(struct i40e_vsi *vsi, uint8_t tc_map)
/* Update the VSI after updating the VSI queue-mapping information */
ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
if (ret) {
- PMD_INIT_LOG(ERR, "Failed to configure "
- "TC queue mapping = %d",
- hw->aq.asq_last_status);
+ PMD_INIT_LOG(ERR, "Failed to configure TC queue mapping = %d",
+ hw->aq.asq_last_status);
goto out;
}
/* update the local VSI info with updated queue map */
@@ -9317,8 +9329,8 @@ i40e_dcb_hw_configure(struct i40e_pf *pf,
/* Use the FW API if FW > v4.4*/
if (!(((hw->aq.fw_maj_ver == 4) && (hw->aq.fw_min_ver >= 4)) ||
(hw->aq.fw_maj_ver >= 5))) {
- PMD_INIT_LOG(ERR, "FW < v4.4, can not use FW LLDP API"
- " to configure DCB");
+ PMD_INIT_LOG(ERR,
+ "FW < v4.4, can not use FW LLDP API to configure DCB");
return I40E_ERR_FIRMWARE_API_VERSION;
}
@@ -9384,8 +9396,8 @@ i40e_dcb_hw_configure(struct i40e_pf *pf,
I40E_DEFAULT_TCMAP);
if (ret)
PMD_INIT_LOG(WARNING,
- "Failed configuring TC for VSI seid=%d\n",
- vsi_list->vsi->seid);
+ "Failed configuring TC for VSI seid=%d\n",
+ vsi_list->vsi->seid);
/* continue */
}
}
@@ -9445,15 +9457,15 @@ i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
I40E_APP_PROTOID_FCOE;
ret = i40e_set_dcb_config(hw);
if (ret) {
- PMD_INIT_LOG(ERR, "default dcb config fails."
- " err = %d, aq_err = %d.", ret,
- hw->aq.asq_last_status);
+ PMD_INIT_LOG(ERR,
+ "default dcb config fails. err = %d, aq_err = %d.",
+ ret, hw->aq.asq_last_status);
return -ENOSYS;
}
} else {
- PMD_INIT_LOG(ERR, "DCB initialization in FW fails,"
- " err = %d, aq_err = %d.", ret,
- hw->aq.asq_last_status);
+ PMD_INIT_LOG(ERR,
+ "DCB initialization in FW fails, err = %d, aq_err = %d.",
+ ret, hw->aq.asq_last_status);
return -ENOTSUP;
}
} else {
@@ -9464,14 +9476,14 @@ i40e_dcb_init_configure(struct rte_eth_dev *dev, bool sw_dcb)
ret = i40e_init_dcb(hw);
if (!ret) {
if (hw->dcbx_status == I40E_DCBX_STATUS_DISABLED) {
- PMD_INIT_LOG(ERR, "HW doesn't support"
- " DCBX offload.");
+ PMD_INIT_LOG(ERR,
+ "HW doesn't support DCBX offload.");
return -ENOTSUP;
}
} else {
- PMD_INIT_LOG(ERR, "DCBX configuration failed, err = %d,"
- " aq_err = %d.", ret,
- hw->aq.asq_last_status);
+ PMD_INIT_LOG(ERR,
+ "DCBX configuration failed, err = %d, aq_err = %d.",
+ ret, hw->aq.asq_last_status);
return -ENOTSUP;
}
}
--
2.11.0
^ permalink raw reply related
* Re: [PATCH v2 13/18] net/ixgbe: parse TCP SYN filter
From: Zhao1, Wei @ 2017-01-11 9:11 UTC (permalink / raw)
To: Yigit, Ferruh, dev@dpdk.org; +Cc: Lu, Wenzhuo
In-Reply-To: <8c0dd569-43e5-8b8c-d411-aef2be616e03@intel.com>
HI, yigit
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Saturday, January 7, 2017 1:20 AM
> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v2 13/18] net/ixgbe: parse TCP SYN filter
>
> On 12/30/2016 7:53 AM, Wei Zhao wrote:
> > check if the rule is a TCP SYN rule, and get the SYN info.
> >
> > Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> > Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
> >
> > ---
> >
> > v2:add new error set function
> > ---
>
> <...>
>
> > +static int
> > +ixgbe_parse_syn_filter(const struct rte_flow_attr *attr,
> > + const struct rte_flow_item pattern[],
> > + const struct rte_flow_action actions[],
> > + struct rte_eth_syn_filter *filter,
> > + struct rte_flow_error *error) {
> > + int ret;
> > +
> > + ret = cons_parse_syn_filter(attr, pattern,
> > + actions, filter, error);
> > +
>
> > + if (ret)
> > + return ret;
> > +
> > + return 0;
>
> "return ret;" will do the same.
> Or remove ret completely perhaps.
Return 0 is the same as "return ret;", so this may be not to need change.
>
> > +}
> > +
> <...>
^ permalink raw reply
* [PATCH] net/mlx5: support extended statistics
From: Shahaf Shuler @ 2017-01-11 8:55 UTC (permalink / raw)
To: adrien.mazarguil; +Cc: dev, Elad Persiko, Hanoch Haim
Implement xstats_*() DPDK callbacks
Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Signed-off-by: Elad Persiko <eladpe@mellanox.com>
Signed-off-by: Hanoch Haim <hhaim@cisco.com>
---
drivers/net/mlx5/mlx5.c | 3 +
drivers/net/mlx5/mlx5.h | 12 ++
drivers/net/mlx5/mlx5_defs.h | 3 +
drivers/net/mlx5/mlx5_stats.c | 342 ++++++++++++++++++++++++++++++++++++++++
drivers/net/mlx5/mlx5_trigger.c | 1 +
5 files changed, 361 insertions(+)
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 6293c1f..3359d3c 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -199,6 +199,9 @@
.link_update = mlx5_link_update,
.stats_get = mlx5_stats_get,
.stats_reset = mlx5_stats_reset,
+ .xstats_get = mlx5_xstats_get,
+ .xstats_reset = mlx5_xstats_reset,
+ .xstats_get_names = mlx5_xstats_get_names,
.dev_infos_get = mlx5_dev_infos_get,
.dev_supported_ptypes_get = mlx5_dev_supported_ptypes_get,
.vlan_filter_set = mlx5_vlan_filter_set,
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index ee62e04..034a05e 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -89,6 +89,11 @@ enum {
PCI_DEVICE_ID_MELLANOX_CONNECTX5EXVF = 0x101a,
};
+struct mlx5_xstats_ctrl {
+ uint64_t shadow[MLX5_MAX_XSTATS];
+ uint16_t stats_n; /* Number of device stats. */
+};
+
struct priv {
struct rte_eth_dev *dev; /* Ethernet device. */
struct ibv_context *ctx; /* Verbs context. */
@@ -142,6 +147,7 @@ struct priv {
struct fdir_queue *fdir_drop_queue; /* Flow director drop queue. */
LIST_HEAD(mlx5_flows, rte_flow) flows; /* RTE Flow rules. */
uint32_t link_speed_capa; /* Link speed capabilities. */
+ struct mlx5_xstats_ctrl xstats_ctrl; /* Extended stats control. */
rte_spinlock_t lock; /* Lock for control functions. */
};
@@ -250,8 +256,14 @@ int mlx5_dev_rss_reta_update(struct rte_eth_dev *,
/* mlx5_stats.c */
+void priv_xstats_init(struct priv *);
void mlx5_stats_get(struct rte_eth_dev *, struct rte_eth_stats *);
void mlx5_stats_reset(struct rte_eth_dev *);
+int mlx5_xstats_get(struct rte_eth_dev *,
+ struct rte_eth_xstat *, unsigned int);
+void mlx5_xstats_reset(struct rte_eth_dev *);
+int mlx5_xstats_get_names(struct rte_eth_dev *,
+ struct rte_eth_xstat_name *, unsigned int);
/* mlx5_vlan.c */
diff --git a/drivers/net/mlx5/mlx5_defs.h b/drivers/net/mlx5/mlx5_defs.h
index b32816e..beabb70 100644
--- a/drivers/net/mlx5/mlx5_defs.h
+++ b/drivers/net/mlx5/mlx5_defs.h
@@ -79,4 +79,7 @@
/* Alarm timeout. */
#define MLX5_ALARM_TIMEOUT_US 100000
+/* Maximum number of extended statistics counters. */
+#define MLX5_MAX_XSTATS 32
+
#endif /* RTE_PMD_MLX5_DEFS_H_ */
diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c
index f2b5781..08a7656 100644
--- a/drivers/net/mlx5/mlx5_stats.c
+++ b/drivers/net/mlx5/mlx5_stats.c
@@ -31,11 +31,16 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <linux/sockios.h>
+#include <linux/ethtool.h>
+
/* DPDK headers don't like -pedantic. */
#ifdef PEDANTIC
#pragma GCC diagnostic ignored "-Wpedantic"
#endif
#include <rte_ethdev.h>
+#include <rte_common.h>
+#include <rte_malloc.h>
#ifdef PEDANTIC
#pragma GCC diagnostic error "-Wpedantic"
#endif
@@ -44,6 +49,269 @@
#include "mlx5_rxtx.h"
#include "mlx5_defs.h"
+struct mlx5_counter_ctrl {
+ /* Name of the counter for dpdk user. */
+ char dpdk_name[RTE_ETH_XSTATS_NAME_SIZE];
+ /* Name of the counter on the device table. */
+ char ctr_name[RTE_ETH_XSTATS_NAME_SIZE];
+ /* Index in the device counters table. */
+ uint16_t dev_table_idx;
+};
+
+static struct mlx5_counter_ctrl mlx5_counters_init[] = {
+ {
+ .dpdk_name = "rx_port_unicast_bytes",
+ .ctr_name = "rx_vport_unicast_bytes",
+ .dev_table_idx = 0
+ },
+ {
+ .dpdk_name = "rx_port_multicast_bytes",
+ .ctr_name = "rx_vport_multicast_bytes",
+ .dev_table_idx = 0
+ },
+ {
+ .dpdk_name = "rx_port_broadcast_bytes",
+ .ctr_name = "rx_vport_broadcast_bytes",
+ .dev_table_idx = 0
+ },
+ {
+ .dpdk_name = "rx_port_unicast_packets",
+ .ctr_name = "rx_vport_unicast_packets",
+ .dev_table_idx = 0
+ },
+ {
+ .dpdk_name = "rx_port_multicast_packets",
+ .ctr_name = "rx_vport_multicast_packets",
+ .dev_table_idx = 0
+ },
+ {
+ .dpdk_name = "rx_port_broadcast_packets",
+ .ctr_name = "rx_vport_broadcast_packets",
+ .dev_table_idx = 0
+ },
+ {
+ .dpdk_name = "tx_port_unicast_bytes",
+ .ctr_name = "tx_vport_unicast_bytes",
+ .dev_table_idx = 0
+ },
+ {
+ .dpdk_name = "tx_port_multicast_bytes",
+ .ctr_name = "tx_vport_multicast_bytes",
+ .dev_table_idx = 0
+ },
+ {
+ .dpdk_name = "tx_port_broadcast_bytes",
+ .ctr_name = "tx_vport_broadcast_bytes",
+ .dev_table_idx = 0
+ },
+ {
+ .dpdk_name = "tx_port_unicast_packets",
+ .ctr_name = "tx_vport_unicast_packets",
+ .dev_table_idx = 0
+ },
+ {
+ .dpdk_name = "tx_port_multicast_packets",
+ .ctr_name = "tx_vport_multicast_packets",
+ .dev_table_idx = 0
+ },
+ {
+ .dpdk_name = "tx_port_broadcast_packets",
+ .ctr_name = "tx_vport_broadcast_packets",
+ .dev_table_idx = 0
+ },
+ {
+ .dpdk_name = "rx_wqe_err",
+ .ctr_name = "rx_wqe_err",
+ .dev_table_idx = 0
+ },
+ {
+ .dpdk_name = "rx_crc_errors_phy",
+ .ctr_name = "rx_crc_errors_phy",
+ .dev_table_idx = 0
+ },
+ {
+ .dpdk_name = "rx_in_range_len_errors_phy",
+ .ctr_name = "rx_in_range_len_errors_phy",
+ .dev_table_idx = 0
+ },
+ {
+ .dpdk_name = "rx_symbol_err_phy",
+ .ctr_name = "rx_symbol_err_phy",
+ .dev_table_idx = 0
+ },
+ {
+ .dpdk_name = "tx_errors_phy",
+ .ctr_name = "tx_errors_phy",
+ .dev_table_idx = 0
+ },
+};
+
+const unsigned int xstats_n = RTE_DIM(mlx5_counters_init);
+
+/**
+ * Read device counters table.
+ *
+ * @param priv
+ * Pointer to private structure.
+ * @param[out] stats
+ * Counters table output buffer.
+ *
+ * @return
+ * 0 on success and stats is filled, negative on error.
+ */
+static int
+priv_read_dev_counters(struct priv *priv, uint64_t *stats)
+{
+ struct mlx5_xstats_ctrl *xstats_ctrl = &priv->xstats_ctrl;
+ unsigned int i;
+ struct ifreq ifr;
+ unsigned int stats_sz = (xstats_ctrl->stats_n * sizeof(uint64_t)) +
+ sizeof(struct ethtool_stats);
+ struct ethtool_stats et_stats[(stats_sz + (
+ sizeof(struct ethtool_stats) - 1)) /
+ sizeof(struct ethtool_stats)];
+
+ et_stats->cmd = ETHTOOL_GSTATS;
+ et_stats->n_stats = xstats_ctrl->stats_n;
+ ifr.ifr_data = (caddr_t)et_stats;
+ if (priv_ifreq(priv, SIOCETHTOOL, &ifr) != 0) {
+ WARN("unable to get statistic values");
+ return -1;
+ }
+ for (i = 0; (i != xstats_n) ; ++i)
+ stats[i] = (uint64_t)
+ et_stats->data[mlx5_counters_init[i].dev_table_idx];
+ return 0;
+}
+
+/**
+ * Init the strcutures to read device counters.
+ *
+ * @param priv
+ * Pointer to private structure.
+ */
+void
+priv_xstats_init(struct priv *priv)
+{
+ struct mlx5_xstats_ctrl *xstats_ctrl = &priv->xstats_ctrl;
+ unsigned int i;
+ unsigned int j;
+ char ifname[IF_NAMESIZE];
+ struct ifreq ifr;
+ struct ethtool_drvinfo drvinfo;
+ struct ethtool_gstrings *strings = NULL;
+ unsigned int dev_stats_n;
+ unsigned int str_sz;
+
+ if (priv_get_ifname(priv, &ifname)) {
+ WARN("unable to get interface name");
+ return;
+ }
+ /* How many statistics are available. */
+ drvinfo.cmd = ETHTOOL_GDRVINFO;
+ ifr.ifr_data = (caddr_t)&drvinfo;
+ if (priv_ifreq(priv, SIOCETHTOOL, &ifr) != 0) {
+ WARN("unable to get driver info");
+ return;
+ }
+ dev_stats_n = drvinfo.n_stats;
+ if (dev_stats_n < 1) {
+ WARN("no extended statistics available");
+ return;
+ }
+ xstats_ctrl->stats_n = dev_stats_n;
+ /* Allocate memory to grab stat names and values. */
+ str_sz = dev_stats_n * ETH_GSTRING_LEN;
+ strings = (struct ethtool_gstrings *)
+ rte_malloc("xstats_strings",
+ str_sz + sizeof(struct ethtool_gstrings), 0);
+ if (!strings) {
+ WARN("unable to allocate memory for xstats");
+ return;
+ }
+ strings->cmd = ETHTOOL_GSTRINGS;
+ strings->string_set = ETH_SS_STATS;
+ strings->len = dev_stats_n;
+ ifr.ifr_data = (caddr_t)strings;
+ if (priv_ifreq(priv, SIOCETHTOOL, &ifr) != 0) {
+ WARN("unable to get statistic names");
+ goto free;
+ }
+ for (j = 0; (j != xstats_n); ++j)
+ mlx5_counters_init[j].dev_table_idx = dev_stats_n;
+ for (i = 0; (i != dev_stats_n); ++i) {
+ const char *curr_string = (const char *)
+ &strings->data[i * ETH_GSTRING_LEN];
+
+ for (j = 0; (j != xstats_n); ++j) {
+ if (!strcmp(mlx5_counters_init[j].ctr_name,
+ curr_string)) {
+ mlx5_counters_init[j].dev_table_idx = i;
+ break;
+ }
+ }
+ }
+ for (j = 0; (j != xstats_n); ++j) {
+ if (mlx5_counters_init[j].dev_table_idx >= dev_stats_n) {
+ WARN("Counters are not recognized");
+ goto free;
+ }
+ }
+ /* Copy to shadow at first time. */
+ assert(xstats_n <= MLX5_MAX_XSTATS);
+ priv_read_dev_counters(priv, xstats_ctrl->shadow);
+free:
+ rte_free(strings);
+}
+
+/**
+ * Get device extended statistics.
+ *
+ * @param priv
+ * Pointer to private structure.
+ * @param[out] stats
+ * Pointer to rte extended stats table.
+ *
+ * @return
+ * Number of extended stats on success and stats is filled,
+ * nagative on error.
+ */
+static int
+priv_xstats_get(struct priv *priv, struct rte_eth_xstat *stats)
+{
+ struct mlx5_xstats_ctrl *xstats_ctrl = &priv->xstats_ctrl;
+ unsigned int i;
+ uint64_t counters[xstats_n];
+
+ if (priv_read_dev_counters(priv, counters) < 0)
+ return -1;
+ for (i = 0; (i != xstats_n) ; ++i) {
+ stats[i].id = i;
+ stats[i].value = (uint64_t)
+ (counters[i] - xstats_ctrl->shadow[i]);
+ }
+ return xstats_n;
+}
+
+/**
+ * Reset device extended statistics.
+ *
+ * @param priv
+ * Pointer to private structure.
+ */
+static void
+priv_xstats_reset(struct priv *priv)
+{
+ struct mlx5_xstats_ctrl *xstats_ctrl = &priv->xstats_ctrl;
+ unsigned int i;
+ uint64_t counters[xstats_n];
+
+ if (priv_read_dev_counters(priv, counters) < 0)
+ return;
+ for (i = 0; (i != xstats_n) ; ++i)
+ xstats_ctrl->shadow[i] = counters[i];
+}
+
/**
* DPDK callback to get device statistics.
*
@@ -142,3 +410,77 @@
#endif
priv_unlock(priv);
}
+
+/**
+ * DPDK callback to get extended device statistics.
+ *
+ * @param dev
+ * Pointer to Ethernet device structure.
+ * @param[out] stats
+ * Stats table output buffer.
+ * @param n
+ * The size of the stats table.
+ *
+ * @return
+ * Number of xstats on success, negative on failure.
+ */
+int
+mlx5_xstats_get(struct rte_eth_dev *dev,
+ struct rte_eth_xstat *stats, unsigned int n)
+{
+ struct priv *priv = mlx5_get_priv(dev);
+ int ret = xstats_n;
+
+ if (n >= xstats_n && stats) {
+ priv_lock(priv);
+ ret = priv_xstats_get(priv, stats);
+ priv_unlock(priv);
+ }
+ return ret;
+}
+
+/**
+ * DPDK callback to clear device extended statistics.
+ *
+ * @param dev
+ * Pointer to Ethernet device structure.
+ */
+void
+mlx5_xstats_reset(struct rte_eth_dev *dev)
+{
+ struct priv *priv = mlx5_get_priv(dev);
+
+ priv_lock(priv);
+ priv_xstats_reset(priv);
+ priv_unlock(priv);
+}
+
+/**
+ * DPDK callback to retrieve names of extended device statistics
+ *
+ * @param dev
+ * Pointer to Ethernet device structure.
+ * @param[out] xstats_names
+ * Block of memory to insert names into
+ * @param size
+ * Number of names.
+ *
+ * @return
+ * Number of xstats names.
+ */
+int
+mlx5_xstats_get_names(struct rte_eth_dev *dev,
+ struct rte_eth_xstat_name *xstats_names, unsigned int size)
+{
+ struct priv *priv = mlx5_get_priv(dev);
+ unsigned int i;
+
+ if (size >= xstats_n && xstats_names) {
+ priv_lock(priv);
+ for (i = 0; (i != xstats_n) ; ++i)
+ strcpy(xstats_names[i].name,
+ mlx5_counters_init[i].dpdk_name);
+ priv_unlock(priv);
+ }
+ return xstats_n;
+}
diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c
index 2399243..30addd2 100644
--- a/drivers/net/mlx5/mlx5_trigger.c
+++ b/drivers/net/mlx5/mlx5_trigger.c
@@ -91,6 +91,7 @@
priv_fdir_enable(priv);
priv_dev_interrupt_handler_install(priv, dev);
err = priv_flow_start(priv);
+ priv_xstats_init(priv);
priv_unlock(priv);
return -err;
}
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH v2 12/18] net/ixgbe: parse ethertype filter
From: Zhao1, Wei @ 2017-01-11 8:54 UTC (permalink / raw)
To: Yigit, Ferruh, dev@dpdk.org; +Cc: Lu, Wenzhuo
In-Reply-To: <155c938b-0d58-0eba-bc0f-7851429f0404@intel.com>
Hi, Yigit
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Saturday, January 7, 2017 1:11 AM
> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v2 12/18] net/ixgbe: parse ethertype filter
>
> On 12/30/2016 7:53 AM, Wei Zhao wrote:
> > check if the rule is a ethertype rule, and get the ethertype info.
> > Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> > Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
> >
> > ---
> >
> > v2:add new error set function
> > ---
>
> <...>
>
> > +static int
> > +ixgbe_parse_ethertype_filter(const struct rte_flow_attr *attr,
> > + const struct rte_flow_item pattern[],
> > + const struct rte_flow_action actions[],
> > + struct rte_eth_ethertype_filter *filter,
> > + struct rte_flow_error *error) {
> > + int ret;
> > +
> > + ret = cons_parse_ethertype_filter(attr, pattern,
> > + actions, filter, error);
> > +
> > + if (ret)
> > + return ret;
> > +
> > + /* Ixgbe doesn't support MAC address. */
> > + if (filter->flags & RTE_ETHTYPE_FLAGS_MAC) {
> > + memset(filter, 0, sizeof(struct rte_eth_ethertype_filter));
>
> Is memset required for error cases, if so is other error cases also require it?
Yes, Ok , I will do as your suggestion.
>
> > + rte_flow_error_set(error, EINVAL,
> > + RTE_FLOW_ERROR_TYPE_ITEM,
> > + NULL, "Not supported by ethertype filter");
> > + return -rte_errno;
> > + }
> > +
> > + if (filter->queue >= IXGBE_MAX_RX_QUEUE_NUM)
> > + return -rte_errno;
> > +
> > + if (filter->ether_type == ETHER_TYPE_IPv4 ||
> > + filter->ether_type == ETHER_TYPE_IPv6) {
> > + PMD_DRV_LOG(ERR, "unsupported ether_type(0x%04x) in"
> > + " ethertype filter.", filter->ether_type);
>
> Not sure about this log here, specially it is in ERR level.
> This function is returning error, and public API will return an error, if we want
> to notify user with a log, should app do this as library
> (here) should do this? More comment welcome?
>
> btw, should rte_flow_error_set() used here (and below) ?
Yes, I will change to rte_flow_error_set()
>
> > + return -rte_errno;
> > + }
> > +
> > + if (filter->flags & RTE_ETHTYPE_FLAGS_MAC) {
>
> Isn't this duplicate with above check?
>
> > + PMD_DRV_LOG(ERR, "mac compare is unsupported.");
> > + return -rte_errno;
> > + }
> > +
> > + if (filter->flags & RTE_ETHTYPE_FLAGS_DROP) {
>
> Just to double check, isn't drop action by ether filters?
Yse , ixgbe do not, but i40e is.
>
> > + PMD_DRV_LOG(ERR, "drop option is unsupported.");
> > + return -rte_errno;
> > + }
> > +
> > + return 0;
> > +}
> > +
> > +/**
> <...>
^ permalink raw reply
* [PATCH v2] doc: add known uio_pci_generic issue for i40e
From: Jeff Guo @ 2016-07-06 14:47 UTC (permalink / raw)
To: helin.zhang, jingjing.wu; +Cc: dev, jia.guo
From: "Guo, Jia" <jia.guo@intel.com>
When bind with uio_pci_generic in X710/XL710/XXV710, the result
is failed. uio_pci_generic is not supported by X710/XL710/XXV710.
Signed-off-by: Guo, Jia <jia.guo@intel.com>
---
v2: add X710/XXV710 limitation case
---
doc/guides/rel_notes/known_issues.rst | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/doc/guides/rel_notes/known_issues.rst b/doc/guides/rel_notes/known_issues.rst
index 3cd4237..1751451 100644
--- a/doc/guides/rel_notes/known_issues.rst
+++ b/doc/guides/rel_notes/known_issues.rst
@@ -640,3 +640,27 @@ I40e VF may not receive packets in the promiscuous mode
**Driver/Module**:
Poll Mode Driver (PMD).
+
+
+uio_pci_generic bind failed in X710/XL710/XXV710
+-------------------------------------------------------
+
+**Description**:
+ uio_pci_generic is not supported by XL710, since the errata of XL710 that the feature
+ about the Interrupt Status bit is not implemented.The errata is the item #71 from the
+ `xl710 controller spec <http://www.intel.com/content/www/us/en/embedded/products/networking/xl710-10-40-controller-spec-update.html>`_.
+ The hw limitation is the same as other X710/XXV710 NICs.
+
+**Implication**:
+ When bind uio_pci_generic, the uio_pci_generic probe device and check the Interrupt
+ Status bit related feature of NICs , since it is not supported by X710/XL710/XXV710,
+ so it return failed.
+
+**Resolution/Workaround**:
+ Do not bind to use uio_pci_generic in X710/XL710/XXV710 NICs.
+
+**Affected Environment/Platform**:
+ All.
+
+**Driver/Module**:
+ Poll Mode Driver (PMD).
--
2.7.4
^ permalink raw reply related
* Re: [PATCH v2 11/18] net/ixgbe: parse n-tuple filter
From: Zhao1, Wei @ 2017-01-11 8:27 UTC (permalink / raw)
To: Yigit, Ferruh, dev@dpdk.org; +Cc: Lu, Wenzhuo
In-Reply-To: <0d561a9d-82e0-bc2b-5dbe-64cc6a9c8e32@intel.com>
Hi, yigit
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Saturday, January 7, 2017 12:56 AM
> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v2 11/18] net/ixgbe: parse n-tuple filter
>
> On 12/30/2016 7:53 AM, Wei Zhao wrote:
> > Add rule validate function and check if the rule is a n-tuple rule,
> > and get the n-tuple info.
> >
> > Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> > Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
> >
> > ---
> >
> > v2:add new error set function
> > ---
> > drivers/net/ixgbe/ixgbe_ethdev.c | 414
> > ++++++++++++++++++++++++++++++++++++++-
> > 1 file changed, 409 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> > b/drivers/net/ixgbe/ixgbe_ethdev.c
> > index 0de1318..198cc4b 100644
> > --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> > @@ -388,6 +388,24 @@ static int ixgbe_dev_udp_tunnel_port_del(struct
> rte_eth_dev *dev,
> > struct rte_eth_udp_tunnel
> *udp_tunnel);
>
> <...>
>
> > +
> > +/**
> > + * Parse the rule to see if it is a n-tuple rule.
> > + * And get the n-tuple filter info BTW.
> > + */
>
> It would be nice to comment here valid/expected pattern values
> (spec/mask/last). Otherwise it is hard to decode from code also it is good to
> document intention, so makes easy if there is any defect.
>
I will do as your suggestion in v3.
> Also valid actions.
>
> > +static int
> > +cons_parse_ntuple_filter(const struct rte_flow_attr *attr,
> > + const struct rte_flow_item pattern[],
> > + const struct rte_flow_action actions[],
> > + struct rte_eth_ntuple_filter *filter,
> > + struct rte_flow_error *error)
> > +{
> > + const struct rte_flow_item *item;
> > + const struct rte_flow_action *act;
> > + const struct rte_flow_item_ipv4 *ipv4_spec;
> > + const struct rte_flow_item_ipv4 *ipv4_mask;
> > + const struct rte_flow_item_tcp *tcp_spec;
> > + const struct rte_flow_item_tcp *tcp_mask;
> > + const struct rte_flow_item_udp *udp_spec;
> > + const struct rte_flow_item_udp *udp_mask;
> > + uint32_t index;
> > +
> > + if (!pattern) {
> > + rte_flow_error_set(error, EINVAL,
> RTE_FLOW_ERROR_TYPE_ITEM_NUM,
> > + NULL, "NULL pattern.");
> > + return -rte_errno;
> > + }
> > +
> > + /* parse pattern */
> > + index = 0;
> > +
> > + /* the first not void item can be MAC or IPv4 */
> > + NEXT_ITEM_OF_PATTERN(item, pattern, index);
> > +
> > + if (item->type != RTE_FLOW_ITEM_TYPE_ETH &&
> > + item->type != RTE_FLOW_ITEM_TYPE_IPV4) {
> > + rte_flow_error_set(error, EINVAL,
> > + RTE_FLOW_ERROR_TYPE_ITEM,
> > + item, "Not supported by ntuple filter");
> > + return -rte_errno;
> > + }
> > + /* Skip Ethernet */
> > + if (item->type == RTE_FLOW_ITEM_TYPE_ETH) {
> > + /*Not supported last point for range*/
> > + if (item->last) {
> > + rte_flow_error_set(error, EINVAL,
> > + RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
> > + item, "Not supported last point for range");
> > + return -rte_errno;
> > +
> > + }
> > + /* if the first item is MAC, the content should be NULL */
> > + if (item->spec || item->mask) {
> > + rte_flow_error_set(error, EINVAL,
> > + RTE_FLOW_ERROR_TYPE_ITEM,
> > + item, "Not supported by ntuple filter");
> > + return -rte_errno;
> > + }
> > + /* check if the next not void item is IPv4 */
> > + index++;
> > + NEXT_ITEM_OF_PATTERN(item, pattern, index);
> > + if (item->type != RTE_FLOW_ITEM_TYPE_IPV4) {
> > + rte_flow_error_set(error,
> > + EINVAL, RTE_FLOW_ERROR_TYPE_ITEM,
> > + item, "Not supported by ntuple filter");
>
> Wrong indentation.
I will do as your suggestion in v3.
>
> > + return -rte_errno;
> > + }
> > + }
> > +
> > + /* get the IPv4 info */
> > + if (!item->spec || !item->mask) {
> > + rte_flow_error_set(error, EINVAL,
> > + RTE_FLOW_ERROR_TYPE_ITEM,
> > + item, "Invalid ntuple mask");
> > + return -rte_errno;
> > + }
> > + /*Not supported last point for range*/
> > + if (item->last) {
> > + rte_flow_error_set(error, EINVAL,
> > + RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
> > + item, "Not supported last point for range");
> > + return -rte_errno;
> > +
> > + }
> > +
> > + ipv4_mask = (const struct rte_flow_item_ipv4 *)item->mask;
> > + /**
> > + * Only support src & dst addresses, protocol,
> > + * others should be masked.
> > + */
> > + if (ipv4_mask->hdr.version_ihl ||
> > + ipv4_mask->hdr.type_of_service ||
> > + ipv4_mask->hdr.total_length ||
> > + ipv4_mask->hdr.packet_id ||
> > + ipv4_mask->hdr.fragment_offset ||
> > + ipv4_mask->hdr.time_to_live ||
> > + ipv4_mask->hdr.hdr_checksum) {
> > + rte_flow_error_set(error,
> > + EINVAL, RTE_FLOW_ERROR_TYPE_ITEM,
> > + item, "Not supported by ntuple filter");
> > + return -rte_errno;
> > + }
> > +
> > + filter->dst_ip_mask = ipv4_mask->hdr.dst_addr;
> > + filter->src_ip_mask = ipv4_mask->hdr.src_addr;
> > + filter->proto_mask = ipv4_mask->hdr.next_proto_id;
> > +
> > + ipv4_spec = (const struct rte_flow_item_ipv4 *)item->spec;
> > + filter->dst_ip = ipv4_spec->hdr.dst_addr;
> > + filter->src_ip = ipv4_spec->hdr.src_addr;
> > + filter->proto = ipv4_spec->hdr.next_proto_id;
> > +
> > + /* check if the next not void item is TCP or UDP */
> > + index++;
> > + NEXT_ITEM_OF_PATTERN(item, pattern, index);
> > + if (item->type != RTE_FLOW_ITEM_TYPE_TCP &&
> > + item->type != RTE_FLOW_ITEM_TYPE_UDP) {
> > + memset(filter, 0, sizeof(struct rte_eth_ntuple_filter));
>
> Sometimes meset filter before return from error, sometimes not. Is memset
> required at all?
Not all necessary, at the beginning ,filter is not config any value, so it do not need to memset .
>
> > + rte_flow_error_set(error, EINVAL,
> > + RTE_FLOW_ERROR_TYPE_ITEM,
> > + item, "Not supported by ntuple filter");
> > + return -rte_errno;
> > + }
> > +
> > + /* get the TCP/UDP info */
> > + if (!item->spec || !item->mask) {
>
> For example there is no memset here for filter ..
>
> > + rte_flow_error_set(error, EINVAL,
> > + RTE_FLOW_ERROR_TYPE_ITEM,
> > + item, "Invalid ntuple mask");
> > + return -rte_errno;
> > + }
> > +
> > + /*Not supported last point for range*/
> > + if (item->last) {
> > + rte_flow_error_set(error, EINVAL,
> > + RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
> > + item, "Not supported last point for range");
> > + return -rte_errno;
> > +
> > + }
> > +
> > + if (item->type == RTE_FLOW_ITEM_TYPE_TCP) {
> > + tcp_mask = (const struct rte_flow_item_tcp *)item->mask;
> > +
> > + /**
> > + * Only support src & dst ports, tcp flags,
> > + * others should be masked.
> > + */
> > + if (tcp_mask->hdr.sent_seq ||
> > + tcp_mask->hdr.recv_ack ||
> > + tcp_mask->hdr.data_off ||
> > + tcp_mask->hdr.rx_win ||
> > + tcp_mask->hdr.cksum ||
> > + tcp_mask->hdr.tcp_urp) {
> > + memset(filter, 0, sizeof(struct
> rte_eth_ntuple_filter));
> > + rte_flow_error_set(error, EINVAL,
> > + RTE_FLOW_ERROR_TYPE_ITEM,
> > + item, "Not supported by ntuple filter");
> > + return -rte_errno;
> > + }
> > +
> > + filter->dst_port_mask = tcp_mask->hdr.dst_port;
> > + filter->src_port_mask = tcp_mask->hdr.src_port;
> > + if (tcp_mask->hdr.tcp_flags == 0xFF) {
> > + filter->flags |= RTE_NTUPLE_FLAGS_TCP_FLAG;
> > + } else if (!tcp_mask->hdr.tcp_flags) {
> > + filter->flags &= ~RTE_NTUPLE_FLAGS_TCP_FLAG;
> > + } else {
> > + memset(filter, 0, sizeof(struct
> rte_eth_ntuple_filter));
> > + rte_flow_error_set(error, EINVAL,
> > + RTE_FLOW_ERROR_TYPE_ITEM,
> > + item, "Not supported by ntuple filter");
> > + return -rte_errno;
> > + }
> > +
> > + tcp_spec = (const struct rte_flow_item_tcp *)item->spec;
> > + filter->dst_port = tcp_spec->hdr.dst_port;
> > + filter->src_port = tcp_spec->hdr.src_port;
> > + filter->tcp_flags = tcp_spec->hdr.tcp_flags;
> > + } else {
> > + udp_mask = (const struct rte_flow_item_udp *)item->mask;
> > +
> > + /**
> > + * Only support src & dst ports,
> > + * others should be masked.
> > + */
> > + if (udp_mask->hdr.dgram_len ||
> > + udp_mask->hdr.dgram_cksum) {
> > + memset(filter, 0, sizeof(struct
> rte_eth_ntuple_filter));
> > + rte_flow_error_set(error, EINVAL,
> > + RTE_FLOW_ERROR_TYPE_ITEM,
> > + item, "Not supported by ntuple filter");
> > + return -rte_errno;
> > + }
> > +
> > + filter->dst_port_mask = udp_mask->hdr.dst_port;
> > + filter->src_port_mask = udp_mask->hdr.src_port;
> > +
> > + udp_spec = (const struct rte_flow_item_udp *)item->spec;
> > + filter->dst_port = udp_spec->hdr.dst_port;
> > + filter->src_port = udp_spec->hdr.src_port;
> > + }
> > +
> > + /* check if the next not void item is END */
> > + index++;
> > + NEXT_ITEM_OF_PATTERN(item, pattern, index);
> > + if (item->type != RTE_FLOW_ITEM_TYPE_END) {
> > + memset(filter, 0, sizeof(struct rte_eth_ntuple_filter));
> > + rte_flow_error_set(error, EINVAL,
> > + RTE_FLOW_ERROR_TYPE_ITEM,
> > + item, "Not supported by ntuple filter");
> > + return -rte_errno;
> > + }
> > +
> > + /* parse action */
> > + index = 0;
> > +
> > + if (!actions) {
>
> Although there is no harm, I would do input check at the beginning of the
> function, to not do extra work if we hit this case.
I will do as your suggestion in v3.
>
> > + rte_flow_error_set(error, EINVAL,
> > + RTE_FLOW_ERROR_TYPE_ACTION_NUM,
> > + NULL, "NULL action.");
> > + return -rte_errno;
> > + }
> > +
> > + /**
> > + * n-tuple only supports forwarding,
> > + * check if the first not void action is QUEUE.
> > + */
> > + NEXT_ITEM_OF_ACTION(act, actions, index);
> > + if (act->type != RTE_FLOW_ACTION_TYPE_QUEUE) {
> > + memset(filter, 0, sizeof(struct rte_eth_ntuple_filter));
> > + rte_flow_error_set(error, EINVAL,
> > + RTE_FLOW_ERROR_TYPE_ACTION,
> > + item, "Not supported action.");
> > + return -rte_errno;
> > + }
> > + filter->queue =
> > + ((const struct rte_flow_action_queue *)act->conf)->index;
> > +
> > + /* check if the next not void item is END */
> > + index++;
> > + NEXT_ITEM_OF_ACTION(act, actions, index);
> > + if (act->type != RTE_FLOW_ACTION_TYPE_END) {
> > + memset(filter, 0, sizeof(struct rte_eth_ntuple_filter));
> > + rte_flow_error_set(error, EINVAL,
> > + RTE_FLOW_ERROR_TYPE_ACTION,
> > + act, "Not supported action.");
> > + return -rte_errno;
> > + }
> > +
> > + /* parse attr */
> > + /* must be input direction */
>
> May be good idea to check if attr is NULL.
I will do as your suggestion in v3. Add it at the beginning of function.
>
> > + if (!attr->ingress) {
> > + memset(filter, 0, sizeof(struct rte_eth_ntuple_filter));
> > + rte_flow_error_set(error, EINVAL,
> > + RTE_FLOW_ERROR_TYPE_ATTR_INGRESS,
> > + attr, "Only support ingress.");
> > + return -rte_errno;
> > + }
> > +
> > + /* not supported */
> > + if (attr->egress) {
> > + memset(filter, 0, sizeof(struct rte_eth_ntuple_filter));
> > + rte_flow_error_set(error, EINVAL,
> > + RTE_FLOW_ERROR_TYPE_ATTR_EGRESS,
> > + attr, "Not support egress.");
> > + return -rte_errno;
> > + }
> > +
> > + if (attr->priority > 0xFFFF) {
> > + memset(filter, 0, sizeof(struct rte_eth_ntuple_filter));
> > + rte_flow_error_set(error, EINVAL,
> > + RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY,
> > + attr, "Error priority.");
> > + return -rte_errno;
> > + }
> > + filter->priority = (uint16_t)attr->priority;
>
> Should check attr->group? Do we support groups?
No , we do not.
>
> > +
> > + return 0;
> > +}
> > +
>
> <...>
^ permalink raw reply
* Re: [PATCH 1/2] net/virtio: fix performance regression due to TSO enabling
From: Olivier MATZ @ 2017-01-11 8:22 UTC (permalink / raw)
To: Maxime Coquelin
Cc: Yuanhan Liu, dev, Tan Jianfeng, Wang Zhihong, Olivier Matz,
Michael S. Tsirkin, stable
In-Reply-To: <e470dbd9-be63-f439-7d2e-dc653f77e514@redhat.com>
Hi Yuanhan,
Thanks for the fix.
On Wed, 11 Jan 2017 08:59:28 +0100, Maxime Coquelin
<maxime.coquelin@redhat.com> wrote:
> On 01/11/2017 05:27 AM, Yuanhan Liu wrote:
> > TSO is now enabled, but it's not actually being used by default in a
> > simple L2 forward mode. In such case, we have to zero the virtio net
> > headers, to inform the vhost backend that no offload is being used:
> >
> > hdr->csum_start = 0;
> > hdr->csum_offset = 0;
> > hdr->flags = 0;
> >
> > hdr->gso_type = 0;
> > hdr->gso_size = 0;
> > hdr->hdr_len = 0;
> >
> > Such writes could be very costly; it introduces severe cache issues:
> > The above operations introduce cache write for each packet, which
> > stalls the read operation from the vhost backend.
> >
> > The fact that virtio net header is initiated to zero in PMD driver
> > init stage means that these costly writes are unnecessary and could
> > be avoided:
> >
> > if (hdr->csum_start != 0)
> > hdr->csum_start = 0;
> >
> > And that's what the macro ASSIGN_UNLESS_EQUAL does. With this, the
> > performance drop introduced by TSO enabling is recovered: it could
> > be up to 20% in micro benchmarking.
> Very nice!
Yep, I'm also impressed by the result.
I would have think this is something already done by the hardware and
transparent to the software.
>
> >
> > Fixes: 58169a9c8153 ("net/virtio: support Tx checksum offload")
> > Fixes: 696573046e9e ("net/virtio: support TSO")
> >
> > Cc: Olivier Matz <olivier.matz@6wind.com>
> > Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
> > Cc: Michael S. Tsirkin <mst@redhat.com>
> > Cc: stable@dpdk.org
> > Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
>
> [...]
>
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
^ permalink raw reply
* [PATCH v2] doc: add known uio_pci_generic issue for i40e
From: Jeff Guo @ 2016-07-06 14:10 UTC (permalink / raw)
To: helin.zhang, jingjing.wu; +Cc: dev, jia.guo
In-Reply-To: <1482460523-74460-1-git-send-email-jia.guo@intel.com>
From: "Guo, Jia" <jia.guo@intel.com>
When bind with uio_pci_generic in X710/XL710/XXV710, the result
is failed. uio_pci_generic is not supported by X710/XL710/XXV710.
Signed-off-by: Guo, Jia <jia.guo@intel.com>
---
v2: add X710/XXV710 limitation case
---
doc/guides/rel_notes/known_issues.rst | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/doc/guides/rel_notes/known_issues.rst b/doc/guides/rel_notes/known_issues.rst
index 3cd4237..1751451 100644
--- a/doc/guides/rel_notes/known_issues.rst
+++ b/doc/guides/rel_notes/known_issues.rst
@@ -640,3 +640,27 @@ I40e VF may not receive packets in the promiscuous mode
**Driver/Module**:
Poll Mode Driver (PMD).
+
+
+uio_pci_generic bind failed in X710/XL710/XXV710
+-------------------------------------------------------
+
+**Description**:
+ uio_pci_generic is not supported by XL710, since the errata of XL710 that the feature
+ about the Interrupt Status bit is not implemented.The errata is the item #71 from the
+ `xl710 controller spec <http://www.intel.com/content/www/us/en/embedded/products/networking/xl710-10-40-controller-spec-update.html>`_.
+ The hw limitation is the same as other X710/XXV710 NICs.
+
+**Implication**:
+ When bind uio_pci_generic, the uio_pci_generic probe device and check the Interrupt
+ Status bit related feature of NICs , since it is not supported by X710/XL710/XXV710,
+ so it return failed.
+
+**Resolution/Workaround**:
+ Do not bind to use uio_pci_generic in X710/XL710/XXV710 NICs.
+
+**Affected Environment/Platform**:
+ All.
+
+**Driver/Module**:
+ Poll Mode Driver (PMD).
--
2.7.4
^ permalink raw reply related
* Re: [PATCH 1/2] net/virtio: fix performance regression due to TSO enabling
From: Yuanhan Liu @ 2017-01-11 8:08 UTC (permalink / raw)
To: Maxime Coquelin
Cc: dev, Tan Jianfeng, Wang Zhihong, Olivier Matz, Michael S. Tsirkin,
stable, Thomas Monjalon
In-Reply-To: <e470dbd9-be63-f439-7d2e-dc653f77e514@redhat.com>
On Wed, Jan 11, 2017 at 08:59:28AM +0100, Maxime Coquelin wrote:
> >+/* avoid write operation when necessary, to lessen cache issues */
> >+#define ASSIGN_UNLESS_EQUAL(var, val) do { \
> >+ if ((var) != (val)) \
> >+ (var) = (val); \
> >+} while (0)
> As it is intended to go in -stable, I think this is fine to have it
> only in the driver, but for v17.02, maybe we should have another patch on
> top that declares it somewhere so that other libs and drivers can
> make use of it?
Yes, if it has any other usages :)
--yliu
^ permalink raw reply
* Re: [PATCH 2/2] net/virtio: optimize header reset on any layout
From: Maxime Coquelin @ 2017-01-11 8:01 UTC (permalink / raw)
To: Yuanhan Liu, dev; +Cc: Tan Jianfeng, Wang Zhihong, Michael S. Tsirkin, stable
In-Reply-To: <1484108832-19907-3-git-send-email-yuanhan.liu@linux.intel.com>
On 01/11/2017 05:27 AM, Yuanhan Liu wrote:
> When any layout is used, the header is stored in the head room of mbuf.
> mbuf is allocated and filled by user, means there is no gurateen the
> header is all zero for non TSO case. Therefore, we have to do the reset
> by ourself:
>
> memest(hdr, 0, head_size);
>
> The memset has two impacts on performance:
>
> - memset could not be inlined, which is a bit costly.
> - more importantly, it touches the mbuf, which could introduce severe
> cache issues as described by former patch.
>
> Similiary, we could do the same trick: reset just when necessary, when
> the corresponding field is already 0, which is likely true for a simple
> l2 forward case. It could boost the performance up to 20+% in micro
> benchmarking.
>
> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: stable@dpdk.org
> Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
> ---
> drivers/net/virtio/virtio_rxtx.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
> index 8ec2f1a..5ca3a88 100644
> --- a/drivers/net/virtio/virtio_rxtx.c
> +++ b/drivers/net/virtio/virtio_rxtx.c
> @@ -292,8 +292,14 @@
> hdr = (struct virtio_net_hdr *)
> rte_pktmbuf_prepend(cookie, head_size);
> /* if offload disabled, it is not zeroed below, do it now */
> - if (offload == 0)
> - memset(hdr, 0, head_size);
> + if (offload == 0) {
> + ASSIGN_UNLESS_EQUAL(hdr->csum_start, 0);
> + ASSIGN_UNLESS_EQUAL(hdr->csum_offset, 0);
> + ASSIGN_UNLESS_EQUAL(hdr->flags, 0);
> + ASSIGN_UNLESS_EQUAL(hdr->gso_type, 0);
> + ASSIGN_UNLESS_EQUAL(hdr->gso_size, 0);
> + ASSIGN_UNLESS_EQUAL(hdr->hdr_len, 0);
> + }
> } else if (use_indirect) {
> /* setup tx ring slot to point to indirect
> * descriptor list stored in reserved region.
>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Thanks!
Maxime
^ permalink raw reply
* Re: [PATCH 1/2] net/virtio: fix performance regression due to TSO enabling
From: Maxime Coquelin @ 2017-01-11 7:59 UTC (permalink / raw)
To: Yuanhan Liu, dev
Cc: Tan Jianfeng, Wang Zhihong, Olivier Matz, Michael S. Tsirkin,
stable
In-Reply-To: <1484108832-19907-2-git-send-email-yuanhan.liu@linux.intel.com>
On 01/11/2017 05:27 AM, Yuanhan Liu wrote:
> TSO is now enabled, but it's not actually being used by default in a
> simple L2 forward mode. In such case, we have to zero the virtio net
> headers, to inform the vhost backend that no offload is being used:
>
> hdr->csum_start = 0;
> hdr->csum_offset = 0;
> hdr->flags = 0;
>
> hdr->gso_type = 0;
> hdr->gso_size = 0;
> hdr->hdr_len = 0;
>
> Such writes could be very costly; it introduces severe cache issues:
> The above operations introduce cache write for each packet, which
> stalls the read operation from the vhost backend.
>
> The fact that virtio net header is initiated to zero in PMD driver
> init stage means that these costly writes are unnecessary and could
> be avoided:
>
> if (hdr->csum_start != 0)
> hdr->csum_start = 0;
>
> And that's what the macro ASSIGN_UNLESS_EQUAL does. With this, the
> performance drop introduced by TSO enabling is recovered: it could
> be up to 20% in micro benchmarking.
Very nice!
>
> Fixes: 58169a9c8153 ("net/virtio: support Tx checksum offload")
> Fixes: 696573046e9e ("net/virtio: support TSO")
>
> Cc: Olivier Matz <olivier.matz@6wind.com>
> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: stable@dpdk.org
> Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
> ---
> drivers/net/virtio/virtio_rxtx.c | 18 ++++++++++++------
> 1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
> index 1e5a6b9..8ec2f1a 100644
> --- a/drivers/net/virtio/virtio_rxtx.c
> +++ b/drivers/net/virtio/virtio_rxtx.c
> @@ -258,6 +258,12 @@
> vtpci_with_feature(hw, VIRTIO_NET_F_HOST_TSO6);
> }
>
> +/* avoid write operation when necessary, to lessen cache issues */
> +#define ASSIGN_UNLESS_EQUAL(var, val) do { \
> + if ((var) != (val)) \
> + (var) = (val); \
> +} while (0)
As it is intended to go in -stable, I think this is fine to have it
only in the driver, but for v17.02, maybe we should have another patch
on top that declares it somewhere so that other libs and drivers can
make use of it?
> +
> static inline void
> virtqueue_enqueue_xmit(struct virtnet_tx *txvq, struct rte_mbuf *cookie,
> uint16_t needed, int use_indirect, int can_push)
> @@ -337,9 +343,9 @@
> break;
>
> default:
> - hdr->csum_start = 0;
> - hdr->csum_offset = 0;
> - hdr->flags = 0;
> + ASSIGN_UNLESS_EQUAL(hdr->csum_start, 0);
> + ASSIGN_UNLESS_EQUAL(hdr->csum_offset, 0);
> + ASSIGN_UNLESS_EQUAL(hdr->flags, 0);
> break;
> }
>
> @@ -355,9 +361,9 @@
> cookie->l3_len +
> cookie->l4_len;
> } else {
> - hdr->gso_type = 0;
> - hdr->gso_size = 0;
> - hdr->hdr_len = 0;
> + ASSIGN_UNLESS_EQUAL(hdr->gso_type, 0);
> + ASSIGN_UNLESS_EQUAL(hdr->gso_size, 0);
> + ASSIGN_UNLESS_EQUAL(hdr->hdr_len, 0);
> }
> }
>
>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Thanks!
Maxime
^ permalink raw reply
* Re: [PATCH 2/8] i40e: don't refer to eth_dev->pci_dev
From: Jan Blunck @ 2017-01-11 7:55 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev, Stephen Hemminger
In-Reply-To: <20170110095749.3cb00cab@xeon-e3>
On Tue, Jan 10, 2017 at 6:57 PM, Stephen Hemminger
<stephen@networkplumber.org> wrote:
> On Tue, 10 Jan 2017 13:08:30 +0100
> Jan Blunck <jblunck@infradead.org> wrote:
>
>> On Sat, Jan 7, 2017 at 7:17 PM, Stephen Hemminger
>> <stephen@networkplumber.org> wrote:
>> > Later patches remove pci_dev from the ethernet device structure.
>> > Fix the i40e code to just use it's own name when forming zone name.
>> >
>> > Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
>> > ---
>> > drivers/net/i40e/i40e_fdir.c | 3 +--
>> > 1 file changed, 1 insertion(+), 2 deletions(-)
>> >
>> > diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
>> > index 335bf15c..68a2523c 100644
>> > --- a/drivers/net/i40e/i40e_fdir.c
>> > +++ b/drivers/net/i40e/i40e_fdir.c
>> > @@ -250,8 +250,7 @@ i40e_fdir_setup(struct i40e_pf *pf)
>> > }
>> >
>> > /* reserve memory for the fdir programming packet */
>> > - snprintf(z_name, sizeof(z_name), "%s_%s_%d",
>> > - eth_dev->driver->pci_drv.driver.name,
>> > + snprintf(z_name, sizeof(z_name), "i40e_%s_%d",
>>
>> The driver is called 'net_i40e'.
>
> It really doesn't matter. The memory name is just so that primary and secondary
> find the same resources. Having net_ on the front doesn't change or help.
I understand. Still David Marchand just recently went through the
exercise to align all driver names and their usage.
Is there a reason why you didn't choose to use eth_dev->data->drv_name?
^ permalink raw reply
* [PATCH v2] examples/vhost: fix the wrong initialization of lcore_ids
From: Yong Wang @ 2017-01-11 8:59 UTC (permalink / raw)
To: huawei.xie, yuanhan.liu; +Cc: dev, Yong Wang
when "TAILQ_INIT()" was added to the loop of "for (lcore_id = 0; ...)"
statement, the assignment to "lcore_ids" was removed out of the loop.
It changed the original initialization of "lcore_ids".
Fix it by introducing two braces.
Fixes: 45657a5c6861 ("examples/vhost: use tailq to link vhost devices")
Signed-off-by: Yong Wang <wang.yong19@zte.com.cn>
v2:
* fix the coding style error of '++'.
---
examples/vhost/main.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index ac1f6e2..91853ec 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -1436,11 +1436,12 @@ static inline void __attribute__((always_inline))
if (ret < 0)
rte_exit(EXIT_FAILURE, "Invalid argument\n");
- for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id ++)
+ for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
TAILQ_INIT(&lcore_info[lcore_id].vdev_list);
if (rte_lcore_is_enabled(lcore_id))
- lcore_ids[core_id ++] = lcore_id;
+ lcore_ids[core_id++] = lcore_id;
+ }
if (rte_lcore_count() > RTE_MAX_LCORE)
rte_exit(EXIT_FAILURE,"Not enough cores\n");
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH v2 10/18] net/ixgbe: flush all the filters
From: Zhao1, Wei @ 2017-01-11 7:51 UTC (permalink / raw)
To: Yigit, Ferruh, dev@dpdk.org; +Cc: Lu, Wenzhuo
In-Reply-To: <5c8bebb9-e44d-6a27-0e08-73d291721e21@intel.com>
Hi,yigit
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Saturday, January 7, 2017 12:40 AM
> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v2 10/18] net/ixgbe: flush all the filters
>
> On 12/30/2016 7:53 AM, Wei Zhao wrote:
> > Add support for flush all the filters in SW.
> >
> > Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
> > Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
> >
> > ---
> >
> > v2:
> > --change flush filter function call relationship
> > ---
> > drivers/net/ixgbe/ixgbe_ethdev.c | 118
> ++++++++++++++++++++++++++++++++++++++-
> > drivers/net/ixgbe/ixgbe_ethdev.h | 9 +++
> > drivers/net/ixgbe/ixgbe_fdir.c | 24 ++++++++
> > drivers/net/ixgbe/ixgbe_pf.c | 1 +
> > 4 files changed, 150 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> > b/drivers/net/ixgbe/ixgbe_ethdev.c
> > index d68de65..0de1318 100644
> > --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> > @@ -61,6 +61,8 @@
> > #include <rte_random.h>
> > #include <rte_dev.h>
> > #include <rte_hash_crc.h>
> > +#include <rte_flow.h>
> > +#include <rte_flow_driver.h>
> >
> > #include "ixgbe_logs.h"
> > #include "base/ixgbe_api.h"
> > @@ -386,7 +388,8 @@ static int ixgbe_dev_udp_tunnel_port_del(struct
> rte_eth_dev *dev,
> > struct rte_eth_udp_tunnel
> *udp_tunnel); static int
> > ixgbe_filter_restore(struct rte_eth_dev *dev); static void
> > ixgbe_l2_tunnel_conf(struct rte_eth_dev *dev);
> > -
> > +static int ixgbe_flow_flush(struct rte_eth_dev *dev,
> > + struct rte_flow_error *error);
>
> I think it is good idea to move all rte_flow related code into a new file, as
> done in i40e (i40e_flow.c)? What do you think, can it be done?
I will do as your suggestion in v3.
>
> <...>
^ permalink raw reply
* [PATCH v2] doc: add known uio_pci_generic issue for i40e
From: Jeff Guo @ 2016-02-12 16:39 UTC (permalink / raw)
To: helin.zhang, jingjing.wu; +Cc: dev, jia.guo, Guo
In-Reply-To: <1482460523-74460-1-git-send-email-jia.guo@intel.com>
From: "Guo, Jia" <jia.guo@intel.com>
When bind with uio_pci_generic in X710/XL710/XXV710, the result
is failed. uio_pci_generic is not supported by X710/XL710/XXV710.
Signed-off-by: Guo, Jia <jia.guo@intel.com>
---
v2: add X710/XXV710 limitation case
---
doc/guides/rel_notes/known_issues.rst | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/doc/guides/rel_notes/known_issues.rst b/doc/guides/rel_notes/known_issues.rst
index 3cd4237..1751451 100644
--- a/doc/guides/rel_notes/known_issues.rst
+++ b/doc/guides/rel_notes/known_issues.rst
@@ -640,3 +640,27 @@ I40e VF may not receive packets in the promiscuous mode
**Driver/Module**:
Poll Mode Driver (PMD).
+
+
+uio_pci_generic bind failed in X710/XL710/XXV710
+-------------------------------------------------------
+
+**Description**:
+ uio_pci_generic is not supported by XL710, since the errata of XL710 that the feature
+ about the Interrupt Status bit is not implemented.The errata is the item #71 from the
+ `xl710 controller spec <http://www.intel.com/content/www/us/en/embedded/products/networking/xl710-10-40-controller-spec-update.html>`_.
+ The hw limitation is the same as other X710/XXV710 NICs.
+
+**Implication**:
+ When bind uio_pci_generic, the uio_pci_generic probe device and check the Interrupt
+ Status bit related feature of NICs , since it is not supported by X710/XL710/XXV710,
+ so it return failed.
+
+**Resolution/Workaround**:
+ Do not bind to use uio_pci_generic in X710/XL710/XXV710 NICs.
+
+**Affected Environment/Platform**:
+ All.
+
+**Driver/Module**:
+ Poll Mode Driver (PMD).
--
2.7.4
^ permalink raw reply related
* [PATCH] examples/vhost: fix the wrong initialization of lcore_ids
From: Yong Wang @ 2017-01-11 8:36 UTC (permalink / raw)
To: huawei.xie, yuanhan.liu; +Cc: dev, Yong Wang
when "TAILQ_INIT()" was added to the loop of "for (lcore_id = 0; ...)"
statement, the assignment to "lcore_ids" was removed out of the loop.
It changed the original initialization of "lcore_ids".
Fix it by introducing two braces.
Fixes: 45657a5c6861 ("examples/vhost: use tailq to link vhost devices")
Signed-off-by: Yong Wang <wang.yong19@zte.com.cn>
---
examples/vhost/main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index ac1f6e2..128a498 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -1436,11 +1436,12 @@ static inline void __attribute__((always_inline))
if (ret < 0)
rte_exit(EXIT_FAILURE, "Invalid argument\n");
- for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id ++)
+ for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id ++) {
TAILQ_INIT(&lcore_info[lcore_id].vdev_list);
if (rte_lcore_is_enabled(lcore_id))
lcore_ids[core_id ++] = lcore_id;
+ }
if (rte_lcore_count() > RTE_MAX_LCORE)
rte_exit(EXIT_FAILURE,"Not enough cores\n");
--
1.8.3.1
^ permalink raw reply related
* [PATCH v7 5/5] ethtool: display firmware version
From: Qiming Yang @ 2017-01-11 6:41 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, remy.horton, Qiming Yang
In-Reply-To: <1484116905-57438-1-git-send-email-qiming.yang@intel.com>
This patch enhances the ethtool example to support to show
firmware version, in the same way that the Linux kernel
ethtool does.
Signed-off-by: Qiming Yang <qiming.yang@intel.com>
Acked-by: Remy Horton <remy.horton@intel.com>
---
examples/ethtool/ethtool-app/ethapp.c | 1 +
examples/ethtool/lib/rte_ethtool.c | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/examples/ethtool/ethtool-app/ethapp.c b/examples/ethtool/ethtool-app/ethapp.c
index 6aeaa06..85c31ac 100644
--- a/examples/ethtool/ethtool-app/ethapp.c
+++ b/examples/ethtool/ethtool-app/ethapp.c
@@ -185,6 +185,7 @@ pcmd_drvinfo_callback(__rte_unused void *ptr_params,
printf("Port %i driver: %s (ver: %s)\n",
id_port, info.driver, info.version
);
+ printf("firmware-version: %s\n", info.fw_version);
}
}
diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c
index b1f159e..33d38a7 100644
--- a/examples/ethtool/lib/rte_ethtool.c
+++ b/examples/ethtool/lib/rte_ethtool.c
@@ -51,12 +51,18 @@ rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo)
struct rte_eth_dev_info dev_info;
struct rte_dev_reg_info reg_info;
int n;
+ int ret;
if (drvinfo == NULL)
return -EINVAL;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ ret = rte_eth_dev_fw_version_get(port_id, drvinfo->fw_version,
+ sizeof(drvinfo->fw_version));
+ if (ret != 0)
+ printf("firmware version get error: (%s)\n", strerror(-ret));
+
memset(&dev_info, 0, sizeof(dev_info));
rte_eth_dev_info_get(port_id, &dev_info);
--
2.7.4
^ permalink raw reply related
* [PATCH v7 4/5] net/i40e: add firmware version get
From: Qiming Yang @ 2017-01-11 6:41 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, remy.horton, Qiming Yang
In-Reply-To: <1484116905-57438-1-git-send-email-qiming.yang@intel.com>
This patch add a new function i40e_fw_version_get.
Signed-off-by: Qiming Yang <qiming.yang@intel.com>
Acked-by: Remy Horton <remy.horton@intel.com>
---
doc/guides/nics/features/i40e.ini | 1 +
drivers/net/i40e/i40e_ethdev.c | 31 +++++++++++++++++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/doc/guides/nics/features/i40e.ini b/doc/guides/nics/features/i40e.ini
index 0d143bc..0dbc3c3 100644
--- a/doc/guides/nics/features/i40e.ini
+++ b/doc/guides/nics/features/i40e.ini
@@ -39,6 +39,7 @@ Packet type parsing = Y
Timesync = Y
Basic stats = Y
Extended stats = Y
+FW version = Y
Multiprocess aware = Y
BSD nic_uio = Y
Linux UIO = Y
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 46def56..713f653 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -266,6 +266,8 @@ static int i40e_dev_queue_stats_mapping_set(struct rte_eth_dev *dev,
uint16_t queue_id,
uint8_t stat_idx,
uint8_t is_rx);
+static int i40e_fw_version_get(struct rte_eth_dev *dev,
+ char *fw_version, size_t fw_size);
static void i40e_dev_info_get(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info);
static int i40e_vlan_filter_set(struct rte_eth_dev *dev,
@@ -458,6 +460,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = {
.stats_reset = i40e_dev_stats_reset,
.xstats_reset = i40e_dev_stats_reset,
.queue_stats_mapping_set = i40e_dev_queue_stats_mapping_set,
+ .fw_version_get = i40e_fw_version_get,
.dev_infos_get = i40e_dev_info_get,
.dev_supported_ptypes_get = i40e_dev_supported_ptypes_get,
.vlan_filter_set = i40e_vlan_filter_set,
@@ -2770,6 +2773,34 @@ i40e_dev_queue_stats_mapping_set(__rte_unused struct rte_eth_dev *dev,
return -ENOSYS;
}
+static int
+i40e_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
+{
+ struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ u32 full_ver;
+ u8 ver, patch;
+ u16 build;
+
+ if (fw_size < 16) {
+ PMD_DRV_LOG(WARNING, "Insufficient fw version buffer size");
+ return -EINVAL;
+ }
+
+ full_ver = hw->nvm.oem_ver;
+ ver = (u8)(full_ver >> 24);
+ build = (u16)((full_ver >> 8) & 0xffff);
+ patch = (u8)(full_ver & 0xff);
+
+ snprintf(fw_version, fw_size,
+ "%d.%d%d 0x%08x %d.%d.%d",
+ ((hw->nvm.version >> 12) & 0xf),
+ ((hw->nvm.version >> 4) & 0xff),
+ (hw->nvm.version & 0xf), hw->nvm.eetrack,
+ ver, build, patch);
+
+ return 0;
+}
+
static void
i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
{
--
2.7.4
^ permalink raw reply related
* [PATCH v7 3/5] net/ixgbe: add firmware version get
From: Qiming Yang @ 2017-01-11 6:41 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, remy.horton, Qiming Yang
In-Reply-To: <1484116905-57438-1-git-send-email-qiming.yang@intel.com>
This patch adds a new function ixgbe_fw_version_get.
Signed-off-by: Qiming Yang <qiming.yang@intel.com>
Acked-by: Remy Horton <remy.horton@intel.com>
---
doc/guides/nics/features/ixgbe.ini | 1 +
drivers/net/ixgbe/ixgbe_ethdev.c | 25 +++++++++++++++++++++++++
2 files changed, 26 insertions(+)
diff --git a/doc/guides/nics/features/ixgbe.ini b/doc/guides/nics/features/ixgbe.ini
index 4a5667f..e7104c2 100644
--- a/doc/guides/nics/features/ixgbe.ini
+++ b/doc/guides/nics/features/ixgbe.ini
@@ -43,6 +43,7 @@ Timesync = Y
Basic stats = Y
Extended stats = Y
Stats per queue = Y
+FW version = Y
EEPROM dump = Y
Registers dump = Y
Multiprocess aware = Y
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index b7ddd4f..a09db78 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -193,6 +193,8 @@ static int ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
uint16_t queue_id,
uint8_t stat_idx,
uint8_t is_rx);
+static int ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
+ size_t fw_size);
static void ixgbe_dev_info_get(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info);
static const uint32_t *ixgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev);
@@ -532,6 +534,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {
.xstats_reset = ixgbe_dev_xstats_reset,
.xstats_get_names = ixgbe_dev_xstats_get_names,
.queue_stats_mapping_set = ixgbe_dev_queue_stats_mapping_set,
+ .fw_version_get = ixgbe_fw_version_get,
.dev_infos_get = ixgbe_dev_info_get,
.dev_supported_ptypes_get = ixgbe_dev_supported_ptypes_get,
.mtu_set = ixgbe_dev_mtu_set,
@@ -3022,6 +3025,28 @@ ixgbevf_dev_stats_reset(struct rte_eth_dev *dev)
hw_stats->vfgotc = 0;
}
+static int
+ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
+{
+ struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ u16 eeprom_verh, eeprom_verl;
+ u32 etrack_id;
+
+ if (fw_size < 11) {
+ PMD_DRV_LOG(WARNING, "Insufficient fw version buffer size");
+ return -EINVAL;
+ }
+
+ ixgbe_read_eeprom(hw, 0x2e, &eeprom_verh);
+ ixgbe_read_eeprom(hw, 0x2d, &eeprom_verl);
+
+ etrack_id = (eeprom_verh << 16) | eeprom_verl;
+ snprintf(fw_version, fw_size,
+ "0x%08x", etrack_id);
+
+ return 0;
+}
+
static void
ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
{
--
2.7.4
^ permalink raw reply related
* [PATCH v7 2/5] net/e1000: add firmware version get
From: Qiming Yang @ 2017-01-11 6:41 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, remy.horton, Qiming Yang
In-Reply-To: <1484116905-57438-1-git-send-email-qiming.yang@intel.com>
This patch adds a new function eth_igb_fw_version_get.
Signed-off-by: Qiming Yang <qiming.yang@intel.com>
Acked-by: Remy Horton <remy.horton@intel.com>
---
doc/guides/nics/features/igb.ini | 1 +
drivers/net/e1000/igb_ethdev.c | 54 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+)
diff --git a/doc/guides/nics/features/igb.ini b/doc/guides/nics/features/igb.ini
index 9fafe72..26ae008 100644
--- a/doc/guides/nics/features/igb.ini
+++ b/doc/guides/nics/features/igb.ini
@@ -35,6 +35,7 @@ Packet type parsing = Y
Timesync = Y
Basic stats = Y
Extended stats = Y
+FW version = Y
EEPROM dump = Y
Registers dump = Y
BSD nic_uio = Y
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 2bb57f5..10519ad 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -120,6 +120,8 @@ static int eth_igb_xstats_get_names(struct rte_eth_dev *dev,
unsigned limit);
static void eth_igb_stats_reset(struct rte_eth_dev *dev);
static void eth_igb_xstats_reset(struct rte_eth_dev *dev);
+static int eth_igb_fw_version_get(struct rte_eth_dev *dev,
+ char *fw_version, size_t fw_size);
static void eth_igb_infos_get(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info);
static const uint32_t *eth_igb_supported_ptypes_get(struct rte_eth_dev *dev);
@@ -391,6 +393,7 @@ static const struct eth_dev_ops eth_igb_ops = {
.xstats_get_names = eth_igb_xstats_get_names,
.stats_reset = eth_igb_stats_reset,
.xstats_reset = eth_igb_xstats_reset,
+ .fw_version_get = eth_igb_fw_version_get,
.dev_infos_get = eth_igb_infos_get,
.dev_supported_ptypes_get = eth_igb_supported_ptypes_get,
.mtu_set = eth_igb_mtu_set,
@@ -1984,6 +1987,57 @@ eth_igbvf_stats_reset(struct rte_eth_dev *dev)
offsetof(struct e1000_vf_stats, gprc));
}
+static int
+eth_igb_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
+ size_t fw_size)
+{
+ struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct e1000_fw_version fw;
+
+ if (fw_size < 16) {
+ PMD_DRV_LOG(WARNING, "Insufficient fw version buffer size");
+ return -EINVAL;
+ }
+
+ e1000_get_fw_version(hw, &fw);
+
+ switch (hw->mac.type) {
+ case e1000_i210:
+ case e1000_i211:
+ if (!(e1000_get_flash_presence_i210(hw))) {
+ snprintf(fw_version, fw_size,
+ "%2d.%2d-%d",
+ fw.invm_major, fw.invm_minor,
+ fw.invm_img_type);
+ break;
+ }
+ /* fall through */
+ default:
+ /* if option rom is valid, display its version too*/
+ if (fw.or_valid) {
+ snprintf(fw_version, fw_size,
+ "%d.%d, 0x%08x, %d.%d.%d",
+ fw.eep_major, fw.eep_minor, fw.etrack_id,
+ fw.or_major, fw.or_build, fw.or_patch);
+ /* no option rom */
+ } else {
+ if (fw.etrack_id != 0X0000) {
+ snprintf(fw_version, fw_size,
+ "%d.%d, 0x%08x",
+ fw.eep_major, fw.eep_minor,
+ fw.etrack_id);
+ } else {
+ snprintf(fw_version, fw_size,
+ "%d.%d.%d",
+ fw.eep_major, fw.eep_minor,
+ fw.eep_build);
+ }
+ }
+ break;
+ }
+ return 0;
+}
+
static void
eth_igb_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
{
--
2.7.4
^ permalink raw reply related
* [PATCH v7 1/5] ethdev: add firmware version get
From: Qiming Yang @ 2017-01-11 6:41 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, remy.horton, Qiming Yang
In-Reply-To: <1484116905-57438-1-git-send-email-qiming.yang@intel.com>
This patch adds a new API 'rte_eth_dev_fw_version_get' for
fetching firmware version by a given device.
Signed-off-by: Qiming Yang <qiming.yang@intel.com>
Acked-by: Remy Horton <remy.horton@intel.com>
---
doc/guides/nics/features/default.ini | 1 +
doc/guides/rel_notes/deprecation.rst | 4 ----
doc/guides/rel_notes/release_17_02.rst | 5 +++++
lib/librte_ether/rte_ethdev.c | 12 ++++++++++++
lib/librte_ether/rte_ethdev.h | 25 +++++++++++++++++++++++++
lib/librte_ether/rte_ether_version.map | 1 +
6 files changed, 44 insertions(+), 4 deletions(-)
diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/default.ini
index f1bf9bf..ae40d57 100644
--- a/doc/guides/nics/features/default.ini
+++ b/doc/guides/nics/features/default.ini
@@ -50,6 +50,7 @@ Timesync =
Basic stats =
Extended stats =
Stats per queue =
+FW version =
EEPROM dump =
Registers dump =
Multiprocess aware =
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 054e2e7..755dc65 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -30,10 +30,6 @@ Deprecation Notices
``nb_seg_max`` and ``nb_mtu_seg_max`` providing information about number of
segments limit to be transmitted by device for TSO/non-TSO packets.
-* In 17.02 ABI change is planned: the ``rte_eth_dev_info`` structure
- will be extended with a new member ``fw_version`` in order to store
- the NIC firmware version.
-
* ethdev: an API change is planned for 17.02 for the function
``_rte_eth_dev_callback_process``. In 17.02 the function will return an ``int``
instead of ``void`` and a fourth parameter ``void *ret_param`` will be added.
diff --git a/doc/guides/rel_notes/release_17_02.rst b/doc/guides/rel_notes/release_17_02.rst
index 5762d3f..f9134bb 100644
--- a/doc/guides/rel_notes/release_17_02.rst
+++ b/doc/guides/rel_notes/release_17_02.rst
@@ -66,6 +66,11 @@ New Features
Support for Mellanox ConnectX-5 family of 10/25/40/50/100 Gbps adapters
has been added to the existing mlx5 PMD.
+* **Added firmware version get API.**
+
+ Added a new function ``rte_eth_dev_fw_version_get()`` to fetch firmware
+ version by a given device.
+
Resolved Issues
---------------
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 917557a..89cffcf 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -1588,6 +1588,18 @@ rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id, uint16_t rx_queue_id,
STAT_QMAP_RX);
}
+int
+rte_eth_dev_fw_version_get(uint8_t port_id, char *fw_version, size_t fw_size)
+{
+ struct rte_eth_dev *dev;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ dev = &rte_eth_devices[port_id];
+
+ RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fw_version_get, -ENOTSUP);
+ return (*dev->dev_ops->fw_version_get)(dev, fw_version, fw_size);
+}
+
void
rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info)
{
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index ded43d7..a9b3686 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1177,6 +1177,10 @@ typedef uint32_t (*eth_rx_queue_count_t)(struct rte_eth_dev *dev,
typedef int (*eth_rx_descriptor_done_t)(void *rxq, uint16_t offset);
/**< @internal Check DD bit of specific RX descriptor */
+typedef int (*eth_fw_version_get_t)(struct rte_eth_dev *dev,
+ char *fw_version, size_t fw_size);
+/**< @internal Get firmware information of an Ethernet device. */
+
typedef void (*eth_rxq_info_get_t)(struct rte_eth_dev *dev,
uint16_t rx_queue_id, struct rte_eth_rxq_info *qinfo);
@@ -1459,6 +1463,7 @@ struct eth_dev_ops {
eth_dev_infos_get_t dev_infos_get; /**< Get device info. */
eth_rxq_info_get_t rxq_info_get; /**< retrieve RX queue information. */
eth_txq_info_get_t txq_info_get; /**< retrieve TX queue information. */
+ eth_fw_version_get_t fw_version_get; /**< Get firmware version. */
eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
/**< Get packet types supported and identified by device. */
@@ -2396,6 +2401,26 @@ void rte_eth_macaddr_get(uint8_t port_id, struct ether_addr *mac_addr);
void rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info);
/**
+ * Retrieve the firmware version of a device.
+ *
+ * @param port_id
+ * The port identifier of the device.
+ * @param fw_version
+ * A array pointer to store the firmware version of a device,
+ * allocated by caller.
+ * @param fw_size
+ * The size of the array pointed by fw_version, which should be
+ * large enough to store firmware version of the device.
+ * @return
+ * - (0) if successful.
+ * - (-ENOTSUP) if operation is not supported.
+ * - (-ENODEV) if *port_id* invalid.
+ * - (-EINVAL) if *fw_size* is not enough to store firmware version.
+ */
+int rte_eth_dev_fw_version_get(uint8_t port_id,
+ char *fw_version, size_t fw_size);
+
+/**
* Retrieve the supported packet types of an Ethernet device.
*
* When a packet type is announced as supported, it *must* be recognized by
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index 0c2859e..c6c9d0d 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -146,6 +146,7 @@ DPDK_17.02 {
global:
_rte_eth_dev_reset;
+ rte_eth_dev_fw_version_get;
rte_flow_create;
rte_flow_destroy;
rte_flow_flush;
--
2.7.4
^ permalink raw reply related
* [PATCH v7 0/5] new API 'rte_eth_dev_fw_version_get'
From: Qiming Yang @ 2017-01-11 6:41 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, remy.horton, Qiming Yang
In-Reply-To: <1484039333-30074-2-git-send-email-qiming.yang@intel.com>
v7: - rebased
v6: - renamed fw_length -> fw_size
- added return value for insufficient fw_size
- fixed the indentation problem in e1000
- added ver.build.patch in i40e, keep the same with Linux kernel driver
v5: - modified the API rte_eth_dev_fw_version_get(uint8_t port_id,
char *fw_version, int fw_length).
v4: - removed deprecation notice
- renamed API as rte_eth_dev_fw_version_get
- splited bus info print from this patch set
v3: - changed API, use rte_eth_dev_fw_info_get(uint8_t port_id,
uint32_t *fw_major, uint32_t *fw_minor, uint32_t *fw_patch,
uint32_t *etrack_id)
- added statusment in /doc/guides/nics/features/default.ini and
release_17_02.rst
v2: - fixed commit log
Now, the example ethtool can only show the driver information. From
customers' point of view, it should be better if we can have the same
way that the Linux kernel ethtool does to show firmware version.
These five patches added a new function ``rte_eth_dev_fw_version_get()``
to fetch firmware version related information and implement the
display in example ethtool.
Qiming Yang (5):
ethdev: add firmware version get
net/e1000: add firmware version get
net/ixgbe: add firmware version get
net/i40e: add firmware version get
ethtool: display firmware version
doc/guides/nics/features/default.ini | 1 +
doc/guides/nics/features/i40e.ini | 1 +
doc/guides/nics/features/igb.ini | 1 +
doc/guides/nics/features/ixgbe.ini | 1 +
doc/guides/rel_notes/deprecation.rst | 4 ---
doc/guides/rel_notes/release_17_02.rst | 5 ++++
drivers/net/e1000/igb_ethdev.c | 54 ++++++++++++++++++++++++++++++++++
drivers/net/i40e/i40e_ethdev.c | 31 +++++++++++++++++++
drivers/net/ixgbe/ixgbe_ethdev.c | 25 ++++++++++++++++
examples/ethtool/ethtool-app/ethapp.c | 1 +
examples/ethtool/lib/rte_ethtool.c | 6 ++++
lib/librte_ether/rte_ethdev.c | 12 ++++++++
lib/librte_ether/rte_ethdev.h | 25 ++++++++++++++++
lib/librte_ether/rte_ether_version.map | 1 +
14 files changed, 164 insertions(+), 4 deletions(-)
--
2.7.4
^ permalink raw reply
* [PATCH] kni: fast data availability check in thread_single loop
From: Sergey Vyazmitinov @ 2016-12-29 23:23 UTC (permalink / raw)
To: ferruh.yigit; +Cc: dev, Sergey Vyazmitinov
This allow to significant reduces packets processing latency.
Signed-off-by: Sergey Vyazmitinov <s.vyazmitinov@brain4net.com>
---
.../linuxapp/eal/include/exec-env/rte_kni_common.h | 6 ++++
lib/librte_eal/linuxapp/kni/kni_misc.c | 33 ++++++++++++++++------
2 files changed, 30 insertions(+), 9 deletions(-)
diff --git a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
index 09713b0..8183a8e 100644
--- a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
+++ b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
@@ -109,6 +109,12 @@ struct rte_kni_fifo {
void *volatile buffer[]; /**< The buffer contains mbuf pointers */
};
+static inline int
+kni_fifo_empty(struct rte_kni_fifo *fifo)
+{
+ return fifo->write == fifo->read;
+}
+
/*
* The kernel image of the rte_mbuf struct, with only the relevant fields.
* Padding is necessary to assure the offsets of these fields
diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c b/lib/librte_eal/linuxapp/kni/kni_misc.c
index 497db9b..4bf9bfa 100644
--- a/lib/librte_eal/linuxapp/kni/kni_misc.c
+++ b/lib/librte_eal/linuxapp/kni/kni_misc.c
@@ -45,6 +45,7 @@ MODULE_AUTHOR("Intel Corporation");
MODULE_DESCRIPTION("Kernel Module for managing kni devices");
#define KNI_RX_LOOP_NUM 1000
+#define KNI_RX_DATA_LOOP_NUM 2500
#define KNI_MAX_DEVICES 32
@@ -129,25 +130,39 @@ static struct pernet_operations kni_net_ops = {
#endif
};
-static int
-kni_thread_single(void *data)
+static inline void
+kni_thread_single_rx_data_loop(struct kni_net *knet)
{
- struct kni_net *knet = data;
- int j;
struct kni_dev *dev;
+ int i;
- while (!kthread_should_stop()) {
- down_read(&knet->kni_list_lock);
- for (j = 0; j < KNI_RX_LOOP_NUM; j++) {
- list_for_each_entry(dev, &knet->kni_list_head, list) {
+ for (i = 0; i < KNI_RX_DATA_LOOP_NUM; ++i) {
+ list_for_each_entry(dev, &knet->kni_list_head, list) {
+ /* Burst dequeue from rx_q */
+ if (!kni_fifo_empty((struct rte_kni_fifo *)dev->rx_q)) {
#ifdef RTE_KNI_VHOST
kni_chk_vhost_rx(dev);
#else
kni_net_rx(dev);
#endif
- kni_net_poll_resp(dev);
}
}
+ }
+ list_for_each_entry(dev, &knet->kni_list_head, list) {
+ kni_net_poll_resp(dev);
+ }
+}
+
+static int
+kni_thread_single(void *data)
+{
+ struct kni_net *knet = data;
+ int j;
+
+ while (!kthread_should_stop()) {
+ down_read(&knet->kni_list_lock);
+ for (j = 0; j < KNI_RX_LOOP_NUM; j++)
+ kni_thread_single_rx_data_loop(knet);
up_read(&knet->kni_list_lock);
#ifdef RTE_KNI_PREEMPT_DEFAULT
/* reschedule out for a while */
--
2.7.4
^ permalink raw reply related
* Re: [PATCH 1/2] add rte_bus->probe
From: Shreyansh Jain @ 2017-01-11 4:53 UTC (permalink / raw)
To: Ferruh Yigit, dev; +Cc: Stephen Hemminger, Jan Blunck
In-Reply-To: <20170110180250.10625-1-ferruh.yigit@intel.com>
On Tuesday 10 January 2017 11:32 PM, Ferruh Yigit wrote:
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
> lib/librte_eal/common/eal_common_bus.c | 7 ++++---
> lib/librte_eal/common/include/rte_bus.h | 3 +++
> lib/librte_eal/linuxapp/eal/eal_pci.c | 1 +
> 3 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c
> index f8c2e03..e8d1143 100644
> --- a/lib/librte_eal/common/eal_common_bus.c
> +++ b/lib/librte_eal/common/eal_common_bus.c
> @@ -145,6 +145,7 @@ rte_eal_bus_register(struct rte_bus *bus)
> /* A bus should mandatorily have the scan and match implemented */
> RTE_VERIFY(bus->scan);
> RTE_VERIFY(bus->match);
> + RTE_VERIFY(bus->probe);
v6 of my patches would include the above.
>
> /* Initialize the driver and device list associated with the bus */
> TAILQ_INIT(&(bus->driver_list));
> @@ -195,19 +196,19 @@ rte_eal_bus_scan(void)
> }
>
> static int
> -perform_probe(struct rte_bus *bus __rte_unused, struct rte_driver *driver,
> +perform_probe(struct rte_bus *bus, struct rte_driver *driver,
> struct rte_device *device)
> {
> int ret;
>
> - if (!driver->probe) {
> + if (!bus->probe) {
> RTE_LOG(ERR, EAL, "Driver (%s) doesn't support probe.\n",
> driver->name);
> /* This is not an error - just a badly implemented PMD */
> return 0;
> }
>
> - ret = driver->probe(driver, device);
> + ret = bus->probe(driver, device);
> if (ret < 0)
> /* One of the probes failed */
> RTE_LOG(ERR, EAL, "Probe failed for (%s).\n", driver->name);
Substantial code has shuffled in v6, including removal of this function.
But again, I agree with your changes.
> diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h
> index 07c30c4..ce1f56a 100644
> --- a/lib/librte_eal/common/include/rte_bus.h
> +++ b/lib/librte_eal/common/include/rte_bus.h
> @@ -135,6 +135,8 @@ typedef int (*bus_scan_t)(struct rte_bus *bus);
> */
> typedef int (*bus_match_t)(struct rte_driver *drv, struct rte_device *dev);
>
> +typedef int (*bus_probe_t)(struct rte_driver *drv, struct rte_device *dev);
> +
> /**
> * A structure describing a generic bus.
> */
> @@ -147,6 +149,7 @@ struct rte_bus {
> const char *name; /**< Name of the bus */
> bus_scan_t scan; /**< Scan for devices attached to bus */
> bus_match_t match;
> + bus_probe_t probe;
> /**< Match device with drivers associated with the bus */
> };
>
> diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
> index 314effa..837adf6 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_pci.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
> @@ -726,6 +726,7 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)
> struct rte_bus pci_bus = {
> .scan = rte_eal_pci_scan,
> .match = rte_eal_pci_match,
> + .probe = rte_eal_pci_probe,
> };
>
> RTE_REGISTER_BUS(pci, pci_bus);
>
^ permalink raw reply
* [PATCH v6 6/6] doc: add ixgbe specific APIs
From: Tiwei Bie @ 2017-01-11 4:31 UTC (permalink / raw)
To: dev
Cc: adrien.mazarguil, wenzhuo.lu, john.mcnamara, olivier.matz,
thomas.monjalon, konstantin.ananyev, helin.zhang, wei.dai,
xiao.w.wang
In-Reply-To: <1484109098-8936-1-git-send-email-tiwei.bie@intel.com>
Add information about the new ixgbe PMD APIs in the release notes.
Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
---
doc/guides/rel_notes/release_17_02.rst | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/doc/guides/rel_notes/release_17_02.rst b/doc/guides/rel_notes/release_17_02.rst
index 3958714..a3490a5 100644
--- a/doc/guides/rel_notes/release_17_02.rst
+++ b/doc/guides/rel_notes/release_17_02.rst
@@ -52,6 +52,11 @@ New Features
See the :ref:`Generic flow API <Generic_flow_API>` documentation for more
information.
+* **Added APIs for MACsec offload support to the ixgbe PMD.**
+
+ Six new APIs have been added to the ixgbe PMD for MACsec offload support.
+ The declarations for the APIs can be found in ``rte_pmd_ixgbe.h``.
+
* **Improved offload support in mbuf.**
Added a new Tx mbuf flag for MACsec, which can be set by applications
--
2.7.4
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox