From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 01E2AA0561; Thu, 18 Mar 2021 18:37:38 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4ECDC140EBA; Thu, 18 Mar 2021 18:37:20 +0100 (CET) Received: from mail-qt1-f169.google.com (mail-qt1-f169.google.com [209.85.160.169]) by mails.dpdk.org (Postfix) with ESMTP id 73EFB4067C for ; Thu, 18 Mar 2021 18:37:16 +0100 (CET) Received: by mail-qt1-f169.google.com with SMTP id h7so4688066qtx.3 for ; Thu, 18 Mar 2021 10:37:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=atomicrules-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dayMpC2YjgNFyj6dzVvg0LneldprgXyyZBXTTJ545Us=; b=rfhl++F4lT286ruIBfiDbadjrIg8KeOIWo2WZtdQ3kUjep0edfm30THMjnh6mK4w9f rKi0/6iZplaUuPmEpeAYRT1rWo9dJXD2hSDiws2/YkTwBcZ1TfDXuqtqDJkhnuF3/kU+ B6RriiJUf0bsssGxDuKslb4BEyB/YJ+F1uhaL+wb/hl7l/pohWN9PBw3/rOKFP/hYwAE +YhKWku18bo5QigxgQHS7E+7SGyQrndfZ3qyM6Rl69/TG49N6pIB3oiPnReij2rT1bMU iHVKKLMckENpvJ0pAsCQQh+iUOOW465AeiY4bbGE8OONWZf22cuu0P0lo4nYBDlHkrtX 4ekA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dayMpC2YjgNFyj6dzVvg0LneldprgXyyZBXTTJ545Us=; b=kRqtKjXJ+Hear9YtjFTK/Rea6kcQjH1egzd3K9F+5sbATWVIS6rXec84DfWUPvP6zr 1N8BREoWQxQCWlQM4Cjkb+yxrqziR8E6hgeVjVsd8NLNwmqO9/W1/6/6wKhqzQvl0Jeq wA+qd62d3/4/7kWIgoxmPlVzJ4HYzlHITo+U2Bpv0RjLklim73LgDE1gqauQcZmVSGkW I57Z7QD2r87nkEUqdhwPPjg+87YhsBhSYELWCOtQPnYj+FuwP2yeew46P6QM4HHNvRQh Fxqtg8CSYR6a3FZqAEklZHQG/3es3CmU4nygWaR4oF3soENk364i3op0eVgj0EUr6qhv wukw== X-Gm-Message-State: AOAM533RWChnk4xMJA4oZUswZERfQnBVCWGmxpd6SlvkiIAAuhHFBbkH aIiBii12av2ouNjdDwFWWxYyOR+h2S8SlA== X-Google-Smtp-Source: ABdhPJzuwF8lC2nmfy4RgeV953LuqdBsTTCSLElOD+oFssWV7INCv0vN68GVcwhRW0SVsN28guC4Jw== X-Received: by 2002:ac8:4681:: with SMTP id g1mr4973647qto.190.1616089035424; Thu, 18 Mar 2021 10:37:15 -0700 (PDT) Received: from z390.czeck.local (pool-72-74-133-40.bstnma.fios.verizon.net. [72.74.133.40]) by smtp.gmail.com with ESMTPSA id j1sm1931741qti.55.2021.03.18.10.37.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Mar 2021 10:37:14 -0700 (PDT) From: Ed Czeck To: dev@dpdk.org, ferruh.yigit@intel.com, bruce.richardson@intel.com Cc: shepard.siegel@atomicrules.com, john.miller@atomicrules.com Date: Thu, 18 Mar 2021 13:36:58 -0400 Message-Id: <20210318173700.15102-4-ed.czeck@atomicrules.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210318173700.15102-1-ed.czeck@atomicrules.com> References: <20210304165637.24658-1-ed.czeck@atomicrules.com> <20210318173700.15102-1-ed.czeck@atomicrules.com> Subject: [dpdk-dev] [PATCH v5 4/6] net/ark: cleanup ark dynamic extension interface X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" - Rename extension functions with rte_pmd_ark prefix - Update local function documentation Signed-off-by: Ed Czeck --- v3: - split function rename from previous commit v4: - reorder patches renaming before adding v5: - Keep the extension function changes in ark_ext.h --- drivers/net/ark/ark_ethdev.c | 32 ++-- drivers/net/ark/ark_ext.h | 304 ++++++++++++++++++++++++++--------- 2 files changed, 247 insertions(+), 89 deletions(-) diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c index 95546a891..5282534d3 100644 --- a/drivers/net/ark/ark_ethdev.c +++ b/drivers/net/ark/ark_ethdev.c @@ -193,58 +193,58 @@ check_for_ext(struct ark_adapter *ark) /* Get the entry points */ ark->user_ext.dev_init = (void *(*)(struct rte_eth_dev *, void *, int)) - dlsym(ark->d_handle, "dev_init"); + dlsym(ark->d_handle, "rte_pmd_ark_dev_init"); ARK_PMD_LOG(DEBUG, "device ext init pointer = %p\n", ark->user_ext.dev_init); ark->user_ext.dev_get_port_count = (int (*)(struct rte_eth_dev *, void *)) - dlsym(ark->d_handle, "dev_get_port_count"); + dlsym(ark->d_handle, "rte_pmd_ark_dev_get_port_count"); ark->user_ext.dev_uninit = (void (*)(struct rte_eth_dev *, void *)) - dlsym(ark->d_handle, "dev_uninit"); + dlsym(ark->d_handle, "rte_pmd_ark_dev_uninit"); ark->user_ext.dev_configure = (int (*)(struct rte_eth_dev *, void *)) - dlsym(ark->d_handle, "dev_configure"); + dlsym(ark->d_handle, "rte_pmd_ark_dev_configure"); ark->user_ext.dev_start = (int (*)(struct rte_eth_dev *, void *)) - dlsym(ark->d_handle, "dev_start"); + dlsym(ark->d_handle, "rte_pmd_ark_dev_start"); ark->user_ext.dev_stop = (void (*)(struct rte_eth_dev *, void *)) - dlsym(ark->d_handle, "dev_stop"); + dlsym(ark->d_handle, "rte_pmd_ark_dev_stop"); ark->user_ext.dev_close = (void (*)(struct rte_eth_dev *, void *)) - dlsym(ark->d_handle, "dev_close"); + dlsym(ark->d_handle, "rte_pmd_ark_dev_close"); ark->user_ext.link_update = (int (*)(struct rte_eth_dev *, int, void *)) - dlsym(ark->d_handle, "link_update"); + dlsym(ark->d_handle, "rte_pmd_ark_link_update"); ark->user_ext.dev_set_link_up = (int (*)(struct rte_eth_dev *, void *)) - dlsym(ark->d_handle, "dev_set_link_up"); + dlsym(ark->d_handle, "rte_pmd_ark_dev_set_link_up"); ark->user_ext.dev_set_link_down = (int (*)(struct rte_eth_dev *, void *)) - dlsym(ark->d_handle, "dev_set_link_down"); + dlsym(ark->d_handle, "rte_pmd_ark_dev_set_link_down"); ark->user_ext.stats_get = (int (*)(struct rte_eth_dev *, struct rte_eth_stats *, void *)) - dlsym(ark->d_handle, "stats_get"); + dlsym(ark->d_handle, "rte_pmd_ark_stats_get"); ark->user_ext.stats_reset = (void (*)(struct rte_eth_dev *, void *)) - dlsym(ark->d_handle, "stats_reset"); + dlsym(ark->d_handle, "rte_pmd_ark_stats_reset"); ark->user_ext.mac_addr_add = (void (*)(struct rte_eth_dev *, struct rte_ether_addr *, uint32_t, uint32_t, void *)) - dlsym(ark->d_handle, "mac_addr_add"); + dlsym(ark->d_handle, "rte_pmd_ark_mac_addr_add"); ark->user_ext.mac_addr_remove = (void (*)(struct rte_eth_dev *, uint32_t, void *)) - dlsym(ark->d_handle, "mac_addr_remove"); + dlsym(ark->d_handle, "rte_pmd_ark_mac_addr_remove"); ark->user_ext.mac_addr_set = (void (*)(struct rte_eth_dev *, struct rte_ether_addr *, void *)) - dlsym(ark->d_handle, "mac_addr_set"); + dlsym(ark->d_handle, "rte_pmd_ark_mac_addr_set"); ark->user_ext.set_mtu = (int (*)(struct rte_eth_dev *, uint16_t, void *)) - dlsym(ark->d_handle, "set_mtu"); + dlsym(ark->d_handle, "rte_pmd_ark_set_mtu"); return found; } diff --git a/drivers/net/ark/ark_ext.h b/drivers/net/ark/ark_ext.h index 821fb55bb..9c7d55a14 100644 --- a/drivers/net/ark/ark_ext.h +++ b/drivers/net/ark/ark_ext.h @@ -7,84 +7,242 @@ #include -/* - * This is the template file for users who which to define a dynamic - * extension to the Arkville PMD. User's who create an extension - * should include this file and define the necessary and desired - * functions. - * Only 1 function is required for an extension, dev_init(); all other - * functions prototyped in this file are optional. +/* The following section lists function prototypes for Arkville's + * dynamic PMD extension. User's who create an extension + * must include this file and define the necessary and desired + * functions. Only 1 function is required for an extension, + * rte_pmd_ark_dev_init(); all other functions prototypes in this + * section are optional. + * See documentation for compiling and use of extensions. */ -/* - * Called post PMD init. - * The implementation returns its private data that gets passed into - * all other functions as user_data - * The ARK extension implementation MUST implement this function +/** + * Extension prototype, required implementation if extensions are used. + * Called during device probe to initialize the user structure + * passed to other extension functions. This is called once for each + * port of the device. + * + * @param dev + * current device. + * @param a_bar + * access to PCIe device bar (application bar) and hence access to + * user's portion of FPGA. + * @param port_id + * port identifier. + * @return user_data + * which will be passed to other extension functions. */ -void *dev_init(struct rte_eth_dev *dev, void *a_bar, int port_id); - -/* Called during device shutdown */ -void dev_uninit(struct rte_eth_dev *dev, void *user_data); - -/* This call is optional and allows the - * extension to specify the number of supported ports. +void *rte_pmd_ark_dev_init(struct rte_eth_dev *dev, void *a_bar, int port_id); + +/** + * Extension prototype, optional implementation. + * Called during device uninit. + * + * @param dev + * current device. + * @param user_data + * user argument from dev_init() call. */ -uint8_t dev_get_port_count(struct rte_eth_dev *dev, - void *user_data); - -/* - * The following functions are optional and are directly mapped - * from the DPDK PMD ops structure. - * Each function if implemented is called after the ARK PMD - * implementation executes. +void rte_pmd_ark_dev_uninit(struct rte_eth_dev *dev, void *user_data); + +/** + * Extension prototype, optional implementation. + * Called during device probe to change the port count from 1. + * + * @param dev + * current device. + * @param user_data + * user argument from dev_init() call. + * @return (0) if successful. */ +uint8_t dev_get_port_count(struct rte_eth_dev *dev, void *user_data); + +/** + * Extension prototype, optional implementation. + * Called during rte_eth_dev_configure(). + * + * @param dev + * current device. + * @param user_data + * user argument from dev_init() call. + * @return (0) if successful. + */ +int rte_pmd_ark_dev_configure(struct rte_eth_dev *dev, void *user_data); + +/** + * Extension prototype, optional implementation. + * Called during rte_eth_dev_start(). + * + * @param dev + * current device. + * @param user_data + * user argument from dev_init() call. + * @return (0) if successful. + */ +int rte_pmd_ark_dev_start(struct rte_eth_dev *dev, void *user_data); + +/** + * Extension prototype, optional implementation. + * Called during rte_eth_dev_stop(). + * + * @param dev + * current device. + * @param user_data + * user argument from dev_init() call. + * @return (0) if successful. + */ +void rte_pmd_ark_dev_stop(struct rte_eth_dev *dev, void *user_data); + +/** + * Extension prototype, optional implementation. + * Called during rte_eth_dev_close(). + * + * @param dev + * current device. + * @param user_data + * user argument from dev_init() call. + * @return (0) if successful. + */ +void rte_pmd_ark_dev_close(struct rte_eth_dev *dev, void *user_data); + +/** + * Extension prototype, optional implementation. + * Called during link_update status event. + * + * @param dev + * current device. + * @param wait_to_complete + * argument from update event. + * @param user_data + * user argument from dev_init() call. + * @return (0) if successful. + */ +int rte_pmd_ark_link_update(struct rte_eth_dev *dev, + int wait_to_complete, + void *user_data); + +/** + * Extension prototype, optional implementation. + * Called during rte_eth_dev_set_link_up(). + * + * @param dev + * current device. + * @param user_data + * user argument from dev_init() call. + * @return (0) if successful. + */ +int rte_pmd_ark_dev_set_link_up(struct rte_eth_dev *dev, void *user_data); + +/** + * Extension prototype, optional implementation. + * Called during rte_eth_dev_set_link_down(). + * + * @param dev + * current device. + * @param user_data + * user argument from dev_init() call. + * @return (0) if successful. + */ +int rte_pmd_ark_dev_set_link_down(struct rte_eth_dev *dev, void *user_data); + +/** + * Extension prototype, optional implementation. + * Called during rte_eth_stats_get(); allows updates to the stats + * struct in addition Ark's PMD operations. + * + * @param dev + * current device. + * @param stats + * statistics struct already populated by Ark PMD. + * @param user_data + * user argument from dev_init() call. + * @return (0) if successful. + */ +int rte_pmd_ark_stats_get(struct rte_eth_dev *dev, + struct rte_eth_stats *stats, + void *user_data); + +/** + * Extension prototype, optional implementation. + * Called during rte_eth_dev_stats_reset(). + * + * @param dev + * current device. + * @param user_data + * user argument from dev_init() call. + * @return (0) if successful. + */ +void rte_pmd_ark_stats_reset(struct rte_eth_dev *dev, void *user_data); + +/** + * Extension prototype, optional implementation. + * Called during rte_eth_dev_mac_addr_add(). + * + * @param dev + * current device. + * @param macaddr + * The MAC address to add + * @param index + * The index into the MAC address array. + * @param pool + * VMDq pool index from caller + * @param user_data + * user argument from dev_init() call. + * @return (0) if successful. + */ +void rte_pmd_ark_mac_addr_add(struct rte_eth_dev *dev, + struct rte_ether_addr *macaddr, + uint32_t index, + uint32_t pool, + void *user_data); + +/** + * Extension prototype, optional implementation. + * Called during rte_eth_dev_mac_addr_remove(). + * + * @param dev + * current device. + * @param index + * The index into the MAC address array. + * @param user_data + * user argument from dev_init() call. + * @return (0) if successful. + */ +void rte_pmd_ark_mac_addr_remove(struct rte_eth_dev *dev, + uint32_t index, + void *user_data); + +/** + * Extension prototype, optional implementation. + * Called during rte_eth_dev_default_mac_addr_set(). + * + * @param dev + * current device. + * @param mac_addr + * The new default MAC address. + * @param user_data + * user argument from dev_init() call. + * @return (0) if successful. + */ +void rte_pmd_ark_mac_addr_set(struct rte_eth_dev *dev, + struct rte_ether_addr *mac_addr, + void *user_data); + +/** + * Extension prototype, optional implementation. + * Called during rte_eth_dev_set_mtu(). + * + * @param dev + * current device. + * @param size + * The MTU to be applied + * @param user_data + * user argument from dev_init() call. + * @return (0) if successful. + */ +int rte_pmd_ark_set_mtu(struct rte_eth_dev *dev, + uint16_t size, + void *user_data); -int dev_configure(struct rte_eth_dev *dev, - void *user_data); - -int dev_start(struct rte_eth_dev *dev, - void *user_data); - -void dev_stop(struct rte_eth_dev *dev, - void *user_data); - -void dev_close(struct rte_eth_dev *dev, - void *user_data); - -int link_update(struct rte_eth_dev *dev, - int wait_to_complete, - void *user_data); - -int dev_set_link_up(struct rte_eth_dev *dev, - void *user_data); - -int dev_set_link_down(struct rte_eth_dev *dev, - void *user_data); - -int stats_get(struct rte_eth_dev *dev, - struct rte_eth_stats *stats, - void *user_data); - -void stats_reset(struct rte_eth_dev *dev, - void *user_data); - -void mac_addr_add(struct rte_eth_dev *dev, - struct rte_ether_addr *macadr, - uint32_t index, - uint32_t pool, - void *user_data); - -void mac_addr_remove(struct rte_eth_dev *dev, - uint32_t index, - void *user_data); - -void mac_addr_set(struct rte_eth_dev *dev, - struct rte_ether_addr *mac_addr, - void *user_data); - -int set_mtu(struct rte_eth_dev *dev, - uint16_t size, - void *user_data); #endif -- 2.17.1