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 2D481A0548; Mon, 20 Sep 2021 15:45:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A02CC40E5A; Mon, 20 Sep 2021 15:45:00 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 3912D40DF7 for ; Mon, 20 Sep 2021 15:44:57 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10112"; a="222782238" X-IronPort-AV: E=Sophos;i="5.85,308,1624345200"; d="scan'208";a="222782238" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2021 06:44:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,308,1624345200"; d="scan'208";a="701061953" Received: from orsmsx605.amr.corp.intel.com ([10.22.229.18]) by fmsmga006.fm.intel.com with ESMTP; 20 Sep 2021 06:44:35 -0700 Received: from orsmsx606.amr.corp.intel.com (10.22.229.19) by ORSMSX605.amr.corp.intel.com (10.22.229.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Mon, 20 Sep 2021 06:44:34 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Mon, 20 Sep 2021 06:44:34 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.170) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Mon, 20 Sep 2021 06:44:34 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=elAtL+vs9wkqvBy25FeBhA3ko8X+NV08jds9AV22pKETSl8DG413G5cfLk42TYFrPmfXEHlxYx43z7LwNd5/z6HADQ2W8MuWTsqBJI+/Yub4e9D/Yfd8K4KKSNbfXuGnHn2ggFonTIhMWBucdEhXp5Eq1in30Ky80IMQPJfA1E5ViL+9qgGGH52n7Sm1qhRUgy5kET0RtuNRZstcuMZYt4EsLaecklZPfnA/rAQBYurOGf7JfcPdXSZaCBANa0z8nfFDrKHw1y/CJt+2WY6n5rI7d1ESKP29/LJW+cpwsKhLOLhoPHpaE5VN+DOeqNkG5tWxMrrHLpFF7dtIC3nGtQ== 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; bh=yzbhoXeroUZFc0T9HAqT+0rA2uaT+Rti8EWNHhXsiUg=; b=n99jzkQsgy3bAvPkNpAOtEBO4FlA97pnrAcIg/8QVk+W6/HAhEUS604QxihKljtza+5DUg54As/TSuahZVUIl+V7Gc/ykk97L/jbGtqNab5PiwR5FTfHJJ9GKpW+ui+f+w2Aqcjoxn1rYaAinY5hpwT6NX+XoohdvbSk2i8Y3paj0wpl7b8ED76Wl+P5uB97+12fAEPQXXAkD8u0M/jHpOwzZBBhlKTOomZBy8iKo63F+F71UcB58WiwMCsTe03buQbwIbxCRalKNWn0Lp27UXJfQEleLM49fCxGZSM73snn5BPSieNxphL0ekrrUXaoE1S0D5g9xfi1uzZOV8aOrQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yzbhoXeroUZFc0T9HAqT+0rA2uaT+Rti8EWNHhXsiUg=; b=KXDXVcFlTqz9FnC0HjCJasEJ/5pC3u9bv+wpCgOEimDtJHpz6hlHtKLT/UKSdfSIt4zaSkTyvKjc9dRHckJFwLK9Y8ws8y5qp1x73uIE/5j+RPQFq9e6cql+nmocoqMbF7IC9Af0mgvXzx0V9yoozYoGni/VBsoJSdL0X0YOsUI= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; Received: from CO1PR11MB4868.namprd11.prod.outlook.com (2603:10b6:303:90::19) by MW3PR11MB4668.namprd11.prod.outlook.com (2603:10b6:303:54::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.16; Mon, 20 Sep 2021 13:44:33 +0000 Received: from CO1PR11MB4868.namprd11.prod.outlook.com ([fe80::4dcc:489e:1d86:47cb]) by CO1PR11MB4868.namprd11.prod.outlook.com ([fe80::4dcc:489e:1d86:47cb%9]) with mapi id 15.20.4523.018; Mon, 20 Sep 2021 13:44:33 +0000 To: "Wu, Jingjing" , "Xing, Beilei" , "Richardson, Bruce" , "Ananyev, Konstantin" , Ray Kinsella CC: "dev@dpdk.org" , "Doherty, Declan" , "Sinha, Abhijit" , "Zhang, Qi Z" References: <20210909142428.750634-1-radu.nicolau@intel.com> <20210915133211.1310791-1-radu.nicolau@intel.com> <20210915133211.1310791-3-radu.nicolau@intel.com> From: "Nicolau, Radu" Message-ID: Date: Mon, 20 Sep 2021 14:44:25 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.14.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB X-ClientProxiedBy: DBBPR09CA0037.eurprd09.prod.outlook.com (2603:10a6:10:d4::25) To CO1PR11MB4868.namprd11.prod.outlook.com (2603:10b6:303:90::19) MIME-Version: 1.0 Received: from [192.168.1.12] (109.255.186.106) by DBBPR09CA0037.eurprd09.prod.outlook.com (2603:10a6:10:d4::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Mon, 20 Sep 2021 13:44:31 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bfe3e374-7a0b-480d-d4d6-08d97c3cc700 X-MS-TrafficTypeDiagnostic: MW3PR11MB4668: X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6VWlv150z+HGw2DsaqrzKSRcPsyrtvttJ3fQq5hRzK43nyHa/YNPRqPTzS492yrTqV7jkbJ5P0VyKpGDwqlfR7/iQHrRtpudJBpaXxbz18DBWbvdmFlHzHWptIwUUiE2si/bfyDpvZIZaDsSzFOcRnp1rXCLyGtaL7qlhrFAoxncPYmwnS9AK96u6r3c7ziCf3tBWBjXcZvUWR2abXenzFVO+Al7fH1f8IMesrm22zaHcQ2BQQNMVNxRJWGILqAPJ7lSVDfxYbsLQQLpVtHGfWodORqcJ95nxWTlZYZvkLGqtyYJQoX4fim+XXv5hMazPUuQHn++Ltstpy3klkF/taILf2ImIQfcMR9b6AhEcgLODJBAXUkVXCzLLN4pyUD4KMDbveRzhuI+9nJfJFisTjO5Ft2lgbCs0D9JXOLGnuIdOGd+uryZMTUKUIWp5UdIRnL3dZMVZM1SyCfYOEdO0xaMgs0wMUJyN2o1Jq8EyfWHWaq7dmk0kwtd2CmY3F3v7G0K/SCWuv5YVBcL+ZDzszDQY+cDg70isxomxSrIN4iuTKoBsi4SXPbZKhuLDS3YympoaslzKhh7depj1dOQK5WUgaO2rU/vFbNikpWOgEL5fpjQrWzC9nqCmNqAw0ArDtxj2KVSMpusg7OoycLNJJZYJA0MH8D+uxd0IK6sq6DRHHJNmg4Xx2rlOuTn+sKI+xxWwd2B9JK+ATeQWji2+rYFgW2qysY58ZObpjKnSfU= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO1PR11MB4868.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(66556008)(66476007)(66946007)(316002)(16576012)(5660300002)(110136005)(54906003)(6486002)(6666004)(86362001)(31696002)(4326008)(31686004)(2616005)(2906002)(508600001)(36756003)(26005)(53546011)(956004)(30864003)(83380400001)(107886003)(8676002)(186003)(55236004)(8936002)(38100700002)(45980500001)(43740500002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?UzZ1SU14aHFkWjhnM3hlcnBzZ01BR0V0RWYvSzFNQmgzeVB0QW5Jc2MycVZ1?= =?utf-8?B?Mm5SVm9jaHp6eTBZMDBFaDhBRXVqcHd5TmtZTFh5NFZHZEhCMklYWTFyTE9Z?= =?utf-8?B?eDE5T01PZzR5cTFKQ2NxUnM1OVJUT3hYUFJrQXpyVmFTd3JTRGpPRk9mdkdy?= =?utf-8?B?Tk1sOURyeFU4S3llbloyK3VwcloyWDNESW5heEV6YzZzUmQ5aVRybldwSEwy?= =?utf-8?B?Z3oxNVZtRCtsZ0tjYnV5UkVOZ1JKZGtNK0QyaTRlZGR0blhMZjRRRnhodDNr?= =?utf-8?B?NmlJZ3lXSHJpa3dKYVVtWUppMjRBb3NaSUZNVktCaUc0cUFhZDRsd01xT0lX?= =?utf-8?B?a3lWNXkvOGZXRzIwL2trNWZmYVF1L2czVlBwWE9jemNoTWlPRlBLSkhtUURX?= =?utf-8?B?TFZuTFQ1M3BweElhTVFCL082M29yQTg2RUR0RHFsQWxrN1FwWlY5NThCMm1I?= =?utf-8?B?c2F2Wkltc2xpWnRMTnYrUkMxUEJ2L0hrRU1LMDdZdVU0cGp2V1VSRDdhWllu?= =?utf-8?B?UmEvRU1aL2NlcmdjdE1iUjNyYXFTR0pWWjZFMFZmT0xRMmdGVlJndFhCU1hL?= =?utf-8?B?OVZZUWswVi8zS1R0WWQzQ3RtM2V6QlYvUWFxUnVtYUR2UkowZmRwczFnSWd1?= =?utf-8?B?N1kxcWdUSGhDYmxKeUQ1dDVuRkRnR2NTQkJzMkd4U1V1ZW4vckVNcE9MVUhP?= =?utf-8?B?OEM1SENUVi9kTDRSRHFiaTJsSU03WDhPS1EzdHlHV3lqTWRzZGJSbXVHWTJp?= =?utf-8?B?cm1TOEZkSGEvYUJzVkxJSTVSK3BqWHRBcUpuTDhGaFhpZW12NlJTaXF5RXo5?= =?utf-8?B?bFoxWHB3aW1ZWkZHRGJrdGI0ME02MTlYQUtGaUl0M25EbVJOMUZCbWQxc25q?= =?utf-8?B?Q3dxM3Z0czNUbjBpK2NzMnpSMDlNbm9mTnpVQWNmeHZkbndBR0hOcVF5OXpV?= =?utf-8?B?NFJ6UXVySkRObTE5VnlnMWVTTXZGUisyV045R3djZ0lSN1NkUHVSejJ1OUFh?= =?utf-8?B?LzhyV2tQaElVcW0xR0FnRklOdHRPcWZRdDBlZzE0Sm83UVdWTzhoRi9XSGEr?= =?utf-8?B?Zi9WTlViTTAxbTR6R2RjKzVJbWhsSUV1bldBdVlhNFBTUmdhMzlKMll0SHFD?= =?utf-8?B?ZXlUSGhIYlMxcFBhZW96dmN3TnVvN1pjT1RmKzRMSTV6NW1Vck1rZk81VnV2?= =?utf-8?B?V2M1N3pyMmUyQmR4RitLdHVmSHpqV082OXBoM0htWWRpNjlYcEgzUm5XbU4y?= =?utf-8?B?aHVwZ1lVUDBtZTN4ZjhUWnpiSXJhZDMxbzZqTzJTcGNtNG1TRXBJSnZSV1Za?= =?utf-8?B?NFJZdkpJMFFBdnRjVG1uQ0sybHJkVEMwODRyNXc2cGRiUWk2T3VVQWJaK2tt?= =?utf-8?B?aHc3ek4rcTNZYUg3aElEQm9ZWm5ob3hxUnprY2lERVB0UGdJT1pKcUlOWWgy?= =?utf-8?B?eGRoaEp5NUE5SEVYdk93WFNYUTIrbkxiZGU3dmZUS3FMbVdBdVkyK0ZvOGJt?= =?utf-8?B?dVFGdUxVN2JWRmtnUWhkdzFZTUpsUCtpVzF0bGZObXlhNHorWWpoMVhSRVVv?= =?utf-8?B?M01udkIxeXcvVXk2aWQ3dS84Z05qdmFZVWVTZldFK0FnR3dXM0RrZ3p3R29y?= =?utf-8?B?aUJnaDJHdmxaVm1DWVdndzNHRGQzVi8vU29pVVNSN3dHa2N6bjJySUsvUVFy?= =?utf-8?B?QUNTekpEMElZZk1oNVVmU25FUnJ0bFFIM0ZWOEFXV2J2NHJ1Q2laY1FkL2lk?= =?utf-8?Q?ijxpOQsun7aIWjOkoE4DvQR9vcAt/euc5lp+DDx?= X-MS-Exchange-CrossTenant-Network-Message-Id: bfe3e374-7a0b-480d-d4d6-08d97c3cc700 X-MS-Exchange-CrossTenant-AuthSource: CO1PR11MB4868.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Sep 2021 13:44:33.0508 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: UrkvEH0Hvsc/5wwa0X0NkxOuJ+b55dB4Ey/PWdxF2rdriypikgvJVjfRjQkET4VwBN2kJelzMEISIGYO44L9XA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR11MB4668 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v2 2/4] net/iavf: add iAVF IPsec inline crypto support 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 Sender: "dev" Hi Jingjing, thanks for reviewing! On 9/18/2021 6:28 AM, Wu, Jingjing wrote: > In general, the patch is too big to review. Patch split would help a lot! I will do my best to split in in the next revision. > > [...] >> +static const struct rte_cryptodev_symmetric_capability * >> +get_capability(struct iavf_security_ctx *iavf_sctx, >> + uint32_t algo, uint32_t type) >> +{ >> + const struct rte_cryptodev_capabilities *capability; >> + int i = 0; >> + >> + capability = &iavf_sctx->crypto_capabilities[i]; >> + >> + while (capability->op != RTE_CRYPTO_OP_TYPE_UNDEFINED) { >> + if (capability->op == RTE_CRYPTO_OP_TYPE_SYMMETRIC && >> + capability->sym.xform_type == type && >> + capability->sym.cipher.algo == algo) >> + return &capability->sym; >> + /** try next capability */ >> + capability = &iavf_crypto_capabilities[i++]; > Better to check i to avoid out of boundary. The condition in the while statement plus the last element in the array set as RTE_CRYPTO_OP_TYPE_UNDEFINED prevents the loop from going out of bounds. > [...] > >> + >> +static int >> +valid_length(uint32_t len, uint32_t min, uint32_t max, uint32_t increment) >> +{ >> + if (len < min || len > max) >> + return 0; >> + >> + if (increment == 0) >> + return 1; >> + >> + if ((len - min) % increment) >> + return 0; >> + >> + return 1; >> +} > Would it be better to use true/false instead of 1/0? And the same to following valid functions. Will do. > [...] > >> +static int >> +iavf_ipsec_crypto_session_validate_conf(struct iavf_security_ctx *iavf_sctx, >> + struct rte_security_session_conf *conf) >> +{ >> + /** validate security action/protocol selection */ >> + if (conf->action_type != RTE_SECURITY_ACTION_TYPE_INLINE_CRYPTO || >> + conf->protocol != RTE_SECURITY_PROTOCOL_IPSEC) { >> + PMD_DRV_LOG(ERR, "Unsupported action / protocol specified"); >> + return -EINVAL; >> + } >> + >> + /** validate IPsec protocol selection */ >> + if (conf->ipsec.proto != RTE_SECURITY_IPSEC_SA_PROTO_ESP) { >> + PMD_DRV_LOG(ERR, "Unsupported IPsec protocol specified"); >> + return -EINVAL; >> + } >> + >> + /** validate selected options */ >> + if (conf->ipsec.options.copy_dscp || >> + conf->ipsec.options.copy_flabel || >> + conf->ipsec.options.copy_df || >> + conf->ipsec.options.dec_ttl || >> + conf->ipsec.options.ecn || >> + conf->ipsec.options.stats) { >> + PMD_DRV_LOG(ERR, "Unsupported IPsec option specified"); >> + return -EINVAL; >> + } >> + >> + /** >> + * Validate crypto xforms parameters. >> + * >> + * AEAD transforms can be used for either inbound/outbound IPsec SAs, >> + * for non-AEAD crypto transforms we explicitly only support CIPHER/AUTH >> + * for outbound and AUTH/CIPHER chained transforms for inbound IPsec. >> + */ >> + if (conf->crypto_xform->type == RTE_CRYPTO_SYM_XFORM_AEAD) { >> + if (!valid_aead_xform(iavf_sctx, &conf->crypto_xform->aead)) { >> + PMD_DRV_LOG(ERR, "Unsupported IPsec option specified"); >> + return -EINVAL; >> + } > Invalid parameter, but not unsupported option, right? Same to below. I reworked the messages to be consistent > [...] > >> +static void >> +sa_add_set_aead_params(struct virtchnl_ipsec_crypto_cfg_item *cfg, >> + struct rte_crypto_aead_xform *aead, uint32_t salt) >> +{ >> + cfg->crypto_type = VIRTCHNL_AEAD; >> + >> + switch (aead->algo) { >> + case RTE_CRYPTO_AEAD_AES_CCM: >> + cfg->algo_type = VIRTCHNL_AES_CCM; break; >> + case RTE_CRYPTO_AEAD_AES_GCM: >> + cfg->algo_type = VIRTCHNL_AES_GCM; break; >> + case RTE_CRYPTO_AEAD_CHACHA20_POLY1305: >> + cfg->algo_type = VIRTCHNL_CHACHA20_POLY1305; break; >> + default: >> + RTE_ASSERT("we should be here"); > Assert just because invalid config? Similar comments to other valid functions. Removed > >> + } >> + >> + cfg->key_len = aead->key.length; >> + cfg->iv_len = aead->iv.length; >> + cfg->digest_len = aead->digest_length; >> + cfg->salt = salt; >> + >> + RTE_ASSERT(sizeof(cfg->key_data) < cfg->key_len); >> + > Not only data, but length, better to valid before setting? The same to other kind params setting. The length here is checked to fit into the array, it can still be valid; I moved this check in the valid_length function that can actually return an error. > [...] > > >> +static inline void >> +iavf_build_data_desc_cmd_offset_fields(volatile uint64_t *qw1, >> + struct rte_mbuf *m) >> +{ >> + uint64_t command = 0; >> + uint64_t offset = 0; >> + uint64_t l2tag1 = 0; >> + >> + *qw1 = IAVF_TX_DESC_DTYPE_DATA; >> + >> + command = (uint64_t)IAVF_TX_DESC_CMD_ICRC; >> + >> + /* Descriptor based VLAN insertion */ >> + if (m->ol_flags & PKT_TX_VLAN_PKT) { >> + command |= (uint64_t)IAVF_TX_DESC_CMD_IL2TAG1; >> + l2tag1 |= m->vlan_tci; >> + } >> + >> /* Set MACLEN */ >> - *td_offset |= (tx_offload.l2_len >> 1) << >> - IAVF_TX_DESC_LENGTH_MACLEN_SHIFT; >> - >> - /* Enable L3 checksum offloads */ >> - if (ol_flags & PKT_TX_IP_CKSUM) { >> - *td_cmd |= IAVF_TX_DESC_CMD_IIPT_IPV4_CSUM; >> - *td_offset |= (tx_offload.l3_len >> 2) << >> - IAVF_TX_DESC_LENGTH_IPLEN_SHIFT; >> - } else if (ol_flags & PKT_TX_IPV4) { >> - *td_cmd |= IAVF_TX_DESC_CMD_IIPT_IPV4; >> - *td_offset |= (tx_offload.l3_len >> 2) << >> - IAVF_TX_DESC_LENGTH_IPLEN_SHIFT; >> - } else if (ol_flags & PKT_TX_IPV6) { >> - *td_cmd |= IAVF_TX_DESC_CMD_IIPT_IPV6; >> - *td_offset |= (tx_offload.l3_len >> 2) << >> - IAVF_TX_DESC_LENGTH_IPLEN_SHIFT; >> - } >> - >> - if (ol_flags & PKT_TX_TCP_SEG) { >> - *td_cmd |= IAVF_TX_DESC_CMD_L4T_EOFT_TCP; >> - *td_offset |= (tx_offload.l4_len >> 2) << >> - IAVF_TX_DESC_LENGTH_L4_FC_LEN_SHIFT; >> - return; > PKT_TX_TCP_SEG flag implies PKT_TX_TCP_CKSUM, > so the offset cannot removed by just check cusm offload fields. I added this back, most likely it was a rebase mistake. > [...] > > >> struct iavf_32b_rx_flex_desc_comms { >> + union { >> + struct { >> /* Qword 0 */ >> u8 rxdid; >> u8 mir_id_umb_cast; >> @@ -305,6 +375,101 @@ struct iavf_32b_rx_flex_desc_comms { >> } flex; >> __le32 ts_high; >> } flex_ts; >> + }; >> + struct { >> + /* Quad Word 0 */ >> + >> + u8 rxdid; /**< Descriptor builder profile ID */ >> + >> + u8 mirror_id:6; >> + u8 umbcast:2; >> + >> + __le16 ptype:10; >> + __le16 flexi_flags_0:6; >> + >> + __le16 packet_length:14; >> + __le16 rsv_0:2; >> + >> + __le16 hlen:11; >> + __le16 sph:1; >> + __le16 flexi_flags_1:4; >> + >> + /* Quad Word 1 */ >> + union { >> + __le16 status_error0; >> + struct { >> + __le16 status_error0_dd:1; >> + /* descriptor done */ >> + __le16 status_error0_eop:1; >> + /* end of packet */ >> + __le16 status_error0_hbo:1; >> + /* header buffer overflow */ >> + __le16 status_error0_l3l4p:1; >> + /* l3/l4 integrity check */ >> + __le16 status_error0_xsum:4; >> + /* checksum report */ >> + __le16 status_error0_lpbk:1; >> + /* loopback */ >> + __le16 status_error0_ipv6exadd:1; >> + /* ipv6 w/ dst options or routing hdr */ >> + __le16 status_error0_rxe:1; >> + /* rcv mac errors */ >> + __le16 status_error0_crcp:1; >> + /* ethernet crc present */ >> + __le16 status_error0_rsshash:1; >> + /* rss hash valid */ >> + __le16 status_error0_l2tag1p:1; >> + /* l2 tag 1 present */ >> + __le16 status_error0_flexi_md0:1; >> + /* flexi md field 0 valid */ >> + __le16 status_error0_flexi_md1:1; >> + /* flexi md field 1 valid */ >> + }; >> + }; >> + __le16 l2tag1; >> + __le16 flex_meta0; /**< flexi metadata field 0 */ >> + __le16 flex_meta1; /**< flexi metadata field 1 */ >> + >> + /* Quad Word 2 */ >> + union { >> + __le16 status_error1; >> + struct { >> + __le16 status_error1_cpm:4; >> + /* Inline IPsec Crypto Status */ >> + __le16 status_error1_udp_tunnel:1; >> + /* UDP tunnelled packet NAT-T/UDP-NAT */ >> + __le16 status_error1_crypto:1; >> + /* Inline IPsec Crypto Offload */ >> + __le16 status_error1_rsv:5; >> + /* Reserved */ >> + __le16 status_error1_l2tag2p:1; >> + /* l2 tag 2 present */ >> + __le16 status_error1_flexi_md2:1; >> + /* flexi md field 2 valid */ >> + __le16 status_error1_flexi_md3:1; >> + /* flexi md field 3 valid */ >> + __le16 status_error1_flexi_md4:1; >> + /* flexi md field 4 valid */ >> + __le16 status_error1_flexi_md5:1; >> + /* flexi md field 5 valid */ >> + }; >> + }; >> + >> + u8 flex_flags2; >> + u8 time_stamp_low; >> + >> + __le16 l2tag2_1st; /**< L2TAG */ >> + __le16 l2tag2_2nd; /**< L2TAG */ >> + >> + /* Quad Word 3 */ >> + >> + __le16 flex_meta2; /**< flexi metadata field 2 */ >> + __le16 flex_meta3; /**< flexi metadata field 3 */ >> + __le16 flex_meta4; /**< flexi metadata field 4 */ >> + __le16 flex_meta5; /**< flexi metadata field 5 */ >> + >> + } debug; >> + }; >> }; > If you check the description of this struct, you will find it is for RxDID Profile ID 16-21. > I think you need define a new struct for ipsec. And for debug, also prefer a new struct > or some func instead of adding union and fields in defined formatted descriptor. I removed this altogether as it has no functional purpose. > [....] > > >> + >> +#include >> + > Put this inline at the beginning of file? I removed this section > [...] > >> @@ -330,18 +339,40 @@ iavf_handle_virtchnl_msg(struct rte_eth_dev *dev) >> case iavf_aqc_opc_send_msg_to_vf: >> if (msg_opc == VIRTCHNL_OP_EVENT) { >> iavf_handle_pf_event_msg(dev, info.msg_buf, >> - info.msg_len); >> + info.msg_len); >> } else { >> + /* check for inline IPsec events */ >> + struct inline_ipsec_msg *imsg = >> + (struct inline_ipsec_msg *)info.msg_buf; >> + struct rte_eth_event_ipsec_desc desc; >> + if (msg_opc == VIRTCHNL_OP_INLINE_IPSEC_CRYPTO >> + && imsg->ipsec_opcode == >> + INLINE_IPSEC_OP_EVENT) { >> + struct virtchnl_ipsec_event *ev = >> + imsg->ipsec_data.event; >> + desc.subtype = >> + RTE_ETH_EVENT_IPSEC_UNKNOWN; >> + desc.metadata = ev->ipsec_event_data; >> + rte_eth_dev_callback_process(dev, >> + RTE_ETH_EVENT_IPSEC, >> + &desc); >> + return; >> + } >> + >> /* read message and it's expected one */ >> - if (msg_opc == vf->pend_cmd) >> - _notify_cmd(vf, msg_ret); >> - else >> - PMD_DRV_LOG(ERR, "command mismatch," >> - "expect %u, get %u", >> - vf->pend_cmd, msg_opc); >> + if (msg_opc == vf->pend_cmd) { >> + rte_atomic32_dec(&vf->pend_cmd_count); >> + if (rte_atomic32_read( >> + &vf->pend_cmd_count) == 0) >> + _notify_cmd(vf, msg_ret); > Only dec the count, does the async mean only the second message carries response info? Yes, from my understanding the 1st message is the confirmation of the request and the second is the reply. > > [...]