[ovs-dev] [patch v1] odp-execute: Rename 'may_steal' to 'must_steal'.

Darrell Ball dlu998 at gmail.com
Thu May 17 02:09:50 UTC 2018


Maybe 'should_steal' is better semantics than 'must_steal'


On Wed, May 16, 2018 at 6:55 PM, Darrell Ball <dlu998 at gmail.com> wrote:

> Signed-off-by: Darrell Ball <dlu998 at gmail.com>
> ---
>  lib/dp-packet.h   |  4 ++--
>  lib/dpif-netdev.c | 26 +++++++++++++-------------
>  lib/dpif.c        |  6 +++---
>  lib/netdev-dpdk.c | 18 +++++++++---------
>  lib/odp-execute.c |  4 ++--
>  lib/odp-execute.h |  2 +-
>  6 files changed, 30 insertions(+), 30 deletions(-)
>
> diff --git a/lib/dp-packet.h b/lib/dp-packet.h
> index 21c8ca5..6d47f4f 100644
> --- a/lib/dp-packet.h
> +++ b/lib/dp-packet.h
> @@ -792,9 +792,9 @@ dp_packet_batch_clone(struct dp_packet_batch *dst,
>  }
>
>  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 must_steal)
>  {
> -    if (may_steal) {
> +    if (must_steal) {
>          struct dp_packet *packet;
>
>          DP_PACKET_BATCH_FOR_EACH (i, packet, batch) {
> diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
> index f86ed2a..d1e87ee 100644
> --- a/lib/dpif-netdev.c
> +++ b/lib/dpif-netdev.c
> @@ -647,7 +647,7 @@ static int dpif_netdev_open(const struct dpif_class *,
> const char *name,
>                              bool create, struct dpif **);
>  static void dp_netdev_execute_actions(struct dp_netdev_pmd_thread *pmd,
>                                        struct dp_packet_batch *,
> -                                      bool may_steal, const struct flow
> *flow,
> +                                      bool must_steal, const struct flow
> *flow,
>                                        const struct nlattr *actions,
>                                        size_t actions_len);
>  static void dp_netdev_input(struct dp_netdev_pmd_thread *,
> @@ -5594,7 +5594,7 @@ error:
>
>  static void
>  dp_execute_userspace_action(struct dp_netdev_pmd_thread *pmd,
> -                            struct dp_packet *packet, bool may_steal,
> +                            struct dp_packet *packet, bool must_steal,
>                              struct flow *flow, ovs_u128 *ufid,
>                              struct ofpbuf *actions,
>                              const struct nlattr *userdata)
> @@ -5609,16 +5609,16 @@ dp_execute_userspace_action(struct
> dp_netdev_pmd_thread *pmd,
>                               NULL);
>      if (!error || error == ENOSPC) {
>          dp_packet_batch_init_packet(&b, packet);
> -        dp_netdev_execute_actions(pmd, &b, may_steal, flow,
> +        dp_netdev_execute_actions(pmd, &b, must_steal, flow,
>                                    actions->data, actions->size);
> -    } else if (may_steal) {
> +    } else if (must_steal) {
>          dp_packet_delete(packet);
>      }
>  }
>
>  static void
>  dp_execute_cb(void *aux_, struct dp_packet_batch *packets_,
> -              const struct nlattr *a, bool may_steal)
> +              const struct nlattr *a, bool must_steal)
>      OVS_NO_THREAD_SAFETY_ANALYSIS
>  {
>      struct dp_netdev_execute_aux *aux = aux_;
> @@ -5635,7 +5635,7 @@ dp_execute_cb(void *aux_, struct dp_packet_batch
> *packets_,
>              struct dp_packet *packet;
>              struct dp_packet_batch out;
>
> -            if (!may_steal) {
> +            if (!must_steal) {
>                  dp_packet_batch_clone(&out, packets_);
>                  dp_packet_batch_reset_cutlen(packets_);
>                  packets_ = &out;
> @@ -5688,7 +5688,7 @@ dp_execute_cb(void *aux_, struct dp_packet_batch
> *packets_,
>              if (p) {
>                  struct dp_packet_batch tnl_pkt;
>
> -                if (!may_steal) {
> +                if (!must_steal) {
>                      dp_packet_batch_clone(&tnl_pkt, packets_);
>                      packets_ = &tnl_pkt;
>                      dp_packet_batch_reset_cutlen(orig_packets_);
> @@ -5728,7 +5728,7 @@ dp_execute_cb(void *aux_, struct dp_packet_batch
> *packets_,
>              ofpbuf_init(&actions, 0);
>
>              if (packets_->trunc) {
> -                if (!may_steal) {
> +                if (!must_steal) {
>                      dp_packet_batch_clone(&usr_pkt, packets_);
>                      packets_ = &usr_pkt;
>                      clone = true;
> @@ -5742,7 +5742,7 @@ dp_execute_cb(void *aux_, struct dp_packet_batch
> *packets_,
>              DP_PACKET_BATCH_FOR_EACH (i, packet, packets_) {
>                  flow_extract(packet, &flow);
>                  dpif_flow_hash(dp->dpif, &flow, sizeof flow, &ufid);
> -                dp_execute_userspace_action(pmd, packet, may_steal,
> &flow,
> +                dp_execute_userspace_action(pmd, packet, must_steal,
> &flow,
>                                              &ufid, &actions, userdata);
>              }
>
> @@ -5761,7 +5761,7 @@ dp_execute_cb(void *aux_, struct dp_packet_batch
> *packets_,
>          if (*depth < MAX_RECIRC_DEPTH) {
>              struct dp_packet_batch recirc_pkts;
>
> -            if (!may_steal) {
> +            if (!must_steal) {
>                 dp_packet_batch_clone(&recirc_pkts, packets_);
>                 packets_ = &recirc_pkts;
>              }
> @@ -5934,18 +5934,18 @@ dp_execute_cb(void *aux_, struct dp_packet_batch
> *packets_,
>          OVS_NOT_REACHED();
>      }
>
> -    dp_packet_delete_batch(packets_, may_steal);
> +    dp_packet_delete_batch(packets_, must_steal);
>  }
>
>  static void
>  dp_netdev_execute_actions(struct dp_netdev_pmd_thread *pmd,
>                            struct dp_packet_batch *packets,
> -                          bool may_steal, const struct flow *flow,
> +                          bool must_steal, const struct flow *flow,
>                            const struct nlattr *actions, size_t
> actions_len)
>  {
>      struct dp_netdev_execute_aux aux = { pmd, flow };
>
> -    odp_execute_actions(&aux, packets, may_steal, actions,
> +    odp_execute_actions(&aux, packets, must_steal, actions,
>                          actions_len, dp_execute_cb);
>  }
>
> diff --git a/lib/dpif.c b/lib/dpif.c
> index a1be4fd..1f132b6 100644
> --- a/lib/dpif.c
> +++ b/lib/dpif.c
> @@ -1162,7 +1162,7 @@ struct dpif_execute_helper_aux {
>   * meaningful. */
>  static void
>  dpif_execute_helper_cb(void *aux_, struct dp_packet_batch *packets_,
> -                       const struct nlattr *action, bool may_steal)
> +                       const struct nlattr *action, bool must_steal)
>  {
>      struct dpif_execute_helper_aux *aux = aux_;
>      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_USERSPACE)) {
>              dp_packet_reset_cutlen(packet);
> -            if (!may_steal) {
> +            if (!must_steal) {
>                  packet = clone = dp_packet_clone(packet);
>              }
>              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:
>          OVS_NOT_REACHED();
>      }
> -    dp_packet_delete_batch(packets_, may_steal);
> +    dp_packet_delete_batch(packets_, must_steal);
>  }
>
>  /* Executes 'execute' by performing most of the actions in userspace and
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> index 87152a7..c5dd8e5 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -272,7 +272,7 @@ struct dpdk_qos_ops {
>       * For all QoS implementations it should always be non-null.
>       */
>      int (*qos_run)(struct qos_conf *qos_conf, struct rte_mbuf **pkts,
> -                   int pkt_cnt, bool may_steal);
> +                   int pkt_cnt, bool must_steal);
>  };
>
>  /* 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
>  netdev_dpdk_policer_run(struct rte_meter_srtcm *meter,
>                          struct rte_mbuf **pkts, int pkt_cnt,
> -                        bool may_steal)
> +                        bool must_steal)
>  {
>      int i = 0;
>      int cnt = 0;
> @@ -1819,7 +1819,7 @@ netdev_dpdk_policer_run(struct rte_meter_srtcm
> *meter,
>              }
>              cnt++;
>          } else {
> -            if (may_steal) {
> +            if (must_steal) {
>                  rte_pktmbuf_free(pkt);
>              }
>          }
> @@ -1830,13 +1830,13 @@ netdev_dpdk_policer_run(struct rte_meter_srtcm
> *meter,
>
>  static int
>  ingress_policer_run(struct ingress_policer *policer, struct rte_mbuf
> **pkts,
> -                    int pkt_cnt, bool may_steal)
> +                    int pkt_cnt, bool must_steal)
>  {
>      int cnt = 0;
>
>      rte_spinlock_lock(&policer->policer_lock);
>      cnt = netdev_dpdk_policer_run(&policer->in_policer, pkts,
> -                                  pkt_cnt, may_steal);
> +                                  pkt_cnt, must_steal);
>      rte_spinlock_unlock(&policer->policer_lock);
>
>      return cnt;
> @@ -2016,13 +2016,13 @@ netdev_dpdk_rxq_recv(struct netdev_rxq *rxq,
> struct dp_packet_batch *batch,
>
>  static inline int
>  netdev_dpdk_qos_run(struct netdev_dpdk *dev, struct rte_mbuf **pkts,
> -                    int cnt, bool may_steal)
> +                    int cnt, bool must_steal)
>  {
>      struct qos_conf *qos_conf = ovsrcu_get(struct qos_conf *,
> &dev->qos_conf);
>
>      if (qos_conf) {
>          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, must_steal);
>          rte_spinlock_unlock(&qos_conf->lock);
>      }
>
> @@ -3655,14 +3655,14 @@ egress_policer_qos_is_equal(const struct qos_conf
> *conf,
>
>  static int
>  egress_policer_run(struct qos_conf *conf, struct rte_mbuf **pkts, int
> pkt_cnt,
> -                   bool may_steal)
> +                   bool must_steal)
>  {
>      int cnt = 0;
>      struct egress_policer *policer =
>          CONTAINER_OF(conf, struct egress_policer, qos_conf);
>
>      cnt = netdev_dpdk_policer_run(&policer->egress_meter, pkts,
> -                                  pkt_cnt, may_steal);
> +                                  pkt_cnt, must_steal);
>
>      return cnt;
>  }
> diff --git a/lib/odp-execute.c b/lib/odp-execute.c
> index 82701f9..3b3eba2 100644
> --- a/lib/odp-execute.c
> +++ b/lib/odp-execute.c
> @@ -713,9 +713,9 @@ odp_execute_actions(void *dp, struct dp_packet_batch
> *batch, bool steal,
>              if (dp_execute_action) {
>                  /* Allow 'dp_execute_action' to steal the packet data if
> we do
>                   * not need it any more. */
> -                bool may_steal = steal && last_action;
> +                bool must_steal = steal && last_action;
>
> -                dp_execute_action(dp, batch, a, may_steal);
> +                dp_execute_action(dp, batch, a, must_steal);
>
>                  if (last_action || batch->count == 0) {
>                      /* We do not need to free the packets.
> diff --git a/lib/odp-execute.h b/lib/odp-execute.h
> index 7223fe8..4b959e8 100644
> --- a/lib/odp-execute.h
> +++ b/lib/odp-execute.h
> @@ -29,7 +29,7 @@ struct pkt_metadata;
>  struct dp_packet_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
> must_steal);
>
>  /* 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
> --
> 1.9.1
>
>


More information about the dev mailing list