From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id DE9ABA04AB; Fri, 8 Nov 2019 20:28:59 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8BB7B1D14D; Fri, 8 Nov 2019 20:28:58 +0100 (CET) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by dpdk.org (Postfix) with ESMTP id EFE571D148 for ; Fri, 8 Nov 2019 20:28:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573241336; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=5mgtdCzskrkc+ShDfMYKMNNuJ7ZiALdgPDzuWcXd66g=; b=QCSZzy1wmqWMpCbjJJoNLQj5Xq6+ZvpImh0TPHDOaNZzxWuPYQGNAVwz78olMX4Lmy0zIk uJumUV0QywTAqdlxBPPMssJdHuaEUXF4SCWRxkGEyPsGOLppg34eIlYA8vQrBiVXaIOD6A IhpGbcEbSQNUZKU5fE7sTRLvSEQ2nSU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-190-7APgExlFPxeBSSUeH9PvGQ-1; Fri, 08 Nov 2019 14:28:53 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A7132800C72; Fri, 8 Nov 2019 19:28:51 +0000 (UTC) Received: from [10.36.118.56] (unknown [10.36.118.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C22A1A7E2; Fri, 8 Nov 2019 19:28:48 +0000 (UTC) To: Xiao Zhang , dev@dpdk.org Cc: beilei.xing@intel.com, qi.z.zhang@intel.com, ian.stokes@intel.com, stable@dpdk.org, Andrew Rybchenko , "Yigit, Ferruh" , "thomas@monjalon.net" , Xiaolong Ye References: <1571039632-5524-1-git-send-email-xiao.zhang@intel.com> <1572325942-72488-1-git-send-email-xiao.zhang@intel.com> From: Kevin Traynor Autocrypt: addr=ktraynor@redhat.com; keydata= mQINBF2J2awBEADUEPNhgNI+nJNgiTAUcw4YIgVXEoHlsNPyyzG1BEXkWXALy0Y3fNTiw6+r ltWDkF9jzL9kfkecgQ67itGfk1OaBXgSGKuw1PUpxAwX2Bi76LAR6M5OsyGM9TSVVQwARalz hMwRBIZPzPc7or6Pw7jAOJ8SQGJ1Zlp1YJCjrvpe87V1tH/LY8Wnxn/EuoseFmWILAQZAtYS tGjcrAgYn3SPMLR1B0BP5bTBY06vWQjiufH8drenfDnMJAzuBdG1mqjnTqCjULZ3Hunv4xqZ aMnkvL/K5Tj1c12Oe4930EE53LrXIBUltRg5mBudSWHnC7twjH0082HH9f963Z/2UI63SFIT iUvRvAzJYytgy7XnWLQ0+goZBADKYfolOuC0H8VgCaux8u8KFF28Dy+N6TV2KI58jTlyg1Zu l7QwykZpnOkJFiy37Gfbu3YEOzO72cP/S7/A+zvuqkxi63jyEkd+FY99vLt/HN2MUZwRmKDw UPbLkmrs8WU01/POVsqDcfvz7vu2St8hqqTiSIdQGS2zyTKB2/DvPSM3jws3udkIYSuhn+X4 QBiV6lkVZ7DSE6a065gnAauAql+b32Eymy+xnG5jCt1tR+0Cp2VZYCR9OU2gmomUKBDoX/He pSgED01CqYPNjN+TddirwmQX7ep4DtXc8FWvv2g/pq9WZFQk2QARAQABtCNLZXZpbiBUcmF5 bm9yIDxrdHJheW5vckByZWRoYXQuY29tPokCTgQTAQgAOBYhBAoiOaH51tHF7VYtEI9CINER a+yJBQJdidmsAhsDBQ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laDaoIjTJk9YYv3iwCsqPd5feU= Message-ID: <39c0da13-5bd4-8dd2-ac09-a6ef5c1e3380@redhat.com> Date: Fri, 8 Nov 2019 19:28:47 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <1572325942-72488-1-git-send-email-xiao.zhang@intel.com> Content-Language: en-US X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: 7APgExlFPxeBSSUeH9PvGQ-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [v3] net/i40e: fix vlan packets drop X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Xiao, On 29/10/2019 05:12, Xiao Zhang wrote: > VLAN packets with ip length bigger than 1496 will not be received by > i40e/i40evf due to wrong packets size checking. This patch fixes the > issue by correcting the maximum frame size during checking. >=20 > Fixes: 43e5488c0ac6 ("net/i40e: support MTU configuration") > Cc: stable@dpdk.org >=20 > Signed-off-by: Xiao Zhang > --- > v3 > Checking more places using max packet len. > v2 > Add fix for i40evf and correct the checking when using the max_pkt_len. > --- > drivers/net/i40e/i40e_ethdev.c | 2 +- > drivers/net/i40e/i40e_ethdev_vf.c | 11 +++++++---- > drivers/net/i40e/i40e_fdir.c | 2 +- > drivers/net/i40e/i40e_rxtx.c | 9 ++++++--- > lib/librte_ethdev/rte_ethdev.c | 10 ++++++++-- > lib/librte_net/rte_ether.h | 1 + > 6 files changed, 24 insertions(+), 11 deletions(-) >=20 > diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethde= v.c > index 77a4683..b0e23c7 100644 > --- a/drivers/net/i40e/i40e_ethdev.c > +++ b/drivers/net/i40e/i40e_ethdev.c > @@ -12105,7 +12105,7 @@ i40e_dev_mtu_set(struct rte_eth_dev *dev, uint16_= t mtu) > =09=09return -EBUSY; > =09} > =20 > -=09if (frame_size > RTE_ETHER_MAX_LEN) > +=09if (frame_size > RTE_ETHER_MAX_LEN + I40E_VLAN_TAG_SIZE * 2) > =09=09dev_data->dev_conf.rxmode.offloads |=3D > =09=09=09DEV_RX_OFFLOAD_JUMBO_FRAME; > =09else > diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_et= hdev_vf.c > index 5dba092..1e0b50f 100644 > --- a/drivers/net/i40e/i40e_ethdev_vf.c > +++ b/drivers/net/i40e/i40e_ethdev_vf.c > @@ -1772,7 +1772,8 @@ i40evf_rxq_init(struct rte_eth_dev *dev, struct i40= e_rx_queue *rxq) > =09 * Check if the jumbo frame and maximum packet length are set correct= ly > =09 */ > =09if (dev_data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) = { > -=09=09if (rxq->max_pkt_len <=3D RTE_ETHER_MAX_LEN || > +=09=09if (rxq->max_pkt_len <=3D RTE_ETHER_MAX_LEN + > +=09=09=09=09I40E_VLAN_TAG_SIZE * 2 || > =09=09 rxq->max_pkt_len > I40E_FRAME_SIZE_MAX) { > =09=09=09PMD_DRV_LOG(ERR, "maximum packet length must be " > =09=09=09=09"larger than %u and smaller than %u, as jumbo " The log needs to be match the check > @@ -1782,12 +1783,14 @@ i40evf_rxq_init(struct rte_eth_dev *dev, struct i= 40e_rx_queue *rxq) > =09=09} > =09} else { > =09=09if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN || > -=09=09 rxq->max_pkt_len > RTE_ETHER_MAX_LEN) { > +=09=09 rxq->max_pkt_len > RTE_ETHER_MAX_LEN + > +=09=09=09=09I40E_VLAN_TAG_SIZE * 2) { > =09=09=09PMD_DRV_LOG(ERR, "maximum packet length must be " > =09=09=09=09"larger than %u and smaller than %u, as jumbo " > =09=09=09=09"frame is disabled", > =09=09=09=09(uint32_t)RTE_ETHER_MIN_LEN, > -=09=09=09=09(uint32_t)RTE_ETHER_MAX_LEN); > +=09=09=09=09(uint32_t)RTE_ETHER_MAX_LEN + > +=09=09=09=09=09I40E_VLAN_TAG_SIZE * 2); > =09=09=09return I40E_ERR_CONFIG; > =09=09} > =09} > @@ -2747,7 +2750,7 @@ i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_= t mtu) > =09=09return -EBUSY; > =09} > =20 > -=09if (frame_size > RTE_ETHER_MAX_LEN) > +=09if (frame_size > RTE_ETHER_MAX_LEN + I40E_VLAN_TAG_SIZE * 2) > =09=09dev_data->dev_conf.rxmode.offloads |=3D > =09=09=09DEV_RX_OFFLOAD_JUMBO_FRAME; > =09else > diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c > index dee007d..8b813cb 100644 > --- a/drivers/net/i40e/i40e_fdir.c > +++ b/drivers/net/i40e/i40e_fdir.c > @@ -113,7 +113,7 @@ i40e_fdir_rx_queue_init(struct i40e_rx_queue *rxq) > #endif > =09rx_ctx.dtype =3D i40e_header_split_none; > =09rx_ctx.hsplit_0 =3D I40E_HEADER_SPLIT_NONE; > -=09rx_ctx.rxmax =3D RTE_ETHER_MAX_LEN; > +=09rx_ctx.rxmax =3D RTE_ETHER_MAX_LEN + I40E_VLAN_TAG_SIZE * 2; > =09rx_ctx.tphrdesc_ena =3D 1; > =09rx_ctx.tphwdesc_ena =3D 1; > =09rx_ctx.tphdata_ena =3D 1; > diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c > index 6a66cec..a93b11f 100644 > --- a/drivers/net/i40e/i40e_rxtx.c > +++ b/drivers/net/i40e/i40e_rxtx.c > @@ -2617,7 +2617,8 @@ i40e_rx_queue_config(struct i40e_rx_queue *rxq) > =09=09RTE_MIN((uint32_t)(hw->func_caps.rx_buf_chain_len * > =09=09=09rxq->rx_buf_len), data->dev_conf.rxmode.max_rx_pkt_len); > =09if (data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) { > -=09=09if (rxq->max_pkt_len <=3D RTE_ETHER_MAX_LEN || > +=09=09if (rxq->max_pkt_len <=3D RTE_ETHER_MAX_LEN + > +=09=09=09=09I40E_VLAN_TAG_SIZE * 2 || > =09=09=09rxq->max_pkt_len > I40E_FRAME_SIZE_MAX) { > =09=09=09PMD_DRV_LOG(ERR, "maximum packet length must " > =09=09=09=09 "be larger than %u and smaller than %u," The log needs to be match the check > @@ -2628,12 +2629,14 @@ i40e_rx_queue_config(struct i40e_rx_queue *rxq) > =09=09} > =09} else { > =09=09if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN || > -=09=09=09rxq->max_pkt_len > RTE_ETHER_MAX_LEN) { > +=09=09=09rxq->max_pkt_len > RTE_ETHER_MAX_LEN + > +=09=09=09=09I40E_VLAN_TAG_SIZE * 2) { > =09=09=09PMD_DRV_LOG(ERR, "maximum packet length must be " > =09=09=09=09 "larger than %u and smaller than %u, " > =09=09=09=09 "as jumbo frame is disabled", > =09=09=09=09 (uint32_t)RTE_ETHER_MIN_LEN, > -=09=09=09=09 (uint32_t)RTE_ETHER_MAX_LEN); > +=09=09=09=09 (uint32_t)RTE_ETHER_MAX_LEN + > +=09=09=09=09=09=09I40E_VLAN_TAG_SIZE * 2); > =09=09=09return I40E_ERR_CONFIG; > =09=09} > =09} > diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethde= v.c > index 7743205..f6722be 100644 > --- a/lib/librte_ethdev/rte_ethdev.c > +++ b/lib/librte_ethdev/rte_ethdev.c > @@ -1257,11 +1257,17 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t = nb_rx_q, uint16_t nb_tx_q, > =09=09=09goto rollback; > =09=09} > =09} else { > +=09=09/** > +=09=09 * The overhead from MTU to max frame size. > +=09=09 * Considering VLAN and QinQ packet, the VLAN tag size > +=09=09 * needs to be added to RTE_ETHER_MAX_LEN. > +=09=09 */ > =09=09if (dev_conf->rxmode.max_rx_pkt_len < RTE_ETHER_MIN_LEN || > -=09=09=09dev_conf->rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN) > +=09=09=09dev_conf->rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN > +=09=09=09=09+ RTE_ETHER_VLAN_LEN * 2) > =09=09=09/* Use default value */ > =09=09=09dev->data->dev_conf.rxmode.max_rx_pkt_len =3D > -=09=09=09=09=09=09=09RTE_ETHER_MAX_LEN; > +=09=09=09=09RTE_ETHER_MAX_LEN + RTE_ETHER_VLAN_LEN * 2; +cc ethdev maintainers This looks ok to me for i40e case, but I don't know if there is a consequence for other PMDs. It seems late to change this, so maybe you can live without this part for now. Even on the i40e parts, there can be some subtle bug and I requested i40e maintainers to review carefully but it has not happened, so for me it shouldn't be merged at present. > =09} > =20 > =09/* Any requested offloading must be within its device capabilities */ > diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h > index e069dc7..9c5eee7 100644 > --- a/lib/librte_net/rte_ether.h > +++ b/lib/librte_net/rte_ether.h > @@ -26,6 +26,7 @@ extern "C" { > #define RTE_ETHER_ADDR_LEN 6 /**< Length of Ethernet address. */ > #define RTE_ETHER_TYPE_LEN 2 /**< Length of Ethernet type field. */ > #define RTE_ETHER_CRC_LEN 4 /**< Length of Ethernet CRC. */ > +#define RTE_ETHER_VLAN_LEN 4 /**< Length of Ethernet VLAN tag. */ > #define RTE_ETHER_HDR_LEN \ > =09(RTE_ETHER_ADDR_LEN * 2 + \ > =09=09RTE_ETHER_TYPE_LEN) /**< Length of Ethernet header. */ >=20