From patchwork Mon Jan 28 12:29:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pieter Jansen van Vuuren X-Patchwork-Id: 1031888 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=netronome.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=netronome-com.20150623.gappssmtp.com header.i=@netronome-com.20150623.gappssmtp.com header.b="qFEIrnHQ"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43p8DS6F2Gz9s7h for ; Mon, 28 Jan 2019 23:33:12 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 523482210; Mon, 28 Jan 2019 12:33:08 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 53F5A1EC0 for ; Mon, 28 Jan 2019 12:29:48 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id A4F25711 for ; Mon, 28 Jan 2019 12:29:46 +0000 (UTC) Received: by mail-wm1-f66.google.com with SMTP id b11so13812374wmj.1 for ; Mon, 28 Jan 2019 04:29:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=AmUe6KDZ+XBGC/0CA45WrHej0C7j3868on5ffi8QS+0=; b=qFEIrnHQEmoA2olvTc6Vf6IJ0qXTZUGRQbHuTq9vllJjqHIB8Rc2E1Axig9ktiSALa 0aHwQh45rDrKQbOo1W5EbmZx7IeyDDNyYyd9++u0s5+aGFNca0ZtNsO09EoP0gRWVAma A1TEVJpozZIZ2tltm0BmEd8OISBHhR8f1D0E21k8TpG1byOzgBhsOBCnQCBv7334wKNm jeHC7INU10eySZDBRW7WR0/mI6HJc4Do+SYcUywco3MvsH4bXGivMZtJ/qxTTJmtxXW7 3V4TMaNy432cPkBxmv2VlvjTlse3b2H5Vj6GMwkzKc0gXyrg81eSH7SFD8Ay8WUAMjxl UbQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=AmUe6KDZ+XBGC/0CA45WrHej0C7j3868on5ffi8QS+0=; b=I5qXcsosdrMQytkQtk28By3euy0Ax3vEZtGiY3tC0RFSDD9F/CEYlJDHPb+GOePg2m 7XlmDlCcDhYQhzNdi8Nl7a94VXxeWk6QUMp189IDGbhN8f6CLQgRmYgtxGY64IKE3A/1 FTvFi08ZC8qw/JURt1x6UcqBkiOvylg5QuTiB2ipIp61aQ6wK/Sx80tAS7USbywcT+1I kl1iYEVOYWV3F1nrNfzp2irGdU14Ez1xpZ9kRaUxk5PXG6U6nTQMLFhEZb69SJ/cxrN7 9DBs5RRdvIYyc4jBG08i/OtfJLZkxIt/6neQQNQhGEyusH3MHMoRKk/dZuZieVLFkeBy 23Og== X-Gm-Message-State: AJcUuke4AwmhBHYml8f9SpJLmXa9rGydes9yjraADy5gt8U7lln31Z4W g+WqdThPTsUAZSM1Wcp4ppEhFqaH1ew= X-Google-Smtp-Source: ALg8bN70HbO6ymUyHKL2UoYMOMuZZjR/xIvaekzIGdu9ea2xTaAZYw/nI/yf3f7Dm7jtfvGor7asDg== X-Received: by 2002:a1c:a913:: with SMTP id s19mr16179728wme.4.1548678585125; Mon, 28 Jan 2019 04:29:45 -0800 (PST) Received: from pieter-Netronome.netronome.com ([217.38.71.146]) by smtp.gmail.com with ESMTPSA id x186sm94367285wmg.41.2019.01.28.04.29.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Jan 2019 04:29:44 -0800 (PST) From: Pieter Jansen van Vuuren To: dev@openvswitch.org Date: Mon, 28 Jan 2019 12:29:06 +0000 Message-Id: <1548678550-6661-1-git-send-email-pieter.jansenvanvuuren@netronome.com> X-Mailer: git-send-email 1.9.1 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: simon.horman@netronome.com, Pieter Jansen van Vuuren Subject: [ovs-dev] [RFC v3 0/4] extend ovs-tc offload for more pedit action X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Hi all, This set fixes and subsequently extends the ovs-tc pedit interface to allow setting ipv4 dscp and ecn fields as well as ipv6 traffic class in tc via pedit. Patch 1 introduces a new sparse header which helps work around the big endian issues in the tc_pedit_key structure. Patch 2 fixes the offset calculation function which could lead to undefined behaviour. Patch 4 in this set also introduces the notion of boundary shifts to allow translating non-byte-aligned fields like traffic class and flow limit for IPv6 to be offloaded. v2 -> v3: - Create sparse/linux/tc_act/tc_pedit.h to work around be32 issue. - Fix big endian issue (patch 1). - Fix 32 bit shift (patch 2). v1 -> v2: - Move helpers from byte-order.h to local tc.c - Swap htonl/ntohl and reword comment. Pieter Jansen van Vuuren (4): lib/tc: make pedit mask calculations byte order agnostic lib/tc: fix 32 bits shift for pedit offset calculation lib/tc: add set ipv4 dscp and ecn action offload via pedit lib/tc: add set ipv6 traffic class action offload via pedit include/sparse/automake.mk | 3 +- include/sparse/linux/tc_act/tc_pedit.h | 29 +++++++++ lib/netdev-tc-offloads.c | 10 ++- lib/tc.c | 87 ++++++++++++++++++-------- lib/tc.h | 2 + 5 files changed, 102 insertions(+), 29 deletions(-) create mode 100644 include/sparse/linux/tc_act/tc_pedit.h