mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Daniel Glöckner" <dg@emlix.com>
To: Sascha Hauer <s.hauer@pengutronix.de>,
	Barebox List <barebox@lists.infradead.org>
Cc: Edmund Henniges <eh@emlix.com>
Subject: Re: [PATCH 15/19] fastboot net: implement fastboot over UDP
Date: Wed, 17 Jun 2020 21:32:45 +0200	[thread overview]
Message-ID: <946b4a56-1c05-6dbd-32d1-c100d6681065@emlix.com> (raw)
In-Reply-To: <20200617081126.5683-16-s.hauer@pengutronix.de>

Hello Sascha,

Am 17.06.20 um 10:11 schrieb Sascha Hauer:

> +	ret = fastboot_net_wait_may_send(fbn);
> +	if (ret)
> +		return ret;

Where is the part that aborts the session on timeout?

> +static void fastboot_start_download_net(struct fastboot *fb)
> +{
> +	struct fastboot_net *fbn = container_of(fb, struct fastboot_net,
> +						fastboot);
> +
> +	fastboot_start_download_generic(fb);
> +	fbn->active_download = true;
> +}

You didn't base v4 on v3, did you?
If FASTBOOT_INIT is received before active_download is set to true, nobody
will close fb->download_fd.

> +static void fastboot_handle_type_fastboot(struct fastboot_net *fbn,
> +					  struct fastboot_header header,
> +					  char *fastboot_data,
> +					  unsigned int fastboot_data_len)
> +{
> +	fbn->response_header = header;
> +	fbn->host_waits_since = get_time_ns();
> +	fbn->may_send = true;

No MAY_SEND_ACK and MAY_SEND_MESSAGE? So you choose to ignore protocol
violations?

> +	if (fbn->active_download) {
> +		if (!fastboot_data_len && fbn->fastboot.download_bytes
> +					   == fbn->fastboot.download_size) {
> +			fastboot_download_finished(&fbn->fastboot);

Now I see why you dropped that fastboot_tx_print in the previous patch.

> +		} else {
> +			fastboot_data_download(fbn, fastboot_data,
> +					       fastboot_data_len);
> +		}
> +	} else {

Fastboot does not allow to queue multiple commands. A command must have
finished before the host may send the next one. That's why there was
an "else if (!fbn->command[0])".

> +		if (fastboot_data_len >= FASTBOOT_MAX_CMD_LEN) {

Off-by-one error: if (fastboot_data_len > FASTBOOT_MAX_CMD_LEN) {

> +		} else if (fastboot_data_len) {
> +			struct fastboot_work *w;
> +
> +			w = xzalloc(sizeof(*w));

Why can't we embed struct fastboot_work in struct fastboot_net?
As I wrote above it is impossible to queue multiple commands.

> +			w->fbn = fbn;
> +			memcpy(w->command, fastboot_data, fastboot_data_len);
> +			w->command[fastboot_data_len] = 0;
> +
> +			wq_queue_work(&fbn->wq, &w->work);
> +		}
> +	}
> +
> +	if (!fbn->fastboot.active)
> +		fbn->active_download = false;

These two lines were gone in v3.

> +static void fastboot_send_keep_alive(struct poller_struct *poller)
> +{
> +	struct fastboot_net *fbn = container_of(poller, struct fastboot_net,
> +					       keep_alive_poller);
> +
> +	if (!fbn->send_keep_alive)
> +		return;
> +
> +	if (!is_timeout_non_interruptible(fbn->host_waits_since,
> +					 30ULL * NSEC_PER_SEC))
> +		return;
> +
> +	if (!fbn->may_send)
> +		return;
> +
> +	fastboot_tx_print(&fbn->fastboot, FASTBOOT_MSG_INFO, "still busy");
> +
> +	fbn->host_waits_since = get_time_ns();

Why do we need this line?
host_waits_since is assigned get_time_ns() when may_send is set to true.


All in all I am not sure I like your simplifications wrt. ack handling,
may_send, and sending multiple messages.

Best regards,

  Daniel

-- 
Dipl.-Math. Daniel Glöckner, emlix GmbH, http://www.emlix.com
Fon +49 551 30664-0, Fax +49 551 30664-11,
Gothaer Platz 3, 37083 Göttingen, Germany
Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160
Geschäftsführung: Heike Jordan, Dr. Uwe Kracke
Ust-IdNr.: DE 205 198 055

emlix - your embedded linux partner

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2020-06-17 19:32 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-17  8:11 [PATCH v4 00/19] Slices and " Sascha Hauer
2020-06-17  8:11 ` [PATCH 01/19] Introduce slices Sascha Hauer
2020-06-17  8:11 ` [PATCH 02/19] Add workqueues Sascha Hauer
2020-06-17 18:30   ` Daniel Glöckner
2020-06-17 19:56     ` Sascha Hauer
2020-06-17  8:11 ` [PATCH 03/19] ratp: Switch to workqueues Sascha Hauer
2020-06-17  8:11 ` [PATCH 04/19] net: Add a slice to struct eth_device Sascha Hauer
2020-06-17  8:11 ` [PATCH 05/19] net: mdiobus: Add slice Sascha Hauer
2020-06-17  8:11 ` [PATCH 06/19] usb: Add a slice to usb host controllers Sascha Hauer
2020-06-17  8:11 ` [PATCH 07/19] usbnet: Add slice Sascha Hauer
2020-06-17  8:11 ` [PATCH 08/19] net: Call net_poll() in a poller Sascha Hauer
2020-06-17  8:11 ` [PATCH 09/19] net: reply to ping requests Sascha Hauer
2020-06-17  8:11 ` [PATCH 10/19] usbnet: Be more friendly in the receive path Sascha Hauer
2020-06-17  8:11 ` [PATCH 11/19] defconfigs: update renamed fastboot options Sascha Hauer
2020-06-17  8:11 ` [PATCH 12/19] globalvar: Add helper for deprecated variable names Sascha Hauer
2020-06-17  8:11 ` [PATCH 13/19] fastboot: rename usbgadget.fastboot_* variables to fastboot.* Sascha Hauer
2020-06-17  8:11 ` [PATCH 14/19] fastboot: remove double print Sascha Hauer
2020-06-17 18:24   ` Daniel Glöckner
2020-06-17 19:54     ` Sascha Hauer
2020-06-18 19:08       ` Daniel Glöckner
2020-06-19  7:01         ` Sascha Hauer
2020-06-17  8:11 ` [PATCH 15/19] fastboot net: implement fastboot over UDP Sascha Hauer
2020-06-17 19:32   ` Daniel Glöckner [this message]
2020-06-18 11:59     ` Sascha Hauer
2020-06-18 18:33       ` Daniel Glöckner
2020-06-19  7:38         ` Sascha Hauer
2020-06-17  8:11 ` [PATCH 16/19] usb: fastboot: execute commands in command context Sascha Hauer
2020-06-17 19:40   ` Daniel Glöckner
2020-06-18  7:26     ` Sascha Hauer
2020-06-17  8:11 ` [PATCH 17/19] Add WARN_ONCE() macro Sascha Hauer
2020-06-17  8:11 ` [PATCH 18/19] fs: Warn when filesystem operations are called from a poller Sascha Hauer
2020-06-17  8:11 ` [PATCH 19/19] Documentation: Add document for parallel execution in barebox Sascha Hauer

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=946b4a56-1c05-6dbd-32d1-c100d6681065@emlix.com \
    --to=dg@emlix.com \
    --cc=barebox@lists.infradead.org \
    --cc=eh@emlix.com \
    --cc=s.hauer@pengutronix.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