From owner-freebsd-net@freebsd.org Wed Apr 5 21:57:05 2017 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D36AAD2DAC3 for ; Wed, 5 Apr 2017 21:57:05 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from mail.ignoranthack.me (ignoranthack.me [199.102.79.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A58E8882 for ; Wed, 5 Apr 2017 21:57:05 +0000 (UTC) (envelope-from sbruno@freebsd.org) Received: from [192.168.0.6] (97-123-4-62.albq.qwest.net [97.123.4.62]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sbruno@ignoranthack.me) by mail.ignoranthack.me (Postfix) with ESMTPSA id 408C71928B5; Wed, 5 Apr 2017 21:57:04 +0000 (UTC) Subject: Re: netmap error on -CURRENT with em and igb To: Giuseppe Lettieri , "Eggert, Lars" , "freebsd-net@FreeBSD.org" References: <8F640402-8F0B-407D-AB72-743A9AB50CA3@netapp.com> <5dc6df40-f5f0-d9c2-ed3e-d543c0dd59e2@iet.unipi.it> From: Sean Bruno Message-ID: Date: Wed, 5 Apr 2017 15:57:03 -0600 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.0 MIME-Version: 1.0 In-Reply-To: <5dc6df40-f5f0-d9c2-ed3e-d543c0dd59e2@iet.unipi.it> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="pE0Jpl0UrGLoq17NGqHJTkHUUUR9pKCdW" X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Apr 2017 21:57:05 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --pE0Jpl0UrGLoq17NGqHJTkHUUUR9pKCdW Content-Type: multipart/mixed; boundary="9RLCpRcfOMLRwxbuf4d61mg2Mo5QlQeDp"; protected-headers="v1" From: Sean Bruno To: Giuseppe Lettieri , "Eggert, Lars" , "freebsd-net@FreeBSD.org" Message-ID: Subject: Re: netmap error on -CURRENT with em and igb References: <8F640402-8F0B-407D-AB72-743A9AB50CA3@netapp.com> <5dc6df40-f5f0-d9c2-ed3e-d543c0dd59e2@iet.unipi.it> In-Reply-To: <5dc6df40-f5f0-d9c2-ed3e-d543c0dd59e2@iet.unipi.it> --9RLCpRcfOMLRwxbuf4d61mg2Mo5QlQeDp Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 02/16/17 02:25, Giuseppe Lettieri wrote: > Hi all, >=20 > the "Operation not permitted" is coming from iflib_netmap_register: >=20 > ifp->if_drv_flags &=3D ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); > ... > IFDI_INIT(ctx); // for igb it calls em_if_init() > ... > return (ifp->if_drv_flags & IFF_DRV_RUNNING ? 0 : 1); >=20 > the last line is meant to check that the initialization was successful,= > but em_if_init() is not setting IFF_DRV_RUNNING. >=20 > Note that the iflib_netmap_register code, and the other netmap register= > functions which it mimicks, have other issues: >=20 > - in case of failure on NIOCREGIF, they leaves the NETMAP_ON flag set > even if the netmap data structures are deleted; > - the 1 was intended as a generic indication of failure, but it > translates to the rather confusing EPERM; > - they check IFF_DRV_RUNNING flag outside of the lock; I don't know it > this is safe or not. >=20 > I can prepare a patch fixing these issues, but I don't know wether > em_if_init() is supposed to set the IFF_DRV_RUNNING flag or not. >=20 > Cheers, > Giuseppe >=20 With IFLIB, em_if_init() should *not* set IFF_DRV_RUNNING, this should be done in sys/net/iflib.c Do you have an idea where you want to put this? sean --9RLCpRcfOMLRwxbuf4d61mg2Mo5QlQeDp-- --pE0Jpl0UrGLoq17NGqHJTkHUUUR9pKCdW Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQGTBAEBCgB9FiEEuq1GMucSHejSCZfdEgHvyh5yfmQFAljlaC9fFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEJB QUQ0NjMyRTcxMjFERThEMjA5OTdERDEyMDFFRkNBMUU3MjdFNjQACgkQEgHvyh5y fmToNQf/a8smuHxF6tOB3FbOgs4/QrXpygrRxGiBJLhmkbtMbyFxfIHfmOZgE/sp Mj6VoqIbQnS3Uz2/wAR44sIlDUrvW7aLKohBsmTyjWyMQ+5iWog/36NGfxzX3PMl YYfrQTdvCQK/Vj6pbldAqhTZm+5AxKHhB4Sp30HVYAV0wrGRBvsOcOKn9gEJyl+l MByYZzFkvxTB/DesOqzY/W8g/AkDmFeB9vMVGxTbTBvzs3UHjHxQ50EXGtu4NyF9 Y4qKPpTX3Lo6QA3EYvDPgQo59RgZglH9IgLcnGYKGCuSE4AyY0c6EQk5xbHN+D6I OoUs7FgSCEPfYrI1N7I+eAHc4K1/Ug== =Hegz -----END PGP SIGNATURE----- --pE0Jpl0UrGLoq17NGqHJTkHUUUR9pKCdW--