Thread (12 messages) 12 messages, 3 authors, 2017-12-05

Re: [PATCH net-next 1/8] net: hns3: Add HNS3 VF IMP(Integrated Management Proc) cmd interface

flat view

From: David Miller <hidden>
Date: 2017-12-05 16:37:49
Also in: linux-rdma, lkml

From: Salil Mehta <redacted>
Date: Sun, 3 Dec 2017 12:33:00 +0000
quoted hunk ↗ jump to hunk
+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.
quoted hunk ↗ jump to hunk
+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.
quoted hunk ↗ jump to hunk
+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.
quoted hunk ↗ jump to hunk
+
+	/* 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help