From patchwork Wed May 16 11:14:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 914553 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40mBfN5ljCz9s2R for ; Wed, 16 May 2018 21:14:36 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40mBfN4JxkzF14Y for ; Wed, 16 May 2018 21:14:36 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=redhat.com (client-ip=66.187.233.73; helo=mx1.redhat.com; envelope-from=thuth@redhat.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40mBfH0cWzzDsQ7 for ; Wed, 16 May 2018 21:14:30 +1000 (AEST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D4547401EF07 for ; Wed, 16 May 2018 11:14:28 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-117-17.ams2.redhat.com [10.36.117.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 550FB6B43C for ; Wed, 16 May 2018 11:14:28 +0000 (UTC) From: Thomas Huth To: slof@lists.ozlabs.org Date: Wed, 16 May 2018 13:14:27 +0200 Message-Id: <1526469267-31583-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 16 May 2018 11:14:28 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 16 May 2018 11:14:28 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'thuth@redhat.com' RCPT:'' Subject: [SLOF] [PATCH] libnet: Get rid of unused huge_load and block_size parameters X-BeenThere: slof@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "Patches for https://github.com/aik/SLOF" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "SLOF" The blocksize is hard-coded to 1428 bytes in obp-tftp.fs, so instead of hardcoding this in the Forth code, we could also move this into netload.c directly instead. A similar condition exists with the huge-tftp-load parameter. While this non-standard variable could still be changed in the obp-tftp package, it does not make much sense to set it to zero - you only lose the possibility to do huge TFTP loads with index wrap-around in that case. Signed-off-by: Thomas Huth --- lib/libnet/libnet.code | 4 +--- lib/libnet/netapps.h | 3 +-- lib/libnet/netload.c | 11 ++++------- slof/fs/packages/obp-tftp.fs | 3 --- 4 files changed, 6 insertions(+), 15 deletions(-) diff --git a/lib/libnet/libnet.code b/lib/libnet/libnet.code index 2746782..419419d 100644 --- a/lib/libnet/libnet.code +++ b/lib/libnet/libnet.code @@ -4,11 +4,9 @@ PRIM(NET_X2d_LOAD) int alen = TOS.n; POP; char *arg = TOS.a; POP; - int blocksize = TOS.n; POP; - int hugeload = TOS.n; POP; long maxlen = TOS.n; POP; void *loadaddr = TOS.a; - TOS.n = netload(loadaddr, maxlen, hugeload, blocksize, arg, alen); + TOS.n = netload(loadaddr, maxlen, arg, alen); MIRP PRIM(NET_X2d_PING) diff --git a/lib/libnet/netapps.h b/lib/libnet/netapps.h index 0e637e1..6e00466 100644 --- a/lib/libnet/netapps.h +++ b/lib/libnet/netapps.h @@ -18,8 +18,7 @@ struct filename_ip; -extern int netload(char *buffer, int len, int huge_load, int block_size, - char *args_fs, int alen); +extern int netload(char *buffer, int len, char *args_fs, int alen); extern int ping(char *args_fs, int alen); extern int dhcp(char *ret_buffer, struct filename_ip *fn_ip, unsigned int retries, int flags); diff --git a/lib/libnet/netload.c b/lib/libnet/netload.c index 5c37fe2..6b9bc57 100644 --- a/lib/libnet/netload.c +++ b/lib/libnet/netload.c @@ -405,13 +405,12 @@ static void seed_rng(uint8_t mac[]) } static int tftp_load(filename_ip_t *fnip, unsigned char *buffer, int len, - unsigned int retries, int32_t mode, - int32_t blksize, int ip_vers) + unsigned int retries, int ip_vers) { tftp_err_t tftp_err; int rc; - rc = tftp(fnip, buffer, len, retries, &tftp_err, mode, blksize, ip_vers); + rc = tftp(fnip, buffer, len, retries, &tftp_err, 1, 1428, ip_vers); if (rc > 0) { printf(" TFTP: Received %s (%d KBytes)\n", fnip->filename, @@ -510,8 +509,7 @@ static void encode_response(char *pkt_buffer, size_t size, int ip_init) } } -int netload(char *buffer, int len, int huge_load, int block_size, - char *args_fs, int alen) +int netload(char *buffer, int len, char *args_fs, int alen) { int rc; filename_ip_t fn_ip; @@ -755,8 +753,7 @@ int netload(char *buffer, int len, int huge_load, int block_size, /* Do the TFTP load and print error message if necessary */ rc = tftp_load(&fn_ip, (unsigned char *)buffer, len, - obp_tftp_args.tftp_retries, huge_load, - block_size, ip_version); + obp_tftp_args.tftp_retries, ip_version); if (obp_tftp_args.ip_init == IP_INIT_DHCP) dhcp_send_release(fn_ip.fd); diff --git a/slof/fs/packages/obp-tftp.fs b/slof/fs/packages/obp-tftp.fs index 17fb980..19c11e1 100644 --- a/slof/fs/packages/obp-tftp.fs +++ b/slof/fs/packages/obp-tftp.fs @@ -12,8 +12,6 @@ s" obp-tftp" device-name -VARIABLE huge-tftp-load 1 huge-tftp-load ! - : open ( -- okay? ) true ; @@ -28,7 +26,6 @@ VARIABLE huge-tftp-load 1 huge-tftp-load ! 60000000 ( addr maxlen ) - huge-tftp-load @ d# 1428 ( addr maxlen hugetftp blocksize ) \ Add OBP-TFTP Bootstring argument, e.g. "10.128.0.1,bootrom.bin,10.128.40.1" my-args net-load dup 0< IF drop 0 THEN