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 82BC0A0C41 for ; Mon, 20 Sep 2021 15:24:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 32F00410EC; Mon, 20 Sep 2021 15:24:05 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 0214240DF5; Mon, 20 Sep 2021 15:24:02 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10112"; a="308674342" X-IronPort-AV: E=Sophos;i="5.85,308,1624345200"; d="scan'208";a="308674342" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2021 06:24:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,308,1624345200"; d="scan'208";a="548710212" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by FMSMGA003.fm.intel.com with ESMTP; 20 Sep 2021 06:24:02 -0700 Received: from fmsmsx605.amr.corp.intel.com (10.18.126.85) by fmsmsx601.amr.corp.intel.com (10.18.126.81) 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:24:01 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx605.amr.corp.intel.com (10.18.126.85) 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:24:01 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.100) by edgegateway.intel.com (192.55.55.70) 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:24:01 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hTaigCrq4Q/UHrz/hWuyY3I/0/fkOgw35bv5wGZ34sQ0wPNgpAoXa4tNdFvShrtaFid8qwrC/3ktVK8yAstf47gvT3n4V1xUFsvlxNyVoGDTKqqtP/wHead9n8bL345d2oRgy+UrISsn/xOsXPgGNiqoWwMxMpURJi9i+OX4uph1dWOwd1/mX5FDvjP/LPS5osN056vE8M9WThizTFV/XYqPFXvXuiGkBShKRvGKP8zXsPyLV8AHOcUdshhGxUmg6bhySTNL8CD27wirNPHhlEOwkYCzCGeDSNiVJfyAKuMCoV7KEbtDuGN0gZWgIue21Sb4VD70ZRTQ3PbXUq4j9g== 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=dBdVCQfQo/7XRliL8DICxzNBS9FIccvHTvtIYYjhHAg=; b=AiDqB4fr9ymnhyOecsLhrjh9pbMBi07yhlW1eT/5qUZf11id/pWUXFxXOTJniiPui1wISZfIZBrDRVVuUQw8/vu+didf/ULvcpwthZVcZ8Qgnjd7pFCE1dy8uMXXGxRTIXvQAQ4P3DoeEGceOd2E+jEY5OeWHtNDAEGJDbAsXSuXHykhlwJrSa9cZB9WLysX2AOCI90mghdLX0oMcEryP73p5DtMpkkDN8NOmQLDHnekUxoLUkKMVL3eh6RwLAWVxjFj/rGStf407t1OvePWPhfoVUtomeRX32zhxY45kYVz793MoRxXJVpAeHn7S/hiCooXgJF9SIQ5s+/9ZJa3zQ== 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=dBdVCQfQo/7XRliL8DICxzNBS9FIccvHTvtIYYjhHAg=; b=nbVeuA/CIurEd0vCETISvG0+bWAa6l/8NvuJwo8tuXi/kvwjWjf+vtBQ+LAiO/Z0ne42FXQfCe+8XWyWHgJom+JJ1XMN+ZYW9dc8epxV8k6fNT6OaOpMP/9PLVlQKBz0+4WTHeis2eP5jfv4q/I7/Fqi0atN4ZJS/jUaK00sMg0= Received: from PH0PR11MB4791.namprd11.prod.outlook.com (2603:10b6:510:43::10) by PH0PR11MB4984.namprd11.prod.outlook.com (2603:10b6:510:34::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Mon, 20 Sep 2021 13:23:57 +0000 Received: from PH0PR11MB4791.namprd11.prod.outlook.com ([fe80::60ba:24be:ee9f:a155]) by PH0PR11MB4791.namprd11.prod.outlook.com ([fe80::60ba:24be:ee9f:a155%7]) with mapi id 15.20.4500.019; Mon, 20 Sep 2021 13:23:57 +0000 From: "Loftus, Ciara" To: Stephen Hemminger , "dev@dpdk.org" CC: "stable@dpdk.org" , "Yigit, Ferruh" , "Zhang, Qi Z" , "Burakov, Anatoly" Thread-Topic: [dpdk-dev] [PATCH] net/af_xdp: fix support of secondary process Thread-Index: AQHXoN77Z48TeDhdbUWkYsYq/ENWeautAvww Date: Mon, 20 Sep 2021 13:23:57 +0000 Message-ID: References: <20210903161525.9929-1-stephen@networkplumber.org> In-Reply-To: <20210903161525.9929-1-stephen@networkplumber.org> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.200.16 authentication-results: networkplumber.org; dkim=none (message not signed) header.d=none;networkplumber.org; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d875883b-a6af-4cf1-b662-08d97c39e6e5 x-ms-traffictypediagnostic: PH0PR11MB4984: 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:9508; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 657NlkBBWxaUhiUSLyJYzaL86qFMeg2t6CLbXysQKU7riz0Zh/fYNDoxfYurmz1um/oBuajVq7zqRAoahTT/WBrjFy1gQ3lgEzRkEIQo0g7frG5vjEwxdrlwR76n6HhMlWG5pjbIEtiiHRBf08syN9EbiDFJRkkau5CE0qjfJwcz08SbRd30xhDMO2nNj/lcfTFFZJyIdPTLhBpEo54HfOP+lWun/sHSJg3Mij3/ShWEue2M5I82mO9NAWDWFjruMelMEbC3tJVY0PuoTH1qbShyl5V6gPdC/208VchsIkYw1TC2Q3l6e/QiVfpMs+hOXfcCBmuLI4l51kahkgJo5SgrY7s2MRzcJZhF4kPZd9u5fwJ+kg+ti5yoZkDY/vBHNOGhHc3LOkIZcx78Yik/oqjqp4WwJ3OUf+42qA2Dzc2SIdJlkqlgjyg5+JCeulPu8ZJ4VgC+w7U7mLviICxM5M6cZCCuPpunCNliW8SpYXi12xZuPXIA7BaUir1RHIHA+pSA2yC7RetjCIuaa3t9Vdw5drKGRyE8CW7B+egU3LeN7n3hl4hDZCRUgTKS1El8MpDrWvcHhuZI7QxF/zz7ZEHPOxJf+EcKTZeFMOYv+B7cY21KK/ImNNWfLOUMdcywxizzNFwCt7ze/r92he7QkOPDMHbReVaryVZFoOU3RLs0/ZjcLnfOyWMf3lBO4pX8guyI926H352jmow9HzwedQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB4791.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(346002)(136003)(366004)(396003)(376002)(53546011)(107886003)(5660300002)(86362001)(6506007)(76116006)(7696005)(122000001)(38100700002)(2906002)(71200400001)(83380400001)(52536014)(66556008)(66446008)(478600001)(64756008)(66476007)(9686003)(66946007)(38070700005)(4326008)(316002)(54906003)(26005)(110136005)(186003)(8936002)(33656002)(55016002)(8676002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?rii9r61BW1qmh53uL1FnngaO7+aOIyNBEhZRskjNw16In2G//T+yuSqNpcku?= =?us-ascii?Q?1ycMDii80ria6qiiCehEtbICqn85i8CohAiJPix0ECMH7uUEbzcg3DKoi44E?= =?us-ascii?Q?sJYaGdHnd1vf9rv1c0r/L2L76kV90ZLX88uWwFjhNhMdSKekB7ZDkhBcR8Cb?= =?us-ascii?Q?g+b2Gi3UO/UYP+QB/tnT8TsIcA4beABWM6QhAaQ6ARAPsIcNzvHwfHs41C/7?= =?us-ascii?Q?jMXZ5PqcBzhnezz2EZpmQ+g9jWmPO9IGWn94nozoC5G73x3F934vkMzlUZCW?= =?us-ascii?Q?fNpL/8ma78M33+Ijx1FnsXPJqq6Ga87PdKLpwYH5zmAhiEYZmmztDlaIL9uM?= =?us-ascii?Q?Mtq5yLErZ1TePXbkBh30NdfoS+ca/UQkBEcm8FgeJ65UH8Mk0yERM49ITotc?= =?us-ascii?Q?Z9HZ3KCCHg4ZXhfTrtY+7Jx28Wx0byv9YEK+NctEaD8S2batMp6eJtQe0UGY?= =?us-ascii?Q?9NbFr2F1jhMD2hNaJBkREdIykjvzrIBGydU5lXU+Uinug1F6MqYaL24IDq5P?= =?us-ascii?Q?4EZSICaDC+1zGZGTnMF+XDpqu+JjvrhvOkMffwGiQVN0RonApOZvx+Hk8xk+?= =?us-ascii?Q?aZGlRVb3oclJ6yrAO8FmYf0U+MCHZ4ehWSxqLKk9SJwvGg01vHVOpEq1VTw6?= =?us-ascii?Q?ayL2yu7B1rfX2CPLVL9BqtiPEBQVmFTE2W2hiBO8bNT2jQd7BMmuKp0lfN0n?= =?us-ascii?Q?dJk2vbdkL8GhFtOCxjPobL3eJ42Ugxsy2bMcyLG1inqaQumehgVUG1htUuc9?= =?us-ascii?Q?WtWrOSbwquCPg1b37cvy/U6/iBzy9cysrZTNnR+wQDNzFr/JIsbRMAs9BC3c?= =?us-ascii?Q?FGUueMevnXbDop87IVSnzzWMAI33aWmZ2nDsuMJEy7IWh4eNqu5qJSJyYYzV?= =?us-ascii?Q?2tgETgZLwEQYGQXgl009f37GzRT4r/XfCApIksh/2rUXn4b3ySVu60LIx/X/?= =?us-ascii?Q?f6Fz7zDqw/luSvWsHa9vyiV0Tu2ojIo4gRO/I1BnWdwTyaqe5l1UY3k5lSW3?= =?us-ascii?Q?Jjwmp/qPfYSVolBQc8erBd6GamBv2jD8NiJJ4cohQ4EVM157SqKimjo+Zu8i?= =?us-ascii?Q?gq0yGFUPDP7ky6FfOViwPeebc46d24Prxqd3stv2xWFg8Ol+dbcXCdHn2ZEN?= =?us-ascii?Q?1FQHhYsHhoAfMVDOoz/LoYX8Y4m/2xGGMHVFGRNYWtaqIVhqUzVrJy7CvltG?= =?us-ascii?Q?4JiNILVKfXtJ6QM1FOWgxKcNu/m59tMq5wmYUSFfDPhOBBar4ALSyqb+GtoO?= =?us-ascii?Q?6us2bjgXLuj1fbeallbfM1kVGo7MkN1gAuYUWT41PTn/xM1HCDB0R8LE8A+1?= =?us-ascii?Q?4C4=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB4791.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d875883b-a6af-4cf1-b662-08d97c39e6e5 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Sep 2021 13:23:57.7344 (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: amEesRk8zy85jxPSw5mV/tY+xvLFRcCJWEZwFL7IoaURB7cf5NDZQUlNQraYNCh51i1S8WOAUT07NsaXB4jctA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB4984 X-OriginatorOrg: intel.com Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] net/af_xdp: fix support of secondary process X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" > -----Original Message----- > From: dev On Behalf Of Stephen Hemminger > Sent: Friday 3 September 2021 17:15 > To: dev@dpdk.org > Cc: Stephen Hemminger ; > stable@dpdk.org; xiaolong.ye@intel.com > Subject: [dpdk-dev] [PATCH] net/af_xdp: fix support of secondary process >=20 > 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. >=20 > 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. >=20 > 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. Hi Stephen, Apologies for the delayed reply, I was on vacation. In the Bugzilla report you suggest we: "mark AF_XDP as broken in with primary/secondary and return an error in probe in secondary process". I agree with this suggestion. However with this patch we still permit secon= dary, and just make sure it doesn't crash for get_stats. Did you change you= r mind? Personally, I would prefer to have primary/secondary either working 100% or= else not allowed at all by throwing an error during probe. What do you thi= nk? Do you have a reason/use case to permit secondary processes despite som= e features not being available eg. full stats, tx? Thanks, Ciara >=20 > 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 >=20 > Signed-off-by: Stephen Hemminger > --- > drivers/net/af_xdp/rte_eth_af_xdp.c | 17 +++++++++-------- > 1 file changed, 9 insertions(+), 8 deletions(-) >=20 > 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; >=20 > for (i =3D 0; i < dev->data->nb_rx_queues; i++) { > optlen =3D sizeof(struct xdp_statistics); > @@ -876,13 +876,12 @@ eth_stats_get(struct rte_eth_dev *dev, struct > rte_eth_stats *stats) > stats->ibytes +=3D stats->q_ibytes[i]; > stats->imissed +=3D rxq->stats.rx_dropped; > stats->oerrors +=3D txq->stats.tx_dropped; > - ret =3D getsockopt(xsk_socket__fd(rxq->xsk), SOL_XDP, > - XDP_STATISTICS, &xdp_stats, &optlen); > - if (ret !=3D 0) { > - AF_XDP_LOG(ERR, "getsockopt() failed for > XDP_STATISTICS.\n"); > - return -1; > - } > - stats->imissed +=3D xdp_stats.rx_dropped; > + > + /* The socket fd is not valid in secondary process */ > + if (rte_eal_process_type() !=3D RTE_PROC_SECONDARY && > + getsockopt(xsk_socket__fd(rxq->xsk), SOL_XDP, > + XDP_STATISTICS, &xdp_stats, &optlen) =3D=3D 0) > + stats->imissed +=3D xdp_stats.rx_dropped; >=20 > stats->opackets +=3D stats->q_opackets[i]; > stats->obytes +=3D 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 =3D &ops; > + eth_dev->device =3D &dev->device; > rte_eth_dev_probing_finish(eth_dev); > return 0; > } > -- > 2.30.2