From patchwork Wed Jan 25 09:56:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Packham X-Patchwork-Id: 719611 X-Patchwork-Delegate: joe.hershberger@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3v7gTS3sHgz9ryZ for ; Wed, 25 Jan 2017 20:57:48 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="vHa3gldm"; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7658AB38BA; Wed, 25 Jan 2017 10:57:44 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1ahW6F_AbCOK; Wed, 25 Jan 2017 10:57:44 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 23FE7B38C8; Wed, 25 Jan 2017 10:57:29 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0DE44A75D2 for ; Wed, 25 Jan 2017 10:57:09 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id g5lijG2B9SuF for ; Wed, 25 Jan 2017 10:57:08 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-pf0-f196.google.com (mail-pf0-f196.google.com [209.85.192.196]) by theia.denx.de (Postfix) with ESMTPS id 23D5EA75CA for ; Wed, 25 Jan 2017 10:57:03 +0100 (CET) Received: by mail-pf0-f196.google.com with SMTP id e4so14032356pfg.0 for ; Wed, 25 Jan 2017 01:57:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LvJ8cnsKwwxuATgaIbXahyZ0UjwPoPIu+V6b4tNOlSA=; b=vHa3gldm84rsoDi5tVOk+MW5YRT+Y/U8PYvVoS9NErm5b5+QOMjZObKRHrguBfoH3L LWI/yspMrw/fsk8AgkDoJ3xHwWRd91Quz67A8GlWL65/ge8EmtNHek6vvEplSdb7e25f vVCuocaicnmR+yHsPviXOJ0Plq4lnqFSop7z4xRQk9s79l1agnX2ZlTzRFS9M5dBeKqE UgLTIWtB8pU5mwoJAD7l8Lk0ttcYCmP4DGgqq/Is0oCvJjvibSfNzWaBYYQGw9BI4FsY DFQ6uJ8SXhy3Yc+tRSLxYaA59Ner+tEfCnDVnqKvSMSnvMUSq8LGc61sbsqiZThh2FUZ ln0Q== 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:in-reply-to :references; bh=LvJ8cnsKwwxuATgaIbXahyZ0UjwPoPIu+V6b4tNOlSA=; b=H3x/1FCYFXC5R7Bdi55umt/4BX9/YcYSUgg2pVH1pa/Xc46RfUsycRufAhn63pLJ68 n0joaxXFtLg6pl6N2tyhl16hsZ9uMs4d26lobTGd2yDnlHxJbQMWCMtFY9hN8vP8kzIe jMGhmAEPPZsxoo1OzTUHN+ty2KCvScQs4PVaFKphGu8/k1nh1aPT4mn2X1Xla5Cjrr8m QVhoND8Vfc77cq1XSizCiTOwUlqgYIfiZDZ7fvrImMIbY331RdOkEmY8ezET1iIuu079 MXHRvQjBtfCCZuDqe3fSqVR/jp1oPbWpNN7XRzruWa5R1sCIHPLXOuJtAETayCvnNc0H I0mA== X-Gm-Message-State: AIkVDXKNsViMD645wOr5WPsXb2vgMy1wH7tStNfRegxL//374mJFeag83FVeYvdR4pZfwQ== X-Received: by 10.98.49.198 with SMTP id x189mr45661933pfx.20.1485338222189; Wed, 25 Jan 2017 01:57:02 -0800 (PST) Received: from chrisp-dl.atlnz.lc ([2001:df5:b000:22:8d2c:469e:c0fc:f3ee]) by smtp.gmail.com with ESMTPSA id t87sm50980162pfe.59.2017.01.25.01.56.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Jan 2017 01:57:01 -0800 (PST) From: Chris Packham To: u-boot@lists.denx.de, Joe Hershberger Date: Wed, 25 Jan 2017 22:56:15 +1300 Message-Id: <20170125095622.20326-5-judge.packham@gmail.com> X-Mailer: git-send-email 2.11.0.24.ge6920cf In-Reply-To: <20170125095622.20326-1-judge.packham@gmail.com> References: <20170125095622.20326-1-judge.packham@gmail.com> Cc: Angga , hannah@marvell.com, Alexey Brodkin , jp.tosoni@acksys.fr, luka.kovacica@gmail.com, reed@fb.com, Stefan Roese , Chris Packham Subject: [U-Boot] [RFC PATCH v3 04/11] net: add definition of udp_hdr X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" UDP is the same over IPv4 as it is over other protocols (i.e. IPv6) add a definition of just the UDP header independent of the IPv4 header that it may or may not be combined with. Signed-off-by: Chris Packham --- Ideally struct ip_udp_hdr would be defined as struct ip_udp_hdr { struct ip_hdr ip; struct udp_hdr udp; }; Implementing this touches more code that I really want to at this point. Some of the code that currently uses struct ip_udp_hdr could probably just use struct ip_hdr instead but some care would need to be taken to much such a change. Changes in v3: None Changes in v2: None include/net.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/include/net.h b/include/net.h index 1f4d94735007..10d98d92535b 100644 --- a/include/net.h +++ b/include/net.h @@ -375,6 +375,18 @@ struct ip_hdr { #define IP_HDR_SIZE (sizeof(struct ip_hdr)) /* + * UDP header. + */ +struct udp_hdr { + __be16 udp_src; /* UDP source port */ + __be16 udp_dst; /* UDP destination port */ + __be16 udp_len; /* Length of UDP packet */ + __be16 udp_xsum; /* Checksum */ +}; + +#define UDP_HDR_SIZE (sizeof(struct udp_hdr)) + +/* * Internet Protocol (IP) + UDP header. */ struct ip_udp_hdr { @@ -395,7 +407,6 @@ struct ip_udp_hdr { }; #define IP_UDP_HDR_SIZE (sizeof(struct ip_udp_hdr)) -#define UDP_HDR_SIZE (IP_UDP_HDR_SIZE - IP_HDR_SIZE) /* * Address Resolution Protocol (ARP) header.