diff mbox series

[net-next,3/5] net: hns3: provide .get_cmdq_stat interface for the client

Message ID 1589016461-10130-4-git-send-email-tanhuazhong@huawei.com
State Accepted
Delegated to: David Miller
Headers show
Series net: hns3: misc updates for -next | expand

Commit Message

tanhuazhong May 9, 2020, 9:27 a.m. UTC
This patch provides a new interface for the client to query
whether CMDQ is ready to work.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hnae3.h             | 1 +
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 9 +++++++++
 2 files changed, 10 insertions(+)

Comments

Jakub Kicinski May 9, 2020, 8:48 p.m. UTC | #1
On Sat, 9 May 2020 17:27:39 +0800 Huazhong Tan wrote:
> This patch provides a new interface for the client to query
> whether CMDQ is ready to work.
> 
> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>

> diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
> index 5602bf2..7506cab 100644
> --- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h
> +++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
> @@ -552,6 +552,7 @@ struct hnae3_ae_ops {
>  	int (*set_vf_mac)(struct hnae3_handle *handle, int vf, u8 *p);
>  	int (*get_module_eeprom)(struct hnae3_handle *handle, u32 offset,
>  				 u32 len, u8 *data);
> +	bool (*get_cmdq_stat)(struct hnae3_handle *handle);
>  };

I don't see anything in this series using this new interface, why is it
added now?
tanhuazhong May 11, 2020, 12:13 a.m. UTC | #2
On 2020/5/10 4:48, Jakub Kicinski wrote:
> On Sat, 9 May 2020 17:27:39 +0800 Huazhong Tan wrote:
>> This patch provides a new interface for the client to query
>> whether CMDQ is ready to work.
>>
>> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
> 
>> diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
>> index 5602bf2..7506cab 100644
>> --- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h
>> +++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
>> @@ -552,6 +552,7 @@ struct hnae3_ae_ops {
>>   	int (*set_vf_mac)(struct hnae3_handle *handle, int vf, u8 *p);
>>   	int (*get_module_eeprom)(struct hnae3_handle *handle, u32 offset,
>>   				 u32 len, u8 *data);
>> +	bool (*get_cmdq_stat)(struct hnae3_handle *handle);
>>   };
> 
> I don't see anything in this series using this new interface, why is it
> added now?
> 

Hi, Jakub.

This interface is needed by the roce client, whose patch will be
upstreamed to the rdma tree, it is other branch. So we provide this 
interface previously, then the rdma guy will upstream their patch later,
maybe linux-5.8-rc*.

Thanks.

> .
>
Jakub Kicinski May 11, 2020, 2:47 a.m. UTC | #3
On Mon, 11 May 2020 08:13:06 +0800 tanhuazhong wrote:
> On 2020/5/10 4:48, Jakub Kicinski wrote:
> > On Sat, 9 May 2020 17:27:39 +0800 Huazhong Tan wrote:  
> >> diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
> >> index 5602bf2..7506cab 100644
> >> --- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h
> >> +++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
> >> @@ -552,6 +552,7 @@ struct hnae3_ae_ops {
> >>   	int (*set_vf_mac)(struct hnae3_handle *handle, int vf, u8 *p);
> >>   	int (*get_module_eeprom)(struct hnae3_handle *handle, u32 offset,
> >>   				 u32 len, u8 *data);
> >> +	bool (*get_cmdq_stat)(struct hnae3_handle *handle);
> >>   };  
> > 
> > I don't see anything in this series using this new interface, why is it
> > added now?
> 
> This interface is needed by the roce client, whose patch will be
> upstreamed to the rdma tree, it is other branch. So we provide this 
> interface previously, then the rdma guy will upstream their patch later,
> maybe linux-5.8-rc*.

Understood. Please make sure to include this kind of information in the
cover letter in the future.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
index 5602bf2..7506cab 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
@@ -552,6 +552,7 @@  struct hnae3_ae_ops {
 	int (*set_vf_mac)(struct hnae3_handle *handle, int vf, u8 *p);
 	int (*get_module_eeprom)(struct hnae3_handle *handle, u32 offset,
 				 u32 len, u8 *data);
+	bool (*get_cmdq_stat)(struct hnae3_handle *handle);
 };
 
 struct hnae3_dcb_ops {
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index 3ad6a6a..1ff896a 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -6402,6 +6402,14 @@  static bool hclge_get_hw_reset_stat(struct hnae3_handle *handle)
 	       hclge_read_dev(&hdev->hw, HCLGE_FUN_RST_ING);
 }
 
+static bool hclge_get_cmdq_stat(struct hnae3_handle *handle)
+{
+	struct hclge_vport *vport = hclge_get_vport(handle);
+	struct hclge_dev *hdev = vport->back;
+
+	return test_bit(HCLGE_STATE_CMD_DISABLE, &hdev->state);
+}
+
 static bool hclge_ae_dev_resetting(struct hnae3_handle *handle)
 {
 	struct hclge_vport *vport = hclge_get_vport(handle);
@@ -11311,6 +11319,7 @@  static const struct hnae3_ae_ops hclge_ops = {
 	.set_vf_rate = hclge_set_vf_rate,
 	.set_vf_mac = hclge_set_vf_mac,
 	.get_module_eeprom = hclge_get_module_eeprom,
+	.get_cmdq_stat = hclge_get_cmdq_stat,
 };
 
 static struct hnae3_ae_algo ae_algo = {