Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dpdk2011 rebase #737

Merged
merged 23 commits into from
Jul 22, 2021
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3eed601
dpvs netif_flow module using generic flow(rte_flow)
ywc689 Sep 19, 2020
dd24c38
sapool: replace flow director with rte_flow
ywc689 Sep 21, 2020
e4e5486
netif_flow: bugfix
ywc689 Sep 22, 2020
5df6130
netif_flow: lock rte_flow api if pmd driver implementation is not thr…
ywc689 Sep 27, 2020
c7604f4
netif_flow: support ixgbe pmd driver
ywc689 Sep 29, 2020
6f7b712
sapool: fix flow mask byte order problem
ywc689 Sep 29, 2020
f10db1e
makefile: update meson build for DPDK
vipinpv85 Jan 25, 2021
b8da933
doc: update the README for meson build
vipinpv85 Jan 25, 2021
6741ce9
fix meson build failure problem
ywc689 Apr 19, 2021
ff650eb
merge dpdk-stable-20.11.x (abandon dpdk-stable-18.11.x)
ywc689 Apr 26, 2021
fa7bc4b
refactor Makefile and fix some bugs after merging dpdk 20.11
ywc689 May 8, 2021
0e37d91
patch: add patches for dpdk-stable-20.11.1
ywc689 Jun 18, 2021
4cb2913
script: add helper script to facilitate dpdk build.
ywc689 Jun 18, 2021
39760a1
patch: remove patches of old dpdk versions
ywc689 Jun 21, 2021
c53a255
main: add dpdk version check
ywc689 Jun 21, 2021
1918017
doc: update docs with dpdk 20.11
ywc689 Jun 21, 2021
c57a0db
makefile: update config.mk
ywc689 Jun 22, 2021
9a5d303
netif: fix rte_flow flush problem for bonding slaves
ywc689 Jun 22, 2021
82f66c5
ci: adapt ci to dpdk-20.11
ywc689 Jun 24, 2021
5e23cc9
patch: add dpdk 20.11.1 bonding mode 4 patch for mlx5
ywc689 Jun 24, 2021
291f4a4
single worker rte_flow invalid process bugfix patch
Jun 29, 2021
2ec96f0
The reason of error return in cons_parse_ntuple_filter() comment
Jul 2, 2021
2947963
fix mbuf dynfield size problem and uniform some coding styles
ywc689 Jul 8, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
netif_flow: lock rte_flow api if pmd driver implementation is not thr…
…ead-safe
  • Loading branch information
ywc689 committed Jun 24, 2021
commit 5df6130f422332913c377b54259cec4002bc233d
23 changes: 23 additions & 0 deletions src/netif_flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@

#define RTE_LOGTYPE_FLOW RTE_LOGTYPE_USER1

/* uncomment the macro if rte_flow pmd driver is not thread-safe. */
// #define CONFIG_DEV_FLOW_LOCK

/* sapool pattern stack: ETH | IP | TCP/UDP | END */
#define SAPOOL_PATTERN_NUM 4
/* sapool action stack: QUEUE | END */
Expand All @@ -38,6 +41,20 @@ typedef enum {
// more ...
} netif_flow_type_prio_t;

static inline void netif_flow_lock(struct netif_port *dev)
{
#ifdef CONFIG_DEV_FLOW_LOCK
rte_rwlock_write_lock(&dev->dev_lock);
#endif
}

static inline void netif_flow_unlock(struct netif_port *dev)
{
#ifdef CONFIG_DEV_FLOW_LOCK
rte_rwlock_write_unlock(&dev->dev_lock);
#endif
}

/*
* Create a rte_flow on a physical port.
*/
Expand All @@ -53,13 +70,16 @@ static inline int __netif_flow_create(struct netif_port *dev,
dev->type != PORT_TYPE_BOND_SLAVE)))
return EDPVS_INVAL;

netif_flow_lock(dev);
if (rte_flow_validate(dev->id, attr, pattern, actions, &flow_error)) {
netif_flow_unlock(dev);
RTE_LOG(WARNING, FLOW, "rte_flow_validate on %s failed -- %d, %s\n",
dev->name, flow_error.type, flow_error.message);
return EDPVS_DPDKAPIFAIL;
}

flow->handler = rte_flow_create(dev->id, attr, pattern, actions, &flow_error);
netif_flow_unlock(dev);
if (!flow->handler) {
flow->pid = 0;
RTE_LOG(WARNING, FLOW, "rte_flow_create on %s failed -- %d, %s\n",
Expand Down Expand Up @@ -87,11 +107,14 @@ static int __netif_flow_destroy(struct netif_flow_handler *flow)
dev->type != PORT_TYPE_BOND_SLAVE)))
return EDPVS_INVAL;

netif_flow_lock(dev);
if (rte_flow_destroy(flow->pid, (struct rte_flow *)flow->handler, &flow_error)) {
RTE_LOG(WARNING, FLOW, "rte_flow_destroy on %s failed -- %d, %s\n",
dev->name, flow_error.type, flow_error.message);
netif_flow_unlock(dev);
return EDPVS_DPDKAPIFAIL;
}
netif_flow_unlock(dev);

return EDPVS_OK;
}
Expand Down