git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
net/ark: refactor Rx buffer recovery
[dpdk.git]
/
drivers
/
net
/
bnxt
/
bnxt_flow.c
diff --git
a/drivers/net/bnxt/bnxt_flow.c
b/drivers/net/bnxt/bnxt_flow.c
index
4473427
..
a8f5d91
100644
(file)
--- a/
drivers/net/bnxt/bnxt_flow.c
+++ b/
drivers/net/bnxt/bnxt_flow.c
@@
-1,5
+1,5
@@
/* SPDX-License-Identifier: BSD-3-Clause
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2014-20
18
Broadcom
+ * Copyright(c) 2014-20
21
Broadcom
* All rights reserved.
*/
* All rights reserved.
*/
@@
-18,6
+18,7
@@
#include "bnxt_hwrm.h"
#include "bnxt_ring.h"
#include "bnxt_rxq.h"
#include "bnxt_hwrm.h"
#include "bnxt_ring.h"
#include "bnxt_rxq.h"
+#include "bnxt_rxr.h"
#include "bnxt_vnic.h"
#include "hsi_struct_def_dpdk.h"
#include "bnxt_vnic.h"
#include "hsi_struct_def_dpdk.h"
@@
-553,7
+554,7
@@
bnxt_validate_and_parse_flow_type(struct bnxt *bp,
}
/* Check if VNI is masked. */
}
/* Check if VNI is masked. */
- if (vxlan_
spec && vxlan_mask
) {
+ if (vxlan_
mask != NULL
) {
vni_masked =
!!memcmp(vxlan_mask->vni, vni_mask,
RTE_DIM(vni_mask));
vni_masked =
!!memcmp(vxlan_mask->vni, vni_mask,
RTE_DIM(vni_mask));
@@
-1055,6
+1056,13
@@
start:
}
PMD_DRV_LOG(DEBUG, "Queue index %d\n", act_q->index);
}
PMD_DRV_LOG(DEBUG, "Queue index %d\n", act_q->index);
+ if (use_ntuple && !BNXT_RFS_NEEDS_VNIC(bp)) {
+ filter->flags =
+ HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_FLAGS_DEST_RFS_RING_IDX;
+ filter->dst_id = act_q->index;
+ goto skip_vnic_alloc;
+ }
+
vnic_id = attr->group;
if (!vnic_id) {
PMD_DRV_LOG(DEBUG, "Group id is 0\n");
vnic_id = attr->group;
if (!vnic_id) {
PMD_DRV_LOG(DEBUG, "Group id is 0\n");
@@
-1126,7
+1134,7
@@
use_vnic:
PMD_DRV_LOG(DEBUG,
"Setting vnic ff_idx %d\n", vnic->ff_pool_idx);
filter->dst_id = vnic->fw_vnic_id;
PMD_DRV_LOG(DEBUG,
"Setting vnic ff_idx %d\n", vnic->ff_pool_idx);
filter->dst_id = vnic->fw_vnic_id;
-
+skip_vnic_alloc:
/* For ntuple filter, create the L2 filter with default VNIC.
* The user specified redirect queue will be set while creating
* the ntuple filter in hardware.
/* For ntuple filter, create the L2 filter with default VNIC.
* The user specified redirect queue will be set while creating
* the ntuple filter in hardware.
@@
-1364,6
+1372,8
@@
use_vnic:
if (vnic->rx_queue_cnt > 1) {
vnic->hash_type =
bnxt_rte_to_hwrm_hash_types(rss->types);
if (vnic->rx_queue_cnt > 1) {
vnic->hash_type =
bnxt_rte_to_hwrm_hash_types(rss->types);
+ vnic->hash_mode =
+ bnxt_rte_to_hwrm_hash_level(bp, rss->types, rss->level);
if (!rss->key_len) {
/* If hash key has not been specified,
if (!rss->key_len) {
/* If hash key has not been specified,
@@
-1403,18
+1413,6
@@
vnic_found:
bnxt_update_filter_flags_en(filter, filter1, use_ntuple);
break;
case RTE_FLOW_ACTION_TYPE_MARK:
bnxt_update_filter_flags_en(filter, filter1, use_ntuple);
break;
case RTE_FLOW_ACTION_TYPE_MARK:
- if (bp->flags & BNXT_FLAG_RX_VECTOR_PKT_MODE) {
- PMD_DRV_LOG(DEBUG,
- "Disable vector processing for mark\n");
- rte_flow_error_set(error,
- ENOTSUP,
- RTE_FLOW_ERROR_TYPE_ACTION,
- act,
- "Disable vector processing for mark");
- rc = -rte_errno;
- goto ret;
- }
-
if (bp->mark_table == NULL) {
rte_flow_error_set(error,
ENOMEM,
if (bp->mark_table == NULL) {
rte_flow_error_set(error,
ENOMEM,
@@
-1425,6
+1423,13
@@
vnic_found:
goto ret;
}
goto ret;
}
+ if (bp->flags & BNXT_FLAG_RX_VECTOR_PKT_MODE) {
+ PMD_DRV_LOG(DEBUG,
+ "Disabling vector processing for mark\n");
+ bp->eth_dev->rx_pkt_burst = bnxt_recv_pkts;
+ bp->flags &= ~BNXT_FLAG_RX_VECTOR_PKT_MODE;
+ }
+
filter->valid_flags |= BNXT_FLOW_MARK_FLAG;
filter->mark = ((const struct rte_flow_action_mark *)
act->conf)->id;
filter->valid_flags |= BNXT_FLOW_MARK_FLAG;
filter->mark = ((const struct rte_flow_action_mark *)
act->conf)->id;
@@
-1633,7
+1638,7
@@
static void
bnxt_setup_flow_counter(struct bnxt *bp)
{
if (bp->fw_cap & BNXT_FW_CAP_ADV_FLOW_COUNTERS &&
bnxt_setup_flow_counter(struct bnxt *bp)
{
if (bp->fw_cap & BNXT_FW_CAP_ADV_FLOW_COUNTERS &&
- !(bp->flags & BNXT_FLAG_FC_THREAD)) {
+ !(bp->flags & BNXT_FLAG_FC_THREAD)
&& BNXT_FLOW_XSTATS_EN(bp)
) {
rte_eal_alarm_set(US_PER_S * BNXT_FC_TIMER,
bnxt_flow_cnt_alarm_cb,
(void *)bp);
rte_eal_alarm_set(US_PER_S * BNXT_FC_TIMER,
bnxt_flow_cnt_alarm_cb,
(void *)bp);
@@
-1646,13
+1651,13
@@
void bnxt_flow_cnt_alarm_cb(void *arg)
int rc = 0;
struct bnxt *bp = arg;
int rc = 0;
struct bnxt *bp = arg;
- if (!bp->rx_fc_out_tbl.va) {
- PMD_DRV_LOG(ERR, "bp->rx_fc_out_tbl.va is NULL?\n");
+ if (!bp->
flow_stat->
rx_fc_out_tbl.va) {
+ PMD_DRV_LOG(ERR, "bp->
flow_stat->
rx_fc_out_tbl.va is NULL?\n");
bnxt_cancel_fc_thread(bp);
return;
}
bnxt_cancel_fc_thread(bp);
return;
}
- if (!bp->flow_count) {
+ if (!bp->flow_
stat->flow_
count) {
bnxt_cancel_fc_thread(bp);
return;
}
bnxt_cancel_fc_thread(bp);
return;
}
@@
-1790,15
+1795,30
@@
bnxt_flow_create(struct rte_eth_dev *dev,
filter->enables |=
HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_L2_FILTER_ID;
ret = bnxt_hwrm_set_em_filter(bp, filter->dst_id, filter);
filter->enables |=
HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_L2_FILTER_ID;
ret = bnxt_hwrm_set_em_filter(bp, filter->dst_id, filter);
+ if (ret != 0) {
+ rte_flow_error_set(error, -ret,
+ RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
+ "Failed to create EM filter");
+ goto free_filter;
+ }
}
if (filter->filter_type == HWRM_CFA_NTUPLE_FILTER) {
filter->enables |=
HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_L2_FILTER_ID;
ret = bnxt_hwrm_set_ntuple_filter(bp, filter->dst_id, filter);
}
if (filter->filter_type == HWRM_CFA_NTUPLE_FILTER) {
filter->enables |=
HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_L2_FILTER_ID;
ret = bnxt_hwrm_set_ntuple_filter(bp, filter->dst_id, filter);
+ if (ret != 0) {
+ rte_flow_error_set(error, -ret,
+ RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
+ "Failed to create ntuple filter");
+ goto free_filter;
+ }
}
}
- vnic = find_matching_vnic(bp, filter);
+ if (BNXT_RFS_NEEDS_VNIC(bp))
+ vnic = find_matching_vnic(bp, filter);
+ else
+ vnic = BNXT_GET_DEFAULT_VNIC(bp);
done:
if (!ret || update_flow) {
flow->filter = filter;
done:
if (!ret || update_flow) {
flow->filter = filter;
@@
-1808,9
+1828,6
@@
done:
goto free_flow;
}
goto free_flow;
}
- STAILQ_INSERT_TAIL(&vnic->filter, filter, next);
- PMD_DRV_LOG(DEBUG, "Successfully created flow.\n");
- STAILQ_INSERT_TAIL(&vnic->flow_list, flow, next);
if (filter->valid_flags & BNXT_FLOW_MARK_FLAG) {
PMD_DRV_LOG(DEBUG,
"Mark action: mark id 0x%x, flow id 0x%x\n",
if (filter->valid_flags & BNXT_FLOW_MARK_FLAG) {
PMD_DRV_LOG(DEBUG,
"Mark action: mark id 0x%x, flow id 0x%x\n",
@@
-1821,18
+1838,25
@@
done:
*/
flow_id = filter->flow_id & BNXT_FLOW_ID_MASK;
if (bp->mark_table[flow_id].valid) {
*/
flow_id = filter->flow_id & BNXT_FLOW_ID_MASK;
if (bp->mark_table[flow_id].valid) {
- PMD_DRV_LOG(ERR,
- "Entry for Mark id 0x%x occupied"
- " flow id 0x%x\n",
- filter->mark, filter->flow_id);
+ rte_flow_error_set(error, EEXIST,
+ RTE_FLOW_ERROR_TYPE_HANDLE,
+ NULL,
+ "Flow with mark id exists");
+ bnxt_clear_one_vnic_filter(bp, filter);
goto free_filter;
}
bp->mark_table[flow_id].valid = true;
bp->mark_table[flow_id].mark_id = filter->mark;
}
goto free_filter;
}
bp->mark_table[flow_id].valid = true;
bp->mark_table[flow_id].mark_id = filter->mark;
}
- bp->flow_count++;
+
+ STAILQ_INSERT_TAIL(&vnic->filter, filter, next);
+ STAILQ_INSERT_TAIL(&vnic->flow_list, flow, next);
+
+ if (BNXT_FLOW_XSTATS_EN(bp))
+ bp->flow_stat->flow_count++;
bnxt_release_flow_lock(bp);
bnxt_setup_flow_counter(bp);
bnxt_release_flow_lock(bp);
bnxt_setup_flow_counter(bp);
+ PMD_DRV_LOG(DEBUG, "Successfully created flow.\n");
return flow;
}
return flow;
}
@@
-1931,11
+1955,7
@@
_bnxt_flow_destroy(struct bnxt *bp,
filter->flow_id = 0;
}
filter->flow_id = 0;
}
- if (filter->filter_type == HWRM_CFA_EM_FILTER)
- ret = bnxt_hwrm_clear_em_filter(bp, filter);
- if (filter->filter_type == HWRM_CFA_NTUPLE_FILTER)
- ret = bnxt_hwrm_clear_ntuple_filter(bp, filter);
- ret = bnxt_hwrm_clear_l2_filter(bp, filter);
+ ret = bnxt_clear_one_vnic_filter(bp, filter);
done:
if (!ret) {
done:
if (!ret) {
@@
-1952,7
+1972,8
@@
done:
bnxt_free_filter(bp, filter);
STAILQ_REMOVE(&vnic->flow_list, flow, rte_flow, next);
rte_free(flow);
bnxt_free_filter(bp, filter);
STAILQ_REMOVE(&vnic->flow_list, flow, rte_flow, next);
rte_free(flow);
- bp->flow_count--;
+ if (BNXT_FLOW_XSTATS_EN(bp))
+ bp->flow_stat->flow_count--;
/* If this was the last flow associated with this vnic,
* switch the queue back to RSS pool.
/* If this was the last flow associated with this vnic,
* switch the queue back to RSS pool.