On 10/18/2018 7:29 PM, Moti Haimovsky wrote: > +/** > + * Parse flower action section in the message retrieving the requested > + * attribute from the first action that provides it. > + * > + * @param opt > + * flower section in the Netlink message received. > + * @param rta_type > + * The backward sequence of rta_types, as written in the attribute table, > + * we need to traverse in order to get to the requested object. > + * @param idx > + * Current location in rta_type table. > + * @param[out] data > + * data retrieved from the message query. > + * > + * @return > + * 0 if data was found and retrieved, -1 otherwise. > + */ > +static int > +flow_tcf_nl_action_parse_and_get(const struct rtattr *arg, > + uint16_t rta_type[], int idx, void *data) > +{ > + struct rtattr *tb[TCA_ACT_MAX_PRIO + 1]; > + int i; > + > + if (arg == NULL || idx < 0) > + return -1; > + flow_tcf_nl_parse_rtattr(tb, TCA_ACT_MAX_PRIO, > + RTA_DATA(arg), RTA_PAYLOAD(arg)); > + switch (rta_type[idx]) { > + /* > + * flow counters are stored in the actions defined by the flow > + * and not in the flow itself, therefore we need to traverse the > + * flower chain of actions in search for them. > + * > + * Note that the index is not decremented here. > + */ > + case TCA_ACT_STATS: > + for (i = 0; i <= TCA_ACT_MAX_PRIO; i++) { > + if (tb[i] && > + !flow_tcf_nl_parse_one_action_and_get(tb[i], > + rta_type, > + idx, data)) > + return 0; > + } > + break; > + default: > + break; > + } > + return -1; > +}
Getting following build error with clang, will not pull from mlx tree until issue resolved, thanks. .../drivers/net/mlx5/mlx5_flow_tcf.c:2507:6: warning: cast from 'const struct rtattr *' to 'char *' drops const qualifier [-Wcast-qual] RTA_DATA(arg), RTA_PAYLOAD(arg)); ^ /usr/include/linux/rtnetlink.h:183:42: note: expanded from macro 'RTA_DATA' #define RTA_DATA(rta) ((void*)(((char*)(rta)) + RTA_LENGTH(0))) ^ .../drivers/net/mlx5/mlx5_flow_tcf.c:2593:31: warning: cast from 'const struct nlmsghdr *' to 'char *' drops const qualifier [-Wcast-qual] struct tcmsg *t = NLMSG_DATA(nlh);