From owner-freebsd-drivers@FreeBSD.ORG Wed Aug 17 15:58:40 2011 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5EB2E106566B; Wed, 17 Aug 2011 15:58:40 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from rfhvm034.hs-regensburg.de (rfhvm034.hs-regensburg.de [194.95.104.22]) by mx1.freebsd.org (Postfix) with ESMTP id 13EC78FC15; Wed, 17 Aug 2011 15:58:39 +0000 (UTC) Received: from rfhvm034.hs-regensburg.de (localhost [127.0.0.1]) by localhost (Postfix) with SMTP id 625561A96F1; Wed, 17 Aug 2011 17:42:32 +0200 (CEST) Received: from rfhrz076.fh-regensburg.de (rfhrz076.fh-regensburg.de [194.95.104.112]) by rfhvm034.hs-regensburg.de (Postfix) with ESMTP id 2C7F11A96EB; Wed, 17 Aug 2011 17:42:32 +0200 (CEST) Date: Wed, 17 Aug 2011 17:42:29 +0200 From: Marius Strobl To: Naresh Message-ID: <20110817174229.34215905@rfhrz076.fh-regensburg.de> In-Reply-To: <1A69CCCE-AF58-465E-87F5-BE3AF0BBAB19@gmail.com> References: <1A69CCCE-AF58-465E-87F5-BE3AF0BBAB19@gmail.com> X-Mailer: Claws Mail 3.7.5 (GTK+ 2.18.7; amd64-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2011.8.17.153016 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1400_1499 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, __ANY_URI 0, __BOUNCE_CHALLENGE_SUBJ 0, __BOUNCE_NDR_SUBJ_EXEMPT 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __FRAUD_BODY_WEBMAIL 0, __FRAUD_WEBMAIL 0, __FW_1LN_BOT_MSGID 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MULTIPLE_RCPTS_CC_X2 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __URI_NO_PATH 0, __URI_NO_WWW 0, __URI_NS ' Cc: freebsd-drivers@freebsd.org, yongari@freebsd.org Subject: Re: MAC and PHY loopback tests entrypoint for NIC controller X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 15:58:40 -0000 On Sat, 6 Aug 2011 23:39:38 +0530 Naresh wrote: > > Hi All, > > I am writing a 10Gb Ethernet driver. We have a requirement to support > Mac and PHY loopback test for the network controller. In Linux there > is a ethtool entrypoint which calls this feature. > > I wondering what will be the equivalent entry point in FreeBSD. I > tried looking in to other drivers, but not lucky enough to find one. > > It is much appreciated if some one could point me to MAC and PHY > loopback test entry point in FreeBSD. > I don't know what API Linux provides but I think the question is how to activate loopback mode from userland. Somewhere in your driver you'll add the supported media similar to the following: ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_AUTO, 0, NULL); If there you also add media variants with option IFM_LOOP f.e. like so: ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_1000_T | IFM_LOOP, 0, NULL); etc then from userland you can activate loopback mode via ifconfig(8) like so: ifconfig youdrv0 1000baseT mediaopt hw-loopback and deactivate if via: ifconfig youdrv0 1000baseT -mediaopt hw-loopback Current versions of FreeBSD also take "loopback" or even just "loop" as an alias for "hw-loopback". The media change handler of your driver of course needs to check whether the selected media has IFM_LOOP set and (de)activate loopback mode in the hardware as appropriate. Marius From owner-freebsd-drivers@FreeBSD.ORG Wed Aug 17 16:25:48 2011 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 16632106566B; Wed, 17 Aug 2011 16:25:48 +0000 (UTC) (envelope-from bhutchings@solarflare.com) Received: from exchange.solarflare.com (exchange.solarflare.com [216.237.3.220]) by mx1.freebsd.org (Postfix) with ESMTP id D13FC8FC17; Wed, 17 Aug 2011 16:25:47 +0000 (UTC) Received: from [10.17.20.137] ([10.17.20.137]) by exchange.solarflare.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Wed, 17 Aug 2011 09:13:42 -0700 From: Ben Hutchings To: Marius Strobl In-Reply-To: <20110817174229.34215905@rfhrz076.fh-regensburg.de> References: <1A69CCCE-AF58-465E-87F5-BE3AF0BBAB19@gmail.com> <20110817174229.34215905@rfhrz076.fh-regensburg.de> Content-Type: text/plain; charset="UTF-8" Organization: Solarflare Communications Date: Wed, 17 Aug 2011 17:13:39 +0100 Message-ID: <1313597619.2776.20.camel@bwh-desktop> Mime-Version: 1.0 X-Mailer: Evolution 2.32.2 (2.32.2-1.fc14) Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 17 Aug 2011 16:13:42.0870 (UTC) FILETIME=[A2223F60:01CC5CF8] X-TM-AS-Product-Ver: SMEX-8.0.0.1181-6.500.1024-18328.005 X-TM-AS-Result: No--22.934600-0.000000-31 X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No Cc: yongari@freebsd.org, Naresh , freebsd-drivers@freebsd.org Subject: Re: MAC and PHY loopback tests entrypoint for NIC controller X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 16:25:48 -0000 On Wed, 2011-08-17 at 17:42 +0200, Marius Strobl wrote: > On Sat, 6 Aug 2011 23:39:38 +0530 > Naresh wrote: > > > > > Hi All, > > > > I am writing a 10Gb Ethernet driver. We have a requirement to support > > Mac and PHY loopback test for the network controller. In Linux there > > is a ethtool entrypoint which calls this feature. Me too! > > I wondering what will be the equivalent entry point in FreeBSD. I > > tried looking in to other drivers, but not lucky enough to find one. > > > > It is much appreciated if some one could point me to MAC and PHY > > loopback test entry point in FreeBSD. > > > > I don't know what API Linux provides but I think the question is how to > activate loopback mode from userland. [...] This is a very different thing. On Linux, ethtool invokes a driver function that runs a set of driver- specific self-tests (synchronously). There is a flag for whether the driver should run offline tests, in which case it will temporarily disconnect from the network stack and then (normally) select loopback mode, generate and validate packets. What you're talking about is configuring loopback mode but leaving the network stack connected. This can be useful for directed testing by developers and QA, but it is not at all useful for an automated self-test. Ben. -- Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked. From owner-freebsd-drivers@FreeBSD.ORG Wed Aug 17 17:24:02 2011 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E6171065670 for ; Wed, 17 Aug 2011 17:24:02 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id 848EF8FC14 for ; Wed, 17 Aug 2011 17:24:01 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id p7HGnlcC027255; Wed, 17 Aug 2011 18:49:47 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id p7HGnl0g027254; Wed, 17 Aug 2011 18:49:47 +0200 (CEST) (envelope-from marius) Date: Wed, 17 Aug 2011 18:49:47 +0200 From: Marius Strobl To: Ben Hutchings Message-ID: <20110817164947.GO48988@alchemy.franken.de> References: <1A69CCCE-AF58-465E-87F5-BE3AF0BBAB19@gmail.com> <20110817174229.34215905@rfhrz076.fh-regensburg.de> <1313597619.2776.20.camel@bwh-desktop> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1313597619.2776.20.camel@bwh-desktop> User-Agent: Mutt/1.4.2.3i Cc: yongari@freebsd.org, Naresh , freebsd-drivers@freebsd.org Subject: Re: MAC and PHY loopback tests entrypoint for NIC controller X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 17:24:02 -0000 On Wed, Aug 17, 2011 at 05:13:39PM +0100, Ben Hutchings wrote: > On Wed, 2011-08-17 at 17:42 +0200, Marius Strobl wrote: > > On Sat, 6 Aug 2011 23:39:38 +0530 > > Naresh wrote: > > > > > > > > Hi All, > > > > > > I am writing a 10Gb Ethernet driver. We have a requirement to support > > > Mac and PHY loopback test for the network controller. In Linux there > > > is a ethtool entrypoint which calls this feature. > > Me too! > > > > I wondering what will be the equivalent entry point in FreeBSD. I > > > tried looking in to other drivers, but not lucky enough to find one. > > > > > > It is much appreciated if some one could point me to MAC and PHY > > > loopback test entry point in FreeBSD. > > > > > > > I don't know what API Linux provides but I think the question is how to > > activate loopback mode from userland. > [...] > > This is a very different thing. > > On Linux, ethtool invokes a driver function that runs a set of driver- > specific self-tests (synchronously). There is a flag for whether the > driver should run offline tests, in which case it will temporarily > disconnect from the network stack and then (normally) select loopback > mode, generate and validate packets. > Ah, okay, unfortunately FreeBSD provides no standard interface for that. Marius From owner-freebsd-drivers@FreeBSD.ORG Thu Aug 18 14:21:46 2011 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F5A9106564A for ; Thu, 18 Aug 2011 14:21:46 +0000 (UTC) (envelope-from gbal.naresh@gmail.com) Received: from mail-yx0-f182.google.com (mail-yx0-f182.google.com [209.85.213.182]) by mx1.freebsd.org (Postfix) with ESMTP id A84738FC08 for ; Thu, 18 Aug 2011 14:21:45 +0000 (UTC) Received: by yxn22 with SMTP id 22so641440yxn.13 for ; Thu, 18 Aug 2011 07:21:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=references:in-reply-to:mime-version:content-transfer-encoding :content-type:message-id:cc:x-mailer:from:subject:date:to; bh=LMLjEhYbU7IghEYqueN/4TrVGU/AAQilXz51KWhNy0o=; b=O6cF0/KMNQdYaWLh18bKzdP3OWiHVCOMMx3TnWtAqzRz1AIJj7sW96Ov4rzNeJnnSC +pcaxkYovi19bPtjjUr8wVD1vtLx/GsMiTz1sQ9xq2nM/BFWN6YDPxcK74BHEiYUpdnv HJPOsszIqB3Fvuy3cxIYO2WG341K6L77Ifg2o= Received: by 10.143.97.24 with SMTP id z24mr435208wfl.212.1313677304709; Thu, 18 Aug 2011 07:21:44 -0700 (PDT) Received: from [192.168.1.2] ([123.236.149.118]) by mx.google.com with ESMTPS id n3sm1508158pbi.37.2011.08.18.07.21.38 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 18 Aug 2011 07:21:42 -0700 (PDT) References: <1A69CCCE-AF58-465E-87F5-BE3AF0BBAB19@gmail.com> <20110817174229.34215905@rfhrz076.fh-regensburg.de> <1313597619.2776.20.camel@bwh-desktop> <20110817164947.GO48988@alchemy.franken.de> In-Reply-To: <20110817164947.GO48988@alchemy.franken.de> Mime-Version: 1.0 (iPhone Mail 8C148) Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Message-Id: X-Mailer: iPhone Mail (8C148) From: Naresh Date: Thu, 18 Aug 2011 19:51:37 +0530 To: Marius Strobl Cc: "freebsd-drivers@freebsd.org" , "yongari@freebsd.org" Subject: Re: MAC and PHY loopback tests entrypoint for NIC controller X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2011 14:21:46 -0000 Thanks a lot Marius and Ben. Sent from my iPhone On 17-Aug-2011, at 10:19 PM, Marius Strobl wrote: > On Wed, Aug 17, 2011 at 05:13:39PM +0100, Ben Hutchings wrote: >> On Wed, 2011-08-17 at 17:42 +0200, Marius Strobl wrote: >>> On Sat, 6 Aug 2011 23:39:38 +0530 >>> Naresh wrote: >>> >>>> >>>> Hi All, >>>> >>>> I am writing a 10Gb Ethernet driver. We have a requirement to support >>>> Mac and PHY loopback test for the network controller. In Linux there >>>> is a ethtool entrypoint which calls this feature. >> >> Me too! >> >>>> I wondering what will be the equivalent entry point in FreeBSD. I >>>> tried looking in to other drivers, but not lucky enough to find one. >>>> >>>> It is much appreciated if some one could point me to MAC and PHY >>>> loopback test entry point in FreeBSD. >>>> >>> >>> I don't know what API Linux provides but I think the question is how to >>> activate loopback mode from userland. >> [...] >> >> This is a very different thing. >> >> On Linux, ethtool invokes a driver function that runs a set of driver- >> specific self-tests (synchronously). There is a flag for whether the >> driver should run offline tests, in which case it will temporarily >> disconnect from the network stack and then (normally) select loopback >> mode, generate and validate packets. >> > > Ah, okay, unfortunately FreeBSD provides no standard interface for that. > > Marius >