From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5F559A0553; Thu, 20 Oct 2022 16:47:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5229142D91; Thu, 20 Oct 2022 16:47:19 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2079.outbound.protection.outlook.com [40.107.243.79]) by mails.dpdk.org (Postfix) with ESMTP id 9B93B42D8A for ; Thu, 20 Oct 2022 16:47:17 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VbtIdnjjMg4mh/0XIjxkelZjh1V6fKai5kx+CCWBcddMn+Ggvm9j4sFzmHzeZJ1IwaskBVLLgsrnkMnKh9LQCNcRR0/Kd3XTKEee3BJoBwgq1oISsB1dZ1tuaMaJNV7cp2cjoFUF/p77sj2/c+kfWHWlOgXlszp2eAijK7L/RRl+QugLscm0ev0cjyNe6Z8r8eq3fRwD5+t3oWKOwJhR6DO8vrE1kycFvUvJwe5lk8bbVAGFubDpOjywKS0A1ctAL8kiM81eHwOvSiRU+jqkXsmzDGwVfnNh2uf86wpSWKwQLc2UywM6I1KCSt4soxpAYnHTsAK0gCCxK4j5b4MECA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+qFI+m5yspkU04/ClHjh+C74JcLVPgczAkANt6yBZHI=; b=G9cWlJ9oLBZXGtel/w9/bMo1WAsOIDTRqz8oZ2H7RYTLEcXXhBf9pgsvlyom6RMWXrH/TmuwTDdTBvzC4xBcB6pltJEoZwKoTgukONXnSCGqerbAnWeu2wstjHaxubcPQlkvl3w5rWl3P2OuTaD2AEAtgk9ye9pQHOkYQYKsgiUIbEHsygU6Yi/GgNA29G3Xc6PG+PI10HageATx/uos6y0wBkoSuo0qvtgay/VgUJn4L8khuc1GB3jyyvEZnez2Tlfp3uwA2YQ4MXSRycqRwwx4ZEE1XRSyd7wBDeBdG+ZNApjBF0M95cWc/zHukcJvwwoRNa5PpCXyKY7lezAb/g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+qFI+m5yspkU04/ClHjh+C74JcLVPgczAkANt6yBZHI=; b=aOY2m4cWe22Qgugpbv5kADlW95EiNnlWbCWuOK0tg61MIRaEBXCq8cwv5gzSz/yc2ggJ45wTXrdp4PUAMysn97PMhrMQ+mAJ0vWuxUghmnGMomlx7znj9wr50PfLK4b29r4OYyttj4tjgctMovvExVyjkraKZvrdrrzOlMDGqS0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from DM6PR12MB4297.namprd12.prod.outlook.com (2603:10b6:5:211::20) by MN0PR12MB5810.namprd12.prod.outlook.com (2603:10b6:208:376::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.33; Thu, 20 Oct 2022 14:47:15 +0000 Received: from DM6PR12MB4297.namprd12.prod.outlook.com ([fe80::b9fd:e732:4585:6b25]) by DM6PR12MB4297.namprd12.prod.outlook.com ([fe80::b9fd:e732:4585:6b25%7]) with mapi id 15.20.5723.033; Thu, 20 Oct 2022 14:47:15 +0000 Message-ID: Date: Thu, 20 Oct 2022 15:47:06 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.3 Subject: Re: [PATCH v6 8/8] net/gve: add support for Rx/Tx Content-Language: en-US To: Junfeng Guo , qi.z.zhang@intel.com, jingjing.wu@intel.com, beilei.xing@intel.com Cc: dev@dpdk.org, xiaoyun.li@intel.com, awogbemila@google.com, bruce.richardson@intel.com, hemant.agrawal@nxp.com, stephen@networkplumber.org, chenbo.xia@intel.com, helin.zhang@intel.com References: <20221010101757.878317-2-junfeng.guo@intel.com> <20221020103656.1068036-1-junfeng.guo@intel.com> <20221020103656.1068036-9-junfeng.guo@intel.com> From: Ferruh Yigit In-Reply-To: <20221020103656.1068036-9-junfeng.guo@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0679.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:351::12) To DM6PR12MB4297.namprd12.prod.outlook.com (2603:10b6:5:211::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR12MB4297:EE_|MN0PR12MB5810:EE_ X-MS-Office365-Filtering-Correlation-Id: 72879584-4644-4f2c-1e37-08dab2a9f935 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lAvzoLbgHG2UzFoJow+126wt+JG3dqR094ehZ7Vrnoman3L+t4yNkRY/k0WunoBQtXcnAp5S5O5CBizdYUnR2Y0ja41+n3K+V1PUZVFvVlgJ8WUxoB08+DURYtLzoTQgBuKfw0d9ulnBMRroRjhQL2NuW+nSKcMgohGtq2mO1IT2SIhWvCV5/mSkGZKMjd9X/6dGXurCKtj3OJ2D5zkfBrhb5Rh1IV1ZSnZfA77L52zwUPg9QT9ZyShQThQ2HngLAQ0CRtelZPEFJJ0jOBYtP97K4ufwx3ghX11Kxnjbpr4dTzOm9xdAkQ2DPv8J7uKsYchjh6ntcgcMSWDCtIpa28B207eHKCOk4WcxHOk0TemkuEzqu4BACxVinqv5c198V547sfT4v1JzSN7JMjnCI30wyqxpo82yHq5dTs3QrS4A64WZjjkBUTTAmB9tkjlNhBMc0F/R1Z63cJ6fYeNvyFb2Ehrtam/DGKd5dYTJteCDBNiHE3/buTK9N2fIx1k2bAsecpO8R92rW0rsFfaniNnC9/iIav1GodUHPYzuGeXkYckKjl754fv0ML0y23SNUoFHtLcR4MeiIsHURKj6QLwqSGCZrZxU7B86WMVVVsI0ITgtk8xxd25DflN9e+JPEXEZ16Iyrryf42MLO2U649AbIYnjkP02n2XnVCqfGd5dZQGenVeDggRqvbAjqpWUqZORY8BpS8/ln743MEqzEsyijMNGvh4RVfydyb/ceiSCscXR200eQnHTIUw7i7AWEXBdCemY0WS1VMnMocdKWyxut/sHyoxss0x64Uhp70U= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR12MB4297.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(366004)(136003)(346002)(396003)(39860400002)(376002)(451199015)(38100700002)(478600001)(86362001)(4326008)(2906002)(6666004)(186003)(31696002)(5660300002)(2616005)(6486002)(31686004)(66476007)(66556008)(8676002)(316002)(8936002)(66946007)(7416002)(41300700001)(53546011)(6506007)(26005)(44832011)(83380400001)(6512007)(36756003)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?dlhDT1g5TUZjZTJqSHZWdHBFSnJOK3o1V0JHR2lKdEh6WFc1NWFBZ1BQeitY?= =?utf-8?B?UWlOeU1LSzBNOUZsb255Z0tWK3VpYkVrY3JpbFVwMjZHMEo0S0R0U29OaHpZ?= =?utf-8?B?elgzMXNqQ3l5Yi9CMFJ4VG5lUEVkdFF6TFgxazNIazZyQWFhTGxld0FpVkFw?= =?utf-8?B?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dlRwQTYrTGxyaDZMZDhBRWtRVVg2QU9vblQvRUFH?= =?utf-8?B?d2xHb2VCcUFnQjdBK2FxeUo3N0ZlTndqN2ZCaEY5WVVTZ3Jvc2IzYk5nTDNU?= =?utf-8?B?ODZOdzZoZE1JWWxKNzNtVGNKcVFBOGdYUEI0U1VSbUxYK0JDdFg1Y0VVNm9r?= =?utf-8?Q?k0Ue0YHXO6qZt1MqJconvUJ5J?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 72879584-4644-4f2c-1e37-08dab2a9f935 X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB4297.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2022 14:47:15.6725 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: s3H8aQ9ZMflVKPn3KERJfk1hJh8HfftOgZMDZjSWepAWevBttlMgSOkzAL54AjRQ X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5810 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 10/20/2022 11:36 AM, Junfeng Guo wrote: > > Add Rx/Tx of GQI_QPL queue format and GQI_RDA queue format. > > Signed-off-by: Xiaoyun Li > Signed-off-by: Junfeng Guo <...> > +uint16_t > +gve_rx_burst(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) > +{ > + volatile struct gve_rx_desc *rxr, *rxd; > + struct gve_rx_queue *rxq = rx_queue; > + uint16_t rx_id = rxq->rx_tail; > + struct rte_mbuf *rxe; > + uint16_t nb_rx, len; > + uint64_t addr; > + uint16_t i; > + > + rxr = rxq->rx_desc_ring; > + nb_rx = 0; > + > + for (i = 0; i < nb_pkts; i++) { > + rxd = &rxr[rx_id]; > + if (GVE_SEQNO(rxd->flags_seq) != rxq->expected_seqno) > + break; > + > + if (rxd->flags_seq & GVE_RXF_ERR) > + continue; > + > + len = rte_be_to_cpu_16(rxd->len) - GVE_RX_PAD; > + rxe = rxq->sw_ring[rx_id]; > + if (rxq->is_gqi_qpl) { > + addr = (uint64_t)(rxq->qpl->mz->addr) + rx_id * PAGE_SIZE + GVE_RX_PAD; > + rte_memcpy((void *)((size_t)rxe->buf_addr + rxe->data_off), > + (void *)(size_t)addr, len); > + } > + rxe->pkt_len = len; > + rxe->data_len = len; > + rxe->port = rxq->port_id; > + rxe->ol_flags = 0; > + > + if (rxd->flags_seq & GVE_RXF_TCP) > + rxe->packet_type |= RTE_PTYPE_L4_TCP; > + if (rxd->flags_seq & GVE_RXF_UDP) > + rxe->packet_type |= RTE_PTYPE_L4_UDP; > + if (rxd->flags_seq & GVE_RXF_IPV4) > + rxe->packet_type |= RTE_PTYPE_L3_IPV4; > + if (rxd->flags_seq & GVE_RXF_IPV6) > + rxe->packet_type |= RTE_PTYPE_L3_IPV6; > + > + if (gve_needs_rss(rxd->flags_seq)) { > + rxe->ol_flags |= RTE_MBUF_F_RX_RSS_HASH; > + rxe->hash.rss = rte_be_to_cpu_32(rxd->rss_hash); You are updating "m->hash.rss" anyway, and if this is without and cost you can force enable as done in previous version: 'dev->data->dev_conf.rxmode.offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH;' <...> > +static inline void > +gve_free_bulk_mbuf(struct rte_mbuf **txep, int num) > +{ > + struct rte_mbuf *m, *free[GVE_TX_MAX_FREE_SZ]; > + int nb_free = 0; > + int i, s; > + > + if (unlikely(num == 0)) > + return; > + > + /* Find the 1st mbuf which needs to be free */ > + for (s = 0; s < num; s++) { > + if (txep[s] != NULL) { > + m = rte_pktmbuf_prefree_seg(txep[s]); > + if (m != NULL) > + break; > + } '}' indentation is wrong. <...> > +static inline void > +gve_tx_clean_swr_qpl(struct gve_tx_queue *txq) > +{ > + uint32_t start = txq->sw_ntc; > + uint32_t ntc, nb_clean; > + > + ntc = txq->sw_tail; > + > + if (ntc == start) > + return; > + > + /* if wrap around, free twice. */ > + if (ntc < start) { > + nb_clean = txq->nb_tx_desc - start; > + if (nb_clean > GVE_TX_MAX_FREE_SZ) > + nb_clean = GVE_TX_MAX_FREE_SZ; > + gve_free_bulk_mbuf(&txq->sw_ring[start], nb_clean); > + > + txq->sw_nb_free += nb_clean; > + start += nb_clean; > + if (start == txq->nb_tx_desc) > + start = 0; > + txq->sw_ntc = start; > + } > + > + if (ntc > start) { may be can drop the 'if' block, since "ntc == start" and "ntc < start" cases already covered. <...> > +uint16_t > +gve_tx_burst(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) > +{ > + struct gve_tx_queue *txq = tx_queue; > + > + if (txq->is_gqi_qpl) > + return gve_tx_burst_qpl(tx_queue, tx_pkts, nb_pkts); > + > + return gve_tx_burst_ra(tx_queue, tx_pkts, nb_pkts); > +} > + Can there be mix of queue types? If only one queue type is supported in specific config, perhaps burst function can be set during configuration, to prevent if check on datapath. This is optimization and can be done later, it doesn't have to be in the set.