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 CC054A0C41; Wed, 15 Sep 2021 10:20:09 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5964B4003F; Wed, 15 Sep 2021 10:20:09 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 169BD4003C; Wed, 15 Sep 2021 10:20:06 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10107"; a="307805347" X-IronPort-AV: E=Sophos;i="5.85,294,1624345200"; d="scan'208";a="307805347" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2021 01:20:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,294,1624345200"; d="scan'208";a="508667487" Received: from fmsmsx606.amr.corp.intel.com ([10.18.126.86]) by fmsmga008.fm.intel.com with ESMTP; 15 Sep 2021 01:20:06 -0700 Received: from fmsmsx606.amr.corp.intel.com (10.18.126.86) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Wed, 15 Sep 2021 01:20:05 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Wed, 15 Sep 2021 01:20:05 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.100) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Wed, 15 Sep 2021 01:20:05 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fjy6JV9dzYRDdtNgkevi4V7weg/K52TaaBEibuLOuw4+XRlkhvfe6WDo7O0cVUH6zjsRAYnQ9ODGGLVahR1X4FsX+tXmu0nNUDhuWpcyodNMgG4C9PF3kUZOhDRedCSfrR1uwNY8lV4ciVO3Uw0FTqe3pD6h2zL8b/ASvoJu9xx9lkEv5FRjlK9+6q5GtMlV0ndz4eoIEcDQmZGhnfeWYC+XFdrcrpDtUfCj1g25hs7TRxT2a+djV8jISr2uYSdDd59oam9GLSHQlPDgfYsWK7sr+QFJl/4fl7y329vqtgVX+Mey5PcjDEk4oRQkBWyL8eA8zH9POijs1tFeWDPxMg== 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=UhUv8+EztO+AyELVXLNXnlYBC6Z7ARqcfPiynNuhd20=; b=O87wgJdda07CdYherP89EYSRQ9QsIabvWqy1I+88hBp733O8lLsLVEw/DqrH3Ti2UxxRnAzWzKIbszHLBKfzkwgkvgfHElv9ov8rjv0wF8QVFylgd3ryjfbEb8hc8nb2G1r+f1X1bbxuNAvuQPhX/9he0hfhVo18MNJo04mu0k2mkM+rr6+0remgJ8kLowdfaiysX4604JKCLDvT8Rxnfn2QeiTjaA6jPag/gCJfHQoKaOLRU2Ysexqzbh9EIY1xVmPm3ZjlO6SPqdHdnnRQIro/8T/a0M++5n+IOPeQQpqbGHTcgk+eVqBAxxQj1lMeGXGwW2zHTvRkAlU7/tIaEw== 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=UhUv8+EztO+AyELVXLNXnlYBC6Z7ARqcfPiynNuhd20=; b=LIMG4SK9C58LtcxTQX50VNNDt4sTUVwN9pS2Fxab+uBRgpSjXzthePHO7iKrW9kD9tSrK17rTSluEuMZU2OVTl4FEA+jZiM9NHDKM1l1IwIqV+RexR+bAoMLsg13zix0oAQqjEvefv1qiIQv/Fq8MT5i7lU3818slR80CspYiNo= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) by PH0PR11MB4774.namprd11.prod.outlook.com (2603:10b6:510:40::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.17; Wed, 15 Sep 2021 08:20:02 +0000 Received: from PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::747b:3a08:d1ec:31fc]) by PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::747b:3a08:d1ec:31fc%5]) with mapi id 15.20.4500.019; Wed, 15 Sep 2021 08:20:02 +0000 To: Stephen Hemminger , CC: , , "Loftus, Ciara" , Qi Zhang , Anatoly Burakov References: <20210903161525.9929-1-stephen@networkplumber.org> From: Ferruh Yigit X-User: ferruhy Message-ID: Date: Wed, 15 Sep 2021 09:19:56 +0100 In-Reply-To: <20210903161525.9929-1-stephen@networkplumber.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: DB3PR06CA0019.eurprd06.prod.outlook.com (2603:10a6:8:1::32) To PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) MIME-Version: 1.0 Received: from [192.168.0.206] (37.228.236.146) by DB3PR06CA0019.eurprd06.prod.outlook.com (2603:10a6:8:1::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Wed, 15 Sep 2021 08:20:01 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b969c1c8-f1d5-477d-e86c-08d978219db1 X-MS-TrafficTypeDiagnostic: PH0PR11MB4774: 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:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4G16tPTeCoPCEhIDVnbEiD2XpVUKcBUoHj7y9d0xOkbwpKziXXEk1qXIwfZnajiyyIyJQTT2nzdYpoGiecSdW85+J6s0kmtypnRQb3qIAS626IQsk4pcVxUZu1tCjyAGN+MQCVEkMYAIIP5aDvDKA7NZuh8beo7p1m71+VuJyO5lDoyjDas3HNb0m9YxKw3tkzo1co8IEjXqMPqIF13qcRgur77IMNwcrHSs6xvCz2/2uMDvbfdmnyFmWJ4FGbB0KU8u1sbslwEE/PHkdf87MNsmIlrFiMFGuuvBqVyNR52mdOp76XP3HQM+wOSlKWD7hTnelqlmkjRn41z4oXrg1RUrVW7qK1uXLRcvYe/1ktp9Ei2v3nP/8DoeYjRD1MR830CUQ+VEZc+Iv87OGHe2YeRq2iANEOQVXcFuSICOnkc5amhduRNP0uqnTNxHAfZ2a+dv5v40f9X+oJbllXwWt3G7ONwSHv0OlbMmYKqOdEEnn9uEYZgVU6Lh6vXI47oVriuNIP8YXZ/UB8DBbXLkc7RBVvZU6xzeIY6GDhhmqPf/wZfDozxvA6mq+J0fmsX54NGaqIKWNaUTzZEiyXvmjLGm4h1f4T7/lwaEoM+kqzM2yQ1YvU88Yh4UFRiF1d5p4//3X5EzeotXhFTJLkoAJ/w1LP0XFUvISO43dpiL6E0AU3lwrbv7RmuKlVgT6otBxetG/nXV5w1tAHtvqs3PUg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5000.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(366004)(346002)(376002)(136003)(396003)(66476007)(6666004)(66946007)(316002)(83380400001)(478600001)(31686004)(2906002)(16576012)(38100700002)(107886003)(66556008)(36756003)(8676002)(8936002)(6486002)(86362001)(26005)(31696002)(54906003)(53546011)(4326008)(2616005)(5660300002)(956004)(44832011)(186003)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?T2FRTG40MlFvQVFKUnZaLzhiWVhhTGVyYUpXL2JINFREWGcxbTNMQjNheUZQ?= =?utf-8?B?Q2hFZ2dDdjdWUDIvQ3FoVEUyaVdFUXdaNFVhRTlrVTkyNGpvbFFJR1owQ1ha?= =?utf-8?B?ZDlJUFRqSlZsR3cvYVZST0E4amxJbkZjZ0R3MFhjWTFpT0pDSWpVS2hHeUls?= =?utf-8?B?VkwxU1FPL3lYNit0VGM1WEkzdXlXM2JoT001OHVpK3lFN2szZUlDQ2YyaGZj?= =?utf-8?B?aUsvSHhqSEs0WnUwbSt5YjNNWUplbDRKWGZMQ2licW4xaTJjNmtNRThOUnJR?= =?utf-8?B?ZWY3djZZOU8yY2pPRHVtWDNZZmVEMzh3QnYxSjcxeHgvVm1KTUFhc1p1aWlj?= =?utf-8?B?eVZKZ0liTGw1UnFaU3QvektHbC9PQU9oRXY3bVRoSXlEcm5BUjJ6T2ZSRHVZ?= =?utf-8?B?akxZMVZ4TEpac29QNW9OQkNReHA5b2QrSi8ycDA0NjJuTjhJUHZFbTZjaUFH?= =?utf-8?B?SHA2L0dKNU5oUnpWUm1UOERWdzRteEFETFJXZDMyY1VsL3hxcnZSTkJiYTdU?= =?utf-8?B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?utf-8?B?enNBSFRJTDJCT0E3bmN5M3h5VUFtV3VNNk1BMkg5OXpOZzN5WlBuNTZRekZa?= =?utf-8?B?OU03T0lmaDhLVXVYT2dQdmZxek5YMS9hdGpPUmdPa3pESEVwMytmelpIWkln?= =?utf-8?B?M2F1c1NxSG9vdzlvN0xUMlp0Y3dITjdLN09MOGFWMzVaSUppd1l3ZjlSOC93?= =?utf-8?B?aDdxeEVTbzd4SHVFa09WdlY5SitEVnJSUXdsQWk5MWNQN1FPbTFOVGF0dFdS?= =?utf-8?B?THVBR0pxWHBmMWVva3l2bFBvSlVFeEhOWklxS2ViQ3dLZllIVWxnZ05OVUJy?= =?utf-8?Q?Qsok7+GnW2n3ux1UiNhsf9P4cbQ3Nf2tN3Q8DP7?= X-MS-Exchange-CrossTenant-Network-Message-Id: b969c1c8-f1d5-477d-e86c-08d978219db1 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5000.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 08:20:02.6692 (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: TC1XBDL3TrAqvLg21D8u6hgPDKO3RIZhMTOEOkhb9wrEKmuvfmQFC0+0fi5SpY6FdFTcL3B5WF1ykKxx/LbTDA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB4774 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH] net/af_xdp: fix support of secondary process 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" On 9/3/2021 5:15 PM, Stephen Hemminger wrote: > Doing basic operations like info_get or get_stats was broken > in af_xdp PMD. The info_get would crash because dev->device > was NULL in secondary process. Fix this by doing same initialization > as af_packet and tap devices. > > The get_stats would crash because the XDP socket is not open in > primary process. As a workaround don't query kernel for dropped > packets when called from secondary process. > > Note: this does not address the other bug which is that transmitting > in secondary process is broken because the send() in tx_kick > will fail because XDP socket fd is not valid in secondary process. > > Bugzilla ID: 805 > Fixes: f1debd77efaf ("net/af_xdp: introduce AF_XDP PMD") > Cc: stable@dpdk.org > Cc: xiaolong.ye@intel.com > Ciara Loftus > Qi Zhang > Anatoly Burakov > +cc Ciara, Qi & Anatoly > Signed-off-by: Stephen Hemminger > --- > drivers/net/af_xdp/rte_eth_af_xdp.c | 17 +++++++++-------- > 1 file changed, 9 insertions(+), 8 deletions(-) > > diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c > index 74ffa4511284..70abc14fa753 100644 > --- a/drivers/net/af_xdp/rte_eth_af_xdp.c > +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c > @@ -860,7 +860,7 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) > struct pkt_rx_queue *rxq; > struct pkt_tx_queue *txq; > socklen_t optlen; > - int i, ret; > + int i; > > for (i = 0; i < dev->data->nb_rx_queues; i++) { > optlen = sizeof(struct xdp_statistics); > @@ -876,13 +876,12 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) > stats->ibytes += stats->q_ibytes[i]; > stats->imissed += rxq->stats.rx_dropped; > stats->oerrors += txq->stats.tx_dropped; > - ret = getsockopt(xsk_socket__fd(rxq->xsk), SOL_XDP, > - XDP_STATISTICS, &xdp_stats, &optlen); > - if (ret != 0) { > - AF_XDP_LOG(ERR, "getsockopt() failed for XDP_STATISTICS.\n"); > - return -1; > - } > - stats->imissed += xdp_stats.rx_dropped; > + > + /* The socket fd is not valid in secondary process */ > + if (rte_eal_process_type() != RTE_PROC_SECONDARY && > + getsockopt(xsk_socket__fd(rxq->xsk), SOL_XDP, > + XDP_STATISTICS, &xdp_stats, &optlen) == 0) > + stats->imissed += xdp_stats.rx_dropped; > > stats->opackets += stats->q_opackets[i]; > stats->obytes += stats->q_obytes[i]; > @@ -1799,7 +1798,9 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device *dev) > AF_XDP_LOG(ERR, "Failed to probe %s\n", name); > return -EINVAL; > } > + /* TODO: reconnect socket from primary */ > eth_dev->dev_ops = &ops; > + eth_dev->device = &dev->device; > rte_eth_dev_probing_finish(eth_dev); > return 0; > } >