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 8F308A050F; Wed, 18 Dec 2019 11:22:10 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C232E2C17; Wed, 18 Dec 2019 11:22:09 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id A3A4D330; Wed, 18 Dec 2019 11:22:06 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Dec 2019 02:22:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,329,1571727600"; d="scan'208";a="210044911" Received: from orsmsx105.amr.corp.intel.com ([10.22.225.132]) by orsmga008.jf.intel.com with ESMTP; 18 Dec 2019 02:22:05 -0800 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX105.amr.corp.intel.com (10.22.225.132) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 18 Dec 2019 02:22:05 -0800 Received: from orsmsx606.amr.corp.intel.com (10.22.229.19) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 18 Dec 2019 02:22:04 -0800 Received: from ORSEDG001.ED.cps.intel.com (10.7.248.4) by orsmsx606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 18 Dec 2019 02:22:04 -0800 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.175) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 18 Dec 2019 02:22:03 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BTYRXRQdOCNnVTEHhUJ6yYtomdGaGGedGmQT7f6XptMDm+OtfVYWkApWEACBnTUSl8vYSmcwXRA111vQBSsCotZ2LQu8PSKTlUmLesN8Rp+PNWg9V3JxwEw7jUs5OKzsj/iXrYFF4kGPbQyWic4G/H6dGB7PuGXC0hEAJB21mK0rP0zfaaWl56hcGO3qLEd1UvtjbR1bRlaUZDISpn5kCmY7pD3gkUTNy1SIRLV4VbKE42CpyEhUh0yCKBNCi1zdmBUH3ySrgElIczMhfi8xyivhTLhH5EMXHmTz20/Wgt7Bwu6c6AmCfy3Q0Ni1VZx4qWo9UA9eZ+q+/pWsyNKNNA== 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=qk1lPTHOu/LCuFakiMw3XPxEXKsldufw3ckWb2s2AI8=; b=I9PKlwBJAz/tW85s676XNnmLgLiZYmJvo1zesttPzG2OAmvpL2gBGs5ytFjkChJVuEKA+jHnQCjOn91MOg/YfBB9tyDKUf2Rqi4kCecv2gvug3HD9tfzigXLfzdNUthBJxcQPZTWt3Nwih2Bq++KBpyeWq/KuKjm5NKX2nxwbg60TsvB5WJUrpwB495IBOdcOBmQKYN3hhuPqycYzFQEpdeL1WvI4irag9AlL4wyvEsqe6F4XJ1XfTcYKJ/ZLeyXgPFUL+//sCcB990aV40Ht0dwEmlgPX8in05/WomFcH+8tzZGqVbrKcEOH9vQ58+Oufxc395vbRuoOldiaelQqA== 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=qk1lPTHOu/LCuFakiMw3XPxEXKsldufw3ckWb2s2AI8=; b=KD2Xpw3WphJ/TjSTrlmWTXz8dn8pZJjARoj2IBSW0sSJyeTDE2sEHWVX97v4ldrtUlfOlbiV+vxUP1ziBlLSdx9dU61Q7ho0BVZklHbz+K1HB1mLnYCyX0TtETPGEVgx4S08/4S9vepYR9GdRMLKvYCXTjVbu674R+a4OhMjqgo= Received: from SN6PR11MB2558.namprd11.prod.outlook.com (52.135.94.19) by SN6PR11MB2877.namprd11.prod.outlook.com (52.135.93.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2538.15; Wed, 18 Dec 2019 10:21:58 +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.2559.012; Wed, 18 Dec 2019 10:21:58 +0000 From: "Ananyev, Konstantin" To: "Cui, LunyuanX" , "dev@dpdk.org" CC: "Lu, Wenzhuo" , "Yang, Qiming" , Ananyev , "stable@dpdk.org" Thread-Topic: [PATCH v3] net/ixgbe: fix port can not link up in FreeBSD Thread-Index: AQHVs7jIV7VoDJBJtE2rBjEaaTYKR6e/si0w Date: Wed, 18 Dec 2019 10:21:58 +0000 Message-ID: References: <20191212111714.533-1-lunyuanx.cui@intel.com> <20191216022418.109608-1-lunyuanx.cui@intel.com> In-Reply-To: <20191216022418.109608-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: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMjEyZWQ5NGMtOGMxNi00NzYxLWIyYmQtZGM3ZTQ5NzQ2YTk4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoia1JrQnl3ZDlaZlFwbmY4NG42SmwzY2xndXhtcmlJekdWSGFVSERDUHZuTDBYZTJWSWdNZllhN0lHbXVId21yeiJ9 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: a3c1eaf7-b880-4575-aff9-08d783a41d2d x-ms-traffictypediagnostic: SN6PR11MB2877: 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:6430; x-forefront-prvs: 0255DF69B9 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(366004)(39860400002)(136003)(396003)(376002)(346002)(189003)(199004)(5660300002)(52536014)(81156014)(478600001)(81166006)(8676002)(8936002)(55016002)(26005)(33656002)(9686003)(2906002)(66556008)(64756008)(66446008)(66946007)(76116006)(110136005)(316002)(54906003)(66476007)(7696005)(450100002)(6506007)(71200400001)(86362001)(4326008)(186003); DIR:OUT; SFP:1102; SCL:1; SRVR:SN6PR11MB2877; 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: lvtoUfJj0hY6+SQHqqhNPsD6/Abjh4mKve3GtPPEtKoxhfxAtY5ip9AzyTbj2q17T+M1I3hHr32JEKEMcjWf+03vxWzteWAqhU8VVvbQG6kZzvWnk9Y6yqo0/leeQENUROGe4tArRfSA2px2/zfUiGatArKQGqr+Z+SyndvIMPdcVjC3C5NV2HdYueuuD8NrrXzC2rVMpOnRlaH3RZn2VM7yZI9whWIhXiugsT3ujuDuWgAkpKVa6WSelE2t+L4Op3lCf6F6P3L8p9SK5n4hFAleHGBaC/+DGsTtEup9MzRjyu3CxxY4g2EAZnoal5yty+TBQ40HRiyr0z02Ez/1sy8WeXHsmiQhV67L/WG4/WoB/fkmJrLqp+dkRMCnHvdipN5fP9A+u6MroKdHfLp0o2gtDrPfTFlz3lFt2QLfSPBarCoNsvh3UYsEhR3FRNdx Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: a3c1eaf7-b880-4575-aff9-08d783a41d2d X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Dec 2019 10:21:58.2543 (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: 13lfGR1USIbjYqPC+UPFVHMF4i2Xv+Bbyt8UxBI/Bo9Bq+SHnqP5V5fme4V4sGbafzOPGCPnqRJFXbaDKIN7mh8c71ln6MG/S8ioZSNiEzU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB2877 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v3] net/ixgbe: fix 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" > 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 > v3 changes: > * Hide ifdef inside the function >=20 > v2 changes: > * Put waiting into a separate function to keep start() code clean. > --- > drivers/net/ixgbe/ixgbe_ethdev.c | 36 ++++++++++++++++++++++++++++++++ > 1 file changed, 36 insertions(+) >=20 > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_e= thdev.c > index 2c6fd0f13..d9b0c5b02 100644 > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > @@ -378,6 +378,7 @@ static int ixgbe_dev_udp_tunnel_port_del(struct rte_e= th_dev *dev, > struct rte_eth_udp_tunnel *udp_tunnel); > static int ixgbe_filter_restore(struct rte_eth_dev *dev); > static void ixgbe_l2_tunnel_conf(struct rte_eth_dev *dev); > +static int ixgbe_wait_for_link_up(struct ixgbe_hw *hw); >=20 > /* > * Define VF Stats MACRO for Non "cleared on read" register > @@ -2801,6 +2802,11 @@ ixgbe_dev_start(struct rte_eth_dev *dev) > "please call hierarchy_commit() " > "before starting the port"); >=20 > + /* wait for the controller to acquire link */ > + err =3D ixgbe_wait_for_link_up(hw); > + if (err) > + goto error; > + > /* > * Update link status right before return, because it may > * start link configuration process in a separate thread. > @@ -4114,6 +4120,36 @@ ixgbe_dev_setup_link_alarm_handler(void *param) > intr->flags &=3D ~IXGBE_FLAG_NEED_LINK_CONFIG; > } >=20 > +/* > + * 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. > + */ > +static int > +ixgbe_wait_for_link_up(struct ixgbe_hw *hw) > +{ > +#ifdef RTE_EXEC_ENV_FREEBSD > + const int nb_iter =3D 25; > +#else > + const int nb_iter =3D 0; > +#endif > + int err, i, link_up =3D 0; > + uint32_t speed =3D 0; > + > + for (i =3D 0; i < nb_iter; 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; > +} > + > /* return 0 means link status changed, -1 means not changed */ > int > ixgbe_dev_link_update_share(struct rte_eth_dev *dev, > -- Acked-by: Konstantin Ananyev > 2.17.1