From owner-svn-src-stable@freebsd.org Tue Sep 3 14:05:47 2019 Return-Path: Delivered-To: svn-src-stable@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 EFEE1DBE45; Tue, 3 Sep 2019 14:05:46 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46N7yf5Tmgz4NqB; Tue, 3 Sep 2019 14:05:46 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1452) id 8AB4B19B2A; Tue, 3 Sep 2019 14:05:46 +0000 (UTC) X-Original-To: yuripv@localmail.freebsd.org Delivered-To: yuripv@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id 543C11ED42; Wed, 27 Mar 2019 19:47:25 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 245E48C56F; Wed, 27 Mar 2019 19:47:25 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 538) id 0BD961ED41; Wed, 27 Mar 2019 19:47:25 +0000 (UTC) Delivered-To: src-committers@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id 7B5001ED3F for ; Wed, 27 Mar 2019 19:47:22 +0000 (UTC) (envelope-from np@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) server-signature RSA-PSS (4096 bits) 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 4907B8C56C; Wed, 27 Mar 2019 19:47:22 +0000 (UTC) (envelope-from np@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 21FBABFDD; Wed, 27 Mar 2019 19:47:22 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2RJlMLr083579; Wed, 27 Mar 2019 19:47:22 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2RJlM3V083578; Wed, 27 Mar 2019 19:47:22 GMT (envelope-from np@FreeBSD.org) Message-Id: <201903271947.x2RJlM3V083578@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r345599 - stable/12/sys/dev/cxgbe X-SVN-Group: stable-12 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/12/sys/dev/cxgbe X-SVN-Commit-Revision: 345599 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk X-Loop: FreeBSD.org Sender: owner-src-committers@freebsd.org X-Rspamd-Queue-Id: 245E48C56F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.993,0]; NEURAL_HAM_SHORT(-0.98)[-0.981,0]; ASN(0.00)[asn:11403, ipnet:96.47.64.0/20, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Status: O X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Tue, 03 Sep 2019 14:05:47 -0000 X-Original-Date: Wed, 27 Mar 2019 19:47:22 +0000 (UTC) X-List-Received-Date: Tue, 03 Sep 2019 14:05:47 -0000 Author: np Date: Wed Mar 27 19:47:21 2019 New Revision: 345599 URL: https://svnweb.freebsd.org/changeset/base/345599 Log: MFC r339967: cxgbe(4): Add rate limiting support for UDP. Sponsored by: Chelsio Communications Modified: stable/12/sys/dev/cxgbe/t4_sge.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/cxgbe/t4_sge.c ============================================================================== --- stable/12/sys/dev/cxgbe/t4_sge.c Wed Mar 27 19:42:24 2019 (r345598) +++ stable/12/sys/dev/cxgbe/t4_sge.c Wed Mar 27 19:47:21 2019 (r345599) @@ -5628,10 +5628,6 @@ write_ethofld_wr(struct cxgbe_snd_tag *cst, struct fw_ m0->m_pkthdr.l4hlen > 0, ("%s: ethofld mbuf %p is missing header lengths", __func__, m0)); - if (needs_udp_csum(m0)) { - CXGBE_UNIMPLEMENTED("UDP ethofld"); - } - len16 = mbuf_eo_len16(m0); nsegs = mbuf_eo_nsegs(m0); pktlen = m0->m_pkthdr.len; @@ -5646,37 +5642,52 @@ write_ethofld_wr(struct cxgbe_snd_tag *cst, struct fw_ wr->equiq_to_len16 = htobe32(V_FW_WR_LEN16(len16) | V_FW_WR_FLOWID(cst->etid)); wr->r3 = 0; - wr->u.tcpseg.type = FW_ETH_TX_EO_TYPE_TCPSEG; - wr->u.tcpseg.ethlen = m0->m_pkthdr.l2hlen; - wr->u.tcpseg.iplen = htobe16(m0->m_pkthdr.l3hlen); - wr->u.tcpseg.tcplen = m0->m_pkthdr.l4hlen; - wr->u.tcpseg.tsclk_tsoff = mbuf_eo_tsclk_tsoff(m0); - wr->u.tcpseg.r4 = 0; - wr->u.tcpseg.r5 = 0; - wr->u.tcpseg.plen = htobe32(pktlen - immhdrs); + if (needs_udp_csum(m0)) { + wr->u.udpseg.type = FW_ETH_TX_EO_TYPE_UDPSEG; + wr->u.udpseg.ethlen = m0->m_pkthdr.l2hlen; + wr->u.udpseg.iplen = htobe16(m0->m_pkthdr.l3hlen); + wr->u.udpseg.udplen = m0->m_pkthdr.l4hlen; + wr->u.udpseg.rtplen = 0; + wr->u.udpseg.r4 = 0; + wr->u.udpseg.mss = htobe16(pktlen - immhdrs); + wr->u.udpseg.schedpktsize = wr->u.udpseg.mss; + wr->u.udpseg.plen = htobe32(pktlen - immhdrs); + cpl = (void *)(wr + 1); + } else { + MPASS(needs_tcp_csum(m0)); + wr->u.tcpseg.type = FW_ETH_TX_EO_TYPE_TCPSEG; + wr->u.tcpseg.ethlen = m0->m_pkthdr.l2hlen; + wr->u.tcpseg.iplen = htobe16(m0->m_pkthdr.l3hlen); + wr->u.tcpseg.tcplen = m0->m_pkthdr.l4hlen; + wr->u.tcpseg.tsclk_tsoff = mbuf_eo_tsclk_tsoff(m0); + wr->u.tcpseg.r4 = 0; + wr->u.tcpseg.r5 = 0; + wr->u.tcpseg.plen = htobe32(pktlen - immhdrs); - if (needs_tso(m0)) { - struct cpl_tx_pkt_lso_core *lso = (void *)(wr + 1); + if (needs_tso(m0)) { + struct cpl_tx_pkt_lso_core *lso = (void *)(wr + 1); - wr->u.tcpseg.mss = htobe16(m0->m_pkthdr.tso_segsz); + wr->u.tcpseg.mss = htobe16(m0->m_pkthdr.tso_segsz); - ctrl = V_LSO_OPCODE(CPL_TX_PKT_LSO) | F_LSO_FIRST_SLICE | - F_LSO_LAST_SLICE | V_LSO_IPHDR_LEN(m0->m_pkthdr.l3hlen >> 2) - | V_LSO_TCPHDR_LEN(m0->m_pkthdr.l4hlen >> 2); - if (m0->m_pkthdr.l2hlen == sizeof(struct ether_vlan_header)) - ctrl |= V_LSO_ETHHDR_LEN(1); - if (m0->m_pkthdr.l3hlen == sizeof(struct ip6_hdr)) - ctrl |= F_LSO_IPV6; - lso->lso_ctrl = htobe32(ctrl); - lso->ipid_ofst = htobe16(0); - lso->mss = htobe16(m0->m_pkthdr.tso_segsz); - lso->seqno_offset = htobe32(0); - lso->len = htobe32(pktlen); + ctrl = V_LSO_OPCODE(CPL_TX_PKT_LSO) | + F_LSO_FIRST_SLICE | F_LSO_LAST_SLICE | + V_LSO_IPHDR_LEN(m0->m_pkthdr.l3hlen >> 2) | + V_LSO_TCPHDR_LEN(m0->m_pkthdr.l4hlen >> 2); + if (m0->m_pkthdr.l2hlen == sizeof(struct ether_vlan_header)) + ctrl |= V_LSO_ETHHDR_LEN(1); + if (m0->m_pkthdr.l3hlen == sizeof(struct ip6_hdr)) + ctrl |= F_LSO_IPV6; + lso->lso_ctrl = htobe32(ctrl); + lso->ipid_ofst = htobe16(0); + lso->mss = htobe16(m0->m_pkthdr.tso_segsz); + lso->seqno_offset = htobe32(0); + lso->len = htobe32(pktlen); - cpl = (void *)(lso + 1); - } else { - wr->u.tcpseg.mss = htobe16(0xffff); - cpl = (void *)(wr + 1); + cpl = (void *)(lso + 1); + } else { + wr->u.tcpseg.mss = htobe16(0xffff); + cpl = (void *)(wr + 1); + } } /* Checksum offload must be requested for ethofld. */ @@ -5695,7 +5706,7 @@ write_ethofld_wr(struct cxgbe_snd_tag *cst, struct fw_ cpl->len = htobe16(pktlen); cpl->ctrl1 = htobe64(ctrl1); - /* Copy Ethernet, IP & TCP hdrs as immediate data */ + /* Copy Ethernet, IP & TCP/UDP hdrs as immediate data */ p = (uintptr_t)(cpl + 1); m_copydata(m0, 0, immhdrs, (void *)p);