From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 0FA585F0F for ; Fri, 16 Mar 2018 18:46:45 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Mar 2018 10:46:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,316,1517904000"; d="scan'208";a="212010670" Received: from fyigit-mobl.ger.corp.intel.com (HELO [10.237.221.62]) ([10.237.221.62]) by fmsmga006.fm.intel.com with ESMTP; 16 Mar 2018 10:46:43 -0700 To: Ravi Kumar , dev@dpdk.org References: <1515145938-97474-1-git-send-email-Ravi1.kumar@amd.com> <1520584954-130575-1-git-send-email-Ravi1.kumar@amd.com> <1520584954-130575-12-git-send-email-Ravi1.kumar@amd.com> From: Ferruh Yigit Message-ID: <983a012d-85a4-82b1-10cf-6da1129a780c@intel.com> Date: Fri, 16 Mar 2018 17:46:43 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1520584954-130575-12-git-send-email-Ravi1.kumar@amd.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH v3 12/18] net/axgbe: add link status update 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: Fri, 16 Mar 2018 17:46:46 -0000 On 3/9/2018 8:42 AM, Ravi Kumar wrote: > Signed-off-by: Ravi Kumar <...> > +/* return 0 means link status changed, -1 means not changed */ > +static int > +axgbe_dev_link_update(struct rte_eth_dev *dev, > + int wait_to_complete __rte_unused) > +{ > + PMD_INIT_FUNC_TRACE(); > + rte_delay_ms(800); > + > + struct axgbe_port *pdata = dev->data->dev_private; > + int old_link_status = dev->data->dev_link.link_status; > + > + pdata->phy_if.phy_status(pdata); > + > + dev->data->dev_link.link_speed = pdata->phy_speed; > + switch (pdata->phy.duplex) { > + case DUPLEX_FULL: > + dev->data->dev_link.link_duplex = ETH_LINK_FULL_DUPLEX; > + break; > + case DUPLEX_HALF: > + dev->data->dev_link.link_duplex = ETH_LINK_HALF_DUPLEX; > + break; > + } > + dev->data->dev_link.link_autoneg = !(dev->data->dev_conf.link_speeds & > + ETH_LINK_SPEED_FIXED); > + dev->data->dev_link.link_status = pdata->phy_link; > + > + return old_link_status == dev->data->dev_link.link_status ? -1 : 0; There are a very recently merged patches to get/set link status atomically (rte_eth_linkstatus_get / rte_eth_linkstatus_set) only in next-net (not merged to main repo yet), you may benefit from them. <...>