From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ferruh Yigit Subject: Re: [PATCH v5 4/4] net/mlx5: support e-switch flow count action Date: Mon, 22 Oct 2018 10:14:58 +0100 Message-ID: <70ed889a-4556-2441-4869-959c819316e5@intel.com> References: <1539797092-2395-4-git-send-email-motih@mellanox.com> <1539887363-27858-5-git-send-email-motih@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org To: Moti Haimovsky , shahafs@mellanox.com Return-path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 96CF14CA7 for ; Mon, 22 Oct 2018 11:15:00 +0200 (CEST) In-Reply-To: <1539887363-27858-5-git-send-email-motih@mellanox.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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);