Commit feaf751d authored by David S. Miller's avatar David S. Miller

Merge branch 'hns3-fixes-for-configuration-lost-problems'

Peng Li says:

====================
fixes for configuration lost problems

This patchset refactors some functions and some bugs in order
to fix the configuration loss problem when resetting and
setting channel number.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 0623951e 7a242b23
...@@ -265,6 +265,8 @@ struct hnae3_ae_dev { ...@@ -265,6 +265,8 @@ struct hnae3_ae_dev {
* Get tc size of handle * Get tc size of handle
* get_vector() * get_vector()
* Get vector number and vector information * Get vector number and vector information
* put_vector()
* Put the vector in hdev
* map_ring_to_vector() * map_ring_to_vector()
* Map rings to vector * Map rings to vector
* unmap_ring_from_vector() * unmap_ring_from_vector()
...@@ -375,6 +377,7 @@ struct hnae3_ae_ops { ...@@ -375,6 +377,7 @@ struct hnae3_ae_ops {
int (*get_vector)(struct hnae3_handle *handle, u16 vector_num, int (*get_vector)(struct hnae3_handle *handle, u16 vector_num,
struct hnae3_vector_info *vector_info); struct hnae3_vector_info *vector_info);
int (*put_vector)(struct hnae3_handle *handle, int vector_num);
int (*map_ring_to_vector)(struct hnae3_handle *handle, int (*map_ring_to_vector)(struct hnae3_handle *handle,
int vector_num, int vector_num,
struct hnae3_ring_chain_node *vr_chain); struct hnae3_ring_chain_node *vr_chain);
......
...@@ -460,15 +460,19 @@ enum hns3_link_mode_bits { ...@@ -460,15 +460,19 @@ enum hns3_link_mode_bits {
#define HNS3_INT_RL_MAX 0x00EC #define HNS3_INT_RL_MAX 0x00EC
#define HNS3_INT_RL_ENABLE_MASK 0x40 #define HNS3_INT_RL_ENABLE_MASK 0x40
struct hns3_enet_coalesce {
u16 int_gl;
u8 gl_adapt_enable;
enum hns3_flow_level_range flow_level;
};
struct hns3_enet_ring_group { struct hns3_enet_ring_group {
/* array of pointers to rings */ /* array of pointers to rings */
struct hns3_enet_ring *ring; struct hns3_enet_ring *ring;
u64 total_bytes; /* total bytes processed this group */ u64 total_bytes; /* total bytes processed this group */
u64 total_packets; /* total packets processed this group */ u64 total_packets; /* total packets processed this group */
u16 count; u16 count;
enum hns3_flow_level_range flow_level; struct hns3_enet_coalesce coal;
u16 int_gl;
u8 gl_adapt_enable;
}; };
struct hns3_enet_tqp_vector { struct hns3_enet_tqp_vector {
......
...@@ -905,11 +905,13 @@ static int hns3_get_coalesce_per_queue(struct net_device *netdev, u32 queue, ...@@ -905,11 +905,13 @@ static int hns3_get_coalesce_per_queue(struct net_device *netdev, u32 queue,
tx_vector = priv->ring_data[queue].ring->tqp_vector; tx_vector = priv->ring_data[queue].ring->tqp_vector;
rx_vector = priv->ring_data[queue_num + queue].ring->tqp_vector; rx_vector = priv->ring_data[queue_num + queue].ring->tqp_vector;
cmd->use_adaptive_tx_coalesce = tx_vector->tx_group.gl_adapt_enable; cmd->use_adaptive_tx_coalesce =
cmd->use_adaptive_rx_coalesce = rx_vector->rx_group.gl_adapt_enable; tx_vector->tx_group.coal.gl_adapt_enable;
cmd->use_adaptive_rx_coalesce =
rx_vector->rx_group.coal.gl_adapt_enable;
cmd->tx_coalesce_usecs = tx_vector->tx_group.int_gl; cmd->tx_coalesce_usecs = tx_vector->tx_group.coal.int_gl;
cmd->rx_coalesce_usecs = rx_vector->rx_group.int_gl; cmd->rx_coalesce_usecs = rx_vector->rx_group.coal.int_gl;
cmd->tx_coalesce_usecs_high = h->kinfo.int_rl_setting; cmd->tx_coalesce_usecs_high = h->kinfo.int_rl_setting;
cmd->rx_coalesce_usecs_high = h->kinfo.int_rl_setting; cmd->rx_coalesce_usecs_high = h->kinfo.int_rl_setting;
...@@ -1029,14 +1031,18 @@ static void hns3_set_coalesce_per_queue(struct net_device *netdev, ...@@ -1029,14 +1031,18 @@ static void hns3_set_coalesce_per_queue(struct net_device *netdev,
tx_vector = priv->ring_data[queue].ring->tqp_vector; tx_vector = priv->ring_data[queue].ring->tqp_vector;
rx_vector = priv->ring_data[queue_num + queue].ring->tqp_vector; rx_vector = priv->ring_data[queue_num + queue].ring->tqp_vector;
tx_vector->tx_group.gl_adapt_enable = cmd->use_adaptive_tx_coalesce; tx_vector->tx_group.coal.gl_adapt_enable =
rx_vector->rx_group.gl_adapt_enable = cmd->use_adaptive_rx_coalesce; cmd->use_adaptive_tx_coalesce;
rx_vector->rx_group.coal.gl_adapt_enable =
cmd->use_adaptive_rx_coalesce;
tx_vector->tx_group.int_gl = cmd->tx_coalesce_usecs; tx_vector->tx_group.coal.int_gl = cmd->tx_coalesce_usecs;
rx_vector->rx_group.int_gl = cmd->rx_coalesce_usecs; rx_vector->rx_group.coal.int_gl = cmd->rx_coalesce_usecs;
hns3_set_vector_coalesce_tx_gl(tx_vector, tx_vector->tx_group.int_gl); hns3_set_vector_coalesce_tx_gl(tx_vector,
hns3_set_vector_coalesce_rx_gl(rx_vector, rx_vector->rx_group.int_gl); tx_vector->tx_group.coal.int_gl);
hns3_set_vector_coalesce_rx_gl(rx_vector,
rx_vector->rx_group.coal.int_gl);
hns3_set_vector_coalesce_rl(tx_vector, h->kinfo.int_rl_setting); hns3_set_vector_coalesce_rl(tx_vector, h->kinfo.int_rl_setting);
hns3_set_vector_coalesce_rl(rx_vector, h->kinfo.int_rl_setting); hns3_set_vector_coalesce_rl(rx_vector, h->kinfo.int_rl_setting);
......
...@@ -144,6 +144,8 @@ static int hclge_map_update(struct hnae3_handle *h) ...@@ -144,6 +144,8 @@ static int hclge_map_update(struct hnae3_handle *h)
if (ret) if (ret)
return ret; return ret;
hclge_rss_indir_init_cfg(hdev);
return hclge_rss_init_hw(hdev); return hclge_rss_init_hw(hdev);
} }
......
...@@ -573,12 +573,27 @@ struct hclge_rx_vtag_cfg { ...@@ -573,12 +573,27 @@ struct hclge_rx_vtag_cfg {
bool vlan2_vlan_prionly;/* Outer VLAN Tag up to descriptor Enable */ bool vlan2_vlan_prionly;/* Outer VLAN Tag up to descriptor Enable */
}; };
struct hclge_rss_tuple_cfg {
u8 ipv4_tcp_en;
u8 ipv4_udp_en;
u8 ipv4_sctp_en;
u8 ipv4_fragment_en;
u8 ipv6_tcp_en;
u8 ipv6_udp_en;
u8 ipv6_sctp_en;
u8 ipv6_fragment_en;
};
struct hclge_vport { struct hclge_vport {
u16 alloc_tqps; /* Allocated Tx/Rx queues */ u16 alloc_tqps; /* Allocated Tx/Rx queues */
u8 rss_hash_key[HCLGE_RSS_KEY_SIZE]; /* User configured hash keys */ u8 rss_hash_key[HCLGE_RSS_KEY_SIZE]; /* User configured hash keys */
/* User configured lookup table entries */ /* User configured lookup table entries */
u8 rss_indirection_tbl[HCLGE_RSS_IND_TBL_SIZE]; u8 rss_indirection_tbl[HCLGE_RSS_IND_TBL_SIZE];
int rss_algo; /* User configured hash algorithm */
/* User configured rss tuple sets */
struct hclge_rss_tuple_cfg rss_tuple_sets;
u16 alloc_rss_size; u16 alloc_rss_size;
u16 qs_offset; u16 qs_offset;
...@@ -627,6 +642,7 @@ int hclge_set_vf_vlan_common(struct hclge_dev *vport, int vfid, ...@@ -627,6 +642,7 @@ int hclge_set_vf_vlan_common(struct hclge_dev *vport, int vfid,
int hclge_buffer_alloc(struct hclge_dev *hdev); int hclge_buffer_alloc(struct hclge_dev *hdev);
int hclge_rss_init_hw(struct hclge_dev *hdev); int hclge_rss_init_hw(struct hclge_dev *hdev);
void hclge_rss_indir_init_cfg(struct hclge_dev *hdev);
void hclge_mbx_handler(struct hclge_dev *hdev); void hclge_mbx_handler(struct hclge_dev *hdev);
void hclge_reset_tqp(struct hnae3_handle *handle, u16 queue_id); void hclge_reset_tqp(struct hnae3_handle *handle, u16 queue_id);
......
...@@ -627,13 +627,18 @@ static int hclgevf_unmap_ring_from_vector( ...@@ -627,13 +627,18 @@ static int hclgevf_unmap_ring_from_vector(
} }
ret = hclgevf_bind_ring_to_vector(handle, false, vector, ring_chain); ret = hclgevf_bind_ring_to_vector(handle, false, vector, ring_chain);
if (ret) { if (ret)
dev_err(&handle->pdev->dev, dev_err(&handle->pdev->dev,
"Unmap ring from vector fail. vector=%d, ret =%d\n", "Unmap ring from vector fail. vector=%d, ret =%d\n",
vector_id, vector_id,
ret); ret);
return ret; return ret;
} }
static int hclgevf_put_vector(struct hnae3_handle *handle, int vector)
{
struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle);
hclgevf_free_vector(hdev, vector); hclgevf_free_vector(hdev, vector);
...@@ -1466,6 +1471,7 @@ static const struct hnae3_ae_ops hclgevf_ops = { ...@@ -1466,6 +1471,7 @@ static const struct hnae3_ae_ops hclgevf_ops = {
.map_ring_to_vector = hclgevf_map_ring_to_vector, .map_ring_to_vector = hclgevf_map_ring_to_vector,
.unmap_ring_from_vector = hclgevf_unmap_ring_from_vector, .unmap_ring_from_vector = hclgevf_unmap_ring_from_vector,
.get_vector = hclgevf_get_vector, .get_vector = hclgevf_get_vector,
.put_vector = hclgevf_put_vector,
.reset_queue = hclgevf_reset_tqp, .reset_queue = hclgevf_reset_tqp,
.set_promisc_mode = hclgevf_set_promisc_mode, .set_promisc_mode = hclgevf_set_promisc_mode,
.get_mac_addr = hclgevf_get_mac_addr, .get_mac_addr = hclgevf_get_mac_addr,
......
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