From owner-svn-src-stable@freebsd.org Thu Jan 14 14:35:48 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE08EA82465; Thu, 14 Jan 2016 14:35:48 +0000 (UTC) (envelope-from arybchik@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 mx1.freebsd.org (Postfix) with ESMTPS id 898741097; Thu, 14 Jan 2016 14:35:48 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u0EEZl84026803; Thu, 14 Jan 2016 14:35:47 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u0EEZlWJ026798; Thu, 14 Jan 2016 14:35:47 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201601141435.u0EEZlWJ026798@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 14 Jan 2016 14:35:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r293945 - stable/10/sys/dev/sfxge/common X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jan 2016 14:35:49 -0000 Author: arybchik Date: Thu Jan 14 14:35:46 2016 New Revision: 293945 URL: https://svnweb.freebsd.org/changeset/base/293945 Log: MFC r291747 sfxge: [EF10] support RxQ scattering control If, for example, a VF is configured to use a 1500 byte MTU, but the port it is attached to is set to 9000 bytes, overlength frames can be received by the VF. As Huntington scatters by default, these overlength packets would be scattered across several descriptors, with all except the last having the CONT bit set. To avoid this, disable scatter when creating RXQs if the firmware supports doing so, which all recent versions do. Then we only get a single descriptor from an overlength frame. This will have the CONT bit set to indicate it was truncated, so we can discard it. Submitted by: Mark Spender Sponsored by: Solarflare Communications, Inc. Modified: stable/10/sys/dev/sfxge/common/efx.h stable/10/sys/dev/sfxge/common/hunt_ev.c stable/10/sys/dev/sfxge/common/hunt_nic.c stable/10/sys/dev/sfxge/common/hunt_rx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sfxge/common/efx.h ============================================================================== --- stable/10/sys/dev/sfxge/common/efx.h Thu Jan 14 14:34:47 2016 (r293944) +++ stable/10/sys/dev/sfxge/common/efx.h Thu Jan 14 14:35:46 2016 (r293945) @@ -1174,6 +1174,7 @@ typedef struct efx_nic_cfg_s { boolean_t enc_hw_tx_insert_vlan_enabled; /* Datapath firmware vadapter/vport/vswitch support */ boolean_t enc_datapath_cap_evb; + boolean_t enc_rx_disable_scatter_supported; /* External port identifier */ uint8_t enc_external_port; } efx_nic_cfg_t; Modified: stable/10/sys/dev/sfxge/common/hunt_ev.c ============================================================================== --- stable/10/sys/dev/sfxge/common/hunt_ev.c Thu Jan 14 14:34:47 2016 (r293944) +++ stable/10/sys/dev/sfxge/common/hunt_ev.c Thu Jan 14 14:35:46 2016 (r293945) @@ -528,10 +528,14 @@ hunt_ev_rx( if (EFX_QWORD_FIELD(*eqp, ESF_DZ_RX_CONT) != 0) { /* + * This may be part of a scattered frame, or it may be a + * truncated frame if scatter is disabled on this RXQ. + * Overlength frames can be received if e.g. a VF is configured + * for 1500 MTU but connected to a port set to 9000 MTU + * (see bug56567). * FIXME: There is not yet any driver that supports scatter on * Huntington. Scatter support is required for OSX. */ - EFSYS_ASSERT(0); flags |= EFX_PKT_CONT; } Modified: stable/10/sys/dev/sfxge/common/hunt_nic.c ============================================================================== --- stable/10/sys/dev/sfxge/common/hunt_nic.c Thu Jan 14 14:34:47 2016 (r293944) +++ stable/10/sys/dev/sfxge/common/hunt_nic.c Thu Jan 14 14:35:46 2016 (r293945) @@ -920,6 +920,14 @@ hunt_get_datapath_caps( encp->enc_rx_batching_enabled = B_FALSE; } + /* Check if the firmware supports disabling scatter on RXQs */ + if (MCDI_CMD_DWORD_FIELD(&datapath_capabilities, + GET_CAPABILITIES_OUT_RX_DISABLE_SCATTER) == 1) { + encp->enc_rx_disable_scatter_supported = B_TRUE; + } else { + encp->enc_rx_disable_scatter_supported = B_FALSE; + } + return (0); fail2: Modified: stable/10/sys/dev/sfxge/common/hunt_rx.c ============================================================================== --- stable/10/sys/dev/sfxge/common/hunt_rx.c Thu Jan 14 14:34:47 2016 (r293944) +++ stable/10/sys/dev/sfxge/common/hunt_rx.c Thu Jan 14 14:35:46 2016 (r293945) @@ -46,7 +46,8 @@ efx_mcdi_init_rxq( __in uint32_t target_evq, __in uint32_t label, __in uint32_t instance, - __in efsys_mem_t *esmp) + __in efsys_mem_t *esmp, + __in boolean_t disable_scatter) { efx_mcdi_req_t req; uint8_t payload[ @@ -71,12 +72,13 @@ efx_mcdi_init_rxq( MCDI_IN_SET_DWORD(req, INIT_RXQ_IN_TARGET_EVQ, target_evq); MCDI_IN_SET_DWORD(req, INIT_RXQ_IN_LABEL, label); MCDI_IN_SET_DWORD(req, INIT_RXQ_IN_INSTANCE, instance); - MCDI_IN_POPULATE_DWORD_5(req, INIT_RXQ_IN_FLAGS, - INIT_RXQ_IN_FLAG_BUFF_MODE, 0, - INIT_RXQ_IN_FLAG_HDR_SPLIT, 0, - INIT_RXQ_IN_FLAG_TIMESTAMP, 0, - INIT_RXQ_IN_CRC_MODE, 0, - INIT_RXQ_IN_FLAG_PREFIX, 1); + MCDI_IN_POPULATE_DWORD_6(req, INIT_RXQ_IN_FLAGS, + INIT_RXQ_IN_FLAG_BUFF_MODE, 0, + INIT_RXQ_IN_FLAG_HDR_SPLIT, 0, + INIT_RXQ_IN_FLAG_TIMESTAMP, 0, + INIT_RXQ_IN_CRC_MODE, 0, + INIT_RXQ_IN_FLAG_PREFIX, 1, + INIT_RXQ_IN_FLAG_DISABLE_SCATTER, disable_scatter); MCDI_IN_SET_DWORD(req, INIT_RXQ_IN_OWNER_ID, 0); MCDI_IN_SET_DWORD(req, INIT_RXQ_IN_PORT_ID, EVB_PORT_ID_ASSIGNED); @@ -685,6 +687,7 @@ hunt_rx_qcreate( { efx_nic_cfg_t *encp = &(enp->en_nic_cfg); efx_rc_t rc; + boolean_t disable_scatter; _NOTE(ARGUNUSED(erp)) @@ -704,14 +707,21 @@ hunt_rx_qcreate( goto fail2; } + /* Scatter can only be disabled if the firmware supports doing so */ + if ((type != EFX_RXQ_TYPE_SCATTER) && + enp->en_nic_cfg.enc_rx_disable_scatter_supported) { + disable_scatter = B_TRUE; + } else { + disable_scatter = B_FALSE; + } + /* - * FIXME: Siena code handles different queue types (default, header - * split, scatter); we'll need to do something more here later, but - * all that stuff is TBD for now. + * Note: EFX_RXQ_TYPE_SPLIT_HEADER and EFX_RXQ_TYPE_SPLIT_PAYLOAD are + * not supported here. */ if ((rc = efx_mcdi_init_rxq(enp, n, eep->ee_index, label, index, - esmp)) != 0) + esmp, disable_scatter)) != 0) goto fail3; erp->er_eep = eep;