From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb0-f171.google.com (mail-yb0-f171.google.com [209.85.213.171]) by dpdk.org (Postfix) with ESMTP id 3F48D2BD0 for ; Thu, 10 Nov 2016 05:09:05 +0100 (CET) Received: by mail-yb0-f171.google.com with SMTP id d128so84615562ybh.2 for ; Wed, 09 Nov 2016 20:09:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=byO0H3c+WajPt0m1zs14UNdo9UWddaWhCZLy/U4ylfo=; b=JkOxFLZf4o9XaX3OkxIFaqBUXNYsHfkxNmBFm/o/JaBNWrBSy6I6J4hGd05GojQ+dI DTY4255YYSK1iHODD6YnaqX592ExWh81UlzQ4GcwKEs3P9I5VUeLEjejhC69hGJtrU0N Sl3e4ZSdHQ1Sy/vFDKtDGuxcVqCPoQ7heM7PE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=byO0H3c+WajPt0m1zs14UNdo9UWddaWhCZLy/U4ylfo=; b=EWputtX6lbZi14dIladidQZMIQv8xZIfgYq719DXXHsKnnmAOX/wyoKTfGZmM2Js1d ZqK0mct0o385o+lAVy8WwBCLQM0WnPRoTcmoWNE+umjb4A2+5EkzvycaJ7TSZoR6bTnN LcDznFBOy9gwuP4YzMXYwtfmiBpie42nCJN52kCEtWmSiNO7K+qQFw6UJNRGOARvslqC k9pg/VO6t74VmCvJA6hsoWb6vaWqAARSt44d9imhI/4CVQ3kMR1oTWBXV8Cp2yiBxKGU G3SX0JdVzDFS7Q88dkIK9CAuZdn0wYsbtvbmuH0O4lHDnxi7igIIXI+Rw0iaqfQcQmTi lAUQ== X-Gm-Message-State: ABUngveiuRCKRQ47ZCcXZkcmc5fuIyt+KuqRKnfglXKsZ3v1Hue4FKIIpYwDpq1iu1RD7BFuxVUbKXGdzD+8IzcG X-Received: by 10.37.163.33 with SMTP id d30mr3080012ybi.54.1478750944357; Wed, 09 Nov 2016 20:09:04 -0800 (PST) MIME-Version: 1.0 Received: by 10.37.171.48 with HTTP; Wed, 9 Nov 2016 20:09:03 -0800 (PST) In-Reply-To: <1477657598-826-7-git-send-email-shreyansh.jain@nxp.com> References: <1477581467-12588-1-git-send-email-shreyansh.jain@nxp.com> <1477657598-826-1-git-send-email-shreyansh.jain@nxp.com> <1477657598-826-7-git-send-email-shreyansh.jain@nxp.com> From: Jianbo Liu Date: Thu, 10 Nov 2016 12:09:03 +0800 Message-ID: To: Shreyansh Jain Cc: dev@dpdk.org, Thomas Monjalon , Jan Viktorin Content-Type: text/plain; charset=UTF-8 Subject: Re: [dpdk-dev] [PATCH v7 06/21] eal/soc: introduce very essential SoC infra definitions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2016 04:09:05 -0000 On 28 October 2016 at 20:26, Shreyansh Jain wrote: > From: Jan Viktorin > > Define initial structures and functions for the SoC infrastructure. > This patch supports only a very minimal functions for now. > More features will be added in the following commits. > > Includes rte_device/rte_driver inheritance of > rte_soc_device/rte_soc_driver. > > Signed-off-by: Jan Viktorin > Signed-off-by: Shreyansh Jain > Signed-off-by: Hemant Agrawal > --- > app/test/Makefile | 1 + > app/test/test_soc.c | 90 +++++++++++++++++++++ > lib/librte_eal/common/Makefile | 2 +- > lib/librte_eal/common/eal_private.h | 4 + > lib/librte_eal/common/include/rte_soc.h | 138 ++++++++++++++++++++++++++++++++ > 5 files changed, 234 insertions(+), 1 deletion(-) > create mode 100644 app/test/test_soc.c > create mode 100644 lib/librte_eal/common/include/rte_soc.h > ... > +/** > + * Utility function to write a SoC device name, this device name can later be > + * used to retrieve the corresponding rte_soc_addr using above functions. > + * > + * @param addr > + * The SoC address > + * @param output > + * The output buffer string > + * @param size > + * The output buffer size > + * @return > + * 0 on success, negative on error. > + */ > +static inline void > +rte_eal_soc_device_name(const struct rte_soc_addr *addr, > + char *output, size_t size) > +{ > + int ret; > + > + RTE_VERIFY(addr != NULL); > + RTE_VERIFY(size >= strlen(addr->name)); Is it better to use (size > strlen(addr->name)? > + ret = snprintf(output, size, "%s", addr->name); > + RTE_VERIFY(ret >= 0); > +} > + > +static inline int > +rte_eal_compare_soc_addr(const struct rte_soc_addr *a0, > + const struct rte_soc_addr *a1) > +{ > + if (a0 == NULL || a1 == NULL) > + return -1; > + > + RTE_VERIFY(a0->name != NULL); > + RTE_VERIFY(a1->name != NULL); > + > + return strcmp(a0->name, a1->name); > +} > + > +#endif > -- > 2.7.4 >