Update indirect action */
| 1920 | |
| 1921 | /** Update indirect action */ |
| 1922 | int |
| 1923 | port_action_handle_update(portid_t port_id, uint32_t id, |
| 1924 | const struct rte_flow_action *action) |
| 1925 | { |
| 1926 | struct rte_flow_error error; |
| 1927 | struct rte_flow_action_handle *action_handle; |
| 1928 | struct port_indirect_action *pia; |
| 1929 | struct rte_flow_update_meter_mark mtr_update; |
| 1930 | const void *update; |
| 1931 | |
| 1932 | action_handle = port_action_handle_get_by_id(port_id, id); |
| 1933 | if (!action_handle) |
| 1934 | return -EINVAL; |
| 1935 | pia = action_get_by_id(port_id, id); |
| 1936 | if (!pia) |
| 1937 | return -EINVAL; |
| 1938 | switch (pia->type) { |
| 1939 | case RTE_FLOW_ACTION_TYPE_AGE: |
| 1940 | case RTE_FLOW_ACTION_TYPE_CONNTRACK: |
| 1941 | update = action->conf; |
| 1942 | break; |
| 1943 | case RTE_FLOW_ACTION_TYPE_METER_MARK: |
| 1944 | memcpy(&mtr_update.meter_mark, action->conf, |
| 1945 | sizeof(struct rte_flow_action_meter_mark)); |
| 1946 | if (mtr_update.meter_mark.profile) |
| 1947 | mtr_update.profile_valid = 1; |
| 1948 | if (mtr_update.meter_mark.policy) |
| 1949 | mtr_update.policy_valid = 1; |
| 1950 | mtr_update.color_mode_valid = 1; |
| 1951 | mtr_update.state_valid = 1; |
| 1952 | update = &mtr_update; |
| 1953 | break; |
| 1954 | default: |
| 1955 | update = action; |
| 1956 | break; |
| 1957 | } |
| 1958 | if (rte_flow_action_handle_update(port_id, action_handle, update, |
| 1959 | &error)) { |
| 1960 | return port_flow_complain(&error); |
| 1961 | } |
| 1962 | printf("Indirect action #%u updated\n", id); |
| 1963 | return 0; |
| 1964 | } |
| 1965 | |
| 1966 | static void |
| 1967 | port_action_handle_query_dump(portid_t port_id, |
no test coverage detected