From: David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
To: salil.mehta-hv44wF8Li93QT0dZR+AlfA@public.gmane.org
Cc: yisen.zhuang-hv44wF8Li93QT0dZR+AlfA@public.gmane.org,
lipeng321-hv44wF8Li93QT0dZR+AlfA@public.gmane.org,
mehta.salil.lnk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linuxarm-hv44wF8Li93QT0dZR+AlfA@public.gmane.org
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-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
From: Salil Mehta <salil.mehta-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-12-05 16:37 UTC|newest]
Thread overview: 15+ 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
[not found] ` <20171203123307.19820-2-salil.mehta-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
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
[not found] ` <20171203123307.19820-1-salil.mehta-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
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
2017-12-03 13:22 ` [PATCH net-next 0/8] Hisilicon Network Subsystem 3 VF Ethernet Driver Or Gerlitz
[not found] ` <CAFOm3gZ8ayvRowh-UdR7WukWNpXvaVmq2xCxwK_wf=fErji37g@mail.gmail.com>
[not found] ` <F4CC6FACFEB3C54C9141D49AD221F7F93BB5F85E@FRAEML521-MBX.china.huawei.com>
2017-12-04 10:48 ` Salil Mehta
2017-12-04 14:07 ` Or Gerlitz
2017-12-04 14:28 ` 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-ft/pcqaiutieiz0/mpfg9q@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linuxarm-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
--cc=lipeng321-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
--cc=mehta.salil.lnk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=salil.mehta-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
--cc=yisen.zhuang-hv44wF8Li93QT0dZR+AlfA@public.gmane.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;
as well as URLs for NNTP newsgroup(s).