From owner-freebsd-net@FreeBSD.ORG Fri Nov 5 10:10:52 2010 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46BCA106566C for ; Fri, 5 Nov 2010 10:10:52 +0000 (UTC) (envelope-from lists@yamagi.org) Received: from mail.yamagi.overkill.yamagi.org (unknown [IPv6:2a01:4f8:121:2102:1::7]) by mx1.freebsd.org (Postfix) with ESMTP id 916218FC1D for ; Fri, 5 Nov 2010 10:10:51 +0000 (UTC) Received: from [2001:6f8:108a:1:21b:21ff:fe07:b562] (unknown [IPv6:2001:6f8:108a:1:21b:21ff:fe07:b562]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.yamagi.overkill.yamagi.org (Postfix) with ESMTPSA id 8194B16663D1 for ; Fri, 5 Nov 2010 11:10:48 +0100 (CET) Date: Fri, 5 Nov 2010 11:10:37 +0100 (CET) From: Yamagi Burmeister X-X-Sender: yamagi@saya.home.yamagi.org To: freebsd-net@freebsd.org Message-ID: User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="2787499574-17269222-1288951846=:9984" Subject: [patch] WOL support for nfe(4) X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2010 10:10:52 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --2787499574-17269222-1288951846=:9984 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII Hi, some time ago we migrated a lot of boxes from Linux to FreeBSD. Those machines have a "NVIDIA nForce4 CK804 MCP4" network adapter, supported by nfe(4). Even if nfe(4) at least tries to enable the WOL capability of the NIC it doesn't work and nfe(4) doesn't integrate with FreeBSDs (new) WOL framework. Since we are in need of WOL I spend some minutes to implement it the correct way. Attached are two patches: - if_nfe_wol_8.1.diff against FreeBSD 8.1-RELEASE-p1, this one is used on our servers. - if_nfe_wol_current.diff against -CURRENT r214831. This one is _untested_! But it should work... In case that the patches a stripped by mailman they can be found here: http://deponie.yamagi.org/freebsd/nfe/ This patch works reliable on our machines and nfe(4) runs without any problems with it. But nevertheless my skills in writting network drivers are somewhat limited therefor a review by somewhat with better knowledge of the WOL framework and maybe nfe(4) itself is highly anticipated. Ciao, Yamagi -- Homepage: www.yamagi.org Jabber: yamagi@yamagi.org GnuPG/GPG: 0xEFBCCBCB --2787499574-17269222-1288951846=:9984 Content-Type: TEXT/PLAIN; charset=US-ASCII; name=if_nfe_wol_current.diff Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: attachment; filename=if_nfe_wol_current.diff LS0tIGlmX25mZS5jCTIwMTAtMTEtMDUgMTA6NDE6MDQuNjcyMzUxODc5ICsw MTAwDQorKysgaWZfbmZlLmMJMjAxMC0xMS0wNSAxMDo0MTowOS4yNTk2ODk1 ODQgKzAxMDANCkBAIC0xMjUsNiArMTI1LDcgQEANCiBzdGF0aWMgdm9pZCBu ZmVfc3lzY3RsX25vZGUoc3RydWN0IG5mZV9zb2Z0YyAqKTsNCiBzdGF0aWMg dm9pZCBuZmVfc3RhdHNfY2xlYXIoc3RydWN0IG5mZV9zb2Z0YyAqKTsNCiBz dGF0aWMgdm9pZCBuZmVfc3RhdHNfdXBkYXRlKHN0cnVjdCBuZmVfc29mdGMg Kik7DQorc3RhdGljIHZvaWQgbmZlX2VuYWJsZV93b2woc3RydWN0IG5mZV9z b2Z0YyAqKTsNCiANCiAjaWZkZWYgTkZFX0RFQlVHDQogc3RhdGljIGludCBu ZmVkZWJ1ZyA9IDA7DQpAQCAtNTk5LDYgKzYwMCwxMCBAQA0KIAlpZnAtPmlm X2NhcGFiaWxpdGllcyB8PSBJRkNBUF9QT0xMSU5HO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yZXNldChzYyk7ICovDQogCU5GRV9VTkxP Q0soc2MpOw0KIA0KIAlyZXR1cm4gKDApOw0KQEAgLTMyMTIsMyArMzIyMywx NyBAQA0KIAkJc3RhdHMtPnJ4X2Jyb2FkY2FzdCArPSBORkVfUkVBRChzYywg TkZFX1RYX0JST0FEQ0FTVCk7DQogCX0NCiB9DQorDQorc3RhdGljIHZvaWQN CituZmVfZW5hYmxlX3dvbChzdHJ1Y3QgbmZlX3NvZnRjICpzYykNCit7DQor CXN0cnVjdCBpZm5ldCAqaWZwOw0KKw0KKwlORkVfTE9DS19BU1NFUlQoc2Mp Ow0KKw0KKwlpZnAgPSBzYy0+bmZlX2lmcDsNCisNCisJaWYgKChpZnAtPmlm X2NhcGVuYWJsZSAmIElGQ0FQX1dPTF9NQUdJQykgIT0gMCkNCisJCU5GRV9X UklURShzYywgTkZFX1dPTF9DVEwsIE5GRV9XT0xfTUFHSUMpOw0KK30NCisN Cg== --2787499574-17269222-1288951846=:9984 Content-Type: TEXT/PLAIN; charset=US-ASCII; name=if_nfe_wol_8.1.diff Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: attachment; filename=if_nfe_wol_8.1.diff LS0tIGlmX25mZS5jCTIwMTAtMTEtMDUgMTA6MzY6NDMuMzAwNzM4MTYxICsw MTAwDQorKysgaWZfbmZlLmMJMjAxMC0xMS0wNSAxMDozOTowNC43MTI2MDM5 MTYgKzAxMDANCkBAIC0xMjUsNiArMTI1LDcgQEANCiBzdGF0aWMgdm9pZCBu ZmVfc3lzY3RsX25vZGUoc3RydWN0IG5mZV9zb2Z0YyAqKTsNCiBzdGF0aWMg dm9pZCBuZmVfc3RhdHNfY2xlYXIoc3RydWN0IG5mZV9zb2Z0YyAqKTsNCiBz dGF0aWMgdm9pZCBuZmVfc3RhdHNfdXBkYXRlKHN0cnVjdCBuZmVfc29mdGMg Kik7DQorc3RhdGljIHZvaWQgbmZlX2VuYWJsZV93b2woc3RydWN0IG5mZV9z b2Z0YyA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