From owner-svn-src-head@freebsd.org Tue Aug 28 17:09:42 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38D331091DE6; Tue, 28 Aug 2018 17:09:42 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D91E68D101; Tue, 28 Aug 2018 17:09:41 +0000 (UTC) (envelope-from mw@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 9DEEA7A8E; Tue, 28 Aug 2018 17:09:41 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w7SH9fRR062598; Tue, 28 Aug 2018 17:09:41 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w7SH9fQK062597; Tue, 28 Aug 2018 17:09:41 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201808281709.w7SH9fQK062597@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Tue, 28 Aug 2018 17:09:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338351 - head/sys/dev/al_eth X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/dev/al_eth X-SVN-Commit-Revision: 338351 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Aug 2018 17:09:42 -0000 Author: mw Date: Tue Aug 28 17:09:41 2018 New Revision: 338351 URL: https://svnweb.freebsd.org/changeset/base/338351 Log: Use ip/ipv6 structures in al_eth only if they are supported The ip/ipv6 header files are included only if the appropriate definition exists, but the driver was missing similar checks when using the ip and ip6_hdr structures. If the kernel was not built with the INET or INET6 option, the driver was preventing kernel from being built. To fix that, the missing ifdef checks were added to the driver. PR: Bug 230886 Submitted by: Michal Krawczyk Reported by: O. Hartmann Approved by: re (gjb) Obtained from: Semihalf MFC after: 1 week Sponsored by: Amazon, Inc. Modified: head/sys/dev/al_eth/al_eth.c Modified: head/sys/dev/al_eth/al_eth.c ============================================================================== --- head/sys/dev/al_eth/al_eth.c Tue Aug 28 15:18:14 2018 (r338350) +++ head/sys/dev/al_eth/al_eth.c Tue Aug 28 17:09:41 2018 (r338351) @@ -1202,8 +1202,12 @@ al_eth_tx_csum(struct al_eth_ring *tx_ring, struct al_ uint32_t mss = m->m_pkthdr.tso_segsz; struct ether_vlan_header *eh; uint16_t etype; +#ifdef INET struct ip *ip; +#endif +#ifdef INET6 struct ip6_hdr *ip6; +#endif struct tcphdr *th = NULL; int ehdrlen, ip_hlen = 0; uint8_t ipproto = 0; @@ -1243,6 +1247,7 @@ al_eth_tx_csum(struct al_eth_ring *tx_ring, struct al_ } switch (etype) { +#ifdef INET case ETHERTYPE_IP: ip = (struct ip *)(m->m_data + ehdrlen); ip_hlen = ip->ip_hl << 2; @@ -1256,6 +1261,8 @@ al_eth_tx_csum(struct al_eth_ring *tx_ring, struct al_ else hal_pkt->l4_proto_idx = AL_ETH_PROTO_ID_UDP; break; +#endif /* INET */ +#ifdef INET6 case ETHERTYPE_IPV6: ip6 = (struct ip6_hdr *)(m->m_data + ehdrlen); hal_pkt->l3_proto_idx = AL_ETH_PROTO_ID_IPv6; @@ -1267,6 +1274,7 @@ al_eth_tx_csum(struct al_eth_ring *tx_ring, struct al_ else hal_pkt->l4_proto_idx = AL_ETH_PROTO_ID_UDP; break; +#endif /* INET6 */ default: break; }