From owner-svn-ports-all@freebsd.org Tue Feb 9 02:51:03 2021 Return-Path: Delivered-To: svn-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 515C252C644; Tue, 9 Feb 2021 02:51:03 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DZS7q1WPHz3pZr; Tue, 9 Feb 2021 02:51:03 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 26EBA2297D; Tue, 9 Feb 2021 02:51:03 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 1192p25D046526; Tue, 9 Feb 2021 02:51:02 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 1192p2ek046523; Tue, 9 Feb 2021 02:51:02 GMT (envelope-from philip@FreeBSD.org) Message-Id: <202102090251.1192p2ek046523@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Tue, 9 Feb 2021 02:51:02 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r564758 - in head/net/aquantia-atlantic-kmod: . files X-SVN-Group: ports-head X-SVN-Commit-Author: philip X-SVN-Commit-Paths: in head/net/aquantia-atlantic-kmod: . files X-SVN-Commit-Revision: 564758 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Feb 2021 02:51:03 -0000 Author: philip Date: Tue Feb 9 02:51:02 2021 New Revision: 564758 URL: https://svnweb.freebsd.org/changeset/ports/564758 Log: net/aquantia-atlantic-kmod: Fix build on CURRENT This patch enables the port to build a working if_atlantic.ko on 13-CURRENT, broken since r353868 (Git commit 19e09f447fd9), where the `if_multi_apply` and `if_multiaddr_count` KPIs were removed. PR: 252642 Submitted by: Michael Chiu Approved by: koobs (maintainer) MFH: 2021Q1 (blanket: build fix) Differential_Revision: https://reviews.freebsd.org/D28135 Added: head/net/aquantia-atlantic-kmod/files/ head/net/aquantia-atlantic-kmod/files/patch-aq__hw.c (contents, props changed) head/net/aquantia-atlantic-kmod/files/patch-aq__main.c (contents, props changed) Modified: head/net/aquantia-atlantic-kmod/Makefile (contents, props changed) Modified: head/net/aquantia-atlantic-kmod/Makefile ============================================================================== --- head/net/aquantia-atlantic-kmod/Makefile Tue Feb 9 02:49:26 2021 (r564757) +++ head/net/aquantia-atlantic-kmod/Makefile Tue Feb 9 02:51:02 2021 (r564758) @@ -2,6 +2,7 @@ PORTNAME= aquantia-atlantic-kmod PORTVERSION= 0.0.5 +PORTREVISION= 1 CATEGORIES= net MAINTAINER= koobs@FreeBSD.org Added: head/net/aquantia-atlantic-kmod/files/patch-aq__hw.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/aquantia-atlantic-kmod/files/patch-aq__hw.c Tue Feb 9 02:51:02 2021 (r564758) @@ -0,0 +1,30 @@ +Upstream PR: +https://github.com/Aquantia/aqtion-freebsd/pull/11 + +--- aq_hw.c.orig 2019-09-24 14:45:34 UTC ++++ aq_hw.c +@@ -160,7 +160,7 @@ static int aq_hw_init_ucp(struct aq_hw *hw) + unsigned int rnd = 0; + unsigned int ucp_0x370 = 0; + +- rnd = random(); ++ rnd = arc4random(); + + ucp_0x370 = 0x02020202 | (0xFEFEFEFE & rnd); + AQ_WRITE_REG(hw, AQ_HW_UCP_0X370_REG, ucp_0x370); +@@ -307,7 +307,6 @@ int aq_hw_get_mac_permanent(struct aq_hw *hw, u8 *mac + + /* Couldn't get MAC address from HW. Use auto-generated one. */ + if ((mac[0] & 1) || ((mac[0] | mac[1] | mac[2]) == 0)) { +- u64 seed = get_cyclecount(); + u16 rnd; + u32 h = 0; + u32 l = 0; +@@ -315,7 +314,6 @@ int aq_hw_get_mac_permanent(struct aq_hw *hw, u8 *mac + printf("atlantic: HW MAC address %x:%x:%x:%x:%x:%x is multicast or empty MAC", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); + printf("atlantic: Use random MAC address"); + +- srandom(seed); + rnd = random(); + + /* chip revision */ Added: head/net/aquantia-atlantic-kmod/files/patch-aq__main.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/aquantia-atlantic-kmod/files/patch-aq__main.c Tue Feb 9 02:51:02 2021 (r564758) @@ -0,0 +1,61 @@ +Upstream PR: +https://github.com/Aquantia/aqtion-freebsd/pull/11 + +--- aq_main.c.orig 2019-09-24 14:45:34 UTC ++++ aq_main.c +@@ -735,6 +735,23 @@ static uint64_t aq_if_get_counter(if_ctx_t ctx, ift_co + } + } + ++#if __FreeBSD_version >= 1300054 ++static u_int aq_mc_filter_apply(void *arg, struct sockaddr_dl *dl, int count) ++{ ++ struct aq_dev *softc = arg; ++ struct aq_hw *hw = &softc->hw; ++ u8 *mac_addr = NULL; ++ ++ if (count == AQ_HW_MAC_MAX) ++ return (0); ++ ++ mac_addr = LLADDR(dl); ++ aq_hw_mac_addr_set(hw, mac_addr, count + 1); ++ ++ aq_log_detail("set %d mc address %6D", count + 1, mac_addr, ":"); ++ return (1); ++} ++#else + static int aq_mc_filter_apply(void *arg, struct ifmultiaddr *ifma, int count) + { + struct aq_dev *softc = arg; +@@ -752,6 +769,7 @@ static int aq_mc_filter_apply(void *arg, struct ifmult + aq_log_detail("set %d mc address %6D", count + 1, mac_addr, ":"); + return (1); + } ++#endif + + static bool aq_is_mc_promisc_required(struct aq_dev *softc) + { +@@ -764,15 +782,22 @@ static void aq_if_multi_set(if_ctx_t ctx) + struct ifnet *ifp = iflib_get_ifp(ctx); + struct aq_hw *hw = &softc->hw; + AQ_DBG_ENTER(); +- ++#if __FreeBSD_version >= 1300054 ++ softc->mcnt = if_llmaddr_count(iflib_get_ifp(ctx)); ++#else + softc->mcnt = if_multiaddr_count(iflib_get_ifp(ctx), AQ_HW_MAC_MAX); ++#endif + if (softc->mcnt >= AQ_HW_MAC_MAX) + { + aq_hw_set_promisc(hw, !!(ifp->if_flags & IFF_PROMISC), + aq_is_vlan_promisc_required(softc), + !!(ifp->if_flags & IFF_ALLMULTI) || aq_is_mc_promisc_required(softc)); + }else{ ++#if __FreeBSD_version >= 1300054 ++ if_foreach_llmaddr(iflib_get_ifp(ctx), aq_mc_filter_apply, softc); ++#else + if_multi_apply(iflib_get_ifp(ctx), aq_mc_filter_apply, softc); ++#endif + } + AQ_DBG_EXIT(0); + }