public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/4] bootp: Move vendor class identifier set to function
Date: Wed,  4 May 2016 19:10:51 +0200	[thread overview]
Message-ID: <1462381853-26828-3-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1462381853-26828-1-git-send-email-agraf@suse.de>

Both the dhcp as well as the bootp case add vendor class identifier
parameters into their packets. Let's move that into a separate function
to make overlaying easier.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 net/bootp.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/net/bootp.c b/net/bootp.c
index d91b307..d718e35 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -411,6 +411,17 @@ static void bootp_timeout_handler(void)
 		e += vci_strlen;				\
 	} while (0)
 
+static u8 *add_vci(u8 *e)
+{
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_NET_VCI_STRING)
+	put_vci(e, CONFIG_SPL_NET_VCI_STRING);
+#elif defined(CONFIG_BOOTP_VCI_STRING)
+	put_vci(e, CONFIG_BOOTP_VCI_STRING);
+#endif
+
+	return e;
+}
+
 /*
  *	Initialize BOOTP extension fields in the request.
  */
@@ -508,11 +519,7 @@ static int dhcp_extended(u8 *e, int message_type, struct in_addr server_ip,
 	}
 #endif
 
-#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_NET_VCI_STRING)
-	put_vci(e, CONFIG_SPL_NET_VCI_STRING);
-#elif defined(CONFIG_BOOTP_VCI_STRING)
-	put_vci(e, CONFIG_BOOTP_VCI_STRING);
-#endif
+	e = add_vci(e);
 
 #if defined(CONFIG_BOOTP_VENDOREX)
 	x = dhcp_vendorex_prep(e);
@@ -598,14 +605,7 @@ static int bootp_extended(u8 *e)
 	*e++ = (576 - 312 + OPT_FIELD_SIZE) & 0xff;
 #endif
 
-#if defined(CONFIG_BOOTP_VCI_STRING) || \
-	(defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_NET_VCI_STRING))
-#ifdef CONFIG_SPL_BUILD
-	put_vci(e, CONFIG_SPL_NET_VCI_STRING);
-#else
-	put_vci(e, CONFIG_BOOTP_VCI_STRING);
-#endif
-#endif
+	add_vci(e);
 
 #if defined(CONFIG_BOOTP_SUBNETMASK)
 	*e++ = 1;		/* Subnet mask request */
-- 
1.8.5.6

  parent reply	other threads:[~2016-05-04 17:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-04 17:10 [U-Boot] [PATCH 0/4] efi_loader: PXE boot support Alexander Graf
2016-05-04 17:10 ` [U-Boot] [PATCH 1/4] efi_loader: Add network access support Alexander Graf
2016-05-04 17:10 ` Alexander Graf [this message]
2016-05-06 17:48   ` [U-Boot] [PATCH 2/4] bootp: Move vendor class identifier set to function Tom Rini
2016-05-04 17:10 ` [U-Boot] [PATCH 3/4] net: Move the VCI and client arch values to Kconfig Alexander Graf
2016-05-06 14:54   ` Tom Rini
2016-05-06 15:22     ` Alexander Graf
2016-05-06 15:38       ` Tom Rini
2016-05-06 16:07         ` Alexander Graf
2016-05-06 16:07     ` Leif Lindholm
2016-05-06 16:57       ` Tom Rini
2016-05-04 17:10 ` [U-Boot] [PATCH 4/4] distro: Add efi pxe boot code Alexander Graf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1462381853-26828-3-git-send-email-agraf@suse.de \
    --to=agraf@suse.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox