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 33AD54298A; Wed, 19 Apr 2023 16:47:35 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0C39A40A79; Wed, 19 Apr 2023 16:47:35 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2056.outbound.protection.outlook.com [40.107.220.56]) by mails.dpdk.org (Postfix) with ESMTP id D46C54021F for ; Wed, 19 Apr 2023 16:47:33 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GwEROiIF6csGNZX1FqOauuNGxnD9KknsKqYZd5lOP3eZ/gzf9q6xcw4tRquYoaSmINjob3jnmvM0TIrSGi4eB1CL0rj84B6ZdljVznN5sjDuvZP6uvBiHnDCZfDmUl6BboTf00HNUhcEmxsh6mwUSvDOCoLBBbvnqFqi0kdQuLzvdVWhAvHXBwKHHG37hJNw5lGcna6o+baumUQdLaeN9ukSI5kc3o5Kzuy2WzpoZlxhLDPie3/iwbusq0ErfWqJzSjVz1EtONdlmjbZjaHVw+zEdSP5ZZ0pl4FOX1gOrKkuSmQU9Ka1H/+AEXVp8QnnH8yGFtTVOAGgmNvmUoH3pA== 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=j2vjqq8PiAAIKNMPFstnJn3I3/vIgEs09aSYzfcv3O4=; b=nhRWZ0R13No/qHMJ/yV6tjf+m9QanbATZW29sksAiN/0LQ8eMI8AC+fyjTI+Ab2b79IBYEgyt1WS4s0ICg40ddtfPnOk2xUUDttNJjbh9P3wwwvJAefGfIc6LhbWjGh5vlsfBVo0PtRJ1HJPCZEUxtjtE6vaGL6+mt8MYe4XqFWhjS6G6ufroWZrDka0eBEEl6pkmZqo5yBXoh9vxz7q1ndGqla4Mjj9nuo/jyIjPPFfkw6dyoZNxnfQdOjuXp4C3XKbHsGDDr1A+GPhX8n9GghsbAwF8LuiW3CS4HNc5HV8Wis5InmhcvhUBCIFnnW6hknIxq7TaNYKBD7kc40JPQ== 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=j2vjqq8PiAAIKNMPFstnJn3I3/vIgEs09aSYzfcv3O4=; b=3K9IINgaDAPxYn993MRvD4/+3Q9HchzbtpaJWx1U0DC7SnorwYmvsTAplyYXF9fgPQrDcz4n3YQorT/cRzaQoYBa+rkyXwjNiy1KZj+yKLH23RENcSnm6kBIP7+BSt8FiYoLc269wyPKwLRB9YBunAXRTSrAZAIUhCCUO3WGbA4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by MW4PR12MB7357.namprd12.prod.outlook.com (2603:10b6:303:219::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.45; Wed, 19 Apr 2023 14:47:31 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::5e2c:c0ed:88a6:a4c7]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::5e2c:c0ed:88a6:a4c7%7]) with mapi id 15.20.6319.022; Wed, 19 Apr 2023 14:47:31 +0000 Message-ID: Date: Wed, 19 Apr 2023 15:46:30 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Content-Language: en-US To: Feifei Wang , Qiming Yang , Wenjun Wu Cc: dev@dpdk.org, konstantin.v.ananyev@yandex.ru, mb@smartsharesystems.com, nd@arm.com, Honnappa Nagarahalli , Ruifeng Wang References: <20211224164613.32569-1-feifei.wang2@arm.com> <20230330062939.1206267-1-feifei.wang2@arm.com> <20230330062939.1206267-4-feifei.wang2@arm.com> From: Ferruh Yigit Subject: Re: [PATCH v5 3/3] net/ixgbe: implement recycle buffer mode In-Reply-To: <20230330062939.1206267-4-feifei.wang2@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0068.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:153::19) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|MW4PR12MB7357:EE_ X-MS-Office365-Filtering-Correlation-Id: 91e7cf1e-8f5d-4242-4280-08db40e500c5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xB6MDgCooRu48XHDMdEEVK0XXh1liVvdWQY9m80E7ELDzW47jBhEXZPZf4Uzn7pnj2WpAeUSHBhJ1RyBMa4h8MplrI8drfuZnG/ziQuQIJXIqF/hcUffg92wy1Q64GZ/DJmghL1Sri8uu8fMMHiegQhSShCP71Tj3tX2MCOZvsnXHggUhv8Vwl2PQbbmdO2mKfIKLUfBx5wgb7TJuEgaaRgs/EIKATsRKFrfC/2sTAjdfSuwzje0IdxYyGYrMeJyg5GFhCPCTaPE5A3w/7D1xvdMhGr2DQ6qmWrUJ7gpt+02bjh4GP6NoJ5HVw1YZeaPW6RPYCWadWop77J+5Y4s0Bv6GjUkDHtes+bgXWus2HUhpSW5Ag66jW21MnL0tMn36nYAKfB0DdSnzBsUMvWF2A1eRiXRZZpK+SEgUSis0n3mbsY1HjEL1IAil3F4pni7h8WnUN9hwq3+D6ii9ubZNJIJWAFfCqRDRaKXV5yTOW3WadobaSvKd2RI6xYPwL2dGctkhgK1xyLzqNTkMJ6csbqxiI2Maa0oQMptHJDPeosbCaItVS9etdup0RzFzlpQhasZffNIK2vfXR3XL5uf/Bf9/IIPr4NdNp5zia1g9wfW8XwdG1aJzq69CuBnjvhPsFy/RLEFKl7a6Tz8rQ/hjw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(136003)(346002)(376002)(396003)(366004)(451199021)(8936002)(38100700002)(36756003)(8676002)(44832011)(2906002)(86362001)(31696002)(5660300002)(478600001)(6486002)(54906003)(110136005)(31686004)(186003)(2616005)(6506007)(53546011)(66946007)(66476007)(6512007)(26005)(316002)(83380400001)(66556008)(41300700001)(4326008)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?VFpHNWx1SWFHdUFjeDJOSytBS0ZzV3BvVWlPd3g4M2dpYWF6cHdFWXd2QURa?= =?utf-8?B?V2RkVHZjU0c0VUFVUHFTVUxLZXNDSnZIdEY2U0hPUFVjcjlrQ1dEeEZzdEVy?= =?utf-8?B?UlFxZjkwYVBWTTQ0NTRneUlZTjZ2WG93VUNkdXBrVHdMYXNJYytOdWJZU1h0?= =?utf-8?B?TUozN1I3QmY3Tm8wbmcrTGUxRU52UnZZOUlCNGdVcnhDTEFOOENReGVNcEtM?= =?utf-8?B?clVRNjFxcHllQm04MWtYUStpb0V3Z0QxYjlhZURlQXYvaHZHOFZOeGxpWFI2?= =?utf-8?B?WkxUTU5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dDVERlYUlTSml6ekxPUDdLMEcwQlJo?= =?utf-8?Q?ysAw7DG7NGsGjNxK98AFX6cFv?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 91e7cf1e-8f5d-4242-4280-08db40e500c5 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Apr 2023 14:47:31.0627 (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: Nou/Q1svqJ5uF2HImaif2YrCYMfFaorAXUhUTGNmUIo/SERrIrFFr6kjfQNzrzZu X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7357 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 3/30/2023 7:29 AM, Feifei Wang wrote: > Define specific function implementation for ixgbe driver. > Currently, recycle buffer mode can support 128bit > vector path. And can be enabled both in fast free and > no fast free mode. > > Suggested-by: Honnappa Nagarahalli > Signed-off-by: Feifei Wang > Reviewed-by: Ruifeng Wang > Reviewed-by: Honnappa Nagarahalli > --- > drivers/net/ixgbe/ixgbe_ethdev.c | 1 + > drivers/net/ixgbe/ixgbe_ethdev.h | 3 + > drivers/net/ixgbe/ixgbe_rxtx.c | 153 +++++++++++++++++++++++++++++++ > drivers/net/ixgbe/ixgbe_rxtx.h | 4 + > 4 files changed, 161 insertions(+) > What do you think to extract buf_recycle related code in drivers into its own file, this may help to manager maintainership of code easier? <...> > +uint16_t > +ixgbe_tx_buf_stash_vec(void *tx_queue, > + struct rte_eth_rxq_buf_recycle_info *rxq_buf_recycle_info) > +{ > + struct ixgbe_tx_queue *txq = tx_queue; > + struct ixgbe_tx_entry *txep; > + struct rte_mbuf **rxep; > + struct rte_mbuf *m[RTE_IXGBE_TX_MAX_FREE_BUF_SZ]; > + int i, j, n; > + uint32_t status; > + uint16_t avail = 0; > + uint16_t buf_ring_size = rxq_buf_recycle_info->buf_ring_size; > + uint16_t mask = rxq_buf_recycle_info->buf_ring_size - 1; > + uint16_t refill_request = rxq_buf_recycle_info->refill_request; > + uint16_t refill_head = *rxq_buf_recycle_info->refill_head; > + uint16_t receive_tail = *rxq_buf_recycle_info->receive_tail; > + > + /* Get available recycling Rx buffers. */ > + avail = (buf_ring_size - (refill_head - receive_tail)) & mask; > + > + /* Check Tx free thresh and Rx available space. */ > + if (txq->nb_tx_free > txq->tx_free_thresh || avail <= txq->tx_rs_thresh) > + return 0; > + > + /* check DD bits on threshold descriptor */ > + status = txq->tx_ring[txq->tx_next_dd].wb.status; > + if (!(status & IXGBE_ADVTXD_STAT_DD)) > + return 0; > + > + n = txq->tx_rs_thresh; > + > + /* Buffer recycle can only support no ring buffer wraparound. > + * Two case for this: > + * > + * case 1: The refill head of Rx buffer ring needs to be aligned with > + * buffer ring size. In this case, the number of Tx freeing buffers > + * should be equal to refill_request. > + * > + * case 2: The refill head of Rx ring buffer does not need to be aligned > + * with buffer ring size. In this case, the update of refill head can not > + * exceed the Rx buffer ring size. > + */ > + if (refill_request != n || > + (!refill_request && (refill_head + n > buf_ring_size))) > + return 0; > + > + /* First buffer to free from S/W ring is at index > + * tx_next_dd - (tx_rs_thresh-1). > + */ > + txep = &txq->sw_ring[txq->tx_next_dd - (n - 1)]; > + rxep = rxq_buf_recycle_info->buf_ring; > + rxep += refill_head; > + > + if (txq->offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE) { > + /* Directly put mbufs from Tx to Rx. */ > + for (i = 0; i < n; i++, rxep++, txep++) > + *rxep = txep[0].mbuf; > + } else { > + for (i = 0, j = 0; i < n; i++) { > + /* Avoid txq contains buffers from expected mempoo. */ mempool (unless trying to introduce a new concept :)