2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

odp-execute: Rename 'may_steal' to 'should_steal'.

Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
Darrell Ball
2018-05-16 19:24:46 -07:00
committed by Ben Pfaff
parent a8ab588936
commit 7d7ded7af7
6 changed files with 31 additions and 30 deletions

View File

@@ -792,9 +792,9 @@ dp_packet_batch_clone(struct dp_packet_batch *dst,
} }
static inline void static inline void
dp_packet_delete_batch(struct dp_packet_batch *batch, bool may_steal) dp_packet_delete_batch(struct dp_packet_batch *batch, bool should_steal)
{ {
if (may_steal) { if (should_steal) {
struct dp_packet *packet; struct dp_packet *packet;
DP_PACKET_BATCH_FOR_EACH (i, packet, batch) { DP_PACKET_BATCH_FOR_EACH (i, packet, batch) {

View File

@@ -647,7 +647,8 @@ static int dpif_netdev_open(const struct dpif_class *, const char *name,
bool create, struct dpif **); bool create, struct dpif **);
static void dp_netdev_execute_actions(struct dp_netdev_pmd_thread *pmd, static void dp_netdev_execute_actions(struct dp_netdev_pmd_thread *pmd,
struct dp_packet_batch *, struct dp_packet_batch *,
bool may_steal, const struct flow *flow, bool should_steal,
const struct flow *flow,
const struct nlattr *actions, const struct nlattr *actions,
size_t actions_len); size_t actions_len);
static void dp_netdev_input(struct dp_netdev_pmd_thread *, static void dp_netdev_input(struct dp_netdev_pmd_thread *,
@@ -5594,7 +5595,7 @@ error:
static void static void
dp_execute_userspace_action(struct dp_netdev_pmd_thread *pmd, dp_execute_userspace_action(struct dp_netdev_pmd_thread *pmd,
struct dp_packet *packet, bool may_steal, struct dp_packet *packet, bool should_steal,
struct flow *flow, ovs_u128 *ufid, struct flow *flow, ovs_u128 *ufid,
struct ofpbuf *actions, struct ofpbuf *actions,
const struct nlattr *userdata) const struct nlattr *userdata)
@@ -5609,16 +5610,16 @@ dp_execute_userspace_action(struct dp_netdev_pmd_thread *pmd,
NULL); NULL);
if (!error || error == ENOSPC) { if (!error || error == ENOSPC) {
dp_packet_batch_init_packet(&b, packet); dp_packet_batch_init_packet(&b, packet);
dp_netdev_execute_actions(pmd, &b, may_steal, flow, dp_netdev_execute_actions(pmd, &b, should_steal, flow,
actions->data, actions->size); actions->data, actions->size);
} else if (may_steal) { } else if (should_steal) {
dp_packet_delete(packet); dp_packet_delete(packet);
} }
} }
static void static void
dp_execute_cb(void *aux_, struct dp_packet_batch *packets_, dp_execute_cb(void *aux_, struct dp_packet_batch *packets_,
const struct nlattr *a, bool may_steal) const struct nlattr *a, bool should_steal)
OVS_NO_THREAD_SAFETY_ANALYSIS OVS_NO_THREAD_SAFETY_ANALYSIS
{ {
struct dp_netdev_execute_aux *aux = aux_; struct dp_netdev_execute_aux *aux = aux_;
@@ -5635,7 +5636,7 @@ dp_execute_cb(void *aux_, struct dp_packet_batch *packets_,
struct dp_packet *packet; struct dp_packet *packet;
struct dp_packet_batch out; struct dp_packet_batch out;
if (!may_steal) { if (!should_steal) {
dp_packet_batch_clone(&out, packets_); dp_packet_batch_clone(&out, packets_);
dp_packet_batch_reset_cutlen(packets_); dp_packet_batch_reset_cutlen(packets_);
packets_ = &out; packets_ = &out;
@@ -5688,7 +5689,7 @@ dp_execute_cb(void *aux_, struct dp_packet_batch *packets_,
if (p) { if (p) {
struct dp_packet_batch tnl_pkt; struct dp_packet_batch tnl_pkt;
if (!may_steal) { if (!should_steal) {
dp_packet_batch_clone(&tnl_pkt, packets_); dp_packet_batch_clone(&tnl_pkt, packets_);
packets_ = &tnl_pkt; packets_ = &tnl_pkt;
dp_packet_batch_reset_cutlen(orig_packets_); dp_packet_batch_reset_cutlen(orig_packets_);
@@ -5728,7 +5729,7 @@ dp_execute_cb(void *aux_, struct dp_packet_batch *packets_,
ofpbuf_init(&actions, 0); ofpbuf_init(&actions, 0);
if (packets_->trunc) { if (packets_->trunc) {
if (!may_steal) { if (!should_steal) {
dp_packet_batch_clone(&usr_pkt, packets_); dp_packet_batch_clone(&usr_pkt, packets_);
packets_ = &usr_pkt; packets_ = &usr_pkt;
clone = true; clone = true;
@@ -5742,7 +5743,7 @@ dp_execute_cb(void *aux_, struct dp_packet_batch *packets_,
DP_PACKET_BATCH_FOR_EACH (i, packet, packets_) { DP_PACKET_BATCH_FOR_EACH (i, packet, packets_) {
flow_extract(packet, &flow); flow_extract(packet, &flow);
dpif_flow_hash(dp->dpif, &flow, sizeof flow, &ufid); dpif_flow_hash(dp->dpif, &flow, sizeof flow, &ufid);
dp_execute_userspace_action(pmd, packet, may_steal, &flow, dp_execute_userspace_action(pmd, packet, should_steal, &flow,
&ufid, &actions, userdata); &ufid, &actions, userdata);
} }
@@ -5761,7 +5762,7 @@ dp_execute_cb(void *aux_, struct dp_packet_batch *packets_,
if (*depth < MAX_RECIRC_DEPTH) { if (*depth < MAX_RECIRC_DEPTH) {
struct dp_packet_batch recirc_pkts; struct dp_packet_batch recirc_pkts;
if (!may_steal) { if (!should_steal) {
dp_packet_batch_clone(&recirc_pkts, packets_); dp_packet_batch_clone(&recirc_pkts, packets_);
packets_ = &recirc_pkts; packets_ = &recirc_pkts;
} }
@@ -5934,18 +5935,18 @@ dp_execute_cb(void *aux_, struct dp_packet_batch *packets_,
OVS_NOT_REACHED(); OVS_NOT_REACHED();
} }
dp_packet_delete_batch(packets_, may_steal); dp_packet_delete_batch(packets_, should_steal);
} }
static void static void
dp_netdev_execute_actions(struct dp_netdev_pmd_thread *pmd, dp_netdev_execute_actions(struct dp_netdev_pmd_thread *pmd,
struct dp_packet_batch *packets, struct dp_packet_batch *packets,
bool may_steal, const struct flow *flow, bool should_steal, const struct flow *flow,
const struct nlattr *actions, size_t actions_len) const struct nlattr *actions, size_t actions_len)
{ {
struct dp_netdev_execute_aux aux = { pmd, flow }; struct dp_netdev_execute_aux aux = { pmd, flow };
odp_execute_actions(&aux, packets, may_steal, actions, odp_execute_actions(&aux, packets, should_steal, actions,
actions_len, dp_execute_cb); actions_len, dp_execute_cb);
} }

View File

@@ -1162,7 +1162,7 @@ struct dpif_execute_helper_aux {
* meaningful. */ * meaningful. */
static void static void
dpif_execute_helper_cb(void *aux_, struct dp_packet_batch *packets_, dpif_execute_helper_cb(void *aux_, struct dp_packet_batch *packets_,
const struct nlattr *action, bool may_steal) const struct nlattr *action, bool should_steal)
{ {
struct dpif_execute_helper_aux *aux = aux_; struct dpif_execute_helper_aux *aux = aux_;
int type = nl_attr_type(action); int type = nl_attr_type(action);
@@ -1234,7 +1234,7 @@ dpif_execute_helper_cb(void *aux_, struct dp_packet_batch *packets_,
|| type == OVS_ACTION_ATTR_TUNNEL_POP || type == OVS_ACTION_ATTR_TUNNEL_POP
|| type == OVS_ACTION_ATTR_USERSPACE)) { || type == OVS_ACTION_ATTR_USERSPACE)) {
dp_packet_reset_cutlen(packet); dp_packet_reset_cutlen(packet);
if (!may_steal) { if (!should_steal) {
packet = clone = dp_packet_clone(packet); packet = clone = dp_packet_clone(packet);
} }
dp_packet_set_size(packet, dp_packet_size(packet) - cutlen); dp_packet_set_size(packet, dp_packet_size(packet) - cutlen);
@@ -1279,7 +1279,7 @@ dpif_execute_helper_cb(void *aux_, struct dp_packet_batch *packets_,
case __OVS_ACTION_ATTR_MAX: case __OVS_ACTION_ATTR_MAX:
OVS_NOT_REACHED(); OVS_NOT_REACHED();
} }
dp_packet_delete_batch(packets_, may_steal); dp_packet_delete_batch(packets_, should_steal);
} }
/* Executes 'execute' by performing most of the actions in userspace and /* Executes 'execute' by performing most of the actions in userspace and

View File

@@ -272,7 +272,7 @@ struct dpdk_qos_ops {
* For all QoS implementations it should always be non-null. * For all QoS implementations it should always be non-null.
*/ */
int (*qos_run)(struct qos_conf *qos_conf, struct rte_mbuf **pkts, int (*qos_run)(struct qos_conf *qos_conf, struct rte_mbuf **pkts,
int pkt_cnt, bool may_steal); int pkt_cnt, bool should_steal);
}; };
/* dpdk_qos_ops for each type of user space QoS implementation */ /* dpdk_qos_ops for each type of user space QoS implementation */
@@ -1803,7 +1803,7 @@ netdev_dpdk_policer_pkt_handle(struct rte_meter_srtcm *meter,
static int static int
netdev_dpdk_policer_run(struct rte_meter_srtcm *meter, netdev_dpdk_policer_run(struct rte_meter_srtcm *meter,
struct rte_mbuf **pkts, int pkt_cnt, struct rte_mbuf **pkts, int pkt_cnt,
bool may_steal) bool should_steal)
{ {
int i = 0; int i = 0;
int cnt = 0; int cnt = 0;
@@ -1819,7 +1819,7 @@ netdev_dpdk_policer_run(struct rte_meter_srtcm *meter,
} }
cnt++; cnt++;
} else { } else {
if (may_steal) { if (should_steal) {
rte_pktmbuf_free(pkt); rte_pktmbuf_free(pkt);
} }
} }
@@ -1830,13 +1830,13 @@ netdev_dpdk_policer_run(struct rte_meter_srtcm *meter,
static int static int
ingress_policer_run(struct ingress_policer *policer, struct rte_mbuf **pkts, ingress_policer_run(struct ingress_policer *policer, struct rte_mbuf **pkts,
int pkt_cnt, bool may_steal) int pkt_cnt, bool should_steal)
{ {
int cnt = 0; int cnt = 0;
rte_spinlock_lock(&policer->policer_lock); rte_spinlock_lock(&policer->policer_lock);
cnt = netdev_dpdk_policer_run(&policer->in_policer, pkts, cnt = netdev_dpdk_policer_run(&policer->in_policer, pkts,
pkt_cnt, may_steal); pkt_cnt, should_steal);
rte_spinlock_unlock(&policer->policer_lock); rte_spinlock_unlock(&policer->policer_lock);
return cnt; return cnt;
@@ -2016,13 +2016,13 @@ netdev_dpdk_rxq_recv(struct netdev_rxq *rxq, struct dp_packet_batch *batch,
static inline int static inline int
netdev_dpdk_qos_run(struct netdev_dpdk *dev, struct rte_mbuf **pkts, netdev_dpdk_qos_run(struct netdev_dpdk *dev, struct rte_mbuf **pkts,
int cnt, bool may_steal) int cnt, bool should_steal)
{ {
struct qos_conf *qos_conf = ovsrcu_get(struct qos_conf *, &dev->qos_conf); struct qos_conf *qos_conf = ovsrcu_get(struct qos_conf *, &dev->qos_conf);
if (qos_conf) { if (qos_conf) {
rte_spinlock_lock(&qos_conf->lock); rte_spinlock_lock(&qos_conf->lock);
cnt = qos_conf->ops->qos_run(qos_conf, pkts, cnt, may_steal); cnt = qos_conf->ops->qos_run(qos_conf, pkts, cnt, should_steal);
rte_spinlock_unlock(&qos_conf->lock); rte_spinlock_unlock(&qos_conf->lock);
} }
@@ -3655,14 +3655,14 @@ egress_policer_qos_is_equal(const struct qos_conf *conf,
static int static int
egress_policer_run(struct qos_conf *conf, struct rte_mbuf **pkts, int pkt_cnt, egress_policer_run(struct qos_conf *conf, struct rte_mbuf **pkts, int pkt_cnt,
bool may_steal) bool should_steal)
{ {
int cnt = 0; int cnt = 0;
struct egress_policer *policer = struct egress_policer *policer =
CONTAINER_OF(conf, struct egress_policer, qos_conf); CONTAINER_OF(conf, struct egress_policer, qos_conf);
cnt = netdev_dpdk_policer_run(&policer->egress_meter, pkts, cnt = netdev_dpdk_policer_run(&policer->egress_meter, pkts,
pkt_cnt, may_steal); pkt_cnt, should_steal);
return cnt; return cnt;
} }

View File

@@ -713,9 +713,9 @@ odp_execute_actions(void *dp, struct dp_packet_batch *batch, bool steal,
if (dp_execute_action) { if (dp_execute_action) {
/* Allow 'dp_execute_action' to steal the packet data if we do /* Allow 'dp_execute_action' to steal the packet data if we do
* not need it any more. */ * not need it any more. */
bool may_steal = steal && last_action; bool should_steal = steal && last_action;
dp_execute_action(dp, batch, a, may_steal); dp_execute_action(dp, batch, a, should_steal);
if (last_action || batch->count == 0) { if (last_action || batch->count == 0) {
/* We do not need to free the packets. /* We do not need to free the packets.

View File

@@ -29,7 +29,7 @@ struct pkt_metadata;
struct dp_packet_batch; struct dp_packet_batch;
typedef void (*odp_execute_cb)(void *dp, struct dp_packet_batch *batch, typedef void (*odp_execute_cb)(void *dp, struct dp_packet_batch *batch,
const struct nlattr *action, bool may_steal); const struct nlattr *action, bool should_steal);
/* Actions that need to be executed in the context of a datapath are handed /* Actions that need to be executed in the context of a datapath are handed
* to 'dp_execute_action', if non-NULL. Currently this is called only for * to 'dp_execute_action', if non-NULL. Currently this is called only for