Date: Thu, 11 Jun 2020 09:36:38 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> 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 Message-ID: <202006110936.05B9acM4031019@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202006110936.05B9acM4031019>