Commit 46ee7350 authored by Guojia Liao's avatar Guojia Liao Committed by David S. Miller

net: hns3: add or modify comments

To explain some code, this patch adds some comments, and modifies or
merges some comments to make them more neat.
Signed-off-by: default avatarGuojia Liao <liaoguojia@huawei.com>
Signed-off-by: default avatarZhongzhu Liu <liuzhongzhu@huawei.com>
Signed-off-by: default avatarWeihang Li <liweihang@hisilicon.com>
Signed-off-by: default avatarGuangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d83d508b
...@@ -87,8 +87,8 @@ struct hnae3_queue { ...@@ -87,8 +87,8 @@ struct hnae3_queue {
struct hnae3_handle *handle; struct hnae3_handle *handle;
int tqp_index; /* index in a handle */ int tqp_index; /* index in a handle */
u32 buf_size; /* size for hnae_desc->addr, preset by AE */ u32 buf_size; /* size for hnae_desc->addr, preset by AE */
u16 tx_desc_num;/* total number of tx desc */ u16 tx_desc_num; /* total number of tx desc */
u16 rx_desc_num;/* total number of rx desc */ u16 rx_desc_num; /* total number of rx desc */
}; };
struct hns3_mac_stats { struct hns3_mac_stats {
...@@ -96,7 +96,7 @@ struct hns3_mac_stats { ...@@ -96,7 +96,7 @@ struct hns3_mac_stats {
u64 rx_pause_cnt; u64 rx_pause_cnt;
}; };
/*hnae3 loop mode*/ /* hnae3 loop mode */
enum hnae3_loop { enum hnae3_loop {
HNAE3_LOOP_APP, HNAE3_LOOP_APP,
HNAE3_LOOP_SERIAL_SERDES, HNAE3_LOOP_SERIAL_SERDES,
...@@ -621,7 +621,7 @@ struct hnae3_handle { ...@@ -621,7 +621,7 @@ struct hnae3_handle {
struct pci_dev *pdev; struct pci_dev *pdev;
void *priv; void *priv;
struct hnae3_ae_algo *ae_algo; /* the class who provides this handle */ struct hnae3_ae_algo *ae_algo; /* the class who provides this handle */
u64 flags; /* Indicate the capabilities for this handle*/ u64 flags; /* Indicate the capabilities for this handle */
union { union {
struct net_device *netdev; /* first member */ struct net_device *netdev; /* first member */
......
...@@ -229,9 +229,9 @@ static void hns3_vector_gl_rl_init(struct hns3_enet_tqp_vector *tqp_vector, ...@@ -229,9 +229,9 @@ static void hns3_vector_gl_rl_init(struct hns3_enet_tqp_vector *tqp_vector,
/* initialize the configuration for interrupt coalescing. /* initialize the configuration for interrupt coalescing.
* 1. GL (Interrupt Gap Limiter) * 1. GL (Interrupt Gap Limiter)
* 2. RL (Interrupt Rate Limiter) * 2. RL (Interrupt Rate Limiter)
*
* Default: enable interrupt coalescing self-adaptive and GL
*/ */
/* Default: enable interrupt coalescing self-adaptive and GL */
tqp_vector->tx_group.coal.gl_adapt_enable = 1; tqp_vector->tx_group.coal.gl_adapt_enable = 1;
tqp_vector->rx_group.coal.gl_adapt_enable = 1; tqp_vector->rx_group.coal.gl_adapt_enable = 1;
...@@ -4207,8 +4207,8 @@ int hns3_nic_reset_all_ring(struct hnae3_handle *h) ...@@ -4207,8 +4207,8 @@ int hns3_nic_reset_all_ring(struct hnae3_handle *h)
static void hns3_store_coal(struct hns3_nic_priv *priv) static void hns3_store_coal(struct hns3_nic_priv *priv)
{ {
/* ethtool only support setting and querying one coal /* ethtool only support setting and querying one coal
* configuation for now, so save the vector 0' coal * configuration for now, so save the vector 0' coal
* configuation here in order to restore it. * configuration here in order to restore it.
*/ */
memcpy(&priv->tx_coal, &priv->tqp_vector[0].tx_group.coal, memcpy(&priv->tx_coal, &priv->tqp_vector[0].tx_group.coal,
sizeof(struct hns3_enet_coalesce)); sizeof(struct hns3_enet_coalesce));
......
...@@ -302,7 +302,7 @@ struct hns3_desc_cb { ...@@ -302,7 +302,7 @@ struct hns3_desc_cb {
dma_addr_t dma; /* dma address of this desc */ dma_addr_t dma; /* dma address of this desc */
void *buf; /* cpu addr for a desc */ void *buf; /* cpu addr for a desc */
/* priv data for the desc, e.g. skb when use with ip stack*/ /* priv data for the desc, e.g. skb when use with ip stack */
void *priv; void *priv;
u32 page_offset; u32 page_offset;
u32 length; /* length of the buffer */ u32 length; /* length of the buffer */
...@@ -325,11 +325,11 @@ enum hns3_pkt_l3type { ...@@ -325,11 +325,11 @@ enum hns3_pkt_l3type {
HNS3_L3_TYPE_MAC_PAUSE, HNS3_L3_TYPE_MAC_PAUSE,
HNS3_L3_TYPE_PFC_PAUSE,/* 0x9*/ HNS3_L3_TYPE_PFC_PAUSE,/* 0x9*/
/* reserved for 0xA~0xB*/ /* reserved for 0xA~0xB */
HNS3_L3_TYPE_CNM = 0xc, HNS3_L3_TYPE_CNM = 0xc,
/* reserved for 0xD~0xE*/ /* reserved for 0xD~0xE */
HNS3_L3_TYPE_PARSE_FAIL = 0xf /* must be last */ HNS3_L3_TYPE_PARSE_FAIL = 0xf /* must be last */
}; };
...@@ -354,7 +354,7 @@ enum hns3_pkt_ol3type { ...@@ -354,7 +354,7 @@ enum hns3_pkt_ol3type {
HNS3_OL3_TYPE_IPV4_OPT = 4, HNS3_OL3_TYPE_IPV4_OPT = 4,
HNS3_OL3_TYPE_IPV6_EXT, HNS3_OL3_TYPE_IPV6_EXT,
/* reserved for 0x6~0xE*/ /* reserved for 0x6~0xE */
HNS3_OL3_TYPE_PARSE_FAIL = 0xf /* must be last */ HNS3_OL3_TYPE_PARSE_FAIL = 0xf /* must be last */
}; };
......
...@@ -635,7 +635,7 @@ static void hns3_get_ksettings(struct hnae3_handle *h, ...@@ -635,7 +635,7 @@ static void hns3_get_ksettings(struct hnae3_handle *h,
&cmd->base.speed, &cmd->base.speed,
&cmd->base.duplex); &cmd->base.duplex);
/* 2.get link mode*/ /* 2.get link mode */
if (ops->get_link_mode) if (ops->get_link_mode)
ops->get_link_mode(h, ops->get_link_mode(h,
cmd->link_modes.supported, cmd->link_modes.supported,
......
...@@ -897,14 +897,17 @@ static void hclge_dbg_fd_tcam_read(struct hclge_dev *hdev, u8 stage, ...@@ -897,14 +897,17 @@ static void hclge_dbg_fd_tcam_read(struct hclge_dev *hdev, u8 stage,
dev_info(&hdev->pdev->dev, " read result tcam key %s(%u):\n", dev_info(&hdev->pdev->dev, " read result tcam key %s(%u):\n",
sel_x ? "x" : "y", loc); sel_x ? "x" : "y", loc);
/* tcam_data0 ~ tcam_data1 */
req = (u32 *)req1->tcam_data; req = (u32 *)req1->tcam_data;
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
dev_info(&hdev->pdev->dev, "%08x\n", *req++); dev_info(&hdev->pdev->dev, "%08x\n", *req++);
/* tcam_data2 ~ tcam_data7 */
req = (u32 *)req2->tcam_data; req = (u32 *)req2->tcam_data;
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
dev_info(&hdev->pdev->dev, "%08x\n", *req++); dev_info(&hdev->pdev->dev, "%08x\n", *req++);
/* tcam_data8 ~ tcam_data12 */
req = (u32 *)req3->tcam_data; req = (u32 *)req3->tcam_data;
for (i = 0; i < 5; i++) for (i = 0; i < 5; i++)
dev_info(&hdev->pdev->dev, "%08x\n", *req++); dev_info(&hdev->pdev->dev, "%08x\n", *req++);
......
...@@ -2810,9 +2810,9 @@ static u32 hclge_check_event_cause(struct hclge_dev *hdev, u32 *clearval) ...@@ -2810,9 +2810,9 @@ static u32 hclge_check_event_cause(struct hclge_dev *hdev, u32 *clearval)
* defer the processing of the mailbox events. Since, we would have not * defer the processing of the mailbox events. Since, we would have not
* cleared RX CMDQ event this time we would receive again another * cleared RX CMDQ event this time we would receive again another
* interrupt from H/W just for the mailbox. * interrupt from H/W just for the mailbox.
*
* check for vector0 reset event sources
*/ */
/* check for vector0 reset event sources */
if (BIT(HCLGE_VECTOR0_IMPRESET_INT_B) & rst_src_reg) { if (BIT(HCLGE_VECTOR0_IMPRESET_INT_B) & rst_src_reg) {
dev_info(&hdev->pdev->dev, "IMP reset interrupt\n"); dev_info(&hdev->pdev->dev, "IMP reset interrupt\n");
set_bit(HNAE3_IMP_RESET, &hdev->reset_pending); set_bit(HNAE3_IMP_RESET, &hdev->reset_pending);
...@@ -8000,7 +8000,7 @@ int hclge_set_vlan_filter(struct hnae3_handle *handle, __be16 proto, ...@@ -8000,7 +8000,7 @@ int hclge_set_vlan_filter(struct hnae3_handle *handle, __be16 proto,
return -EBUSY; return -EBUSY;
} }
/* When port base vlan enabled, we use port base vlan as the vlan /* when port base vlan enabled, we use port base vlan as the vlan
* filter entry. In this case, we don't update vlan filter table * filter entry. In this case, we don't update vlan filter table
* when user add new vlan or remove exist vlan, just update the vport * when user add new vlan or remove exist vlan, just update the vport
* vlan list. The vlan id in vlan list will be writen in vlan filter * vlan list. The vlan id in vlan list will be writen in vlan filter
...@@ -8019,7 +8019,7 @@ int hclge_set_vlan_filter(struct hnae3_handle *handle, __be16 proto, ...@@ -8019,7 +8019,7 @@ int hclge_set_vlan_filter(struct hnae3_handle *handle, __be16 proto,
hclge_add_vport_vlan_table(vport, vlan_id, hclge_add_vport_vlan_table(vport, vlan_id,
writen_to_tbl); writen_to_tbl);
} else if (is_kill) { } else if (is_kill) {
/* When remove hw vlan filter failed, record the vlan id, /* when remove hw vlan filter failed, record the vlan id,
* and try to remove it from hw later, to be consistence * and try to remove it from hw later, to be consistence
* with stack * with stack
*/ */
......
...@@ -479,7 +479,7 @@ static void hclge_mbx_reset_vf_queue(struct hclge_vport *vport, ...@@ -479,7 +479,7 @@ static void hclge_mbx_reset_vf_queue(struct hclge_vport *vport,
hclge_reset_vf_queue(vport, queue_id); hclge_reset_vf_queue(vport, queue_id);
/* send response msg to VF after queue reset complete*/ /* send response msg to VF after queue reset complete */
hclge_gen_resp_to_vf(vport, mbx_req, 0, NULL, 0); hclge_gen_resp_to_vf(vport, mbx_req, 0, NULL, 0);
} }
......
...@@ -1269,7 +1269,7 @@ static int hclgevf_set_vlan_filter(struct hnae3_handle *handle, ...@@ -1269,7 +1269,7 @@ static int hclgevf_set_vlan_filter(struct hnae3_handle *handle,
HCLGE_MBX_VLAN_FILTER, msg_data, HCLGE_MBX_VLAN_FILTER, msg_data,
HCLGEVF_VLAN_MBX_MSG_LEN, false, NULL, 0); HCLGEVF_VLAN_MBX_MSG_LEN, false, NULL, 0);
/* When remove hw vlan filter failed, record the vlan id, /* when remove hw vlan filter failed, record the vlan id,
* and try to remove it from hw later, to be consistence * and try to remove it from hw later, to be consistence
* with stack. * with stack.
*/ */
...@@ -1561,7 +1561,7 @@ static int hclgevf_reset(struct hclgevf_dev *hdev) ...@@ -1561,7 +1561,7 @@ static int hclgevf_reset(struct hclgevf_dev *hdev)
rtnl_lock(); rtnl_lock();
/* now, re-initialize the nic client and ae device*/ /* now, re-initialize the nic client and ae device */
ret = hclgevf_reset_stack(hdev); ret = hclgevf_reset_stack(hdev);
if (ret) { if (ret) {
dev_err(&hdev->pdev->dev, "failed to reset VF stack\n"); dev_err(&hdev->pdev->dev, "failed to reset VF stack\n");
...@@ -1784,9 +1784,8 @@ static void hclgevf_reset_service_task(struct work_struct *work) ...@@ -1784,9 +1784,8 @@ static void hclgevf_reset_service_task(struct work_struct *work)
* 1b and 2. cases but we will not get any intimation about 1a * 1b and 2. cases but we will not get any intimation about 1a
* from PF as cmdq would be in unreliable state i.e. mailbox * from PF as cmdq would be in unreliable state i.e. mailbox
* communication between PF and VF would be broken. * communication between PF and VF would be broken.
*/ *
* if we are never geting into pending state it means either:
/* if we are never geting into pending state it means either:
* 1. PF is not receiving our request which could be due to IMP * 1. PF is not receiving our request which could be due to IMP
* reset * reset
* 2. PF is screwed * 2. PF is screwed
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment