From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl0-f67.google.com (mail-pl0-f67.google.com [209.85.160.67]) by dpdk.org (Postfix) with ESMTP id 6381C3257 for ; Wed, 17 Jan 2018 17:05:59 +0100 (CET) Received: by mail-pl0-f67.google.com with SMTP id bi12so9202768plb.6 for ; Wed, 17 Jan 2018 08:05:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BP8QckFEcdkRmw+iy+a1FsE/sKLNTfTcRq2cBc/kS3c=; b=FiSgvjgSN+ggSIGYrEEmazf5Z3TEnO5GSV1gl/RZCQq/IW3vVqbc4mkS445xmz/07z tLMaOlWoaby80+bDDhvA6hp4pEBEAzYnwdJENyv0HyRq/Y1OZB/WMsiSO19DpQHmvYmu 0iM3VSJojjfbbHKXyRcV6xrB3BYeo/jw5QNusHEEFMoeNyhIKu91Cgt9L3J/uMH94unu sIpeuSAi9F4IK4k1PVzDrWP0TuL54H583Lc/dzcv7bU8zS+CCK+XBvaxW9YE9U/pHYFF tdWvO3QYesS+GMTf36If1TYONGHUFZsxcbeKa0D2x5ub3Y/hoM+ZRGcbs0yP/WmiWcWS YkYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BP8QckFEcdkRmw+iy+a1FsE/sKLNTfTcRq2cBc/kS3c=; b=m9Pm7ZF6uNrejxKKxueVHjehGvLiQqlXaqnROMAgRuAxueOA0pl0NXLlxMh/Bo0Gi2 Q1H27KfYSXB7TqONmP5xSAom4SBK5RNFY/ugR+NYQCEsdqW3uk1irQwjEiEs11z6+ilE HOxUkRjdGhb1C2UwgHojxd0xtKKshfgvQlJPEEwoKsRnsw3UAGG07XGhUDcYuAl71YdK jce7Z7Nu11+bYYg3vXpYdzq9wBcJFOqZxluoNlHstCiM+jcJxslZpX5QaPXEmG6+eW1G DGPLfjWkBqm+rQRYBY9WoLisQFOoxAIMUZwMbfo1Hz/kX1GloWecqG//zGEoFwJnMLGj 9vWg== X-Gm-Message-State: AKwxytcB5P+2Rhy2diSmxXNtAgN5A28p+tMvEKGLsGzDGz0Tx2+Kd5eN IN5tOPPpx/DrJxFjfEbD4uBJ6Q== X-Google-Smtp-Source: ACJfBoshdHtgxjeMJbJv0/n5OULbaekY8MoAFInKIf7hWjjRTy0Qu84BnhptyUsRe/AO+0cjlLwwDA== X-Received: by 10.84.134.129 with SMTP id 1mr1522906plh.53.1516205158269; Wed, 17 Jan 2018 08:05:58 -0800 (PST) Received: from xeon-e3 (204-195-18-133.wavecable.com. [204.195.18.133]) by smtp.gmail.com with ESMTPSA id q65sm10028242pfj.137.2018.01.17.08.05.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Jan 2018 08:05:58 -0800 (PST) Date: Wed, 17 Jan 2018 08:05:55 -0800 From: Stephen Hemminger To: Ferruh Yigit Cc: Andrew Rybchenko , dev@dpdk.org Message-ID: <20180117080555.5afd8c78@xeon-e3> In-Reply-To: <27f327e5-5632-69cc-feaa-10cf9384a701@intel.com> References: <20180116183755.24542-1-stephen@networkplumber.org> <42f4f5a2-008d-c3e8-4c00-ed9ef59065c8@solarflare.com> <27f327e5-5632-69cc-feaa-10cf9384a701@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v5 00/15] common ethdev linkstatus functions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jan 2018 16:05:59 -0000 On Wed, 17 Jan 2018 14:32:17 +0000 Ferruh Yigit wrote: > On 1/17/2018 7:56 AM, Andrew Rybchenko wrote: > > On 01/16/2018 09:37 PM, Stephen Hemminger wrote: > >> While reviewing drivers, noticed a lot of unnecessary > >> duplication of code in drivers for handling the eth_dev link status > >> information. While consolidating this, it also became obvious that > >> some drivers behave differently for no good reason. > >> > >> It also was a good chance to introduce atomic exchange primitives > >> in EAL because there are other places using cmpset where not > >> necessary (such as bonding). > >> > >> Mostly only compile tested only, don't have all of the hardware > >> available (except ixgbe and virtio) to test. > >> > >> Note: the eth_dev_link_update function return value is inconsistent > >> across drivers. Should be changed to be void. > > > > I would say "link_update" callback return value is inconsistent across > > drivers. I'm not sure which direction is right here: make it consistent > > or make it void. Also any changes in link information could be > > important. As I understand it should not happen without up/down, > > but bugs with loss of intermediate transitions are definitely possible. > > So, notifying about any changes in link information is definitely safer. > > May be not now. > > Again, why not return previous link status, it is simple enough to prevent > inconsistent usage. > > rte_eth_link_get() already discards the return value, so won't be a problem there. > > For the cases PMD would like know about link changes, they will need to > implement almost same link_update function with a return value, so why not use > existing link_update function? > > Like been in virtio, link_update() used in interrupt handler, and calls a > callback process if status changes. When link_update() return status changed to > void, I guess they will need to implement another version of the link_update > with return and use it. The interrupt and non-interrupt model are different. Also the driver internally may want to do something different, this is about the return value for dev_ops->link_update. The code in rte_eth_dev never used the return value. The bonding driver was expecting it to work but it doesn't. Anyway drivers shouldn't in general be directly calling other devices eth_dev_ops