From patchwork Wed Jan 22 10:05:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sven Auhagen X-Patchwork-Id: 1227148 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=voleatech.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=voleatech.de header.i=@voleatech.de header.a=rsa-sha256 header.s=selector2 header.b=AKnQZY8B; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 482gyJ29mqz9sQp for ; Wed, 22 Jan 2020 21:05:28 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729516AbgAVKF0 (ORCPT ); Wed, 22 Jan 2020 05:05:26 -0500 Received: from mail-db8eur05on2095.outbound.protection.outlook.com ([40.107.20.95]:54720 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729078AbgAVKF0 (ORCPT ); Wed, 22 Jan 2020 05:05:26 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g5ENIEROutNhqmFt+mnO3bMbA7FpItLyE0p6FgU/eanrqZs/c/BZfeBNBxsTiW3aqU/3QRQv5hDBTp8BmwZSpWrf918UsK7hCPotAfiNN7haGxZcyekeZbVVdcRFbJtOL2P7K+Rch0uIHpXKJCmCqaTpo7dtLcW1lo4xEHCEMSwbeD8eeCrxxi1ZBsvFtoRi6nGEhG7MyloLC9wYt2PM7gWhy1E2T9jexocbboo/Tv5h6lsly+e+SXKDDaD8kZps+U1S01uJLLnY2EyxOXquiql+nKnxb8ttQJzzy1XTCtzbJRDsASvfQjH1JvxxDXgji0YbNZ/E1yf2mmwcAo5Lbw== 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-SenderADCheck; bh=CASeRVJzg1Zgmh2ZrJVBTqpb5ewSbN1cUkBizEERPm4=; b=KYZ58/gAdd1lOxkMVvqd660o2u74QGydAkf7GamIymjqCpc94c26R6ZYCcoF4m2jwlLbJkHvxJ0Lgefvzq1J5P7je23BYXuCFI+B+j5Ip6WIM2FAPpsY/pkimChf1s+C5j7yWbRuVWlZ0pARhEMyvLDbdBQ0vVo89HNIkiLXhkqqznJTBtYSnJPovKZ26f4qCtdMPdqtz6H60rqaTCZmHVp5A5rTTHO0avt9b9emuqtARqSKGLWP2R9qQlv+1VeHojddRZhpXeUX96jfHZGAHb0vpqNsKx8TvSfs8E9MohQHy+bDY1dQoTmoklIW5IayqNdRIo57Vpx1uEQaXOyh7A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=voleatech.de; dmarc=pass action=none header.from=voleatech.de; dkim=pass header.d=voleatech.de; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=voleatech.de; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CASeRVJzg1Zgmh2ZrJVBTqpb5ewSbN1cUkBizEERPm4=; b=AKnQZY8BRbdlxU7+s3HlHSIWVnsgfMQ4ZKAik4HDFhHoWFZB19YaFqBvsxz5O71jiqcVgWG4HgVecWu70jKDwjmYe3DNItt9XgqR2INbHlp286wv6Cc5wMQHcTj3+ONwWjrfegB+NLRu8qi3L/j7ry+yZCCqxzVvDYjRIkeNQBc= Received: from AM0PR05MB5156.eurprd05.prod.outlook.com (20.178.20.19) by AM0PR05MB5939.eurprd05.prod.outlook.com (20.178.118.94) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.18; Wed, 22 Jan 2020 10:05:21 +0000 Received: from AM0PR05MB5156.eurprd05.prod.outlook.com ([fe80::28cb:442b:6907:83e7]) by AM0PR05MB5156.eurprd05.prod.outlook.com ([fe80::28cb:442b:6907:83e7%6]) with mapi id 15.20.2644.027; Wed, 22 Jan 2020 10:05:21 +0000 From: Sven Auhagen To: "netdev@vger.kernel.org" CC: "lorenzo.bianconi@redhat.com" , "davem@davemloft.net" , "thomas.petazzoni@bootlin.com" , "brouer@redhat.com" , "ilias.apalodimas@linaro.org" , "matteo.croce@redhat.com" , "mw@semihalf.com" , "jakub.kicinski@netronome.com" Subject: [PATCH] mvneta driver XDP fixes armhf Thread-Topic: [PATCH] mvneta driver XDP fixes armhf Thread-Index: AQHV0Qt0wGHHU1bPe06KgczxouriXQ== Date: Wed, 22 Jan 2020 10:05:21 +0000 Message-ID: Accept-Language: en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=sven.auhagen@voleatech.de; x-originating-ip: [37.24.174.42] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5b93cf1e-7071-4350-694a-08d79f229736 x-ms-traffictypediagnostic: AM0PR05MB5939: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 029097202E x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(4636009)(346002)(366004)(199004)(189003)(6512007)(2616005)(15974865002)(4326008)(81156014)(8936002)(8676002)(508600001)(33656002)(44832011)(86362001)(76116006)(64756008)(2906002)(66556008)(66476007)(66446008)(36756003)(66946007)(6916009)(81166006)(26005)(186003)(6506007)(54906003)(71200400001)(6486002)(5660300002)(66574012); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR05MB5939; H:AM0PR05MB5156.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: voleatech.de does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: b0Bm0FRxBTQPOmQZaMT9DGHrLIZ2UWNySjFNePHJKgKKs+BG4VGFnf0FW/i06FnkbzFNi2vAuERWka62dmGAs4EuQga+CsHeR7tokyGiC9DWZkXiwPC7QZoyUAUOQaw6xFXd0iP7KJdS4hBGiHPxAUbwx7mDtm7NJ5mLJjE1e773ZUpBEvgFfIgWzZWYmdzmfyWpyZTPYSV7Aq/K60t4ZrV29Be5NJ+iz8lGpxFazjyI6FXy6NWULprDdrTz+z2EBQGNEOjGtHfnDskJkFJXmJSb0t4Fc6/+FVIOqJ/O3cgPiai/OfZL1i9ZTm6jhZgRUDPKFuNoQnwLNe+GufvJyhfdL4qFQqMjBqXQ31CTs22RGaIA+9y3Ma9Zz3n5WoZ945el+zPilw6THfiWp/vpasfRdG0n75G9tW48Zv3vPpS629O9KuDU7Y6a4A4PxP0g x-ms-exchange-transport-forked: True Content-ID: <3939AA22C595144ABCB34AAD265218E5@eurprd05.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: voleatech.de X-MS-Exchange-CrossTenant-Network-Message-Id: 5b93cf1e-7071-4350-694a-08d79f229736 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Jan 2020 10:05:21.0394 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b82a99f6-7981-4a72-9534-4d35298f847b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: PrFYmC98rIQEIF5bMUbuE5+xNacQAqeUP4ZgJLgVUOM127VJelmF8WnI6BracioHxAU6wCDXtGjVyNwXi3ZtCox708ynfZPbzChqI9mUVUs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB5939 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Recently XDP Support was added to the mvneta driver for software buffer management. I tested XDP with my armada 388 board. It has hardware buffer management defined in the device tree file. I disabled the mvneta_bm module to test XDP. I found multiple problems. 1. With hardware buffer management enabled and mvneta_bm disabled the rx_offset was set to 0 with armhf (32 bit) which leads to no headroom in XDP and therefore the XDP Redirect did not work. 2. Removing the hardware buffer management from the device tree file completely made the mvneta driver unusable as it did not work anymore. After some debugging I found out that xdp->data = data + pp->rx_offset_correction + MVNETA_MH_SIZE; has to be xdp->data = data + pp->rx_offset_correction; if pp->rx_offset_correction > 0. I am not sure why and I am looking for help if someone is seeing the same on an arm64 board. Attached is a patch that fixes the problem on my armhf platform, as said I am not sure if this is a universal fix or armhf only. Any feedback is appreciated. Signed-off-by: Sven Auhagen +++ Voleatech auf der E-World, 11. bis 13. Februar 2020, Halle 5, Stand 521 +++ Beste Grüße/Best regards Sven Auhagen Dipl. Math. oec., M.Sc. Voleatech GmbH HRB: B 754643 USTID: DE303643180 Grathwohlstr. 5 72762 Reutlingen Tel: +49 7121539550 Fax: +49 7121539551 E-Mail: sven.auhagen@voleatech.de www.voleatech.de Diese Information ist ausschließlich für den Adressaten bestimmt und kann vertraulich oder gesetzlich geschützte Informationen enthalten. Wenn Sie nicht der bestimmungsgemäße Adressat sind, unterrichten Sie bitte den Absender und vernichten Sie diese Mail. Anderen als dem bestimmungsgemäßen Adressaten ist es untersagt, diese E-Mail zu lesen, zu speichern, weiterzuleiten oder ihren Inhalt auf welche Weise auch immer zu verwenden. Für den Adressaten sind die Informationen in dieser Mail nur zum persönlichen Gebrauch. Eine Weiterleitung darf nur nach Rücksprache mit dem Absender erfolgen. Wir verwenden aktuelle Virenschutzprogramme. Für Schäden, die dem Empfänger gleichwohl durch von uns zugesandte mit Viren befallene E-Mails entstehen, schließen wir jede Haftung aus. --- a/drivers/net/ethernet/marvell/mvneta.c2020-01-22 08:44:05.611395960 +0000 +++ b/drivers/net/ethernet/marvell/mvneta.c2020-01-22 08:59:27.053739433 +0000 @@ -2158,7 +2158,7 @@ mvneta_swbm_rx_frame(struct mvneta_port prefetch(data); xdp->data_hard_start = data; -xdp->data = data + pp->rx_offset_correction + MVNETA_MH_SIZE; +xdp->data = data + pp->rx_offset_correction; xdp->data_end = xdp->data + data_len; xdp_set_data_meta_invalid(xdp); @@ -4960,7 +4960,8 @@ static int mvneta_probe(struct platform_ * NET_SKB_PAD, exceeds 64B. It should be 64B for 64-bit * platforms and 0B for 32-bit ones. */ -pp->rx_offset_correction = max(0, +if (pp->bm_priv) +pp->rx_offset_correction = max(0, NET_SKB_PAD - MVNETA_RX_PKT_OFFSET_CORRECTION); }