From owner-svn-src-head@freebsd.org Thu Jun 11 09:36:38 2020 Return-Path: Delivered-To: svn-src-head@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 DCE29328920; Thu, 11 Jun 2020 09:36:38 +0000 (UTC) (envelope-from hselasky@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 "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jJdy5bHmz4K0w; Thu, 11 Jun 2020 09:36:38 +0000 (UTC) (envelope-from hselasky@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 BB144160A0; Thu, 11 Jun 2020 09:36:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05B9acDg031022; Thu, 11 Jun 2020 09:36:38 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05B9acM4031019; Thu, 11 Jun 2020 09:36:38 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202006110936.05B9acM4031019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 11 Jun 2020 09:36:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362043 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 362043 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.33 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: Thu, 11 Jun 2020 09:36:38 -0000 Author: hselasky Date: Thu Jun 11 09:36:37 2020 New Revision: 362043 URL: https://svnweb.freebsd.org/changeset/base/362043 Log: Use const keyword when parsing the TCP/IP header in the fast path in mlx5en(4). When parsing the TCP/IP header in the fast path, make it clear by using the const keyword, no fields are to be modified inside the transmitted packet. No functional change. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Modified: head/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- head/sys/dev/mlx5/mlx5_en/en.h Thu Jun 11 05:34:31 2020 (r362042) +++ head/sys/dev/mlx5/mlx5_en/en.h Thu Jun 11 09:36:37 2020 (r362043) @@ -1105,7 +1105,7 @@ struct mlx5e_eeprom { #define MLX5E_FLD_MAX(typ, fld) ((1ULL << __mlx5_bit_sz(typ, fld)) - 1ULL) bool mlx5e_do_send_cqe(struct mlx5e_sq *); -int mlx5e_get_full_header_size(struct mbuf *, struct tcphdr **); +int mlx5e_get_full_header_size(const struct mbuf *, const struct tcphdr **); int mlx5e_xmit(struct ifnet *, struct mbuf *); int mlx5e_open_locked(struct ifnet *); Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c Thu Jun 11 05:34:31 2020 (r362042) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c Thu Jun 11 09:36:37 2020 (r362043) @@ -689,7 +689,7 @@ mlx5e_sq_tls_xmit(struct mlx5e_sq *sq, struct mlx5e_xm { struct mlx5e_tls_tag *ptls_tag; struct mlx5e_snd_tag *ptag; - struct tcphdr *th; + const struct tcphdr *th; struct mbuf *mb = *ppmb; u64 rcd_sn; u32 header_size; Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Thu Jun 11 05:34:31 2020 (r362042) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Thu Jun 11 09:36:37 2020 (r362043) @@ -245,17 +245,17 @@ max_inline: * this function returns zero, the parsing failed. */ int -mlx5e_get_full_header_size(struct mbuf *mb, struct tcphdr **ppth) +mlx5e_get_full_header_size(const struct mbuf *mb, const struct tcphdr **ppth) { - struct ether_vlan_header *eh; - struct tcphdr *th; - struct ip *ip; + const struct ether_vlan_header *eh; + const struct tcphdr *th; + const struct ip *ip; int ip_hlen, tcp_hlen; - struct ip6_hdr *ip6; + const struct ip6_hdr *ip6; uint16_t eth_type; int eth_hdr_len; - eh = mtod(mb, struct ether_vlan_header *); + eh = mtod(mb, const struct ether_vlan_header *); if (mb->m_len < ETHER_HDR_LEN) goto failure; if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN)) { @@ -270,7 +270,7 @@ mlx5e_get_full_header_size(struct mbuf *mb, struct tcp switch (eth_type) { case ETHERTYPE_IP: - ip = (struct ip *)(mb->m_data + eth_hdr_len); + ip = (const struct ip *)(mb->m_data + eth_hdr_len); if (mb->m_len < eth_hdr_len + sizeof(*ip)) goto failure; switch (ip->ip_p) { @@ -288,7 +288,7 @@ mlx5e_get_full_header_size(struct mbuf *mb, struct tcp } break; case ETHERTYPE_IPV6: - ip6 = (struct ip6_hdr *)(mb->m_data + eth_hdr_len); + ip6 = (const struct ip6_hdr *)(mb->m_data + eth_hdr_len); if (mb->m_len < eth_hdr_len + sizeof(*ip6)) goto failure; switch (ip6->ip6_nxt) { @@ -309,7 +309,7 @@ mlx5e_get_full_header_size(struct mbuf *mb, struct tcp tcp_packet: if (mb->m_len < eth_hdr_len + sizeof(*th)) goto failure; - th = (struct tcphdr *)(mb->m_data + eth_hdr_len); + th = (const struct tcphdr *)(mb->m_data + eth_hdr_len); tcp_hlen = th->th_off << 2; eth_hdr_len += tcp_hlen; udp_packet: