From owner-svn-src-head@freebsd.org Thu May 10 09:37:55 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 1D4A9FC011E; Thu, 10 May 2018 09:37:55 +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 C190D6CAA1; Thu, 10 May 2018 09:37:54 +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 A2C661E961; Thu, 10 May 2018 09:37:54 +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 w4A9bsbw073077; Thu, 10 May 2018 09:37:54 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4A9bsKc073076; Thu, 10 May 2018 09:37:54 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201805100937.w4A9bsKc073076@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Thu, 10 May 2018 09:37:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333456 - head/sys/dev/ena X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/dev/ena X-SVN-Commit-Revision: 333456 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.25 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, 10 May 2018 09:37:55 -0000 Author: mw Date: Thu May 10 09:37:54 2018 New Revision: 333456 URL: https://svnweb.freebsd.org/changeset/base/333456 Log: Do not pass header length to the ENA controller Header length is optional hint for the ENA device. Because It is not guaranteed that every packet header will be in the first mbuf segment, it is better to skip passing any information. If the header length will be indicating invalid value (different than 0), then the packet will be dropped. This kind situation can appear, when the UDP packet will be fragmented by the stack in the ip_fragment() function. Submitted by: Michal Krawczyk Reported by: Krishna Yenduri Obtained from: Semihalf Sponsored by: Amazon, Inc. Modified: head/sys/dev/ena/ena.c Modified: head/sys/dev/ena/ena.c ============================================================================== --- head/sys/dev/ena/ena.c Thu May 10 09:37:50 2018 (r333455) +++ head/sys/dev/ena/ena.c Thu May 10 09:37:54 2018 (r333456) @@ -2742,7 +2742,7 @@ ena_xmit_mbuf(struct ena_ring *tx_ring, struct mbuf ** uint16_t req_id; uint16_t push_len; uint16_t ena_qid; - uint32_t len, nsegs, header_len; + uint32_t nsegs, header_len; int i, rc; int nb_hw_desc; @@ -2766,12 +2766,18 @@ ena_xmit_mbuf(struct ena_ring *tx_ring, struct mbuf ** tx_info->num_of_bufs = 0; ena_buf = tx_info->bufs; - len = (*mbuf)->m_len; ena_trace(ENA_DBG | ENA_TXPTH, "Tx: %d bytes", (*mbuf)->m_pkthdr.len); push_len = 0; - header_len = min_t(uint32_t, len, tx_ring->tx_max_header_size); + /* + * header_len is just a hint for the device. Because FreeBSD is not + * giving us information about packet header length and it is not + * guaranteed that all packet headers will be in the 1st mbuf, setting + * header_len to 0 is making the device ignore this value and resolve + * header on it's own. + */ + header_len = 0; push_hdr = NULL; rc = bus_dmamap_load_mbuf_sg(adapter->tx_buf_tag, tx_info->map,