From patchwork Wed Dec 27 02:28:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Subash Abhinov Kasiviswanathan X-Patchwork-Id: 853038 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) 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; dkim=pass (1024-bit key; unprotected) header.d=codeaurora.org header.i=@codeaurora.org header.b="QNtI+Tbg"; dkim=pass (1024-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="KBCg0K1r"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3z5xc21vRHz9s7c for ; Wed, 27 Dec 2017 13:28:34 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751833AbdL0C2c (ORCPT ); Tue, 26 Dec 2017 21:28:32 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:48442 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751824AbdL0C23 (ORCPT ); Tue, 26 Dec 2017 21:28:29 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 5715D60B1F; Wed, 27 Dec 2017 02:28:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1514341709; bh=D+1MEtz98jhoEOVaUY6+b1iPBH2ITMnXJ13vqcyrhJ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QNtI+TbgJhybFugISX3z7lpbqyLgLFCUglkYESWz5ksblQI2JPHtNlEYEj+CBdwye T0nCzi/+KZqIVNqR9vIJOlPQZvQ9wxbx25TKG0YezxasjPINNGGagpzPOR6ApUgBXa CxSMVYLNQf4ezVJgJ2Rghgi7zFYxfYwPXeOhuMaE= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED, T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from subashab-lnx.qualcomm.com (unknown [129.46.15.92]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: subashab@codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 943E56071B; Wed, 27 Dec 2017 02:28:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1514341708; bh=D+1MEtz98jhoEOVaUY6+b1iPBH2ITMnXJ13vqcyrhJ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KBCg0K1rp/yCmzAYthVC+KE6vTh0CCSJi7yhEYNDx6L6QZdMMRL/+2XS61/k4YEUa fcjD0XQpPsJno5jz7SPxa9vf2WK8wh/6EtaZm7BKprKhXwn1i8Vl/jJZ2U6l0VZDa5 YJ+gve943ZXh3gzW1lcpJRyVHZK03tsrWjBF+oLw= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 943E56071B Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=subashab@codeaurora.org From: Subash Abhinov Kasiviswanathan To: davem@davemloft.net, netdev@vger.kernel.org Cc: Subash Abhinov Kasiviswanathan Subject: [PATCH net-next 06/10] net: qualcomm: rmnet: Define the MAPv4 packet formats Date: Tue, 26 Dec 2017 19:28:01 -0700 Message-Id: <1514341685-11262-7-git-send-email-subashab@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1514341685-11262-1-git-send-email-subashab@codeaurora.org> References: <1514341685-11262-1-git-send-email-subashab@codeaurora.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The MAPv4 packet format adds support for RX / TX checksum offload. For a bi-directional UDP stream at a rate of 570 / 146 Mbps, roughly 10% CPU cycles are saved. For receive path, there is a checksum trailer appended to the end of the MAP packet. The valid field indicates if hardware has computed the checksum. csum_start_offset indicates the offset from the start of the IP header from which hardware has computed checksum. csum_length is the number of bytes over which the checksum was computed and the resulting value is csum_value. In the transmit path, a header is appended between the end of the MAP header and the start of the IP packet. csum_start_offset is the offset in bytes from which hardware will compute the checksum if the csum_enabled bit is set. udp_ip4_ind indicates if the checksum value of 0 is valid or not. csum_insert_offset is the offset from the csum_start_offset where hardware will insert the computed checksum. The use of this additional packet format for checksum offload is explained in subsequent patches. Signed-off-by: Subash Abhinov Kasiviswanathan --- drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h | 16 ++++++++++++++++ drivers/net/ethernet/qualcomm/rmnet/rmnet_private.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h index ef0eff2..01d876c 100644 --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map.h @@ -47,6 +47,22 @@ struct rmnet_map_header { u16 pkt_len; } __aligned(1); +struct rmnet_map_dl_csum_trailer { + u8 reserved1; + u8 valid:1; + u8 reserved2:7; + u16 csum_start_offset; + u16 csum_length; + u16 csum_value; +} __aligned(1); + +struct rmnet_map_ul_csum_header { + u16 csum_start_offset; + u16 csum_insert_offset:14; + u16 udp_ip4_ind:1; + u16 csum_enabled:1; +} __aligned(1); + #define RMNET_MAP_GET_MUX_ID(Y) (((struct rmnet_map_header *) \ (Y)->data)->mux_id) #define RMNET_MAP_GET_CD_BIT(Y) (((struct rmnet_map_header *) \ diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_private.h b/drivers/net/ethernet/qualcomm/rmnet/rmnet_private.h index d214280..de0143e 100644 --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_private.h +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_private.h @@ -21,6 +21,8 @@ /* Constants */ #define RMNET_INGRESS_FORMAT_DEAGGREGATION BIT(0) #define RMNET_INGRESS_FORMAT_MAP_COMMANDS BIT(1) +#define RMNET_INGRESS_FORMAT_MAP_CKSUMV4 BIT(2) +#define RMNET_EGRESS_FORMAT_MAP_CKSUMV4 BIT(3) /* Replace skb->dev to a virtual rmnet device and pass up the stack */ #define RMNET_EPMODE_VND (1)