mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: salil.mehta@huawei.com
Cc: yisen.zhuang@huawei.com, lipeng321@huawei.com,
	mehta.salil.lnk@gmail.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org,
	linuxarm@huawei.com
Subject: Re: [PATCH net-next 1/8] net: hns3: Add HNS3 VF IMP(Integrated Management Proc) cmd interface
Date: Tue, 05 Dec 2017 11:37:44 -0500 (EST)	[thread overview]
Message-ID: <20171205.113744.2040678170803031734.davem@davemloft.net> (raw)
In-Reply-To: <20171203123307.19820-2-salil.mehta@huawei.com>

From: Salil Mehta <salil.mehta@huawei.com>
Date: Sun, 3 Dec 2017 12:33:00 +0000

> +static int hclgevf_ring_space(struct hclgevf_cmq_ring *ring)
> +{
> +	int ntu = ring->next_to_use;
> +	int ntc = ring->next_to_clean;
> +	int used = (ntu - ntc + ring->desc_num) % ring->desc_num;

Order local variables from longest to shortest line, please.

Audit your entire submission for this issue.

> +static int hclgevf_cmd_csq_done(struct hclgevf_hw *hw)
> +{
> +	u32 head = hclgevf_read_dev(hw, HCLGEVF_NIC_CSQ_HEAD_REG);
> +	return head == hw->cmq.csq.next_to_use;
> +}

Please return bool from this function.

> +void hclgevf_cmd_setup_basic_desc(struct hclgevf_desc *desc,
> +				  enum hclgevf_opcode_type opcode, bool is_read)
> +{
> +	memset((void *)desc, 0, sizeof(struct hclgevf_desc));

You never need casts like this, when the functions argument is void any
pointer can be passed in as-is.

> +
> +	/* If the command is sync, wait for the firmware to write back,
> +	 * if multi descriptors to be sent, use the first one to check
> +	 */
> +	if (HCLGEVF_SEND_SYNC(le16_to_cpu(desc->flag))) {
> +		do {
> +			if (hclgevf_cmd_csq_done(hw))
> +				break;
> +			udelay(1);
> +			timeout++;
> +		} while (timeout < hw->cmq.tx_timeout);
> +	}

This is potentially a long timeout with a spinlock held.  Consider using
sleeping and completions.

  reply	other threads:[~2017-12-05 16:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-03 12:32 [PATCH net-next 0/8] Hisilicon Network Subsystem 3 VF Ethernet Driver Salil Mehta
2017-12-03 12:33 ` [PATCH net-next 1/8] net: hns3: Add HNS3 VF IMP(Integrated Management Proc) cmd interface Salil Mehta
2017-12-05 16:37   ` David Miller [this message]
2017-12-05 17:11     ` Salil Mehta
2017-12-03 12:33 ` [PATCH net-next 2/8] net: hns3: Add mailbox support to VF driver Salil Mehta
2017-12-03 12:33 ` [PATCH net-next 3/8] net: hns3: Add HNS3 VF HCL(Hardware Compatibility Layer) Support Salil Mehta
2017-12-03 12:33 ` [PATCH net-next 4/8] net: hns3: Add HNS3 VF driver to kernel build framework Salil Mehta
2017-12-03 12:33 ` [PATCH net-next 5/8] net: hns3: Unified HNS3 {VF|PF} Ethernet Driver for hip08 SoC Salil Mehta
2017-12-03 12:33 ` [PATCH net-next 6/8] net: hns3: Add mailbox support to PF driver Salil Mehta
2017-12-03 12:33 ` [PATCH net-next 7/8] net: hns3: Change PF to add ring-vect binding & resetQ to mailbox Salil Mehta
2017-12-03 12:33 ` [PATCH net-next 8/8] net: hns3: Add mailbox interrupt handling to PF driver Salil Mehta

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=20171205.113744.2040678170803031734.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=lipeng321@huawei.com \
    --cc=mehta.salil.lnk@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=salil.mehta@huawei.com \
    --cc=yisen.zhuang@huawei.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

all inboxes | Powered by JetHome®