From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Alexander Aring <aahringo@redhat.com>
Cc: linux-wpan@vger.kernel.org, stefan@datenfreihafen.org
Subject: Re: [RFCv2 ben-wpan] fw: add trac reg to tx done
Date: Tue, 6 Sep 2022 10:20:55 +0200 [thread overview]
Message-ID: <20220906102055.5698691c@xps-13> (raw)
In-Reply-To: <20220906001218.1029787-1-aahringo@redhat.com>
Hi Alexander,
aahringo@redhat.com wrote on Mon, 5 Sep 2022 20:12:18 -0400:
> This patch adds an additional byte for tx done for the trac status
> register which can then evaluated by the atusb Linux driver.
>
> We need to move the transition to RX_AACK_ON after reading the trac
> register value. The current optimization by switchting to RX_AACK_ON
> after invoking transceiver transmission could have the side effect that
> the trac register is not read out before a frame is received. Receiving
> another frame will overwrite the trac register. We can only switch to
> RX_AACK_ON state after we read out the trac register.
> ---
> Not tested yet.
>
> atusb/fw/mac.c | 24 ++++++++++++------------
> 1 file changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/atusb/fw/mac.c b/atusb/fw/mac.c
> index 835002c..165ce30 100644
> --- a/atusb/fw/mac.c
> +++ b/atusb/fw/mac.c
> @@ -32,7 +32,7 @@ static uint8_t tx_buf[MAX_PSDU];
> static uint8_t tx_size = 0;
> static bool txing = 0;
> static bool queued_tx_ack = 0;
> -static uint8_t next_seq, this_seq, queued_seq;
> +static uint8_t next_seq, this_seq, this_data[2], queued_data[2];
>
>
> /* ----- Receive buffer management ----------------------------------------- */
> @@ -65,7 +65,8 @@ static void usb_next(void)
> }
>
> if (queued_tx_ack) {
> - usb_send(&eps[1], &queued_seq, 1, tx_ack_done, NULL);
> + usb_send(&eps[1], queued_data, sizeof(queued_data),
> + tx_ack_done, NULL);
> queued_tx_ack = 0;
> }
> }
> @@ -124,11 +125,17 @@ static bool handle_irq(void)
>
> if (txing) {
> if (eps[1].state == EP_IDLE) {
> - usb_send(&eps[1], &this_seq, 1, tx_ack_done, NULL);
> + this_data[0] = this_seq;
> + this_data[1] = reg_read(REG_TRX_STATE);
> + usb_send(&eps[1], this_data, sizeof(this_data),
> + tx_ack_done, NULL);
> } else {
> queued_tx_ack = 1;
> - queued_seq = this_seq;
> + queued_data[0] = this_seq;
> + queued_data[1] = reg_read(REG_TRX_STATE);
> }
> + change_state(TRX_CMD_PLL_ON);
> + change_state(TRX_CMD_RX_AACK_ON);
> txing = 0;
> return 1;
> }
> @@ -215,13 +222,6 @@ static void do_tx(void *user)
>
> txing = 1;
> this_seq = next_seq;
> -
> - /*
> - * Wait until we reach BUSY_TX_ARET, so that we command the transition to
> - * RX_AACK_ON which will be executed upon TX completion.
> - */
> - change_state(TRX_CMD_PLL_ON);
> - change_state(TRX_CMD_RX_AACK_ON);
Mmmh, I see. Good catch.
And this patch works.
> }
>
>
> @@ -242,7 +242,7 @@ void mac_reset(void)
> txing = 0;
> queued_tx_ack = 0;
> rx_in = rx_out = 0;
> - next_seq = this_seq = queued_seq = 0;
> + next_seq = this_seq = queued_data[0], queued_data[1] = 0;
>
> /* enable CRC and PHY_RSSI (with RX_CRC_VALID) in SPI status return */
> reg_write(REG_TRX_CTRL_1,
Thanks,
Miquèl
prev parent reply other threads:[~2022-09-06 8:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-06 0:12 [RFCv2 ben-wpan] fw: add trac reg to tx done Alexander Aring
2022-09-06 8:20 ` Miquel Raynal [this message]
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=20220906102055.5698691c@xps-13 \
--to=miquel.raynal@bootlin.com \
--cc=aahringo@redhat.com \
--cc=linux-wpan@vger.kernel.org \
--cc=stefan@datenfreihafen.org \
/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