public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Kiran K <kiran.k@intel.com>
Cc: linux-bluetooth@vger.kernel.org, ravishankar.srivatsa@intel.com,
	chethan.tumkur.narayan@intel.com,
	Chandrashekar <chandrashekar.devegowda@intel.com>
Subject: Re: [PATCH v1 3/3] Bluetooth: btintel_pcie: Add *setup* function to download firmware
Date: Thu, 28 Mar 2024 12:08:31 -0500	[thread overview]
Message-ID: <20240328170831.GA1570559@bhelgaas> (raw)
In-Reply-To: <20240328111904.992068-3-kiran.k@intel.com>

On Thu, Mar 28, 2024 at 04:49:04PM +0530, Kiran K wrote:
> Add to support to download firmware.

s/Add to/Add/

> +static void btintel_pcie_prepare_tx(struct txq *txq, u16 tfd_index,
> +				    struct sk_buff *skb)
> +{
> +	struct data_buf *buf;
> +	struct tfd *tfd;
> +
> +	tfd = &txq->tfds[tfd_index];
> +	memset(tfd, 0, sizeof(*tfd));
> +
> +	/* Get the buffer of the tfd index for DMA */

s/tfd/TFD/ for consistency.

> +static int btintel_pcie_hci_send_frame(struct hci_dev *hdev,
> +				       struct sk_buff *skb)
> +{
> +	struct btintel_pcie_data *data = hci_get_drvdata(hdev);
> +	int ret;
> +	u32 type;
> +
> +	/* Due to the fw limitation, the type header of the packet should be
> +	 * 4 bytes unlikely 1 byte for UART. In UART, the firmware can reads
> +	 * the first byte to get the packet type and redirect the rest of data
> +	 * packet to the right handler. But for PCIe, THF(Transfer Flow Handler)
> +	 * fetches the 4 bytes of data from DMA memory and by the time it reads
> +	 * the first 4 bytes, it already consumes some part of packet. Thus
> +	 * the packet type indicator for iBT PCIe is 4 bytes.
> +	 * Luckily, when HCI core creates the skb, it allocated 8 bytes of
> +	 * head room for profile and driver use, and before sending the data
> +	 * to the device, append the iBT PCIe packet type in the front.

s/unlikely/unlike/
s/can reads/can read/
s/it already consumes/it has already consumed/

Add blank line between paragraphs.

> +	 */
> +	switch (hci_skb_pkt_type(skb)) {
> +	case HCI_COMMAND_PKT:
> +		type = BTINTEL_PCIE_HCI_CMD_PKT;
> +		if (btintel_test_flag(hdev, INTEL_BOOTLOADER)) {
> +			struct hci_command_hdr *cmd = (void *)skb->data;
> +			__u16 opcode = le16_to_cpu(cmd->opcode);
> +
> +			/* When the 0xfc01 command is issued to boot into
> +			 * the operational firmware, it will actually not
> +			 * send a command complete event. To keep the flow
> +			 * control working inject that event here.
> +			 */
> +			if (opcode == 0xfc01)
> +				btintel_pcie_inject_cmd_complete(hdev, opcode);
> +		}
> +		hdev->stat.cmd_tx++;
> +		break;
> +	case HCI_ACLDATA_PKT:
> +		type = BTINTEL_PCIE_HCI_ACL_PKT;
> +		hdev->stat.acl_tx++;
> +		break;
> +	case HCI_SCODATA_PKT:
> +		type = BTINTEL_PCIE_HCI_SCO_PKT;
> +		hdev->stat.sco_tx++;
> +		break;
> +	default:
> +		bt_dev_err(hdev, "Unknown HCI packet type");
> +		ret = -EILSEQ;
> +		goto exit_error;
> +	}
> +	memcpy(skb_push(skb, BTINTEL_PCIE_HCI_TYPE_LEN), &type,
> +	       BTINTEL_PCIE_HCI_TYPE_LEN);
> +
> +	ret = btintel_pcie_send_sync(data, skb);
> +	if (ret) {
> +		hdev->stat.err_tx++;
> +		bt_dev_err(hdev, "Failed to send frame (%d)", ret);
> +		goto exit_error;
> +	} else {
> +		hdev->stat.byte_tx += skb->len;
> +		kfree_skb(skb);
> +	}
> +
> +exit_error:
> +
> +	return ret;

There's no cleanup here, so it would be simpler to omit "ret"
completely and return directly above instead of using the goto.

> +}

  reply	other threads:[~2024-03-28 17:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-28 11:19 [PATCH v1 1/3] Bluetooth: btintel: Export few static functions Kiran K
2024-03-28 11:19 ` [PATCH v1 2/3] Bluetooth: btintel_pcie: Add support for PCIE transport Kiran K
2024-03-28 12:24   ` Paul Menzel
2024-05-07 13:34     ` K, Kiran
2024-05-07 20:28       ` Luiz Augusto von Dentz
2024-03-28 14:09   ` Luiz Augusto von Dentz
2024-03-28 14:13     ` Luiz Augusto von Dentz
2024-05-07 14:39     ` K, Kiran
2024-03-28 17:08   ` Bjorn Helgaas
2024-05-07 13:47     ` K, Kiran
2024-03-28 11:19 ` [PATCH v1 3/3] Bluetooth: btintel_pcie: Add *setup* function to download firmware Kiran K
2024-03-28 17:08   ` Bjorn Helgaas [this message]
2024-05-07 13:59     ` K, Kiran
2024-05-08  2:03   ` Bjorn Helgaas
2024-05-08  2:04     ` Bjorn Helgaas
2024-03-28 11:31 ` [v1,1/3] Bluetooth: btintel: Export few static functions bluez.test.bot

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=20240328170831.GA1570559@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=chandrashekar.devegowda@intel.com \
    --cc=chethan.tumkur.narayan@intel.com \
    --cc=kiran.k@intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=ravishankar.srivatsa@intel.com \
    /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