From owner-svn-soc-all@freebsd.org Sun Jun 19 05:40:10 2016 Return-Path: Delivered-To: svn-soc-all@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 D9003A78AE1 for ; Sun, 19 Jun 2016 05:40:10 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (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 CBF2B20DB for ; Sun, 19 Jun 2016 05:40:10 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u5J5eAVe005642 for ; Sun, 19 Jun 2016 05:40:10 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u5J5eARe005616 for svn-soc-all@FreeBSD.org; Sun, 19 Jun 2016 05:40:10 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Sun, 19 Jun 2016 05:40:10 GMT Message-Id: <201606190540.u5J5eARe005616@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r305343 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 05:40:10 -0000 Author: yuanxunzhang Date: Sun Jun 19 05:40:09 2016 New Revision: 305343 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305343 Log: EAPS: Kernel debug test Modified: soc2016/yuanxunzhang/head/sys/net/if.c Modified: soc2016/yuanxunzhang/head/sys/net/if.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/if.c Sun Jun 19 03:45:32 2016 (r305342) +++ soc2016/yuanxunzhang/head/sys/net/if.c Sun Jun 19 05:40:09 2016 (r305343) @@ -2677,6 +2677,8 @@ case SIOCIFCREATE2: error = priv_check(td, PRIV_NET_IFCREATE); if (error == 0) + printf("%s: Kernel debug test.\n", __func__); + sprintf("Kernel debug test."); error = if_clone_create(ifr->ifr_name, sizeof(ifr->ifr_name), cmd == SIOCIFCREATE2 ? ifr->ifr_data : NULL); From owner-svn-soc-all@freebsd.org Sun Jun 19 06:00:55 2016 Return-Path: Delivered-To: svn-soc-all@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 95252A78EC1 for ; Sun, 19 Jun 2016 06:00:55 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (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 77BA82841 for ; Sun, 19 Jun 2016 06:00:55 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u5J60t3c073858 for ; Sun, 19 Jun 2016 06:00:55 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u5J60si0073214 for svn-soc-all@FreeBSD.org; Sun, 19 Jun 2016 06:00:54 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Sun, 19 Jun 2016 06:00:54 GMT Message-Id: <201606190600.u5J60si0073214@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r305344 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 06:00:55 -0000 Author: yuanxunzhang Date: Sun Jun 19 06:00:54 2016 New Revision: 305344 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305344 Log: EAPS: Kernel debug test Modified: soc2016/yuanxunzhang/head/sys/net/if.c Modified: soc2016/yuanxunzhang/head/sys/net/if.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/if.c Sun Jun 19 05:40:09 2016 (r305343) +++ soc2016/yuanxunzhang/head/sys/net/if.c Sun Jun 19 06:00:54 2016 (r305344) @@ -2678,7 +2678,6 @@ error = priv_check(td, PRIV_NET_IFCREATE); if (error == 0) printf("%s: Kernel debug test.\n", __func__); - sprintf("Kernel debug test."); error = if_clone_create(ifr->ifr_name, sizeof(ifr->ifr_name), cmd == SIOCIFCREATE2 ? ifr->ifr_data : NULL); From owner-svn-soc-all@freebsd.org Sun Jun 19 07:16:54 2016 Return-Path: Delivered-To: svn-soc-all@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 F32A2A7AACD for ; Sun, 19 Jun 2016 07:16:53 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (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 D97FF219F for ; Sun, 19 Jun 2016 07:16:53 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u5J7GrWT059094 for ; Sun, 19 Jun 2016 07:16:53 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u5J7GqFk059051 for svn-soc-all@FreeBSD.org; Sun, 19 Jun 2016 07:16:52 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Sun, 19 Jun 2016 07:16:52 GMT Message-Id: <201606190716.u5J7GqFk059051@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r305345 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 07:16:54 -0000 Author: yuanxunzhang Date: Sun Jun 19 07:16:52 2016 New Revision: 305345 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305345 Log: EAPS: Kernel debug test Modified: soc2016/yuanxunzhang/head/sys/net/if.c soc2016/yuanxunzhang/head/sys/net/if_clone.c Modified: soc2016/yuanxunzhang/head/sys/net/if.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/if.c Sun Jun 19 06:00:54 2016 (r305344) +++ soc2016/yuanxunzhang/head/sys/net/if.c Sun Jun 19 07:16:52 2016 (r305345) @@ -2677,7 +2677,6 @@ case SIOCIFCREATE2: error = priv_check(td, PRIV_NET_IFCREATE); if (error == 0) - printf("%s: Kernel debug test.\n", __func__); error = if_clone_create(ifr->ifr_name, sizeof(ifr->ifr_name), cmd == SIOCIFCREATE2 ? ifr->ifr_data : NULL); Modified: soc2016/yuanxunzhang/head/sys/net/if_clone.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/if_clone.c Sun Jun 19 06:00:54 2016 (r305344) +++ soc2016/yuanxunzhang/head/sys/net/if_clone.c Sun Jun 19 07:16:52 2016 (r305345) @@ -179,10 +179,13 @@ /* Try to find an applicable cloner for this request */ IF_CLONERS_LOCK(); LIST_FOREACH(ifc, &V_if_cloners, ifc_list) + printf("%s: Kernel debug test-1.\n", __func__); if (ifc->ifc_type == SIMPLE) { + printf("%s: Kernel debug test-2.\n", __func__); if (ifc_simple_match(ifc, name)) break; } else { + printf("%s: Kernel debug test-3.\n", __func__); if (ifc->ifc_match(ifc, name)) break; } @@ -216,7 +219,7 @@ { int err; struct ifnet *ifp; - + printf("%s: Kernel debug test-4.\n", __func__); if (ifunit(name) != NULL) return (EEXIST); From owner-svn-soc-all@freebsd.org Sun Jun 19 07:45:27 2016 Return-Path: Delivered-To: svn-soc-all@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 18E74A7A450 for ; Sun, 19 Jun 2016 07:45:27 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (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 056E9128E for ; Sun, 19 Jun 2016 07:45:27 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u5J7jQHs018580 for ; Sun, 19 Jun 2016 07:45:26 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u5J7jQdQ018578 for svn-soc-all@FreeBSD.org; Sun, 19 Jun 2016 07:45:26 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Sun, 19 Jun 2016 07:45:26 GMT Message-Id: <201606190745.u5J7jQdQ018578@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r305346 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 07:45:27 -0000 Author: yuanxunzhang Date: Sun Jun 19 07:45:25 2016 New Revision: 305346 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305346 Log: EAPS: Kernel debug test Modified: soc2016/yuanxunzhang/head/sys/net/if_clone.c Modified: soc2016/yuanxunzhang/head/sys/net/if_clone.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/if_clone.c Sun Jun 19 07:16:52 2016 (r305345) +++ soc2016/yuanxunzhang/head/sys/net/if_clone.c Sun Jun 19 07:45:25 2016 (r305346) @@ -179,13 +179,12 @@ /* Try to find an applicable cloner for this request */ IF_CLONERS_LOCK(); LIST_FOREACH(ifc, &V_if_cloners, ifc_list) - printf("%s: Kernel debug test-1.\n", __func__); if (ifc->ifc_type == SIMPLE) { - printf("%s: Kernel debug test-2.\n", __func__); + printf("%s: Kernel debug test-1.\n", __func__); if (ifc_simple_match(ifc, name)) break; } else { - printf("%s: Kernel debug test-3.\n", __func__); + printf("%s: Kernel debug test-2.\n", __func__); if (ifc->ifc_match(ifc, name)) break; } @@ -219,7 +218,7 @@ { int err; struct ifnet *ifp; - printf("%s: Kernel debug test-4.\n", __func__); + printf("%s: Kernel debug test-3.\n", __func__); if (ifunit(name) != NULL) return (EEXIST); From owner-svn-soc-all@freebsd.org Sun Jun 19 16:00:37 2016 Return-Path: Delivered-To: svn-soc-all@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 52D24A79FED for ; Sun, 19 Jun 2016 16:00:37 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (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 45F7F18A3 for ; Sun, 19 Jun 2016 16:00:37 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u5JG0bJr087780 for ; Sun, 19 Jun 2016 16:00:37 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u5JG0adn087447 for svn-soc-all@FreeBSD.org; Sun, 19 Jun 2016 16:00:36 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Sun, 19 Jun 2016 16:00:36 GMT Message-Id: <201606191600.u5JG0adn087447@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r305348 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 16:00:37 -0000 Author: yuanxunzhang Date: Sun Jun 19 16:00:35 2016 New Revision: 305348 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305348 Log: EAPS: Change interface name Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c soc2016/yuanxunzhang/head/sys/net/if_clone.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Sun Jun 19 07:31:02 2016 (r305347) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Sun Jun 19 16:00:35 2016 (r305348) @@ -70,7 +70,7 @@ static VNET_DEFINE(struct if_clone *, eaps_cloner); #define V_eaps_cloner VNET(eaps_cloner) -static const char eaps_name[] = "EAPS"; +static const char eaps_name[] = "eaps"; SYSCTL_DECL(_net_link); static SYSCTL_NODE(_net_link, IFT_EAPS, eaps, CTLFLAG_RW, 0, "EAPS"); Modified: soc2016/yuanxunzhang/head/sys/net/if_clone.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/if_clone.c Sun Jun 19 07:31:02 2016 (r305347) +++ soc2016/yuanxunzhang/head/sys/net/if_clone.c Sun Jun 19 16:00:35 2016 (r305348) @@ -180,11 +180,9 @@ IF_CLONERS_LOCK(); LIST_FOREACH(ifc, &V_if_cloners, ifc_list) if (ifc->ifc_type == SIMPLE) { - printf("%s: Kernel debug test-1.\n", __func__); if (ifc_simple_match(ifc, name)) break; } else { - printf("%s: Kernel debug test-2.\n", __func__); if (ifc->ifc_match(ifc, name)) break; } @@ -218,7 +216,7 @@ { int err; struct ifnet *ifp; - printf("%s: Kernel debug test-3.\n", __func__); + printf("%s: Kernel debug test-3.\n", __func__); if (ifunit(name) != NULL) return (EEXIST); From owner-svn-soc-all@freebsd.org Sun Jun 19 17:00:46 2016 Return-Path: Delivered-To: svn-soc-all@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 1A209A7AE9F for ; Sun, 19 Jun 2016 17:00:46 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (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 065D41BD0 for ; Sun, 19 Jun 2016 17:00:46 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u5JH0jdH054373 for ; Sun, 19 Jun 2016 17:00:45 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u5JH0jH4053343 for svn-soc-all@FreeBSD.org; Sun, 19 Jun 2016 17:00:45 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Sun, 19 Jun 2016 17:00:45 GMT Message-Id: <201606191700.u5JH0jH4053343@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r305349 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 17:00:46 -0000 Author: yuanxunzhang Date: Sun Jun 19 17:00:44 2016 New Revision: 305349 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305349 Log: EAPS: kernel debug test Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c soc2016/yuanxunzhang/head/sys/net/if_clone.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Sun Jun 19 16:00:35 2016 (r305348) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Sun Jun 19 17:00:44 2016 (r305349) @@ -142,6 +142,7 @@ static int eaps_clone_create(struct if_clone *ifc, int unit, caddr_t params) { + printf("%s: Kernel debug test-1.\n", __func__); return (0); } Modified: soc2016/yuanxunzhang/head/sys/net/if_clone.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/if_clone.c Sun Jun 19 16:00:35 2016 (r305348) +++ soc2016/yuanxunzhang/head/sys/net/if_clone.c Sun Jun 19 17:00:44 2016 (r305349) @@ -216,7 +216,6 @@ { int err; struct ifnet *ifp; - printf("%s: Kernel debug test-3.\n", __func__); if (ifunit(name) != NULL) return (EEXIST); From owner-svn-soc-all@freebsd.org Sun Jun 19 17:41:51 2016 Return-Path: Delivered-To: svn-soc-all@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 3E482A7AE98 for ; Sun, 19 Jun 2016 17:41:51 +0000 (UTC) (envelope-from iateaca@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (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 31C851CE1 for ; Sun, 19 Jun 2016 17:41:51 +0000 (UTC) (envelope-from iateaca@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u5JHfpUr067565 for ; Sun, 19 Jun 2016 17:41:51 GMT (envelope-from iateaca@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u5JHfoGH067506 for svn-soc-all@FreeBSD.org; Sun, 19 Jun 2016 17:41:50 GMT (envelope-from iateaca@FreeBSD.org) Date: Sun, 19 Jun 2016 17:41:50 GMT Message-Id: <201606191741.u5JHfoGH067506@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to iateaca@FreeBSD.org using -f From: iateaca@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r305350 - soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 17:41:51 -0000 Author: iateaca Date: Sun Jun 19 17:41:50 2016 New Revision: 305350 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305350 Log: implement the hda_update_intr function: assert or deassert the line interrupt clear the SDSTS bits when the software (guest) writes them and update the irq M bhyve/pci_hda.c Modified: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c Modified: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c ============================================================================== --- soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c Sun Jun 19 17:00:44 2016 (r305349) +++ soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c Sun Jun 19 17:41:50 2016 (r305350) @@ -66,6 +66,8 @@ struct pci_devinst *pci_dev; uint32_t regs[HDA_LAST_OFFSET]; + uint8_t lintr; + struct hda_codec_cmd_ctl corb; struct hda_codec_cmd_ctl rirb; @@ -87,6 +89,8 @@ hda_set_field_by_offset(struct hda_softc *sc, uint32_t offset, uint32_t mask, uint32_t value); static struct hda_softc *hda_init(const char *opts); +static void +hda_update_intr(struct hda_softc *sc); static int hda_codec_constructor(struct hda_softc *sc, struct hda_codec_class *codec); static struct hda_codec_class * @@ -140,6 +144,8 @@ hda_set_sdctl(struct hda_softc *sc, uint32_t offset, uint32_t old); static void hda_set_sdctl2(struct hda_softc *sc, uint32_t offset, uint32_t old); +static void +hda_set_sdsts(struct hda_softc *sc, uint32_t offset, uint32_t old); static int hda_signal_state_change(struct hda_codec_inst *hci); @@ -170,10 +176,12 @@ #define HDAC_ISTREAM(n, iss, oss) \ [_HDAC_ISDCTL(n, iss, oss)] = hda_set_sdctl, \ [_HDAC_ISDCTL(n, iss, oss) + 2] = hda_set_sdctl2, \ + [_HDAC_ISDSTS(n, iss, oss)] = hda_set_sdsts, \ #define HDAC_OSTREAM(n, iss, oss) \ [_HDAC_OSDCTL(n, iss, oss)] = hda_set_sdctl, \ [_HDAC_OSDCTL(n, iss, oss) + 2] = hda_set_sdctl2, \ + [_HDAC_OSDSTS(n, iss, oss)] = hda_set_sdsts, \ HDAC_ISTREAM(0, HDA_ISS_NO, HDA_OSS_NO) HDAC_ISTREAM(1, HDA_ISS_NO, HDA_OSS_NO) @@ -288,6 +296,47 @@ return sc; } +static void +hda_update_intr(struct hda_softc *sc) +{ + struct pci_devinst *pi = sc->pci_dev; + uint32_t intctl = hda_get_reg_by_offset(sc, HDAC_INTCTL); + uint32_t intsts = 0; + uint32_t sdsts = 0; + uint32_t off = 0; + int i; + + /* TODO update the CIS bits */ + + /* update the SIS bits */ + for (i = 0; i < HDA_IOSS_NO; i++) { + off = hda_get_offset_stream(i); + sdsts = hda_get_reg_by_offset(sc, off + HDAC_SDSTS); + if (sdsts & HDAC_SDSTS_BCIS) + intsts |= (1 << i); + } + + /* update the GIS bit */ + if (intsts) + intsts |= HDAC_INTSTS_GIS; + + hda_set_reg_by_offset(sc, HDAC_INTSTS, intsts); + + if ((intctl & HDAC_INTCTL_GIE) && ((intsts & ~HDAC_INTSTS_GIS) & intctl)) { + if (!sc->lintr) { + pci_lintr_assert(pi); + sc->lintr = 1; + } + } else { + if (sc->lintr) { + pci_lintr_deassert(pi); + sc->lintr = 0; + } + } + + return; +} + static int hda_codec_constructor(struct hda_softc *sc, struct hda_codec_class *codec) { @@ -757,6 +806,19 @@ return; } +static void +hda_set_sdsts(struct hda_softc *sc, uint32_t offset, uint32_t old) +{ + uint32_t value = hda_get_reg_by_offset(sc, offset); + + /* clear the corresponding bits written by the software (guest) */ + hda_set_field_by_offset(sc, offset, value, 0); + + hda_update_intr(sc); + + return; +} + static int hda_signal_state_change(struct hda_codec_inst *hci) { From owner-svn-soc-all@freebsd.org Sun Jun 19 17:47:40 2016 Return-Path: Delivered-To: svn-soc-all@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 673CFA7AF8C for ; Sun, 19 Jun 2016 17:47:40 +0000 (UTC) (envelope-from iateaca@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (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 31DF21DB5 for ; Sun, 19 Jun 2016 17:47:40 +0000 (UTC) (envelope-from iateaca@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u5JHleGB076339 for ; Sun, 19 Jun 2016 17:47:40 GMT (envelope-from iateaca@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u5JHldOf076335 for svn-soc-all@FreeBSD.org; Sun, 19 Jun 2016 17:47:39 GMT (envelope-from iateaca@FreeBSD.org) Date: Sun, 19 Jun 2016 17:47:39 GMT Message-Id: <201606191747.u5JHldOf076335@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to iateaca@FreeBSD.org using -f From: iateaca@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r305351 - soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2016 17:47:40 -0000 Author: iateaca Date: Sun Jun 19 17:47:39 2016 New Revision: 305351 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305351 Log: rename the hda_start_stream and hda_reset_stream in hda_stream_start respectively hda_stream_reset M bhyve/pci_hda.c Modified: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c Modified: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c ============================================================================== --- soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c Sun Jun 19 17:41:50 2016 (r305350) +++ soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c Sun Jun 19 17:47:39 2016 (r305351) @@ -103,9 +103,9 @@ static void hda_reset_regs(struct hda_softc *sc); static void -hda_reset_stream(struct hda_softc *sc, uint8_t stream_ind); +hda_stream_reset(struct hda_softc *sc, uint8_t stream_ind); static int -hda_start_stream(struct hda_softc *sc, uint8_t stream_ind); +hda_stream_start(struct hda_softc *sc, uint8_t stream_ind); static uint32_t hda_read(struct hda_softc *sc, uint32_t offset); static int @@ -446,7 +446,7 @@ } static void -hda_reset_stream(struct hda_softc *sc, uint8_t stream_ind) +hda_stream_reset(struct hda_softc *sc, uint8_t stream_ind) { struct hda_stream_desc *st = &sc->streams[stream_ind]; uint32_t off = hda_get_offset_stream(stream_ind); @@ -465,7 +465,7 @@ } static int -hda_start_stream(struct hda_softc *sc, uint8_t stream_ind) +hda_stream_start(struct hda_softc *sc, uint8_t stream_ind) { struct hda_stream_desc *st = &sc->streams[stream_ind]; struct hda_bdle_desc *bdle_desc = NULL; @@ -785,11 +785,11 @@ hda_set_field_by_offset(sc, offset, 0x00ffff00, old); if (value & HDAC_SDCTL_SRST) { - hda_reset_stream(sc, stream_ind); + hda_stream_reset(sc, stream_ind); } if (value & HDAC_SDCTL_RUN) { - err = hda_start_stream(sc, stream_ind); + err = hda_stream_start(sc, stream_ind); assert(!err); } From owner-svn-soc-all@freebsd.org Mon Jun 20 07:54:47 2016 Return-Path: Delivered-To: svn-soc-all@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 D576EA7AF94 for ; Mon, 20 Jun 2016 07:54:47 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (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 C1AFA2058 for ; Mon, 20 Jun 2016 07:54:47 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u5K7sltg093230 for ; Mon, 20 Jun 2016 07:54:47 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u5K7sk9d093227 for svn-soc-all@FreeBSD.org; Mon, 20 Jun 2016 07:54:46 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 20 Jun 2016 07:54:46 GMT Message-Id: <201606200754.u5K7sk9d093227@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r305360 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 07:54:47 -0000 Author: yuanxunzhang Date: Mon Jun 20 07:54:46 2016 New Revision: 305360 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305360 Log: EAPS: add functions for eaps interface initialization Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c soc2016/yuanxunzhang/head/sys/net/eaps.h Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Jun 20 06:45:42 2016 (r305359) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Jun 20 07:54:46 2016 (r305360) @@ -66,6 +66,10 @@ */ static int eaps_clone_create(struct if_clone *, int, caddr_t); static void eaps_clone_destroy(struct ifnet *); +static int eaps_ioctl(struct ifnet *, u_long, caddr_t); +static int eaps_transmit(struct ifnet *, struct mbuf *); +static void eaps_qflush(struct ifnet *); +static void bridge_init(void *); static VNET_DEFINE(struct if_clone *, eaps_cloner); #define V_eaps_cloner VNET(eaps_cloner) @@ -142,7 +146,33 @@ static int eaps_clone_create(struct if_clone *ifc, int unit, caddr_t params) { - printf("%s: Kernel debug test-1.\n", __func__); + struct eaps_softc *sc; + struct ifnet *ifp; + + sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO); + ifp = sc->sc_ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) { + free(sc, M_DEVBUF); + return (ENOSPC); + } + + EAPS_LOCK_INIT(sc); + + ifp->if_softc = sc; + if_initname(ifp, eaps_name, unit); + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_ioctl = eaps_ioctl; + ifp->if_transmit = eaps_transmit; + ifp->if_qflush = eaps_qflush; + ifp->if_init = eaps_init; + ifp->if_type = IFT_EAPS; + + ether_ifattach(ifp, sc->sc_defaddr); + + EAPS_LIST_LOCK(); + LIST_INSERT_HEAD(&V_eaps_list, sc, sc_entries); + EAPS_LIST_UNLOCK(); + return (0); } @@ -157,3 +187,74 @@ } +/* + * eaps_ioctl: + * + * Handle a control request from the operator. + */ +static int +eaps_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) +{ + struct bridge_softc *sc = ifp->if_softc; + struct ifreq *ifr = (struct ifreq *)data; + struct ifdrv *ifd = (struct ifdrv *) data; + + switch (cmd) { + + break; + default: + error = ether_ioctl(ifp, cmd, data); + break; + } + + return (error); +} + +/* + * eaps_transmit: + * + * Do output on a bridge. + * + */ +static int +eaps_transmit(struct ifnet *ifp, struct mbuf *m) +{ + struct eaps_softc *sc; + struct ether_header *eh; + struct ifnet *dst_if; + int error = 0; + + sc = ifp->if_softc; + ETHER_BPF_MTAP(ifp, m); + + return (error); +} + +/* + * The ifp->if_qflush entry point for eaps(4) is no-op. + */ +static void +bridge_qflush(struct ifnet *ifp __unused) +{ +} + +/* + * eaps_init: + * + * Initialize a eaps interface. + */ +static void +eaps_init(void *xsc) +{ + struct eaps_softc *sc = (struct eaps_softc *)xsc; + struct ifnet *ifp = sc->sc_ifp; + + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + return; + + BRIDGE_LOCK(sc); + ifp->if_drv_flags |= IFF_DRV_RUNNING; + BRIDGE_UNLOCK(sc); +} + + Modified: soc2016/yuanxunzhang/head/sys/net/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.h Mon Jun 20 06:45:42 2016 (r305359) +++ soc2016/yuanxunzhang/head/sys/net/eaps.h Mon Jun 20 07:54:46 2016 (r305360) @@ -137,6 +137,17 @@ #define EAPS_S_PREFORWARD 0x05 /* Transit in PREFORWARDING State */ #define EAPS_S_INIT 0x06 /* Master node in INIT state */ + +#define EAPS_LOCK_INIT(_sc) rm_init(&(_sc)->sc_mtx, "eaps rmlock") +#define EAPS_LOCK_DESTROY(_sc) rm_destroy(&(_sc)->sc_mtx) +#define EAPS_RLOCK(_sc, _p) rm_rlock(&(_sc)->sc_mtx, (_p)) +#define EAPS_WLOCK(_sc) rm_wlock(&(_sc)->sc_mtx) +#define EAPS_RUNLOCK(_sc, _p) rm_runlock(&(_sc)->sc_mtx, (_p)) +#define EAPS_WUNLOCK(_sc) rm_wunlock(&(_sc)->sc_mtx) +#define EAPS_RLOCK_ASSERT(_sc) rm_assert(&(_sc)->sc_mtx, RA_RLOCKED) +#define EAPS_WLOCK_ASSERT(_sc) rm_assert(&(_sc)->sc_mtx, RA_WLOCKED) +#define EAPS_UNLOCK_ASSERT(_sc) rm_assert(&(_sc)->sc_mtx, RA_UNLOCKED) + #endif /* _KERNEL */ #endif /* _NET_EAPS_H_ */ From owner-svn-soc-all@freebsd.org Mon Jun 20 08:03:26 2016 Return-Path: Delivered-To: svn-soc-all@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 61492A7B3FA for ; Mon, 20 Jun 2016 08:03:26 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (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 512BA2523 for ; Mon, 20 Jun 2016 08:03:26 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u5K83Q4V046920 for ; Mon, 20 Jun 2016 08:03:26 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u5K83P7n046917 for svn-soc-all@FreeBSD.org; Mon, 20 Jun 2016 08:03:25 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 20 Jun 2016 08:03:25 GMT Message-Id: <201606200803.u5K83P7n046917@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r305361 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 08:03:26 -0000 Author: yuanxunzhang Date: Mon Jun 20 08:03:25 2016 New Revision: 305361 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305361 Log: EAPS: add functions for eaps interface initialization Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Jun 20 07:54:46 2016 (r305360) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Jun 20 08:03:25 2016 (r305361) @@ -252,9 +252,9 @@ if (ifp->if_drv_flags & IFF_DRV_RUNNING) return; - BRIDGE_LOCK(sc); + EAPS_WLOCK(sc); ifp->if_drv_flags |= IFF_DRV_RUNNING; - BRIDGE_UNLOCK(sc); + EAPS_WUNLOCK(sc); } From owner-svn-soc-all@freebsd.org Mon Jun 20 08:07:25 2016 Return-Path: Delivered-To: svn-soc-all@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 BC213A7B4BC for ; Mon, 20 Jun 2016 08:07:25 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (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 AFA5326BE for ; Mon, 20 Jun 2016 08:07:25 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u5K87P4F051840 for ; Mon, 20 Jun 2016 08:07:25 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u5K87OKw051836 for svn-soc-all@FreeBSD.org; Mon, 20 Jun 2016 08:07:24 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 20 Jun 2016 08:07:24 GMT Message-Id: <201606200807.u5K87OKw051836@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r305362 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 08:07:25 -0000 Author: yuanxunzhang Date: Mon Jun 20 08:07:24 2016 New Revision: 305362 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305362 Log: EAPS: add functions for eaps interface initialization Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c soc2016/yuanxunzhang/head/sys/net/eaps.h Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Jun 20 08:03:25 2016 (r305361) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Jun 20 08:07:24 2016 (r305362) @@ -170,7 +170,7 @@ ether_ifattach(ifp, sc->sc_defaddr); EAPS_LIST_LOCK(); - LIST_INSERT_HEAD(&V_eaps_list, sc, sc_entries); + LIST_INSERT_HEAD(&V_eaps_list, sc, sc_list); EAPS_LIST_UNLOCK(); return (0); Modified: soc2016/yuanxunzhang/head/sys/net/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.h Mon Jun 20 08:03:25 2016 (r305361) +++ soc2016/yuanxunzhang/head/sys/net/eaps.h Mon Jun 20 08:07:24 2016 (r305362) @@ -39,6 +39,7 @@ */ struct eaps_softc { struct ifnet *sc_ifp; /* make this an interface */ + struct rmlock sc_mtx; LIST_ENTRY(eaps_softc) sc_list; }; From owner-svn-soc-all@freebsd.org Mon Jun 20 08:16:09 2016 Return-Path: Delivered-To: svn-soc-all@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 DF4B5A7B765 for ; Mon, 20 Jun 2016 08:16:09 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (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 D02072CE9 for ; Mon, 20 Jun 2016 08:16:09 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u5K8G9VQ070870 for ; Mon, 20 Jun 2016 08:16:09 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u5K8G92S070868 for svn-soc-all@FreeBSD.org; Mon, 20 Jun 2016 08:16:09 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 20 Jun 2016 08:16:09 GMT Message-Id: <201606200816.u5K8G92S070868@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r305363 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 08:16:10 -0000 Author: yuanxunzhang Date: Mon Jun 20 08:16:08 2016 New Revision: 305363 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305363 Log: EAPS: add functions for eaps interface initialization Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Jun 20 08:07:24 2016 (r305362) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Jun 20 08:16:08 2016 (r305363) @@ -198,6 +198,7 @@ struct bridge_softc *sc = ifp->if_softc; struct ifreq *ifr = (struct ifreq *)data; struct ifdrv *ifd = (struct ifdrv *) data; + int error = 0; switch (cmd) { @@ -219,14 +220,8 @@ static int eaps_transmit(struct ifnet *ifp, struct mbuf *m) { - struct eaps_softc *sc; - struct ether_header *eh; - struct ifnet *dst_if; int error = 0; - sc = ifp->if_softc; - ETHER_BPF_MTAP(ifp, m); - return (error); } From owner-svn-soc-all@freebsd.org Mon Jun 20 08:17:30 2016 Return-Path: Delivered-To: svn-soc-all@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 3F339A7B7BB for ; Mon, 20 Jun 2016 08:17:30 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (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 32AA32D2C for ; Mon, 20 Jun 2016 08:17:30 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u5K8HUXR072495 for ; Mon, 20 Jun 2016 08:17:30 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u5K8HTCW072492 for svn-soc-all@FreeBSD.org; Mon, 20 Jun 2016 08:17:29 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 20 Jun 2016 08:17:29 GMT Message-Id: <201606200817.u5K8HTCW072492@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r305364 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 08:17:30 -0000 Author: yuanxunzhang Date: Mon Jun 20 08:17:29 2016 New Revision: 305364 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305364 Log: EAPS: add functions for eaps interface initialization Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Jun 20 08:16:08 2016 (r305363) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Jun 20 08:17:29 2016 (r305364) @@ -241,9 +241,6 @@ static void eaps_init(void *xsc) { - struct eaps_softc *sc = (struct eaps_softc *)xsc; - struct ifnet *ifp = sc->sc_ifp; - if (ifp->if_drv_flags & IFF_DRV_RUNNING) return; From owner-svn-soc-all@freebsd.org Mon Jun 20 08:18:18 2016 Return-Path: Delivered-To: svn-soc-all@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 0E01DA7B7E2 for ; Mon, 20 Jun 2016 08:18:18 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (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 018FE2D51 for ; Mon, 20 Jun 2016 08:18:18 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u5K8IHmT073501 for ; Mon, 20 Jun 2016 08:18:17 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u5K8IHSb073466 for svn-soc-all@FreeBSD.org; Mon, 20 Jun 2016 08:18:17 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 20 Jun 2016 08:18:17 GMT Message-Id: <201606200818.u5K8IHSb073466@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r305365 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 08:18:18 -0000 Author: yuanxunzhang Date: Mon Jun 20 08:18:16 2016 New Revision: 305365 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305365 Log: EAPS: add functions for eaps interface initialization Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Jun 20 08:17:29 2016 (r305364) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Jun 20 08:18:16 2016 (r305365) @@ -241,6 +241,9 @@ static void eaps_init(void *xsc) { + struct eaps_softc *sc = (struct eaps_softc *)xsc; + struct ifnet *ifp = sc->sc_ifp; + if (ifp->if_drv_flags & IFF_DRV_RUNNING) return; From owner-svn-soc-all@freebsd.org Mon Jun 20 08:24:15 2016 Return-Path: Delivered-To: svn-soc-all@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 F416AA7B950 for ; Mon, 20 Jun 2016 08:24:14 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (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 E7A4A11EE for ; Mon, 20 Jun 2016 08:24:14 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u5K8OERf087957 for ; Mon, 20 Jun 2016 08:24:14 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u5K8OEqi087915 for svn-soc-all@FreeBSD.org; Mon, 20 Jun 2016 08:24:14 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 20 Jun 2016 08:24:14 GMT Message-Id: <201606200824.u5K8OEqi087915@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r305366 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 08:24:15 -0000 Author: yuanxunzhang Date: Mon Jun 20 08:24:13 2016 New Revision: 305366 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305366 Log: EAPS: add functions for eaps interface initialization Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Jun 20 08:18:16 2016 (r305365) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Jun 20 08:24:13 2016 (r305366) @@ -196,8 +196,6 @@ eaps_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct bridge_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; - struct ifdrv *ifd = (struct ifdrv *) data; int error = 0; switch (cmd) { From owner-svn-soc-all@freebsd.org Mon Jun 20 08:24:50 2016 Return-Path: Delivered-To: svn-soc-all@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 0F717A7B967 for ; Mon, 20 Jun 2016 08:24:50 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (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 02F50120A for ; Mon, 20 Jun 2016 08:24:50 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u5K8Onuq088746 for ; Mon, 20 Jun 2016 08:24:49 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u5K8OnaU088744 for svn-soc-all@FreeBSD.org; Mon, 20 Jun 2016 08:24:49 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 20 Jun 2016 08:24:49 GMT Message-Id: <201606200824.u5K8OnaU088744@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r305367 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 08:24:50 -0000 Author: yuanxunzhang Date: Mon Jun 20 08:24:48 2016 New Revision: 305367 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305367 Log: EAPS: add functions for eaps interface initialization Modified: soc2016/yuanxunzhang/head/sys/net/eaps.h Modified: soc2016/yuanxunzhang/head/sys/net/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.h Mon Jun 20 08:24:13 2016 (r305366) +++ soc2016/yuanxunzhang/head/sys/net/eaps.h Mon Jun 20 08:24:48 2016 (r305367) @@ -41,6 +41,7 @@ struct ifnet *sc_ifp; /* make this an interface */ struct rmlock sc_mtx; LIST_ENTRY(eaps_softc) sc_list; + u_char sc_defaddr[6]; /* Default MAC address */ }; /* From owner-svn-soc-all@freebsd.org Mon Jun 20 08:25:44 2016 Return-Path: Delivered-To: svn-soc-all@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 1DD7EA7B992 for ; Mon, 20 Jun 2016 08:25:44 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (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 117611225 for ; Mon, 20 Jun 2016 08:25:44 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u5K8PheF090100 for ; Mon, 20 Jun 2016 08:25:43 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u5K8Ph0j090096 for svn-soc-all@FreeBSD.org; Mon, 20 Jun 2016 08:25:43 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 20 Jun 2016 08:25:43 GMT Message-Id: <201606200825.u5K8Ph0j090096@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r305368 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 08:25:44 -0000 Author: yuanxunzhang Date: Mon Jun 20 08:25:42 2016 New Revision: 305368 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305368 Log: EAPS: add functions for eaps interface initialization Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Jun 20 08:24:48 2016 (r305367) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Jun 20 08:25:42 2016 (r305368) @@ -69,7 +69,7 @@ static int eaps_ioctl(struct ifnet *, u_long, caddr_t); static int eaps_transmit(struct ifnet *, struct mbuf *); static void eaps_qflush(struct ifnet *); -static void bridge_init(void *); +static void eaps_init(void *); static VNET_DEFINE(struct if_clone *, eaps_cloner); #define V_eaps_cloner VNET(eaps_cloner) From owner-svn-soc-all@freebsd.org Mon Jun 20 08:26:28 2016 Return-Path: Delivered-To: svn-soc-all@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 1BFE0A7B9E2 for ; Mon, 20 Jun 2016 08:26:28 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (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 0F90B12A3 for ; Mon, 20 Jun 2016 08:26:28 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u5K8QROp091184 for ; Mon, 20 Jun 2016 08:26:27 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u5K8QRA4091167 for svn-soc-all@FreeBSD.org; Mon, 20 Jun 2016 08:26:27 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 20 Jun 2016 08:26:27 GMT Message-Id: <201606200826.u5K8QRA4091167@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r305369 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 08:26:28 -0000 Author: yuanxunzhang Date: Mon Jun 20 08:26:26 2016 New Revision: 305369 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305369 Log: EAPS: add functions for eaps interface initialization Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Jun 20 08:25:42 2016 (r305368) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Jun 20 08:26:26 2016 (r305369) @@ -195,7 +195,7 @@ static int eaps_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { - struct bridge_softc *sc = ifp->if_softc; + struct eaps_softc *sc = ifp->if_softc; int error = 0; switch (cmd) { From owner-svn-soc-all@freebsd.org Mon Jun 20 08:27:03 2016 Return-Path: Delivered-To: svn-soc-all@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 98F2AA7BA12 for ; Mon, 20 Jun 2016 08:27:03 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (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 8C7DE12CB for ; Mon, 20 Jun 2016 08:27:03 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u5K8R3E9091994 for ; Mon, 20 Jun 2016 08:27:03 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u5K8R3Fe091992 for svn-soc-all@FreeBSD.org; Mon, 20 Jun 2016 08:27:03 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 20 Jun 2016 08:27:03 GMT Message-Id: <201606200827.u5K8R3Fe091992@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r305370 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 08:27:03 -0000 Author: yuanxunzhang Date: Mon Jun 20 08:27:02 2016 New Revision: 305370 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305370 Log: EAPS: add functions for eaps interface initialization Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Jun 20 08:26:26 2016 (r305369) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Jun 20 08:27:02 2016 (r305370) @@ -195,7 +195,6 @@ static int eaps_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { - struct eaps_softc *sc = ifp->if_softc; int error = 0; switch (cmd) { From owner-svn-soc-all@freebsd.org Mon Jun 20 08:28:26 2016 Return-Path: Delivered-To: svn-soc-all@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 6F136A7BA7B for ; Mon, 20 Jun 2016 08:28:26 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (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 62B4612FA for ; Mon, 20 Jun 2016 08:28:26 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u5K8SQro094126 for ; Mon, 20 Jun 2016 08:28:26 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u5K8SPKP094123 for svn-soc-all@FreeBSD.org; Mon, 20 Jun 2016 08:28:25 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 20 Jun 2016 08:28:25 GMT Message-Id: <201606200828.u5K8SPKP094123@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r305371 - soc2016/yuanxunzhang/head/sys/net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 08:28:26 -0000 Author: yuanxunzhang Date: Mon Jun 20 08:28:25 2016 New Revision: 305371 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305371 Log: EAPS: add functions for eaps interface initialization Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Jun 20 08:27:02 2016 (r305370) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Mon Jun 20 08:28:25 2016 (r305371) @@ -211,7 +211,7 @@ /* * eaps_transmit: * - * Do output on a bridge. + * Do output on a eaps. * */ static int @@ -226,7 +226,7 @@ * The ifp->if_qflush entry point for eaps(4) is no-op. */ static void -bridge_qflush(struct ifnet *ifp __unused) +eaps_qflush(struct ifnet *ifp __unused) { } From owner-svn-soc-all@freebsd.org Mon Jun 20 15:07:40 2016 Return-Path: Delivered-To: svn-soc-all@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 EE936AC4538 for ; Mon, 20 Jun 2016 15:07:40 +0000 (UTC) (envelope-from iateaca@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (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 E178A2E24 for ; Mon, 20 Jun 2016 15:07:40 +0000 (UTC) (envelope-from iateaca@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u5KF7e2d077857 for ; Mon, 20 Jun 2016 15:07:40 GMT (envelope-from iateaca@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u5KF7dGx077565 for svn-soc-all@FreeBSD.org; Mon, 20 Jun 2016 15:07:39 GMT (envelope-from iateaca@FreeBSD.org) Date: Mon, 20 Jun 2016 15:07:39 GMT Message-Id: <201606201507.u5KF7dGx077565@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to iateaca@FreeBSD.org using -f From: iateaca@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r305374 - soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2016 15:07:41 -0000 Author: iateaca Date: Mon Jun 20 15:07:38 2016 New Revision: 305374 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305374 Log: = hda_codec.c = design the struct hda_audio_ctxt data structure: HDA Audio Context data structure implement the HDA Audio Context (hda_audio_ctxt_thr, hda_audio_ctxt_init, hda_audio_ctxt_start, hda_audio_ctxt_stop) this context is going to run transfers between the HDA and sound audio card add ont HDA Audio Context per stream implement the hda_codec_notify function used by the HDA controller to start / stop the Audio Context in the codec = pci_hda.c = implement the hda_notify_codecs function in order to notify the codecs one stream has started / stopped implement the hda_stream_stop function M bhyve/hda_codec.c M bhyve/pci_hda.c M bhyve/pci_hda.h Modified: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_codec.c soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.h Modified: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_codec.c ============================================================================== --- soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_codec.c Mon Jun 20 09:15:03 2016 (r305373) +++ soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_codec.c Mon Jun 20 15:07:38 2016 (r305374) @@ -1,4 +1,8 @@ +#include +#include +#include + #include "pci_hda.h" /* @@ -43,8 +47,40 @@ #define HDA_CONFIG_DEFAULTCONF_COLOR_BLACK (0x01 << HDA_CONFIG_DEFAULTCONF_COLOR_SHIFT) +#define HDA_CODEC_BUF_SIZE 0x100 + #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + +/* + * HDA Audio Context data structures + */ + +typedef void (*transfer_func_t)(void *arg); + +struct hda_audio_ctxt { + char name[64]; + uint8_t run; + pthread_t tid; + pthread_mutex_t mtx; + pthread_cond_t cond; + transfer_func_t do_transfer; + void *priv; +}; + +/* + * HDA Audio Context module function declarations + */ + +static void * +hda_audio_ctxt_thr(void *arg); +static int +hda_audio_ctxt_init(struct hda_audio_ctxt *actx, const char *tname, transfer_func_t do_transfer, void *priv); +static int +hda_audio_ctxt_start(struct hda_audio_ctxt *actx); +static int +hda_audio_ctxt_stop(struct hda_audio_ctxt *actx); + /* * HDA Codec data structures */ @@ -54,9 +90,12 @@ typedef uint32_t (*verb_func_t)(struct hda_codec_softc *sc, uint16_t verb, uint16_t payload); struct hda_codec_stream { + uint8_t buf[HDA_CODEC_BUF_SIZE]; uint8_t stream; uint8_t channel; uint16_t fmt; + + struct hda_audio_ctxt actx; }; struct hda_codec_softc { @@ -80,8 +119,13 @@ hda_codec_reset(struct hda_codec_inst *hci); static int hda_codec_command(struct hda_codec_inst *hci, uint32_t cmd_data); +static int +hda_codec_notify(struct hda_codec_inst *hci, uint8_t run, uint8_t stream, uint8_t dir); -uint32_t hda_codec_audio_output_nid(struct hda_codec_softc *sc, uint16_t verb, uint16_t payload); +static uint32_t +hda_codec_audio_output_nid(struct hda_codec_softc *sc, uint16_t verb, uint16_t payload); +static void +hda_codec_audio_output_do_transfer(void *arg); /* * HDA Codec global data @@ -158,6 +202,7 @@ hda_codec_init(struct hda_codec_inst *hci, const char *opts) { struct hda_codec_softc *sc = NULL; + int err; DPRINTF("cad: 0x%x opts: %s\n", hci->cad, opts); @@ -174,6 +219,9 @@ sc->verb_handlers = hda_codec_verb_handlers; DPRINTF("HDA Codec nodes: %d\n", sc->no_nodes); + err = hda_audio_ctxt_init(&sc->streams[HDA_CODEC_STREAM_OUTPUT].actx, "hda-audio-output", hda_codec_audio_output_do_transfer, sc); + assert(!err); + hci->priv = sc; return 0; @@ -269,7 +317,41 @@ return hops->response(hci, res, HDA_CODEC_RESPONSE_EX_SOL); } -uint32_t hda_codec_audio_output_nid(struct hda_codec_softc *sc, uint16_t verb, uint16_t payload) +static int +hda_codec_notify(struct hda_codec_inst *hci, uint8_t run, uint8_t stream, uint8_t dir) +{ + struct hda_codec_softc *sc = NULL; + struct hda_codec_stream *st = NULL; + struct hda_audio_ctxt *actx = NULL; + int err; + + assert(hci); + + sc = (struct hda_codec_softc *)hci->priv; + assert(sc); + + DPRINTF("run: %d, stream: 0x%x, dir: %d\n", run, stream, dir); + + /* TODO search the right stream + * For now, there is only only stream + */ + st = &sc->streams[HDA_CODEC_STREAM_OUTPUT]; + + if (stream != st->stream) + return -1; + + actx = &st->actx; + + if (run) + err = hda_audio_ctxt_start(actx); + else + err = hda_audio_ctxt_stop(actx); + + return err; +} + +static uint32_t +hda_codec_audio_output_nid(struct hda_codec_softc *sc, uint16_t verb, uint16_t payload) { struct hda_codec_stream *st = NULL; uint32_t res = 0; @@ -294,12 +376,107 @@ return res; } +static void +hda_codec_audio_output_do_transfer(void *arg) +{ + /* + * TODO transfer betweenthe HDA and sound card + */ + DPRINTF("\n"); + usleep(20 * 1000); + return; +} + struct hda_codec_class hda_codec = { .name = "hda_codec", .init = hda_codec_init, .reset = hda_codec_reset, .command = hda_codec_command, + .notify = hda_codec_notify, }; HDA_EMUL_SET(hda_codec); + +/* + * HDA Audio Context module function definitions + */ + +static void * +hda_audio_ctxt_thr(void *arg) +{ + struct hda_audio_ctxt *actx = (struct hda_audio_ctxt *)arg; + + DPRINTF("Start Thread: %s\n", actx->name); + + pthread_mutex_lock(&actx->mtx); + while (1) { + while (!actx->run) + pthread_cond_wait(&actx->cond, &actx->mtx); + + actx->do_transfer(actx->priv); + } + pthread_mutex_unlock(&actx->mtx); + + pthread_exit(NULL); + + return NULL; +} + +static int +hda_audio_ctxt_init(struct hda_audio_ctxt *actx, const char *tname, transfer_func_t do_transfer, void *priv) +{ + int err; + + assert(actx); + assert(tname); + assert(do_transfer); + assert(priv); + + memset(actx, 0, sizeof(*actx)); + + actx->run = 0; + actx->do_transfer = do_transfer; + actx->priv = priv; + if (strlen(tname) < sizeof(actx->name)) + memcpy(actx->name, tname, strlen(tname) + 1); + else + strcpy(actx->name, "unknown"); + + err = pthread_mutex_init(&actx->mtx, NULL); + assert(!err); + + err = pthread_cond_init(&actx->cond, NULL); + assert(!err); + + err = pthread_create(&actx->tid, NULL, hda_audio_ctxt_thr, actx); + assert(!err); + + pthread_set_name_np(actx->tid, tname); + assert(!err); + + return 0; +} + +static int +hda_audio_ctxt_start(struct hda_audio_ctxt *actx) +{ + /* The stream is supposed to be stopped */ + if (actx->run) + return -1; + + pthread_mutex_lock(&actx->mtx); + actx->run = 1; + pthread_cond_signal(&actx->cond); + pthread_mutex_unlock(&actx->mtx); + + return 0; +} + +static int +hda_audio_ctxt_stop(struct hda_audio_ctxt *actx) +{ + actx->run = 0; + return 0; +} + Modified: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c ============================================================================== --- soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c Mon Jun 20 09:15:03 2016 (r305373) +++ soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c Mon Jun 20 15:07:38 2016 (r305374) @@ -55,6 +55,7 @@ }; struct hda_stream_desc { + uint8_t stream; uint8_t run; uint8_t dir; @@ -98,6 +99,8 @@ static int hda_send_command(struct hda_softc *sc, uint32_t verb); +static int +hda_notify_codecs(struct hda_softc *sc, uint8_t run, uint8_t stream, uint8_t dir); static void hda_reset(struct hda_softc *sc); static void @@ -106,6 +109,8 @@ hda_stream_reset(struct hda_softc *sc, uint8_t stream_ind); static int hda_stream_start(struct hda_softc *sc, uint8_t stream_ind); +static int +hda_stream_stop(struct hda_softc *sc, uint8_t stream_ind); static uint32_t hda_read(struct hda_softc *sc, uint32_t offset); static int @@ -403,6 +408,32 @@ return codec->command(hci, verb); } +static int +hda_notify_codecs(struct hda_softc *sc, uint8_t run, uint8_t stream, uint8_t dir) +{ + struct hda_codec_inst *hci = NULL; + struct hda_codec_class *codec = NULL; + int err; + int i; + + /* Notify each codec */ + for (i = 0; i < sc->codecs_no; i++) { + hci = sc->codecs[i]; + assert(hci); + + codec = hci->codec; + assert(codec); + + if (codec->notify) { + err = codec->notify(hci, run, stream, dir); + if (!err) + break; + } + } + + return i == sc->codecs_no ? (-1) : 0; +} + static void hda_reset(struct hda_softc *sc) { @@ -485,6 +516,7 @@ uint32_t sdctl = 0; uint8_t strm = 0; uint8_t dir = 0; + int err; int i; assert(!st->run); @@ -533,8 +565,28 @@ DPRINTF("strm: 0x%x, dir: 0x%x\n", strm, dir); sc->stream_map[strm] = stream_ind; + st->stream = strm; st->dir = dir; + err = hda_notify_codecs(sc, 1, strm, dir); + assert(!err); + + return 0; +} + +static int +hda_stream_stop(struct hda_softc *sc, uint8_t stream_ind) +{ + struct hda_stream_desc *st = &sc->streams[stream_ind]; + uint8_t strm = st->stream; + uint8_t dir = st->dir; + int err; + + DPRINTF("stream: 0x%x, strm: 0x%x, dir: 0x%x\n", stream_ind, strm, dir); + + err = hda_notify_codecs(sc, 0, strm, dir); + assert(!err); + return 0; } @@ -788,9 +840,14 @@ hda_stream_reset(sc, stream_ind); } - if (value & HDAC_SDCTL_RUN) { - err = hda_stream_start(sc, stream_ind); - assert(!err); + if ((value & HDAC_SDCTL_RUN) != (old & HDAC_SDCTL_RUN)) { + if (value & HDAC_SDCTL_RUN) { + err = hda_stream_start(sc, stream_ind); + assert(!err); + } else { + err = hda_stream_stop(sc, stream_ind); + assert(!err); + } } return; Modified: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.h ============================================================================== --- soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.h Mon Jun 20 09:15:03 2016 (r305373) +++ soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.h Mon Jun 20 15:07:38 2016 (r305374) @@ -43,6 +43,7 @@ int (*init)(struct hda_codec_inst *hci, const char *opts); int (*reset)(struct hda_codec_inst *hci); int (*command)(struct hda_codec_inst *hci, uint32_t cmd_data); + int (*notify)(struct hda_codec_inst *hci, uint8_t run, uint8_t stream, uint8_t dir); }; struct hda_ops { From owner-svn-soc-all@freebsd.org Sat Jun 25 18:28:24 2016 Return-Path: Delivered-To: svn-soc-all@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 30C7EB81D55 for ; Sat, 25 Jun 2016 18:28:24 +0000 (UTC) (envelope-from iateaca@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (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 1615326A9 for ; Sat, 25 Jun 2016 18:28:24 +0000 (UTC) (envelope-from iateaca@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u5PISNhQ080044 for ; Sat, 25 Jun 2016 18:28:23 GMT (envelope-from iateaca@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u5PISNh7080033 for svn-soc-all@FreeBSD.org; Sat, 25 Jun 2016 18:28:23 GMT (envelope-from iateaca@FreeBSD.org) Date: Sat, 25 Jun 2016 18:28:23 GMT Message-Id: <201606251828.u5PISNh7080033@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to iateaca@FreeBSD.org using -f From: iateaca@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r305547 - soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 18:28:24 -0000 Author: iateaca Date: Sat Jun 25 18:28:22 2016 New Revision: 305547 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305547 Log: implement the Audio Player used to play samples to the sound device (/dev/dsp) the public interface provides 3 functions: audio_init, audio_set_params and audio_playback A audio.c A audio.h Added: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/audio.c soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/audio.h Added: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/audio.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/audio.c Sat Jun 25 18:28:22 2016 (r305547) @@ -0,0 +1,163 @@ + +#include +#include +#include +#include +#include +#include +#include + +#include "audio.h" +#include "pci_hda.h" + +/* + * Audio Player internal data structures + */ + +struct audio { + int fd; + uint8_t dir; + char dev_name[64]; +}; + +/* + * Audio Player module function definitions + */ + +/* + * audio_init - initialize an instance of audio player + * @dev_name - the backend sound device used to play / capture + * @dir - dir = 1 for write mode, dir = 0 for read mode + */ +struct audio *audio_init(const char *dev_name, uint8_t dir) +{ + struct audio *aud = NULL; + + assert(dev_name); + + aud = calloc(1, sizeof(*aud)); + if (!aud) + return NULL; + + if (strlen(dev_name) < sizeof(aud->dev_name)) + memcpy(aud->dev_name, dev_name, strlen(dev_name) + 1); + else { + DPRINTF("dev_name too big\n"); + free(aud); + return NULL; + } + + aud->fd = -1; + aud->dir = dir; + + return aud; +} + +/* + * audio_set_params - reset the sound device and set the audio params + * @aud - the audio player to be configured + * @params - the audio parameters to be set + */ +int audio_set_params(struct audio *aud, struct audio_params *params) +{ + int audio_fd = -1; + int format, channels, rate; + int err; + + assert(aud); + assert(params); + + /* Close the device if was opened before */ + if (aud->fd != -1) { + err = close(aud->fd); + if (err == -1) { + DPRINTF("Fail to close fd: %d, errno: %d\n", aud->fd, errno); + return -1; + } + } + + audio_fd = open(aud->dev_name, aud->dir ? O_WRONLY : O_RDONLY, 0); + if (audio_fd == -1) { + DPRINTF("Fail to open dev: %s, errno: %d\n", aud->dev_name, errno); + return -1; + } + + aud->fd = audio_fd; + + /* Set the Format (Bits per Sample) */ + format = params->format; + err = ioctl(audio_fd, SNDCTL_DSP_SETFMT, &format); + if (err == -1) { + DPRINTF("Fail to set fmt: 0x%x errno: %d\n", params->format, errno); + return -1; + } + + /* The device does not support the requested audio format */ + if (format != params->format) { + DPRINTF("Mismatch format: 0x%x params->format: 0x%x\n", format, params->format); + return -1; + } + + /* Set the Number of Channels */ + channels = params->channels; + err = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &channels); + if (err == -1) { + DPRINTF("Fail to set channels: %d errno: %d\n", params->channels, errno); + return -1; + } + + /* The device does not support the requested no. of channels */ + if (channels != params->channels) { + DPRINTF("Mismatch channels: %d params->channels: %d\n", channels, params->channels); + return -1; + } + + /* Set the Sample Rate / Speed */ + rate = params->rate; + err = ioctl(audio_fd, SNDCTL_DSP_SPEED, &rate); + if (err == -1) { + DPRINTF("Fail to set speed: %d errno: %d\n", params->rate, errno); + return -1; + } + + /* The device does not support the requested rate / speed */ + if (rate != params->rate) { + DPRINTF("Mismatch rate: %d params->rate: %d\n", rate, params->rate); + return -1; + } + + return 0; +} + +/* + * audio_playback - plays samples to the sound device using blocking operations + * @aud - the audio player used to play the samples + * @buf - the buffer containing the samples + * @count - the number of bytes in buffer + */ +ssize_t audio_playback(struct audio *aud, const void *buf, size_t count) +{ + int audio_fd = -1; + ssize_t len = 0, total = 0; + + assert(aud); + assert(aud->dir); + assert(buf); + + audio_fd = aud->fd; + assert(audio_fd != -1); + + total = 0; + while (total < count) { + len = write(audio_fd, buf + total, count - total); + if (len == -1) { + DPRINTF("Fail to write to fd: %d, errno: %d\n", audio_fd, errno); + return -1; + } + + total += len; + } + + return 0; +} + Added: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/audio.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/audio.h Sat Jun 25 18:28:22 2016 (r305547) @@ -0,0 +1,46 @@ + +#ifndef _AUDIO_EMUL_H_ +#define _AUDIO_EMUL_H_ + +#include +#include + +/* + * Audio Player data structures + */ + +struct audio; + +struct audio_params { + int format; + int channels; + int rate; +}; + +/* + * Audio Player API + */ + +/* + * audio_init - initialize an instance of audio player + * @dev_name - the backend sound device used to play / capture + * @dir - dir = 1 for write mode, dir = 0 for read mode + */ +struct audio *audio_init(const char *dev_name, uint8_t dir); + +/* + * audio_set_params - reset the sound device and set the audio params + * @aud - the audio player to be configured + * @params - the audio parameters to be set + */ +int audio_set_params(struct audio *aud, struct audio_params *params); + +/* + * audio_playback - plays samples to the sound device using blocking operations + * @aud - the audio player used to play the samples + * @buf - the buffer containing the samples + * @count - the number of bytes in buffer + */ +ssize_t audio_playback(struct audio *aud, const void *buf, size_t count); + +#endif /* _AUDIO_EMUL_H_ */ From owner-svn-soc-all@freebsd.org Sat Jun 25 19:16:16 2016 Return-Path: Delivered-To: svn-soc-all@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 45305B806D2 for ; Sat, 25 Jun 2016 19:16:16 +0000 (UTC) (envelope-from iateaca@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (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 2A04C116D for ; Sat, 25 Jun 2016 19:16:16 +0000 (UTC) (envelope-from iateaca@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u5PJGGoc007436 for ; Sat, 25 Jun 2016 19:16:16 GMT (envelope-from iateaca@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u5PJGFur007429 for svn-soc-all@FreeBSD.org; Sat, 25 Jun 2016 19:16:15 GMT (envelope-from iateaca@FreeBSD.org) Date: Sat, 25 Jun 2016 19:16:15 GMT Message-Id: <201606251916.u5PJGFur007429@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to iateaca@FreeBSD.org using -f From: iateaca@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r305548 - soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 19:16:16 -0000 Author: iateaca Date: Sat Jun 25 19:16:14 2016 New Revision: 305548 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305548 Log: implement the hda_codec_parse_format in order to get the sample rate, bits per sample and no. of channels parameters from the stream format implement the hda_codec_audio_output_do_setup function in order to set the stream parameters in the audio player call do_setup function when the stream is started just before to wake up the thread M bhyve/Makefile M bhyve/hda_codec.c Modified: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/Makefile soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_codec.c Modified: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/Makefile ============================================================================== --- soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/Makefile Sat Jun 25 18:28:22 2016 (r305547) +++ soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/Makefile Sat Jun 25 19:16:14 2016 (r305548) @@ -14,6 +14,7 @@ SRCS= \ atkbdc.c \ acpi.c \ + audio.c \ bhyverun.c \ block_if.c \ bootrom.c \ Modified: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_codec.c ============================================================================== --- soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_codec.c Sat Jun 25 18:28:22 2016 (r305547) +++ soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_codec.c Sat Jun 25 19:16:14 2016 (r305548) @@ -4,6 +4,7 @@ #include #include "pci_hda.h" +#include "audio.h" /* * HDA Codec defines @@ -26,6 +27,23 @@ #define HDA_CODEC_SUPP_STREAM_FORMATS_PCM (1 << HDA_PARAM_SUPP_STREAM_FORMATS_PCM_SHIFT) +#define HDA_CODEC_FMT_BASE_MASK (0x01 << 14) + +#define HDA_CODEC_FMT_MULT_MASK (0x07 << 11) +#define HDA_CODEC_FMT_MULT_2 (0x01 << 11) +#define HDA_CODEC_FMT_MULT_3 (0x02 << 11) +#define HDA_CODEC_FMT_MULT_4 (0x03 << 11) + +#define HDA_CODEC_FMT_DIV_MASK 0x07 +#define HDA_CODEC_FMT_DIV_SHIFT 8 + +#define HDA_CODEC_FMT_BITS_MASK (0x07 << 4) +#define HDA_CODEC_FMT_BITS_8 (0x00 << 4) +#define HDA_CODEC_FMT_BITS_16 (0x01 << 4) +#define HDA_CODEC_FMT_BITS_32 (0x04 << 4) + +#define HDA_CODEC_FMT_CHAN_MASK (0x0f << 0) + #define HDA_CODEC_AUDIO_WCAP_OUTPUT (0x00 << HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_SHIFT) #define HDA_CODEC_AUDIO_WCAP_PIN (0x04 << HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_SHIFT) #define HDA_CODEC_AUDIO_WCAP_CONN_LIST (1 << HDA_PARAM_AUDIO_WIDGET_CAP_CONN_LIST_SHIFT) @@ -57,6 +75,7 @@ */ typedef void (*transfer_func_t)(void *arg); +typedef int (*setup_func_t)(void *arg); struct hda_audio_ctxt { char name[64]; @@ -65,6 +84,7 @@ pthread_mutex_t mtx; pthread_cond_t cond; transfer_func_t do_transfer; + setup_func_t do_setup; void *priv; }; @@ -75,7 +95,7 @@ static void * hda_audio_ctxt_thr(void *arg); static int -hda_audio_ctxt_init(struct hda_audio_ctxt *actx, const char *tname, transfer_func_t do_transfer, void *priv); +hda_audio_ctxt_init(struct hda_audio_ctxt *actx, const char *tname, transfer_func_t do_transfer, setup_func_t do_setup, void *priv); static int hda_audio_ctxt_start(struct hda_audio_ctxt *actx); static int @@ -96,6 +116,7 @@ uint16_t fmt; struct hda_audio_ctxt actx; + struct audio *aud; }; struct hda_codec_softc { @@ -122,10 +143,14 @@ static int hda_codec_notify(struct hda_codec_inst *hci, uint8_t run, uint8_t stream, uint8_t dir); +static int hda_codec_parse_format(uint16_t fmt, struct audio_params *params); + static uint32_t hda_codec_audio_output_nid(struct hda_codec_softc *sc, uint16_t verb, uint16_t payload); static void hda_codec_audio_output_do_transfer(void *arg); +static int +hda_codec_audio_output_do_setup(void *arg); /* * HDA Codec global data @@ -202,6 +227,7 @@ hda_codec_init(struct hda_codec_inst *hci, const char *opts) { struct hda_codec_softc *sc = NULL; + struct hda_codec_stream *st = NULL; int err; DPRINTF("cad: 0x%x opts: %s\n", hci->cad, opts); @@ -219,9 +245,18 @@ sc->verb_handlers = hda_codec_verb_handlers; DPRINTF("HDA Codec nodes: %d\n", sc->no_nodes); - err = hda_audio_ctxt_init(&sc->streams[HDA_CODEC_STREAM_OUTPUT].actx, "hda-audio-output", hda_codec_audio_output_do_transfer, sc); + st = &sc->streams[HDA_CODEC_STREAM_OUTPUT]; + + err = hda_audio_ctxt_init(&st->actx, "hda-audio-output", hda_codec_audio_output_do_transfer, hda_codec_audio_output_do_setup, sc); assert(!err); + /* TODO Get the name of the sound device from the config string */ + st->aud = audio_init("/dev/dsp", 1); + if (!st->aud) { + DPRINTF("Fail to init the output audio player\n"); + return -1; + } + hci->priv = sc; return 0; @@ -333,7 +368,7 @@ DPRINTF("run: %d, stream: 0x%x, dir: %d\n", run, stream, dir); /* TODO search the right stream - * For now, there is only only stream + * For now, there is only one stream */ st = &sc->streams[HDA_CODEC_STREAM_OUTPUT]; @@ -350,6 +385,50 @@ return err; } +static int hda_codec_parse_format(uint16_t fmt, struct audio_params *params) +{ + uint8_t div = 0; + + /* Compute the Sample Rate */ + params->rate = (fmt & HDA_CODEC_FMT_BASE_MASK) ? 44100 : 48000; + + switch (fmt & HDA_CODEC_FMT_MULT_MASK) { + case HDA_CODEC_FMT_MULT_2: + params->rate *= 2; + break; + case HDA_CODEC_FMT_MULT_3: + params->rate *= 3; + break; + case HDA_CODEC_FMT_MULT_4: + params->rate *= 4; + break; + } + + div = (fmt >> HDA_CODEC_FMT_DIV_SHIFT) & HDA_CODEC_FMT_DIV_MASK; + params->rate /= (div + 1); + + /* Compute the Bits per Sample */ + switch (fmt & HDA_CODEC_FMT_BITS_MASK) { + case HDA_CODEC_FMT_BITS_8: + params->format = AFMT_U8; + break; + case HDA_CODEC_FMT_BITS_16: + params->format = AFMT_S16_LE; + break; + case HDA_CODEC_FMT_BITS_32: + params->format = AFMT_S32_LE; + break; + default: + DPRINTF("Unknown format bits: 0x%x\n", fmt & HDA_CODEC_FMT_BITS_MASK); + return -1; + } + + /* Compute the Number of Channels */ + params->channels = (fmt & HDA_CODEC_FMT_CHAN_MASK) + 1; + + return 0; +} + static uint32_t hda_codec_audio_output_nid(struct hda_codec_softc *sc, uint16_t verb, uint16_t payload) { @@ -379,14 +458,46 @@ static void hda_codec_audio_output_do_transfer(void *arg) { - /* - * TODO transfer betweenthe HDA and sound card - */ - DPRINTF("\n"); + struct hda_codec_softc *sc = (struct hda_codec_softc *)arg; + struct hda_codec_stream *st = NULL; + struct audio *aud = NULL; + int err; + + st = &sc->streams[HDA_CODEC_STREAM_OUTPUT]; + aud = st->aud; + + memset(st->buf, 0x31, sizeof(st->buf)); + + err = audio_playback(aud, st->buf, sizeof(st->buf)); + assert(!err); + usleep(20 * 1000); + + DPRINTF("\n"); return; } +static int +hda_codec_audio_output_do_setup(void *arg) +{ + struct hda_codec_softc *sc = (struct hda_codec_softc *)arg; + struct hda_codec_stream *st = NULL; + struct audio *aud = NULL; + struct audio_params params; + int err; + + st = &sc->streams[HDA_CODEC_STREAM_OUTPUT]; + aud = st->aud; + + err = hda_codec_parse_format(st->fmt, ¶ms); + if (err) + return -1; + + DPRINTF("rate: %d, channels: %d, format: 0x%x\n", params.rate, params.channels, params.format); + + return audio_set_params(aud, ¶ms); +} + struct hda_codec_class hda_codec = { .name = "hda_codec", .init = hda_codec_init, @@ -424,19 +535,21 @@ } static int -hda_audio_ctxt_init(struct hda_audio_ctxt *actx, const char *tname, transfer_func_t do_transfer, void *priv) +hda_audio_ctxt_init(struct hda_audio_ctxt *actx, const char *tname, transfer_func_t do_transfer, setup_func_t do_setup, void *priv) { int err; assert(actx); assert(tname); assert(do_transfer); + assert(do_setup); assert(priv); memset(actx, 0, sizeof(*actx)); actx->run = 0; actx->do_transfer = do_transfer; + actx->do_setup = do_setup; actx->priv = priv; if (strlen(tname) < sizeof(actx->name)) memcpy(actx->name, tname, strlen(tname) + 1); @@ -461,16 +574,21 @@ static int hda_audio_ctxt_start(struct hda_audio_ctxt *actx) { + int err = 0; + /* The stream is supposed to be stopped */ if (actx->run) return -1; pthread_mutex_lock(&actx->mtx); - actx->run = 1; - pthread_cond_signal(&actx->cond); + err = actx->do_setup(actx->priv); + if (!err) { + actx->run = 1; + pthread_cond_signal(&actx->cond); + } pthread_mutex_unlock(&actx->mtx); - return 0; + return err; } static int