From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CB8D7A04F2; Fri, 13 Dec 2019 15:32:43 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E23FE1BFAB; Fri, 13 Dec 2019 15:32:42 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 6B0621BFA9; Fri, 13 Dec 2019 15:32:38 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Dec 2019 06:32:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,309,1571727600"; d="scan'208";a="239306430" Received: from orsmsx102.amr.corp.intel.com ([10.22.225.129]) by fmsmga004.fm.intel.com with ESMTP; 13 Dec 2019 06:32:36 -0800 Received: from orsmsx162.amr.corp.intel.com (10.22.240.85) by ORSMSX102.amr.corp.intel.com (10.22.225.129) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 13 Dec 2019 06:32:36 -0800 Received: from ORSEDG001.ED.cps.intel.com (10.7.248.4) by ORSMSX162.amr.corp.intel.com (10.22.240.85) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 13 Dec 2019 06:32:36 -0800 Received: from NAM04-BN3-obe.outbound.protection.outlook.com (104.47.46.57) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 13 Dec 2019 06:32:36 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rdp75ON0cwZ5ckEw3nClxTBVMaGLQM39A2i6djO1u+UCq6CLYqEVeQ2DFkD8uoHQlEkj3GuP1u6EPfMoUeYvtWmEZaYMMnMAQYKpxGg3xGqoXtqUdAy53ukPgHM6DvxtdpTkYwPyiw3stubqZW9Sl48OrfTw3txKpBei3diC8JRZfw9ka8ZwHNxI67Lv58ZIFfOcQLCL/R7NU+286lEFGRhcejxS0PDbPpSFCflWqe5WGM41Kwn6j0umn8GATqEdqMmkdZQ8RjqE9NwD+xKVNiACFeBVnIrs3HwiUHx92ICXZzxv36C2G+0IbK6kpTjAi1uDyOEz2H9KFzkv7ixDFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OixTK+NzFn384bmbVfBX9KcSlNRyMb9BoOWsn3oRrGs=; b=jDEadP6y7bp54fqI7fCCPvJZKE8H6y4R6lmN0oLbHkDuQAR1rttiuIF098GPrr8cxYYeU6TWBGi2n3ouNi8c9JjYrQ/XIhEOqP1QRN10Hgd9MnjCuoyACwCRBF1JPbSkSAto3PMqKcP0pTr1ObM/Ron6oUTuwM7TluBSQUBOLXkfE4kOCTd/2xftWB4wJaEj2VynscK3XQBD7VNEW28UPBmtfKSvvxdjkl0kD2CslvslEAPpnNUSgkc6v6RMqjAhQoYIhhCUIAz7IaDEbz02ehkTCCDryUpU88Bdus2ntW0tkxpGBR+QRzZPaibVOn8yzSxIxLzx19l+avOrhXWxcg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OixTK+NzFn384bmbVfBX9KcSlNRyMb9BoOWsn3oRrGs=; b=LFsFczIGBWaukaWMCId6XJ2xTben1+0xKvyL+uHIqrac/zsttXbp8J+GKYJ/nl7sHsQkxwuULsOuat50K1oR9rWIgvHzDTVdWtK6nnAB9KsJSiloLh+HdxMe7Yn7muecZjQYH/N6pYMt9rCXMPg6dIJHG7E8lD80AZme1R5gSpo= Received: from SN6PR11MB2558.namprd11.prod.outlook.com (52.135.94.19) by SN6PR11MB2815.namprd11.prod.outlook.com (52.135.96.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2538.15; Fri, 13 Dec 2019 14:32:34 +0000 Received: from SN6PR11MB2558.namprd11.prod.outlook.com ([fe80::4d86:362a:13c3:8386]) by SN6PR11MB2558.namprd11.prod.outlook.com ([fe80::4d86:362a:13c3:8386%7]) with mapi id 15.20.2538.016; Fri, 13 Dec 2019 14:32:34 +0000 From: "Ananyev, Konstantin" To: "Cui, LunyuanX" , "dev@dpdk.org" CC: "Lu, Wenzhuo" , "Yang, Qiming" , Ananyev , "stable@dpdk.org" Thread-Topic: [PATCH v2] net/ixgbe: fixed port can not link up in FreeBSD Thread-Index: AQHVsV6fuH1KsABnYEe2Q3+kLyjlQ6e4H+Zg Date: Fri, 13 Dec 2019 14:32:33 +0000 Message-ID: References: <20191212111714.533-1-lunyuanx.cui@intel.com> <20191213023621.38787-1-lunyuanx.cui@intel.com> In-Reply-To: <20191213023621.38787-1-lunyuanx.cui@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZDVkZjIzZTctYWY3OS00MjQ3LTg3MTAtZDUzYzViNDIyNjA3IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiWHpHdWNsNnhoRHdpcmFKbXYyOUV6YWlyY1pibmZ2N1ppdUlpQlFIZmw0Z3o0QkFna2FhVGlDaytBUk13cFRnbyJ9 dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.2.0.6 x-ctpclassification: CTP_NT authentication-results: spf=none (sender IP is ) smtp.mailfrom=konstantin.ananyev@intel.com; x-originating-ip: [192.198.151.184] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d24dacf1-d12b-4362-64b9-08d77fd94b18 x-ms-traffictypediagnostic: SN6PR11MB2815: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6108; x-forefront-prvs: 0250B840C1 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(376002)(396003)(136003)(366004)(346002)(189003)(199004)(2906002)(55016002)(9686003)(450100002)(71200400001)(66556008)(64756008)(66446008)(66946007)(4326008)(66476007)(7696005)(110136005)(76116006)(316002)(186003)(26005)(478600001)(33656002)(8936002)(6506007)(81156014)(81166006)(5660300002)(54906003)(52536014)(8676002)(86362001); DIR:OUT; SFP:1102; SCL:1; SRVR:SN6PR11MB2815; H:SN6PR11MB2558.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Rjj99S+y8d8UnveGafDKzi7f0ngWyngfdr7jfougGuMsMzs4bSvUUDCjXD0Wtz5ZNIgXUJi3ctfDHvDmWNXkYcMOlYSmGl8H/T3ucnG4xPx9XhL3D8Anin3aBU+Z1f30wZ8tOr2zhBGLAwNCcQJUEJVTHInbjinAgdtaMQNRVrODU1nxNlp2hr3vKxExw+/mQdeQpF/Q86DudDO8l+6F8l0OuW1ECz+nEFVaZ/1ijJKr/t7ynrqMcw+1nISR+tQy9FHfz98aZh6702g/G8Vu8NTB9hc8ILxANvXW7yvCKMeBUDsyAQYpIcbF9hLYUtZQq6Jd+RFgHXEQFOGGeaYyUHNjz7Ki30wjjuntDU1f+oW4rhlZCZTFyzg1S22bgVVwqUo/1J56z0kBz9/Lyg3o2dgKDrewaS53arQ3mIZIjJcw9l5m11Cl/BJMtpqsAxd8 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: d24dacf1-d12b-4362-64b9-08d77fd94b18 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Dec 2019 14:32:33.7646 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: H9akPhMi4ceuPejBl/YBl2c4Y5Zk+HkWVVirAo3GlseJhA8vAv8NusJb9WnUOv/T3vRBFJXSpQNAd87mKtcUJssOhcWT4bZ4Z6PVr3MJBHw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB2815 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v2] net/ixgbe: fixed port can not link up in FreeBSD 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Few small nits below. s/fixed/fix/ > In FreeBSD environment, nic_uio drivers do not support interrupts, > rte_intr_callback_register() will fail to register interrupts. > We can not make link status to change from down to up by interrupt > callback. So we need to wait for the controller to acquire link > when ports start. Through multiple tests, 5s should be enough. >=20 > Fixes: b9bd0f09fa15 ("ethdev: fix link status query") > Cc: stable@dpdk.org >=20 > Signed-off-by: Lunyuan Cui > --- >=20 > v2 changes: > * Put waiting into a separate function to keep start() code clean. > --- > drivers/net/ixgbe/ixgbe_ethdev.c | 32 ++++++++++++++++++++++++++++++++ > drivers/net/ixgbe/ixgbe_ethdev.h | 3 +++ > 2 files changed, 35 insertions(+) >=20 > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_e= thdev.c > index 2c6fd0f13..fba666186 100644 > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > @@ -2801,6 +2801,13 @@ ixgbe_dev_start(struct rte_eth_dev *dev) > "please call hierarchy_commit() " > "before starting the port"); >=20 > +#ifdef RTE_EXEC_ENV_FREEBSD > + /* wait for the controller to acquire link */ > + err =3D ixgbe_wait_for_link_up(hw); > + if (err) > + goto error; > +#endif You can hide ifdef inside the function, see below. > + > /* > * Update link status right before return, because it may > * start link configuration process in a separate thread. > @@ -4114,6 +4121,31 @@ ixgbe_dev_setup_link_alarm_handler(void *param) > intr->flags &=3D ~IXGBE_FLAG_NEED_LINK_CONFIG; > } >=20 > +#ifdef RTE_EXEC_ENV_FREEBSD > +/* > + * In freebsd environment, nic_uio drivers do not support interrupts, > + * rte_intr_callback_register() will fail to register interrupts. > + * We can not make link status to change from down to up by interrupt > + * callback. So we need to wait for the controller to acquire link > + * when ports start. > + * It returns 0 on link up. > + */ > +int32_t ixgbe_wait_for_link_up(struct ixgbe_hw *hw) This function can be static, plus pls try to follow dpdk codying style: static int ixgbe_wait_for_link_up(struct ixgbe_hw *hw) { ....=20 You can put #ifdef inside the function: #ifdef RTE_EXEC_ENV_FREEBSD #else RTE_SET_USED(hw); #endif Or even: #ifdef RTE_EXEC_ENV_FREEBSD const uint32_t nb_iter =3D 25; #else const uint32_t nb_iter =3D 0; #endif ... for (i =3D 0; i < nb_iter; i++) {=20 ... > +{ > + int err, i, link_up =3D 0; > + uint32_t speed =3D 0; Empty line here would help readability. > + for (i =3D 0; i < 25; i++) { > + err =3D ixgbe_check_link(hw, &speed, &link_up, 0); > + if (err) > + return err; > + if (link_up) > + return 0; > + msec_delay(200); > + } > + return 0; > +} > +#endif > + > /* return 0 means link status changed, -1 means not changed */ > int > ixgbe_dev_link_update_share(struct rte_eth_dev *dev, > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_e= thdev.h > index 76a1b9d18..9a1d8c54c 100644 > --- a/drivers/net/ixgbe/ixgbe_ethdev.h > +++ b/drivers/net/ixgbe/ixgbe_ethdev.h > @@ -700,6 +700,9 @@ int > ixgbe_dev_link_update_share(struct rte_eth_dev *dev, > int wait_to_complete, int vf); >=20 > +#ifdef RTE_EXEC_ENV_FREEBSD > +int32_t ixgbe_wait_for_link_up(struct ixgbe_hw *hw); > +#endif Pls see above, that function can be static. > /* > * misc function prototypes > */ > -- > 2.17.1