From: Ferruh Yigit Subject: Re: [PATCH v4 11/22] net/atlantic: link status and interrupt management Date: Wed, 10 Oct 2018 11:27:06 +0100 Message-ID: <7c0b1d32-bcd1-6940-11e5-0a02a4b73d3e@intel.com> References: <47435052475de2be4f474a230ebaa3e66bdf4bb5.1539075891.git.igor.russkikh@aquantia.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: Pavel Belous To: Igor Russkikh , "dev@dpdk.org" Return-path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 39C481B51F for ; Wed, 10 Oct 2018 12:27:09 +0200 (CEST) In-Reply-To: <47435052475de2be4f474a230ebaa3e66bdf4bb5.1539075891.git.igor.russkikh@aquantia.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/9/2018 10:31 AM, Igor Russkikh wrote: > From: Pavel Belous > > Implement link interrupt, link info, link polling. > > Signed-off-by: Igor Russkikh > Signed-off-by: Pavel Belous <...> > +/** > + * Atomically reads the link status information from global > + * structure rte_eth_dev. > + * > + * @param dev > + * - Pointer to the structure rte_eth_dev to read from. > + * - Pointer to the buffer to be saved with the link status. > + * > + * @return > + * - On success, zero. > + * - On failure, negative value. > + */ > +static inline int > +rte_atl_dev_atomic_read_link_status(struct rte_eth_dev *dev, > + struct rte_eth_link *link) > +{ > + struct rte_eth_link *dst = link; > + struct rte_eth_link *src = &dev->data->dev_link; > + > + if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst, > + *(uint64_t *)src) == 0) > + return -1; > + > + return 0; > +} > + > +/** > + * Atomically writes the link status information into global > + * structure rte_eth_dev. > + * > + * @param dev > + * - Pointer to the structure rte_eth_dev to read from. > + * - Pointer to the buffer to be saved with the link status. > + * > + * @return > + * - On success, zero. > + * - On failure, negative value. > + */ > +static inline int > +rte_atl_dev_atomic_write_link_status(struct rte_eth_dev *dev, > + struct rte_eth_link *link) > +{ > + struct rte_eth_link *dst = &dev->data->dev_link; > + struct rte_eth_link *src = link; > + > + if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst, > + *(uint64_t *)src) == 0) > + return -1; > + > + return 0; > +} No need to implement atomic link status read/writes in PMDs anymore, new common functions for it added: rte_eth_linkstatus_get() rte_eth_linkstatus_set()