mlx5dv_create_flow(3)

okay bestie, this is mlx5dv_create_flow(3) straight out of the mlx5 Programmerโ€™s Manual โ€” and yes, the manual name is folded in right here near the top, no copied header line, weโ€™re doing this ๐Ÿ’…โœจ

โœจ NAME โœจ

mlx5dv_create_flow โ€” creates a steering flow rule ๐ŸŽ€

๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

              #include <infiniband/mlx5dv.h>

              struct ibv_flow *
              mlx5dv_create_flow(struct mlx5dv_flow_matcher *flow_matcher,
                         struct mlx5dv_flow_match_parameters *match_value,
                         size_t num_actions,
                         struct mlx5dv_flow_action_attr actions_attr[])

๐Ÿ’– DESCRIPTION ๐Ÿ’–

mlx5dv_create_flow() creates a steering flow rule with the ability to specify specific driver properties. itโ€™s giving โ€œmake me a flow rule, but make it driver-property-specificโ€ fr fr ๐Ÿ‘‘

๐Ÿงš ARGUMENTS ๐Ÿงš

bestie, for flow_matcher and match_value, please see mlx5dv_create_flow_matcher(3) โ€” theyโ€™re literally the whole setup vibe ๐ŸŒธ

  • num_actions โ€” specifies how many actions are passed in actions_attr ๐Ÿ”ข

๐Ÿซถ actions_attr ๐Ÿซถ

              struct mlx5dv_flow_action_attr {
                  enum mlx5dv_flow_action_type type;
                  union {
                      struct ibv_qp *qp;
                      struct ibv_counters *counter;
                      struct ibv_flow_action *action;
                      uint32_t tag_value;
                      struct mlx5dv_devx_obj *obj;
                      struct {
                          struct mlx5dv_devx_obj *obj;
                          uint32_t offset;
                      } bulk_obj;
                  };
              };

type is the main-character field here; it tells the flow rule what kind of action itโ€™s getting. the values are:

  • MLX5DV_FLOW_ACTION_DEST_IBV_QP โ€” the QP passed will receive the matched packets ๐Ÿ’Œ
  • MLX5DV_FLOW_ACTION_IBV_FLOW_ACTION โ€” the flow action to be applied โœจ
  • MLX5DV_FLOW_ACTION_TAG โ€” flow tag to be provided in work completion ๐Ÿท๏ธ
  • MLX5DV_FLOW_ACTION_DEST_DEVX โ€” the DEVX destination object for the matched packets ๐ŸŽฏ
  • MLX5DV_FLOW_ACTION_COUNTERS_DEVX โ€” the DEVX counter object for the matched packets ๐Ÿงฎ
  • MLX5DV_FLOW_ACTION_DEFAULT_MISS โ€” steer the packet to the default miss destination ๐Ÿซฅ
  • MLX5DV_FLOW_ACTION_DROP โ€” action is dropping the matched packet ๐Ÿ’€
  • MLX5DV_FLOW_ACTION_COUNTERS_DEVX_WITH_OFFSET โ€” the DEVX bulk counter object and its counter offset for the matched packets ๐Ÿ“

and now the field lowdown:

  • qp โ€” QP passed, to be used with type MLX5DV_FLOW_ACTION_DEST_IBV_QP ๐Ÿ‡
  • action โ€” flow action, to be used with type MLX5DV_FLOW_ACTION_IBV_FLOW_ACTION; see mlx5dv_create_flow_action_modify_header(3) and mlx5dv_create_flow_action_packet_reformat(3) ๐ŸŽ€
  • tag_value โ€” tag value to be passed in the work completion, to be used with type MLX5DV_FLOW_ACTION_TAG; see ibv_create_cq_ex(3) ๐Ÿท๏ธ
  • obj โ€” DEVX object, to be used with type MLX5DV_FLOW_ACTION_DEST_DEVX or by MLX5DV_FLOW_ACTION_COUNTERS_DEVX or by MLX5DV_FLOW_ACTION_COUNTERS_DEVX_WITH_OFFSET ๐Ÿงš
  • offset โ€” offset to the target counter within a bulk DEVX object, to be used with type MLX5DV_FLOW_ACTION_COUNTERS_DEVX_WITH_OFFSET ๐ŸŽฏ

๐ŸŒˆ RETURN VALUE ๐ŸŒˆ

mlx5dv_create_flow returns a pointer to the created flow rule. on error, NULL will be returned and errno will be set. no cap, thatโ€™s the whole return-value tea ๐Ÿ˜ญ

๐Ÿ‘‘ SEE ALSO ๐Ÿ‘‘

๐ŸŒธ AUTHOR ๐ŸŒธ

Mark Bloch <marb@mellanox.com> ๐Ÿ’–


and thatโ€™s the page, bestie โ€” cute little footer sign-off: source/version mlx5, date 2018-9-19, page title mlx5dv_create_flow(3). slay, go build that flow rule ๐Ÿซถโœจ

๐Ÿ“ฆ where this page comes from