Commit 26e392ca authored by David S. Miller's avatar David S. Miller

Merge branch 'hns3-next'

Huazhong Tan says:

====================
net: hns3: some code optimizations & cleanups & bugfixes

This patch-set includes code optimizations, cleanups and bugfixes for
the HNS3 ethernet controller driver.

[patch 1/12 - 6/12] adds some code optimizations and bugfixes about RAS
and MSI-X HW error.

[patch 7/12] fixes a loading issue.

[patch 8/12 - 11/12] adds some bugfixes.

[patch 12/12] adds some cleanups, which does not change the logic of code.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents cbbe9bd0 ebaf1908
...@@ -26,7 +26,8 @@ static bool hnae3_client_match(enum hnae3_client_type client_type) ...@@ -26,7 +26,8 @@ static bool hnae3_client_match(enum hnae3_client_type client_type)
} }
void hnae3_set_client_init_flag(struct hnae3_client *client, void hnae3_set_client_init_flag(struct hnae3_client *client,
struct hnae3_ae_dev *ae_dev, int inited) struct hnae3_ae_dev *ae_dev,
unsigned int inited)
{ {
if (!client || !ae_dev) if (!client || !ae_dev)
return; return;
......
...@@ -214,6 +214,7 @@ struct hnae3_ae_dev { ...@@ -214,6 +214,7 @@ struct hnae3_ae_dev {
struct list_head node; struct list_head node;
u32 flag; u32 flag;
u8 override_pci_need_reset; /* fix to stop multiple reset happening */ u8 override_pci_need_reset; /* fix to stop multiple reset happening */
unsigned long hw_err_reset_req;
enum hnae3_reset_type reset_type; enum hnae3_reset_type reset_type;
void *priv; void *priv;
}; };
...@@ -459,6 +460,8 @@ struct hnae3_ae_ops { ...@@ -459,6 +460,8 @@ struct hnae3_ae_ops {
u16 vlan, u8 qos, __be16 proto); u16 vlan, u8 qos, __be16 proto);
int (*enable_hw_strip_rxvtag)(struct hnae3_handle *handle, bool enable); int (*enable_hw_strip_rxvtag)(struct hnae3_handle *handle, bool enable);
void (*reset_event)(struct pci_dev *pdev, struct hnae3_handle *handle); void (*reset_event)(struct pci_dev *pdev, struct hnae3_handle *handle);
enum hnae3_reset_type (*get_reset_level)(struct hnae3_ae_dev *ae_dev,
unsigned long *addr);
void (*set_default_reset_request)(struct hnae3_ae_dev *ae_dev, void (*set_default_reset_request)(struct hnae3_ae_dev *ae_dev,
enum hnae3_reset_type rst_type); enum hnae3_reset_type rst_type);
void (*get_channels)(struct hnae3_handle *handle, void (*get_channels)(struct hnae3_handle *handle,
...@@ -490,7 +493,7 @@ struct hnae3_ae_ops { ...@@ -490,7 +493,7 @@ struct hnae3_ae_ops {
void (*enable_fd)(struct hnae3_handle *handle, bool enable); void (*enable_fd)(struct hnae3_handle *handle, bool enable);
int (*add_arfs_entry)(struct hnae3_handle *handle, u16 queue_id, int (*add_arfs_entry)(struct hnae3_handle *handle, u16 queue_id,
u16 flow_id, struct flow_keys *fkeys); u16 flow_id, struct flow_keys *fkeys);
int (*dbg_run_cmd)(struct hnae3_handle *handle, char *cmd_buf); int (*dbg_run_cmd)(struct hnae3_handle *handle, const char *cmd_buf);
pci_ers_result_t (*handle_hw_ras_error)(struct hnae3_ae_dev *ae_dev); pci_ers_result_t (*handle_hw_ras_error)(struct hnae3_ae_dev *ae_dev);
bool (*get_hw_reset_stat)(struct hnae3_handle *handle); bool (*get_hw_reset_stat)(struct hnae3_handle *handle);
bool (*ae_dev_resetting)(struct hnae3_handle *handle); bool (*ae_dev_resetting)(struct hnae3_handle *handle);
...@@ -642,5 +645,6 @@ void hnae3_unregister_client(struct hnae3_client *client); ...@@ -642,5 +645,6 @@ void hnae3_unregister_client(struct hnae3_client *client);
int hnae3_register_client(struct hnae3_client *client); int hnae3_register_client(struct hnae3_client *client);
void hnae3_set_client_init_flag(struct hnae3_client *client, void hnae3_set_client_init_flag(struct hnae3_client *client,
struct hnae3_ae_dev *ae_dev, int inited); struct hnae3_ae_dev *ae_dev,
unsigned int inited);
#endif #endif
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
static struct dentry *hns3_dbgfs_root; static struct dentry *hns3_dbgfs_root;
static int hns3_dbg_queue_info(struct hnae3_handle *h, char *cmd_buf) static int hns3_dbg_queue_info(struct hnae3_handle *h,
const char *cmd_buf)
{ {
struct hns3_nic_priv *priv = h->priv; struct hns3_nic_priv *priv = h->priv;
struct hns3_nic_ring_data *ring_data; struct hns3_nic_ring_data *ring_data;
...@@ -155,7 +156,7 @@ static int hns3_dbg_queue_map(struct hnae3_handle *h) ...@@ -155,7 +156,7 @@ static int hns3_dbg_queue_map(struct hnae3_handle *h)
return 0; return 0;
} }
static int hns3_dbg_bd_info(struct hnae3_handle *h, char *cmd_buf) static int hns3_dbg_bd_info(struct hnae3_handle *h, const char *cmd_buf)
{ {
struct hns3_nic_priv *priv = h->priv; struct hns3_nic_priv *priv = h->priv;
struct hns3_nic_ring_data *ring_data; struct hns3_nic_ring_data *ring_data;
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#define hns3_tx_bd_count(S) DIV_ROUND_UP(S, HNS3_MAX_BD_SIZE) #define hns3_tx_bd_count(S) DIV_ROUND_UP(S, HNS3_MAX_BD_SIZE)
static void hns3_clear_all_ring(struct hnae3_handle *h); static void hns3_clear_all_ring(struct hnae3_handle *h);
static void hns3_force_clear_all_rx_ring(struct hnae3_handle *h); static void hns3_force_clear_all_ring(struct hnae3_handle *h);
static void hns3_remove_hw_addr(struct net_device *netdev); static void hns3_remove_hw_addr(struct net_device *netdev);
static const char hns3_driver_name[] = "hns3"; static const char hns3_driver_name[] = "hns3";
...@@ -143,6 +143,7 @@ static int hns3_nic_init_irq(struct hns3_nic_priv *priv) ...@@ -143,6 +143,7 @@ static int hns3_nic_init_irq(struct hns3_nic_priv *priv)
if (ret) { if (ret) {
netdev_err(priv->netdev, "request irq(%d) fail\n", netdev_err(priv->netdev, "request irq(%d) fail\n",
tqp_vectors->vector_irq); tqp_vectors->vector_irq);
hns3_nic_uninit_irq(priv);
return ret; return ret;
} }
...@@ -487,7 +488,12 @@ static void hns3_nic_net_down(struct net_device *netdev) ...@@ -487,7 +488,12 @@ static void hns3_nic_net_down(struct net_device *netdev)
/* free irq resources */ /* free irq resources */
hns3_nic_uninit_irq(priv); hns3_nic_uninit_irq(priv);
hns3_clear_all_ring(priv->ae_handle); /* delay ring buffer clearing to hns3_reset_notify_uninit_enet
* during reset process, because driver may not be able
* to disable the ring through firmware when downing the netdev.
*/
if (!hns3_nic_resetting(netdev))
hns3_clear_all_ring(priv->ae_handle);
} }
static int hns3_nic_net_stop(struct net_device *netdev) static int hns3_nic_net_stop(struct net_device *netdev)
...@@ -1005,7 +1011,8 @@ static int hns3_fill_desc_vtags(struct sk_buff *skb, ...@@ -1005,7 +1011,8 @@ static int hns3_fill_desc_vtags(struct sk_buff *skb,
} }
static int hns3_fill_desc(struct hns3_enet_ring *ring, void *priv, static int hns3_fill_desc(struct hns3_enet_ring *ring, void *priv,
int size, int frag_end, enum hns_desc_type type) unsigned int size, int frag_end,
enum hns_desc_type type)
{ {
struct hns3_desc_cb *desc_cb = &ring->desc_cb[ring->next_to_use]; struct hns3_desc_cb *desc_cb = &ring->desc_cb[ring->next_to_use];
struct hns3_desc *desc = &ring->desc[ring->next_to_use]; struct hns3_desc *desc = &ring->desc[ring->next_to_use];
...@@ -1509,12 +1516,12 @@ static void hns3_nic_get_stats64(struct net_device *netdev, ...@@ -1509,12 +1516,12 @@ static void hns3_nic_get_stats64(struct net_device *netdev,
static int hns3_setup_tc(struct net_device *netdev, void *type_data) static int hns3_setup_tc(struct net_device *netdev, void *type_data)
{ {
struct tc_mqprio_qopt_offload *mqprio_qopt = type_data; struct tc_mqprio_qopt_offload *mqprio_qopt = type_data;
struct hnae3_handle *h = hns3_get_handle(netdev);
struct hnae3_knic_private_info *kinfo = &h->kinfo;
u8 *prio_tc = mqprio_qopt->qopt.prio_tc_map; u8 *prio_tc = mqprio_qopt->qopt.prio_tc_map;
struct hnae3_knic_private_info *kinfo;
u8 tc = mqprio_qopt->qopt.num_tc; u8 tc = mqprio_qopt->qopt.num_tc;
u16 mode = mqprio_qopt->mode; u16 mode = mqprio_qopt->mode;
u8 hw = mqprio_qopt->qopt.hw; u8 hw = mqprio_qopt->qopt.hw;
struct hnae3_handle *h;
if (!((hw == TC_MQPRIO_HW_OFFLOAD_TCS && if (!((hw == TC_MQPRIO_HW_OFFLOAD_TCS &&
mode == TC_MQPRIO_MODE_CHANNEL) || (!hw && tc == 0))) mode == TC_MQPRIO_MODE_CHANNEL) || (!hw && tc == 0)))
...@@ -1526,6 +1533,9 @@ static int hns3_setup_tc(struct net_device *netdev, void *type_data) ...@@ -1526,6 +1533,9 @@ static int hns3_setup_tc(struct net_device *netdev, void *type_data)
if (!netdev) if (!netdev)
return -EINVAL; return -EINVAL;
h = hns3_get_handle(netdev);
kinfo = &h->kinfo;
return (kinfo->dcb_ops && kinfo->dcb_ops->setup_tc) ? return (kinfo->dcb_ops && kinfo->dcb_ops->setup_tc) ?
kinfo->dcb_ops->setup_tc(h, tc, prio_tc) : -EOPNOTSUPP; kinfo->dcb_ops->setup_tc(h, tc, prio_tc) : -EOPNOTSUPP;
} }
...@@ -1930,17 +1940,22 @@ static pci_ers_result_t hns3_error_detected(struct pci_dev *pdev, ...@@ -1930,17 +1940,22 @@ static pci_ers_result_t hns3_error_detected(struct pci_dev *pdev,
static pci_ers_result_t hns3_slot_reset(struct pci_dev *pdev) static pci_ers_result_t hns3_slot_reset(struct pci_dev *pdev)
{ {
struct hnae3_ae_dev *ae_dev = pci_get_drvdata(pdev); struct hnae3_ae_dev *ae_dev = pci_get_drvdata(pdev);
const struct hnae3_ae_ops *ops = ae_dev->ops;
enum hnae3_reset_type reset_type;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
dev_info(dev, "requesting reset due to PCI error\n");
if (!ae_dev || !ae_dev->ops) if (!ae_dev || !ae_dev->ops)
return PCI_ERS_RESULT_NONE; return PCI_ERS_RESULT_NONE;
/* request the reset */ /* request the reset */
if (ae_dev->ops->reset_event) { if (ops->reset_event) {
if (!ae_dev->override_pci_need_reset) if (!ae_dev->override_pci_need_reset) {
ae_dev->ops->reset_event(pdev, NULL); reset_type = ops->get_reset_level(ae_dev,
&ae_dev->hw_err_reset_req);
ops->set_default_reset_request(ae_dev, reset_type);
dev_info(dev, "requesting reset due to PCI error\n");
ops->reset_event(pdev, NULL);
}
return PCI_ERS_RESULT_RECOVERED; return PCI_ERS_RESULT_RECOVERED;
} }
...@@ -3410,7 +3425,7 @@ static int hns3_nic_dealloc_vector_data(struct hns3_nic_priv *priv) ...@@ -3410,7 +3425,7 @@ static int hns3_nic_dealloc_vector_data(struct hns3_nic_priv *priv)
} }
static int hns3_ring_get_cfg(struct hnae3_queue *q, struct hns3_nic_priv *priv, static int hns3_ring_get_cfg(struct hnae3_queue *q, struct hns3_nic_priv *priv,
int ring_type) unsigned int ring_type)
{ {
struct hns3_nic_ring_data *ring_data = priv->ring_data; struct hns3_nic_ring_data *ring_data = priv->ring_data;
int queue_num = priv->ae_handle->kinfo.num_tqps; int queue_num = priv->ae_handle->kinfo.num_tqps;
...@@ -3905,7 +3920,7 @@ static void hns3_client_uninit(struct hnae3_handle *handle, bool reset) ...@@ -3905,7 +3920,7 @@ static void hns3_client_uninit(struct hnae3_handle *handle, bool reset)
hns3_del_all_fd_rules(netdev, true); hns3_del_all_fd_rules(netdev, true);
hns3_force_clear_all_rx_ring(handle); hns3_force_clear_all_ring(handle);
hns3_nic_uninit_vector_data(priv); hns3_nic_uninit_vector_data(priv);
...@@ -4074,7 +4089,7 @@ static void hns3_force_clear_rx_ring(struct hns3_enet_ring *ring) ...@@ -4074,7 +4089,7 @@ static void hns3_force_clear_rx_ring(struct hns3_enet_ring *ring)
} }
} }
static void hns3_force_clear_all_rx_ring(struct hnae3_handle *h) static void hns3_force_clear_all_ring(struct hnae3_handle *h)
{ {
struct net_device *ndev = h->kinfo.netdev; struct net_device *ndev = h->kinfo.netdev;
struct hns3_nic_priv *priv = netdev_priv(ndev); struct hns3_nic_priv *priv = netdev_priv(ndev);
...@@ -4082,6 +4097,9 @@ static void hns3_force_clear_all_rx_ring(struct hnae3_handle *h) ...@@ -4082,6 +4097,9 @@ static void hns3_force_clear_all_rx_ring(struct hnae3_handle *h)
u32 i; u32 i;
for (i = 0; i < h->kinfo.num_tqps; i++) { for (i = 0; i < h->kinfo.num_tqps; i++) {
ring = priv->ring_data[i].ring;
hns3_clear_tx_ring(ring);
ring = priv->ring_data[i + h->kinfo.num_tqps].ring; ring = priv->ring_data[i + h->kinfo.num_tqps].ring;
hns3_force_clear_rx_ring(ring); hns3_force_clear_rx_ring(ring);
} }
...@@ -4312,7 +4330,8 @@ static int hns3_reset_notify_uninit_enet(struct hnae3_handle *handle) ...@@ -4312,7 +4330,8 @@ static int hns3_reset_notify_uninit_enet(struct hnae3_handle *handle)
return 0; return 0;
} }
hns3_force_clear_all_rx_ring(handle); hns3_clear_all_ring(handle);
hns3_force_clear_all_ring(handle);
hns3_nic_uninit_vector_data(priv); hns3_nic_uninit_vector_data(priv);
......
...@@ -417,7 +417,7 @@ struct hns3_enet_ring { ...@@ -417,7 +417,7 @@ struct hns3_enet_ring {
*/ */
int next_to_clean; int next_to_clean;
int pull_len; /* head length for current packet */ u32 pull_len; /* head length for current packet */
u32 frag_num; u32 frag_num;
unsigned char *va; /* first buffer address for current packet */ unsigned char *va; /* first buffer address for current packet */
......
...@@ -250,11 +250,13 @@ static int hns3_lp_run_test(struct net_device *ndev, enum hnae3_loop mode) ...@@ -250,11 +250,13 @@ static int hns3_lp_run_test(struct net_device *ndev, enum hnae3_loop mode)
skb_get(skb); skb_get(skb);
tx_ret = hns3_nic_net_xmit(skb, ndev); tx_ret = hns3_nic_net_xmit(skb, ndev);
if (tx_ret == NETDEV_TX_OK) if (tx_ret == NETDEV_TX_OK) {
good_cnt++; good_cnt++;
else } else {
kfree_skb(skb);
netdev_err(ndev, "hns3_lb_run_test xmit failed: %d\n", netdev_err(ndev, "hns3_lb_run_test xmit failed: %d\n",
tx_ret); tx_ret);
}
} }
if (good_cnt != HNS3_NIC_LB_TEST_PKT_NUM) { if (good_cnt != HNS3_NIC_LB_TEST_PKT_NUM) {
ret_val = HNS3_NIC_LB_TEST_TX_CNT_ERR; ret_val = HNS3_NIC_LB_TEST_TX_CNT_ERR;
......
...@@ -61,8 +61,8 @@ static int hclge_dbg_cmd_send(struct hclge_dev *hdev, ...@@ -61,8 +61,8 @@ static int hclge_dbg_cmd_send(struct hclge_dev *hdev,
static void hclge_dbg_dump_reg_common(struct hclge_dev *hdev, static void hclge_dbg_dump_reg_common(struct hclge_dev *hdev,
struct hclge_dbg_dfx_message *dfx_message, struct hclge_dbg_dfx_message *dfx_message,
char *cmd_buf, int msg_num, int offset, const char *cmd_buf, int msg_num,
enum hclge_opcode_type cmd) int offset, enum hclge_opcode_type cmd)
{ {
#define BD_DATA_NUM 6 #define BD_DATA_NUM 6
...@@ -111,7 +111,7 @@ static void hclge_dbg_dump_reg_common(struct hclge_dev *hdev, ...@@ -111,7 +111,7 @@ static void hclge_dbg_dump_reg_common(struct hclge_dev *hdev,
kfree(desc_src); kfree(desc_src);
} }
static void hclge_dbg_dump_dcb(struct hclge_dev *hdev, char *cmd_buf) static void hclge_dbg_dump_dcb(struct hclge_dev *hdev, const char *cmd_buf)
{ {
struct device *dev = &hdev->pdev->dev; struct device *dev = &hdev->pdev->dev;
struct hclge_dbg_bitmap_cmd *bitmap; struct hclge_dbg_bitmap_cmd *bitmap;
...@@ -211,7 +211,7 @@ static void hclge_dbg_dump_dcb(struct hclge_dev *hdev, char *cmd_buf) ...@@ -211,7 +211,7 @@ static void hclge_dbg_dump_dcb(struct hclge_dev *hdev, char *cmd_buf)
dev_info(dev, "IGU_TX_PRI_MAP_TC_CFG: 0x%x\n", desc[0].data[5]); dev_info(dev, "IGU_TX_PRI_MAP_TC_CFG: 0x%x\n", desc[0].data[5]);
} }
static void hclge_dbg_dump_reg_cmd(struct hclge_dev *hdev, char *cmd_buf) static void hclge_dbg_dump_reg_cmd(struct hclge_dev *hdev, const char *cmd_buf)
{ {
int msg_num; int msg_num;
...@@ -541,7 +541,8 @@ static void hclge_dbg_dump_tm(struct hclge_dev *hdev) ...@@ -541,7 +541,8 @@ static void hclge_dbg_dump_tm(struct hclge_dev *hdev)
cmd, ret); cmd, ret);
} }
static void hclge_dbg_dump_tm_map(struct hclge_dev *hdev, char *cmd_buf) static void hclge_dbg_dump_tm_map(struct hclge_dev *hdev,
const char *cmd_buf)
{ {
struct hclge_bp_to_qs_map_cmd *bp_to_qs_map_cmd; struct hclge_bp_to_qs_map_cmd *bp_to_qs_map_cmd;
struct hclge_nq_to_qs_link_cmd *nq_to_qs_map; struct hclge_nq_to_qs_link_cmd *nq_to_qs_map;
...@@ -984,7 +985,8 @@ void hclge_dbg_get_m7_stats_info(struct hclge_dev *hdev) ...@@ -984,7 +985,8 @@ void hclge_dbg_get_m7_stats_info(struct hclge_dev *hdev)
* @hdev: pointer to struct hclge_dev * @hdev: pointer to struct hclge_dev
* @cmd_buf: string that contains offset and length * @cmd_buf: string that contains offset and length
*/ */
static void hclge_dbg_dump_ncl_config(struct hclge_dev *hdev, char *cmd_buf) static void hclge_dbg_dump_ncl_config(struct hclge_dev *hdev,
const char *cmd_buf)
{ {
#define HCLGE_MAX_NCL_CONFIG_OFFSET 4096 #define HCLGE_MAX_NCL_CONFIG_OFFSET 4096
#define HCLGE_MAX_NCL_CONFIG_LENGTH (20 + 24 * 4) #define HCLGE_MAX_NCL_CONFIG_LENGTH (20 + 24 * 4)
...@@ -1063,7 +1065,7 @@ static void hclge_dbg_dump_mac_tnl_status(struct hclge_dev *hdev) ...@@ -1063,7 +1065,7 @@ static void hclge_dbg_dump_mac_tnl_status(struct hclge_dev *hdev)
} }
} }
int hclge_dbg_run_cmd(struct hnae3_handle *handle, char *cmd_buf) int hclge_dbg_run_cmd(struct hnae3_handle *handle, const char *cmd_buf)
{ {
struct hclge_vport *vport = hclge_get_vport(handle); struct hclge_vport *vport = hclge_get_vport(handle);
struct hclge_dev *hdev = vport->back; struct hclge_dev *hdev = vport->back;
......
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
#define HCLGE_IGU_EGU_TNL_INT_MASK GENMASK(5, 0) #define HCLGE_IGU_EGU_TNL_INT_MASK GENMASK(5, 0)
#define HCLGE_PPP_MPF_INT_ST3_MASK GENMASK(5, 0) #define HCLGE_PPP_MPF_INT_ST3_MASK GENMASK(5, 0)
#define HCLGE_PPU_MPF_INT_ST3_MASK GENMASK(7, 0) #define HCLGE_PPU_MPF_INT_ST3_MASK GENMASK(7, 0)
#define HCLGE_PPU_MPF_INT_ST2_MSIX_MASK GENMASK(29, 28) #define HCLGE_PPU_MPF_INT_ST2_MSIX_MASK BIT(29)
#define HCLGE_PPU_PF_INT_RAS_MASK 0x18 #define HCLGE_PPU_PF_INT_RAS_MASK 0x18
#define HCLGE_PPU_PF_INT_MSIX_MASK 0x26 #define HCLGE_PPU_PF_INT_MSIX_MASK 0x26
#define HCLGE_PPU_PF_OVER_8BD_ERR_MASK 0x01 #define HCLGE_PPU_PF_OVER_8BD_ERR_MASK 0x01
...@@ -123,6 +123,7 @@ struct hclge_hw_error { ...@@ -123,6 +123,7 @@ struct hclge_hw_error {
int hclge_config_mac_tnl_int(struct hclge_dev *hdev, bool en); int hclge_config_mac_tnl_int(struct hclge_dev *hdev, bool en);
int hclge_config_nic_hw_error(struct hclge_dev *hdev, bool state); int hclge_config_nic_hw_error(struct hclge_dev *hdev, bool state);
int hclge_config_rocee_ras_interrupt(struct hclge_dev *hdev, bool en); int hclge_config_rocee_ras_interrupt(struct hclge_dev *hdev, bool en);
void hclge_handle_all_hns_hw_errors(struct hnae3_ae_dev *ae_dev);
pci_ers_result_t hclge_handle_hw_ras_error(struct hnae3_ae_dev *ae_dev); pci_ers_result_t hclge_handle_hw_ras_error(struct hnae3_ae_dev *ae_dev);
int hclge_handle_hw_msix_error(struct hclge_dev *hdev, int hclge_handle_hw_msix_error(struct hclge_dev *hdev,
unsigned long *reset_requests); unsigned long *reset_requests);
......
...@@ -701,6 +701,17 @@ struct hclge_mac_tnl_stats { ...@@ -701,6 +701,17 @@ struct hclge_mac_tnl_stats {
#define HCLGE_RESET_INTERVAL (10 * HZ) #define HCLGE_RESET_INTERVAL (10 * HZ)
#pragma pack(1)
struct hclge_vf_vlan_cfg {
u8 mbx_cmd;
u8 subcode;
u8 is_kill;
u16 vlan;
u16 proto;
};
#pragma pack()
/* For each bit of TCAM entry, it uses a pair of 'x' and /* For each bit of TCAM entry, it uses a pair of 'x' and
* 'y' to indicate which value to match, like below: * 'y' to indicate which value to match, like below:
* ---------------------------------- * ----------------------------------
...@@ -924,7 +935,7 @@ struct hclge_vport { ...@@ -924,7 +935,7 @@ struct hclge_vport {
u16 used_umv_num; u16 used_umv_num;
int vport_id; u16 vport_id;
struct hclge_dev *back; /* Back reference to associated dev */ struct hclge_dev *back; /* Back reference to associated dev */
struct hnae3_handle nic; struct hnae3_handle nic;
struct hnae3_handle roce; struct hnae3_handle roce;
...@@ -986,7 +997,7 @@ int hclge_func_reset_cmd(struct hclge_dev *hdev, int func_id); ...@@ -986,7 +997,7 @@ int hclge_func_reset_cmd(struct hclge_dev *hdev, int func_id);
int hclge_vport_start(struct hclge_vport *vport); int hclge_vport_start(struct hclge_vport *vport);
void hclge_vport_stop(struct hclge_vport *vport); void hclge_vport_stop(struct hclge_vport *vport);
int hclge_set_vport_mtu(struct hclge_vport *vport, int new_mtu); int hclge_set_vport_mtu(struct hclge_vport *vport, int new_mtu);
int hclge_dbg_run_cmd(struct hnae3_handle *handle, char *cmd_buf); int hclge_dbg_run_cmd(struct hnae3_handle *handle, const char *cmd_buf);
u16 hclge_covert_handle_qid_global(struct hnae3_handle *handle, u16 queue_id); u16 hclge_covert_handle_qid_global(struct hnae3_handle *handle, u16 queue_id);
int hclge_notify_client(struct hclge_dev *hdev, int hclge_notify_client(struct hclge_dev *hdev,
enum hnae3_reset_notify_type type); enum hnae3_reset_notify_type type);
......
...@@ -306,21 +306,23 @@ int hclge_push_vf_port_base_vlan_info(struct hclge_vport *vport, u8 vfid, ...@@ -306,21 +306,23 @@ int hclge_push_vf_port_base_vlan_info(struct hclge_vport *vport, u8 vfid,
static int hclge_set_vf_vlan_cfg(struct hclge_vport *vport, static int hclge_set_vf_vlan_cfg(struct hclge_vport *vport,
struct hclge_mbx_vf_to_pf_cmd *mbx_req) struct hclge_mbx_vf_to_pf_cmd *mbx_req)
{ {
struct hclge_vf_vlan_cfg *msg_cmd;
int status = 0; int status = 0;
if (mbx_req->msg[1] == HCLGE_MBX_VLAN_FILTER) { msg_cmd = (struct hclge_vf_vlan_cfg *)mbx_req->msg;
if (msg_cmd->subcode == HCLGE_MBX_VLAN_FILTER) {
struct hnae3_handle *handle = &vport->nic; struct hnae3_handle *handle = &vport->nic;
u16 vlan, proto; u16 vlan, proto;
bool is_kill; bool is_kill;
is_kill = !!mbx_req->msg[2]; is_kill = !!msg_cmd->is_kill;
memcpy(&vlan, &mbx_req->msg[3], sizeof(vlan)); vlan = msg_cmd->vlan;
memcpy(&proto, &mbx_req->msg[5], sizeof(proto)); proto = msg_cmd->proto;
status = hclge_set_vlan_filter(handle, cpu_to_be16(proto), status = hclge_set_vlan_filter(handle, cpu_to_be16(proto),
vlan, is_kill); vlan, is_kill);
} else if (mbx_req->msg[1] == HCLGE_MBX_VLAN_RX_OFF_CFG) { } else if (msg_cmd->subcode == HCLGE_MBX_VLAN_RX_OFF_CFG) {
struct hnae3_handle *handle = &vport->nic; struct hnae3_handle *handle = &vport->nic;
bool en = mbx_req->msg[2] ? true : false; bool en = msg_cmd->is_kill ? true : false;
status = hclge_en_hw_strip_rxvtag(handle, en); status = hclge_en_hw_strip_rxvtag(handle, en);
} else if (mbx_req->msg[1] == HCLGE_MBX_PORT_BASE_VLAN_CFG) { } else if (mbx_req->msg[1] == HCLGE_MBX_PORT_BASE_VLAN_CFG) {
...@@ -363,7 +365,8 @@ static int hclge_get_vf_tcinfo(struct hclge_vport *vport, ...@@ -363,7 +365,8 @@ static int hclge_get_vf_tcinfo(struct hclge_vport *vport,
{ {
struct hnae3_knic_private_info *kinfo = &vport->nic.kinfo; struct hnae3_knic_private_info *kinfo = &vport->nic.kinfo;
u8 vf_tc_map = 0; u8 vf_tc_map = 0;
int i, ret; unsigned int i;
int ret;
for (i = 0; i < kinfo->num_tc; i++) for (i = 0; i < kinfo->num_tc; i++)
vf_tc_map |= BIT(i); vf_tc_map |= BIT(i);
...@@ -551,7 +554,8 @@ void hclge_mbx_handler(struct hclge_dev *hdev) ...@@ -551,7 +554,8 @@ void hclge_mbx_handler(struct hclge_dev *hdev)
struct hclge_mbx_vf_to_pf_cmd *req; struct hclge_mbx_vf_to_pf_cmd *req;
struct hclge_vport *vport; struct hclge_vport *vport;
struct hclge_desc *desc; struct hclge_desc *desc;
int ret, flag; unsigned int flag;
int ret;
/* handle all the mailbox requests in the queue */ /* handle all the mailbox requests in the queue */
while (!hclge_cmd_crq_empty(&hdev->hw)) { while (!hclge_cmd_crq_empty(&hdev->hw)) {
......
...@@ -55,9 +55,9 @@ static int hclge_mdio_write(struct mii_bus *bus, int phyid, int regnum, ...@@ -55,9 +55,9 @@ static int hclge_mdio_write(struct mii_bus *bus, int phyid, int regnum,
mdio_cmd = (struct hclge_mdio_cfg_cmd *)desc.data; mdio_cmd = (struct hclge_mdio_cfg_cmd *)desc.data;
hnae3_set_field(mdio_cmd->phyid, HCLGE_MDIO_PHYID_M, hnae3_set_field(mdio_cmd->phyid, HCLGE_MDIO_PHYID_M,
HCLGE_MDIO_PHYID_S, phyid); HCLGE_MDIO_PHYID_S, (u32)phyid);
hnae3_set_field(mdio_cmd->phyad, HCLGE_MDIO_PHYREG_M, hnae3_set_field(mdio_cmd->phyad, HCLGE_MDIO_PHYREG_M,
HCLGE_MDIO_PHYREG_S, regnum); HCLGE_MDIO_PHYREG_S, (u32)regnum);
hnae3_set_bit(mdio_cmd->ctrl_bit, HCLGE_MDIO_CTRL_START_B, 1); hnae3_set_bit(mdio_cmd->ctrl_bit, HCLGE_MDIO_CTRL_START_B, 1);
hnae3_set_field(mdio_cmd->ctrl_bit, HCLGE_MDIO_CTRL_ST_M, hnae3_set_field(mdio_cmd->ctrl_bit, HCLGE_MDIO_CTRL_ST_M,
...@@ -93,9 +93,9 @@ static int hclge_mdio_read(struct mii_bus *bus, int phyid, int regnum) ...@@ -93,9 +93,9 @@ static int hclge_mdio_read(struct mii_bus *bus, int phyid, int regnum)
mdio_cmd = (struct hclge_mdio_cfg_cmd *)desc.data; mdio_cmd = (struct hclge_mdio_cfg_cmd *)desc.data;
hnae3_set_field(mdio_cmd->phyid, HCLGE_MDIO_PHYID_M, hnae3_set_field(mdio_cmd->phyid, HCLGE_MDIO_PHYID_M,
HCLGE_MDIO_PHYID_S, phyid); HCLGE_MDIO_PHYID_S, (u32)phyid);
hnae3_set_field(mdio_cmd->phyad, HCLGE_MDIO_PHYREG_M, hnae3_set_field(mdio_cmd->phyad, HCLGE_MDIO_PHYREG_M,
HCLGE_MDIO_PHYREG_S, regnum); HCLGE_MDIO_PHYREG_S, (u32)regnum);
hnae3_set_bit(mdio_cmd->ctrl_bit, HCLGE_MDIO_CTRL_START_B, 1); hnae3_set_bit(mdio_cmd->ctrl_bit, HCLGE_MDIO_CTRL_START_B, 1);
hnae3_set_field(mdio_cmd->ctrl_bit, HCLGE_MDIO_CTRL_ST_M, hnae3_set_field(mdio_cmd->ctrl_bit, HCLGE_MDIO_CTRL_ST_M,
......
...@@ -976,7 +976,7 @@ static int hclge_tm_ets_tc_dwrr_cfg(struct hclge_dev *hdev) ...@@ -976,7 +976,7 @@ static int hclge_tm_ets_tc_dwrr_cfg(struct hclge_dev *hdev)
struct hclge_ets_tc_weight_cmd *ets_weight; struct hclge_ets_tc_weight_cmd *ets_weight;
struct hclge_desc desc; struct hclge_desc desc;
int i; unsigned int i;
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_ETS_TC_WEIGHT, false); hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_ETS_TC_WEIGHT, false);
ets_weight = (struct hclge_ets_tc_weight_cmd *)desc.data; ets_weight = (struct hclge_ets_tc_weight_cmd *)desc.data;
......
...@@ -382,7 +382,7 @@ static int hclgevf_knic_setup(struct hclgevf_dev *hdev) ...@@ -382,7 +382,7 @@ static int hclgevf_knic_setup(struct hclgevf_dev *hdev)
struct hnae3_handle *nic = &hdev->nic; struct hnae3_handle *nic = &hdev->nic;
struct hnae3_knic_private_info *kinfo; struct hnae3_knic_private_info *kinfo;
u16 new_tqps = hdev->num_tqps; u16 new_tqps = hdev->num_tqps;
int i; unsigned int i;
kinfo = &nic->kinfo; kinfo = &nic->kinfo;
kinfo->num_tc = 0; kinfo->num_tc = 0;
...@@ -540,8 +540,8 @@ static int hclgevf_set_rss_algo_key(struct hclgevf_dev *hdev, ...@@ -540,8 +540,8 @@ static int hclgevf_set_rss_algo_key(struct hclgevf_dev *hdev,
const u8 hfunc, const u8 *key) const u8 hfunc, const u8 *key)
{ {
struct hclgevf_rss_config_cmd *req; struct hclgevf_rss_config_cmd *req;
unsigned int key_offset = 0;
struct hclgevf_desc desc; struct hclgevf_desc desc;
int key_offset = 0;
int key_counts; int key_counts;
int key_size; int key_size;
int ret; int ret;
...@@ -626,7 +626,7 @@ static int hclgevf_set_rss_tc_mode(struct hclgevf_dev *hdev, u16 rss_size) ...@@ -626,7 +626,7 @@ static int hclgevf_set_rss_tc_mode(struct hclgevf_dev *hdev, u16 rss_size)
struct hclgevf_desc desc; struct hclgevf_desc desc;
u16 roundup_size; u16 roundup_size;
int status; int status;
int i; unsigned int i;
req = (struct hclgevf_rss_tc_mode_cmd *)desc.data; req = (struct hclgevf_rss_tc_mode_cmd *)desc.data;
...@@ -1129,7 +1129,7 @@ static int hclgevf_set_promisc_mode(struct hclgevf_dev *hdev, bool en_bc_pmc) ...@@ -1129,7 +1129,7 @@ static int hclgevf_set_promisc_mode(struct hclgevf_dev *hdev, bool en_bc_pmc)
return hclgevf_cmd_set_promisc_mode(hdev, en_bc_pmc); return hclgevf_cmd_set_promisc_mode(hdev, en_bc_pmc);
} }
static int hclgevf_tqp_enable(struct hclgevf_dev *hdev, int tqp_id, static int hclgevf_tqp_enable(struct hclgevf_dev *hdev, unsigned int tqp_id,
int stream_id, bool enable) int stream_id, bool enable)
{ {
struct hclgevf_cfg_com_tqp_queue_cmd *req; struct hclgevf_cfg_com_tqp_queue_cmd *req;
...@@ -1142,7 +1142,8 @@ static int hclgevf_tqp_enable(struct hclgevf_dev *hdev, int tqp_id, ...@@ -1142,7 +1142,8 @@ static int hclgevf_tqp_enable(struct hclgevf_dev *hdev, int tqp_id,
false); false);
req->tqp_id = cpu_to_le16(tqp_id & HCLGEVF_RING_ID_MASK); req->tqp_id = cpu_to_le16(tqp_id & HCLGEVF_RING_ID_MASK);
req->stream_id = cpu_to_le16(stream_id); req->stream_id = cpu_to_le16(stream_id);
req->enable |= enable << HCLGEVF_TQP_ENABLE_B; if (enable)
req->enable |= 1U << HCLGEVF_TQP_ENABLE_B;
status = hclgevf_cmd_send(&hdev->hw, &desc, 1); status = hclgevf_cmd_send(&hdev->hw, &desc, 1);
if (status) if (status)
......
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