net: hns3: remove a redundant hclge_cmd_csq_done
authorHuazhong Tan <tanhuazhong@huawei.com>
Mon, 2 Jul 2018 07:50:22 +0000 (15:50 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 2 Jul 2018 13:49:14 +0000 (22:49 +0900)
Set complete in the first hclge_cmd_csq_done of hclge_cmd_send,
and check if complete later, unnecessary to do hclge_cmd_csq_done
again.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c

index 0839e8410e6dcce526f35a0f258e574720c0ffcc..db80485b65ea282771fa69eff7589ba602343d2a 100644 (file)
@@ -242,15 +242,18 @@ int hclge_cmd_send(struct hclge_hw *hw, struct hclge_desc *desc, int num)
         */
        if (HCLGE_SEND_SYNC(le16_to_cpu(desc->flag))) {
                do {
-                       if (hclge_cmd_csq_done(hw))
+                       if (hclge_cmd_csq_done(hw)) {
+                               complete = true;
                                break;
+                       }
                        udelay(1);
                        timeout++;
                } while (timeout < hw->cmq.tx_timeout);
        }
 
-       if (hclge_cmd_csq_done(hw)) {
-               complete = true;
+       if (!complete) {
+               retval = -EAGAIN;
+       } else {
                handle = 0;
                while (handle < num) {
                        /* Get the result of hardware write back */
@@ -274,9 +277,6 @@ int hclge_cmd_send(struct hclge_hw *hw, struct hclge_desc *desc, int num)
                }
        }
 
-       if (!complete)
-               retval = -EAGAIN;
-
        /* Clean the command send queue */
        handle = hclge_cmd_csq_clean(hw);
        if (handle != num) {