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/pcap: support imissed stats
[dpdk.git]
/
drivers
/
net
/
bnxt
/
bnxt_filter.c
diff --git
a/drivers/net/bnxt/bnxt_filter.c
b/drivers/net/bnxt/bnxt_filter.c
index
0aed29f
..
1d08e03
100644
(file)
--- a/
drivers/net/bnxt/bnxt_filter.c
+++ b/
drivers/net/bnxt/bnxt_filter.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.
*/
@@
-26,21
+26,20
@@
struct bnxt_filter_info *bnxt_alloc_filter(struct bnxt *bp)
{
struct bnxt_filter_info *filter;
{
struct bnxt_filter_info *filter;
- /* Find the 1st unused filter from the free_filter_list pool*/
- filter = STAILQ_FIRST(&bp->free_filter_list);
+ filter = bnxt_get_unused_filter(bp);
if (!filter) {
PMD_DRV_LOG(ERR, "No more free filter resources\n");
return NULL;
}
if (!filter) {
PMD_DRV_LOG(ERR, "No more free filter resources\n");
return NULL;
}
- STAILQ_REMOVE_HEAD(&bp->free_filter_list, next);
+ filter->mac_index = INVALID_MAC_INDEX;
/* Default to L2 MAC Addr filter */
filter->flags = HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_RX;
filter->enables = HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR |
HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR_MASK;
/* Default to L2 MAC Addr filter */
filter->flags = HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_RX;
filter->enables = HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR |
HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR_MASK;
- memcpy(filter->l2_addr, bp->eth_dev->data->mac_addrs->addr_bytes,
- RTE_ETHER_ADDR_LEN);
+ memcpy(filter->l2_addr, bp->mac_addr, RTE_ETHER_ADDR_LEN);
memset(filter->l2_addr_mask, 0xff, RTE_ETHER_ADDR_LEN);
memset(filter->l2_addr_mask, 0xff, RTE_ETHER_ADDR_LEN);
+
return filter;
}
return filter;
}
@@
-56,11
+55,11
@@
struct bnxt_filter_info *bnxt_alloc_vf_filter(struct bnxt *bp, uint16_t vf)
}
filter->fw_l2_filter_id = UINT64_MAX;
}
filter->fw_l2_filter_id = UINT64_MAX;
- STAILQ_INSERT_TAIL(&bp->pf
.
vf_info[vf].filter, filter, next);
+ STAILQ_INSERT_TAIL(&bp->pf
->
vf_info[vf].filter, filter, next);
return filter;
}
return filter;
}
-void bnxt_init_filters(struct bnxt *bp)
+
static
void bnxt_init_filters(struct bnxt *bp)
{
struct bnxt_filter_info *filter;
int i, max_filters;
{
struct bnxt_filter_info *filter;
int i, max_filters;
@@
-82,7
+81,15
@@
void bnxt_free_all_filters(struct bnxt *bp)
struct bnxt_filter_info *filter, *temp_filter;
unsigned int i;
struct bnxt_filter_info *filter, *temp_filter;
unsigned int i;
-// for (i = 0; i < MAX_FF_POOLS; i++) {
+ for (i = 0; i < bp->pf->max_vfs; i++) {
+ STAILQ_FOREACH(filter, &bp->pf->vf_info[i].filter, next) {
+ bnxt_hwrm_clear_l2_filter(bp, filter);
+ }
+ }
+
+ if (bp->vnic_info == NULL)
+ return;
+
for (i = 0; i < bp->nr_vnics; i++) {
vnic = &bp->vnic_info[i];
filter = STAILQ_FIRST(&vnic->filter);
for (i = 0; i < bp->nr_vnics; i++) {
vnic = &bp->vnic_info[i];
filter = STAILQ_FIRST(&vnic->filter);
@@
-97,11
+104,6
@@
void bnxt_free_all_filters(struct bnxt *bp)
STAILQ_INIT(&vnic->filter);
}
STAILQ_INIT(&vnic->filter);
}
- for (i = 0; i < bp->pf.max_vfs; i++) {
- STAILQ_FOREACH(filter, &bp->pf.vf_info[i].filter, next) {
- bnxt_hwrm_clear_l2_filter(bp, filter);
- }
- }
}
void bnxt_free_filter_mem(struct bnxt *bp)
}
void bnxt_free_filter_mem(struct bnxt *bp)
@@
-117,39
+119,39
@@
void bnxt_free_filter_mem(struct bnxt *bp)
max_filters = bp->max_l2_ctx;
for (i = 0; i < max_filters; i++) {
filter = &bp->filter_info[i];
max_filters = bp->max_l2_ctx;
for (i = 0; i < max_filters; i++) {
filter = &bp->filter_info[i];
- if (filter->fw_l2_filter_id != ((uint64_t)-1) &&
- filter->filter_type == HWRM_CFA_L2_FILTER) {
- PMD_DRV_LOG(ERR, "L2 filter is not free\n");
+ if (filter->fw_ntuple_filter_id != ((uint64_t)-1) &&
+ filter->filter_type == HWRM_CFA_NTUPLE_FILTER) {
/* Call HWRM to try to free filter again */
/* Call HWRM to try to free filter again */
- rc = bnxt_hwrm_clear_
l2
_filter(bp, filter);
+ rc = bnxt_hwrm_clear_
ntuple
_filter(bp, filter);
if (rc)
PMD_DRV_LOG(ERR,
if (rc)
PMD_DRV_LOG(ERR,
- "Cannot free
L2
filter: %d\n",
+ "Cannot free
ntuple
filter: %d\n",
rc);
}
rc);
}
- filter->fw_
l2
_filter_id = UINT64_MAX;
+ filter->fw_
ntuple
_filter_id = UINT64_MAX;
- if (filter->fw_
ntuple
_filter_id != ((uint64_t)-1) &&
- filter->filter_type == HWRM_CFA_
NTUPLE
_FILTER) {
- PMD_DRV_LOG(
ERR, "NTUPLE
filter is not free\n");
+ if (filter->fw_
l2
_filter_id != ((uint64_t)-1) &&
+ filter->filter_type == HWRM_CFA_
L2
_FILTER) {
+ PMD_DRV_LOG(
DEBUG, "L2
filter is not free\n");
/* Call HWRM to try to free filter again */
/* Call HWRM to try to free filter again */
- rc = bnxt_hwrm_clear_
ntuple
_filter(bp, filter);
+ rc = bnxt_hwrm_clear_
l2
_filter(bp, filter);
if (rc)
PMD_DRV_LOG(ERR,
if (rc)
PMD_DRV_LOG(ERR,
- "Cannot free
NTUPLE
filter: %d\n",
+ "Cannot free
L2
filter: %d\n",
rc);
}
rc);
}
- filter->fw_ntuple_filter_id = UINT64_MAX;
+ filter->fw_l2_filter_id = UINT64_MAX;
+
}
STAILQ_INIT(&bp->free_filter_list);
rte_free(bp->filter_info);
bp->filter_info = NULL;
}
STAILQ_INIT(&bp->free_filter_list);
rte_free(bp->filter_info);
bp->filter_info = NULL;
- for (i = 0; i < bp->pf
.
max_vfs; i++) {
- STAILQ_FOREACH(filter, &bp->pf
.
vf_info[i].filter, next) {
+ for (i = 0; i < bp->pf
->
max_vfs; i++) {
+ STAILQ_FOREACH(filter, &bp->pf
->
vf_info[i].filter, next) {
rte_free(filter);
rte_free(filter);
- STAILQ_REMOVE(&bp->pf
.
vf_info[i].filter, filter,
+ STAILQ_REMOVE(&bp->pf
->
vf_info[i].filter, filter,
bnxt_filter_info, next);
}
}
bnxt_filter_info, next);
}
}
@@
-171,6
+173,7
@@
int bnxt_alloc_filter_mem(struct bnxt *bp)
return -ENOMEM;
}
bp->filter_info = filter_mem;
return -ENOMEM;
}
bp->filter_info = filter_mem;
+ bnxt_init_filters(bp);
return 0;
}
return 0;
}
@@
-191,5
+194,10
@@
struct bnxt_filter_info *bnxt_get_unused_filter(struct bnxt *bp)
void bnxt_free_filter(struct bnxt *bp, struct bnxt_filter_info *filter)
{
void bnxt_free_filter(struct bnxt *bp, struct bnxt_filter_info *filter)
{
+ memset(filter, 0, sizeof(*filter));
+ filter->mac_index = INVALID_MAC_INDEX;
+ filter->fw_l2_filter_id = UINT64_MAX;
+ filter->fw_ntuple_filter_id = UINT64_MAX;
+ filter->fw_em_filter_id = UINT64_MAX;
STAILQ_INSERT_TAIL(&bp->free_filter_list, filter, next);
}
STAILQ_INSERT_TAIL(&bp->free_filter_list, filter, next);
}