From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH v4 2/2] ethdev: add traffic management API Date: Fri, 19 May 2017 10:34:27 -0700 Message-ID: <20170519103427.4b083a11@xeon-e3> References: <1488589820-206947-2-git-send-email-cristian.dumitrescu@intel.com> <1495213972-109148-1-git-send-email-cristian.dumitrescu@intel.com> <1495213972-109148-3-git-send-email-cristian.dumitrescu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org, thomas.monjalon@6wind.com, jerin.jacob@caviumnetworks.com, balasubramanian.manoharan@cavium.com, hemant.agrawal@nxp.com, shreyansh.jain@nxp.com To: Cristian Dumitrescu Return-path: Received: from mail-pg0-f45.google.com (mail-pg0-f45.google.com [74.125.83.45]) by dpdk.org (Postfix) with ESMTP id 9CD792901 for ; Fri, 19 May 2017 19:34:35 +0200 (CEST) Received: by mail-pg0-f45.google.com with SMTP id u187so41150841pgb.0 for ; Fri, 19 May 2017 10:34:35 -0700 (PDT) In-Reply-To: <1495213972-109148-3-git-send-email-cristian.dumitrescu@intel.com> 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 Fri, 19 May 2017 18:12:52 +0100 Cristian Dumitrescu wrote: > + > +#define RTE_TM_FUNC(port_id, func) \ > +({ \ > + const struct rte_tm_ops *ops = \ > + rte_tm_ops_get(port_id, error); \ > + if (ops == NULL) \ > + return -rte_errno; \ > + \ > + if (ops->func == NULL) \ > + return -rte_tm_error_set(error, \ > + ENOSYS, \ > + RTE_TM_ERROR_TYPE_UNSPECIFIED, \ > + NULL, \ > + rte_strerror(ENOSYS)); \ > + \ > + ops->func; \ > +}) If you are going to use a templating macro why not go all the way and generate the whole function. Examples are in Linux kernel macros are often used to generate show and set functions.