mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-17 01:54:01 +08:00
Merge branch 'hns3-cleanups'
Huazhong Tan says: ==================== net: hns3: some cleanups for -next There are some cleanups for the HNS3 ethernet driver. change log: V2: remove previous #3 which should target net. previous version: V1: https://patchwork.kernel.org/project/netdevbpf/cover/1612784382-27262-1-git-send-email-tanhuazhong@huawei.com/ ==================== Acked-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
3e566dacc9
@ -272,7 +272,7 @@ struct hnae3_ring_chain_node {
|
||||
};
|
||||
|
||||
#define HNAE3_IS_TX_RING(node) \
|
||||
(((node)->flag & (1 << HNAE3_RING_TYPE_B)) == HNAE3_RING_TYPE_TX)
|
||||
(((node)->flag & 1 << HNAE3_RING_TYPE_B) == HNAE3_RING_TYPE_TX)
|
||||
|
||||
/* device specification info from firmware */
|
||||
struct hnae3_dev_specs {
|
||||
@ -292,7 +292,6 @@ struct hnae3_client_ops {
|
||||
int (*init_instance)(struct hnae3_handle *handle);
|
||||
void (*uninit_instance)(struct hnae3_handle *handle, bool reset);
|
||||
void (*link_status_change)(struct hnae3_handle *handle, bool state);
|
||||
int (*setup_tc)(struct hnae3_handle *handle, u8 tc);
|
||||
int (*reset_notify)(struct hnae3_handle *handle,
|
||||
enum hnae3_reset_notify_type type);
|
||||
void (*process_hw_error)(struct hnae3_handle *handle,
|
||||
@ -776,9 +775,9 @@ struct hnae3_handle {
|
||||
#define hnae3_get_field(origin, mask, shift) (((origin) & (mask)) >> (shift))
|
||||
|
||||
#define hnae3_set_bit(origin, shift, val) \
|
||||
hnae3_set_field((origin), (0x1 << (shift)), (shift), (val))
|
||||
hnae3_set_field(origin, 0x1 << (shift), shift, val)
|
||||
#define hnae3_get_bit(origin, shift) \
|
||||
hnae3_get_field((origin), (0x1 << (shift)), (shift))
|
||||
hnae3_get_field(origin, 0x1 << (shift), shift)
|
||||
|
||||
#define HNAE3_DBG_TM_NODES "tm_nodes"
|
||||
#define HNAE3_DBG_TM_PRI "tm_priority"
|
||||
|
@ -162,7 +162,7 @@ static int hns3_dbg_queue_map(struct hnae3_handle *h)
|
||||
continue;
|
||||
|
||||
dev_info(&h->pdev->dev,
|
||||
" %4d %4d %4d\n",
|
||||
" %4d %4u %4d\n",
|
||||
i, global_qid, priv->ring[i].tqp_vector->vector_irq);
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
#define CREATE_TRACE_POINTS
|
||||
#include "hns3_trace.h"
|
||||
|
||||
#define hns3_set_field(origin, shift, val) ((origin) |= ((val) << (shift)))
|
||||
#define hns3_set_field(origin, shift, val) ((origin) |= (val) << (shift))
|
||||
#define hns3_tx_bd_count(S) DIV_ROUND_UP(S, HNS3_MAX_BD_SIZE)
|
||||
|
||||
#define hns3_rl_err(fmt, ...) \
|
||||
@ -2329,7 +2329,7 @@ static pci_ers_result_t hns3_error_detected(struct pci_dev *pdev,
|
||||
struct hnae3_ae_dev *ae_dev = pci_get_drvdata(pdev);
|
||||
pci_ers_result_t ret;
|
||||
|
||||
dev_info(&pdev->dev, "PCI error detected, state(=%d)!!\n", state);
|
||||
dev_info(&pdev->dev, "PCI error detected, state(=%u)!!\n", state);
|
||||
|
||||
if (state == pci_channel_io_perm_failure)
|
||||
return PCI_ERS_RESULT_DISCONNECT;
|
||||
@ -4084,7 +4084,7 @@ out_when_alloc_ring_memory:
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
int hns3_uninit_all_ring(struct hns3_nic_priv *priv)
|
||||
static void hns3_uninit_all_ring(struct hns3_nic_priv *priv)
|
||||
{
|
||||
struct hnae3_handle *h = priv->ae_handle;
|
||||
int i;
|
||||
@ -4093,7 +4093,6 @@ int hns3_uninit_all_ring(struct hns3_nic_priv *priv)
|
||||
hns3_fini_ring(&priv->ring[i]);
|
||||
hns3_fini_ring(&priv->ring[i + h->kinfo.num_tqps]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Set mac addr if it is configured. or leave it to the AE driver */
|
||||
@ -4321,7 +4320,6 @@ static void hns3_client_uninit(struct hnae3_handle *handle, bool reset)
|
||||
{
|
||||
struct net_device *netdev = handle->kinfo.netdev;
|
||||
struct hns3_nic_priv *priv = netdev_priv(netdev);
|
||||
int ret;
|
||||
|
||||
if (netdev->reg_state != NETREG_UNINITIALIZED)
|
||||
unregister_netdev(netdev);
|
||||
@ -4347,9 +4345,7 @@ static void hns3_client_uninit(struct hnae3_handle *handle, bool reset)
|
||||
|
||||
hns3_nic_dealloc_vector_data(priv);
|
||||
|
||||
ret = hns3_uninit_all_ring(priv);
|
||||
if (ret)
|
||||
netdev_err(netdev, "uninit ring error\n");
|
||||
hns3_uninit_all_ring(priv);
|
||||
|
||||
hns3_put_ring_config(priv);
|
||||
|
||||
@ -4378,20 +4374,6 @@ static void hns3_link_status_change(struct hnae3_handle *handle, bool linkup)
|
||||
}
|
||||
}
|
||||
|
||||
static int hns3_client_setup_tc(struct hnae3_handle *handle, u8 tc)
|
||||
{
|
||||
struct hnae3_knic_private_info *kinfo = &handle->kinfo;
|
||||
struct net_device *ndev = kinfo->netdev;
|
||||
|
||||
if (tc > HNAE3_MAX_TC)
|
||||
return -EINVAL;
|
||||
|
||||
if (!ndev)
|
||||
return -ENODEV;
|
||||
|
||||
return hns3_nic_set_real_num_queue(ndev);
|
||||
}
|
||||
|
||||
static void hns3_clear_tx_ring(struct hns3_enet_ring *ring)
|
||||
{
|
||||
while (ring->next_to_clean != ring->next_to_use) {
|
||||
@ -4676,9 +4658,7 @@ static int hns3_reset_notify_uninit_enet(struct hnae3_handle *handle)
|
||||
|
||||
hns3_nic_dealloc_vector_data(priv);
|
||||
|
||||
ret = hns3_uninit_all_ring(priv);
|
||||
if (ret)
|
||||
netdev_err(netdev, "uninit ring error\n");
|
||||
hns3_uninit_all_ring(priv);
|
||||
|
||||
hns3_put_ring_config(priv);
|
||||
|
||||
@ -4828,7 +4808,6 @@ static const struct hnae3_client_ops client_ops = {
|
||||
.init_instance = hns3_client_init,
|
||||
.uninit_instance = hns3_client_uninit,
|
||||
.link_status_change = hns3_link_status_change,
|
||||
.setup_tc = hns3_client_setup_tc,
|
||||
.reset_notify = hns3_reset_notify,
|
||||
.process_hw_error = hns3_process_hw_error,
|
||||
};
|
||||
|
@ -554,7 +554,7 @@ static inline void hns3_write_reg(void __iomem *base, u32 reg, u32 value)
|
||||
}
|
||||
|
||||
#define hns3_read_dev(a, reg) \
|
||||
hns3_read_reg((a)->io_base, (reg))
|
||||
hns3_read_reg((a)->io_base, reg)
|
||||
|
||||
static inline bool hns3_nic_resetting(struct net_device *netdev)
|
||||
{
|
||||
@ -564,7 +564,7 @@ static inline bool hns3_nic_resetting(struct net_device *netdev)
|
||||
}
|
||||
|
||||
#define hns3_write_dev(a, reg, value) \
|
||||
hns3_write_reg((a)->io_base, (reg), (value))
|
||||
hns3_write_reg((a)->io_base, reg, value)
|
||||
|
||||
#define ring_to_dev(ring) ((ring)->dev)
|
||||
|
||||
@ -588,15 +588,15 @@ static inline unsigned int hns3_page_order(struct hns3_enet_ring *ring)
|
||||
|
||||
/* iterator for handling rings in ring group */
|
||||
#define hns3_for_each_ring(pos, head) \
|
||||
for (pos = (head).ring; pos; pos = pos->next)
|
||||
for (pos = (head).ring; (pos); pos = (pos)->next)
|
||||
|
||||
#define hns3_get_handle(ndev) \
|
||||
(((struct hns3_nic_priv *)netdev_priv(ndev))->ae_handle)
|
||||
|
||||
#define hns3_gl_usec_to_reg(int_gl) (int_gl >> 1)
|
||||
#define hns3_gl_usec_to_reg(int_gl) ((int_gl) >> 1)
|
||||
#define hns3_gl_round_down(int_gl) round_down(int_gl, 2)
|
||||
|
||||
#define hns3_rl_usec_to_reg(int_rl) (int_rl >> 2)
|
||||
#define hns3_rl_usec_to_reg(int_rl) ((int_rl) >> 2)
|
||||
#define hns3_rl_round_down(int_rl) round_down(int_rl, 4)
|
||||
|
||||
void hns3_ethtool_set_ops(struct net_device *netdev);
|
||||
@ -605,7 +605,6 @@ int hns3_set_channels(struct net_device *netdev,
|
||||
|
||||
void hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget);
|
||||
int hns3_init_all_ring(struct hns3_nic_priv *priv);
|
||||
int hns3_uninit_all_ring(struct hns3_nic_priv *priv);
|
||||
int hns3_nic_reset_all_ring(struct hnae3_handle *h);
|
||||
void hns3_fini_ring(struct hns3_enet_ring *ring);
|
||||
netdev_tx_t hns3_nic_net_xmit(struct sk_buff *skb, struct net_device *netdev);
|
||||
|
@ -456,7 +456,7 @@ static void *hns3_update_strings(u8 *data, const struct hns3_stats *stats,
|
||||
data[ETH_GSTRING_LEN - 1] = '\0';
|
||||
|
||||
/* first, prepend the prefix string */
|
||||
n1 = scnprintf(data, MAX_PREFIX_SIZE, "%s%d_",
|
||||
n1 = scnprintf(data, MAX_PREFIX_SIZE, "%s%u_",
|
||||
prefix, i);
|
||||
size_left = (ETH_GSTRING_LEN - 1) - n1;
|
||||
|
||||
|
@ -1144,9 +1144,9 @@ static inline void hclge_write_reg(void __iomem *base, u32 reg, u32 value)
|
||||
}
|
||||
|
||||
#define hclge_write_dev(a, reg, value) \
|
||||
hclge_write_reg((a)->io_base, (reg), (value))
|
||||
hclge_write_reg((a)->io_base, reg, value)
|
||||
#define hclge_read_dev(a, reg) \
|
||||
hclge_read_reg((a)->io_base, (reg))
|
||||
hclge_read_reg((a)->io_base, reg)
|
||||
|
||||
static inline u32 hclge_read_reg(u8 __iomem *base, u32 reg)
|
||||
{
|
||||
|
@ -176,29 +176,6 @@ static int hclge_map_update(struct hclge_dev *hdev)
|
||||
return hclge_rss_init_hw(hdev);
|
||||
}
|
||||
|
||||
static int hclge_client_setup_tc(struct hclge_dev *hdev)
|
||||
{
|
||||
struct hclge_vport *vport = hdev->vport;
|
||||
struct hnae3_client *client;
|
||||
struct hnae3_handle *handle;
|
||||
int ret;
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < hdev->num_vmdq_vport + 1; i++) {
|
||||
handle = &vport[i].nic;
|
||||
client = handle->client;
|
||||
|
||||
if (!client || !client->ops || !client->ops->setup_tc)
|
||||
continue;
|
||||
|
||||
ret = client->ops->setup_tc(handle, hdev->tm_info.num_tc);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hclge_notify_down_uinit(struct hclge_dev *hdev)
|
||||
{
|
||||
int ret;
|
||||
@ -257,10 +234,6 @@ static int hclge_ieee_setets(struct hnae3_handle *h, struct ieee_ets *ets)
|
||||
if (ret)
|
||||
goto err_out;
|
||||
|
||||
ret = hclge_client_setup_tc(hdev);
|
||||
if (ret)
|
||||
goto err_out;
|
||||
|
||||
ret = hclge_notify_init_up(hdev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
@ -696,17 +696,16 @@ static void hclge_dbg_dump_tm_map(struct hclge_dev *hdev,
|
||||
u32 qset_mapping[HCLGE_BP_EXT_GRP_NUM];
|
||||
struct hclge_qs_to_pri_link_cmd *map;
|
||||
struct hclge_tqp_tx_queue_tc_cmd *tc;
|
||||
u16 group_id, queue_id, qset_id;
|
||||
enum hclge_opcode_type cmd;
|
||||
u8 grp_num, pri_id, tc_id;
|
||||
struct hclge_desc desc;
|
||||
int queue_id, group_id;
|
||||
int tc_id, qset_id;
|
||||
int pri_id, ret;
|
||||
u16 qs_id_l;
|
||||
u16 qs_id_h;
|
||||
u8 grp_num;
|
||||
int ret;
|
||||
u32 i;
|
||||
|
||||
ret = kstrtouint(cmd_buf, 0, &queue_id);
|
||||
ret = kstrtou16(cmd_buf, 0, &queue_id);
|
||||
queue_id = (ret != 0) ? 0 : queue_id;
|
||||
|
||||
cmd = HCLGE_OPC_TM_NQ_TO_QS_LINK;
|
||||
@ -754,7 +753,7 @@ static void hclge_dbg_dump_tm_map(struct hclge_dev *hdev,
|
||||
tc_id = tc->tc_id & 0x7;
|
||||
|
||||
dev_info(&hdev->pdev->dev, "queue_id | qset_id | pri_id | tc_id\n");
|
||||
dev_info(&hdev->pdev->dev, "%04d | %04d | %02d | %02d\n",
|
||||
dev_info(&hdev->pdev->dev, "%04u | %04u | %02u | %02u\n",
|
||||
queue_id, qset_id, pri_id, tc_id);
|
||||
|
||||
if (!hnae3_dev_dcb_supported(hdev)) {
|
||||
|
@ -1073,7 +1073,7 @@ static int hclge_config_ssu_hw_err_int(struct hclge_dev *hdev, bool en)
|
||||
* This function querys number of mpf and pf buffer descriptors.
|
||||
*/
|
||||
static int hclge_query_bd_num(struct hclge_dev *hdev, bool is_ras,
|
||||
int *mpf_bd_num, int *pf_bd_num)
|
||||
u32 *mpf_bd_num, u32 *pf_bd_num)
|
||||
{
|
||||
struct device *dev = &hdev->pdev->dev;
|
||||
u32 mpf_min_bd_num, pf_min_bd_num;
|
||||
@ -1102,7 +1102,7 @@ static int hclge_query_bd_num(struct hclge_dev *hdev, bool is_ras,
|
||||
*mpf_bd_num = le32_to_cpu(desc_bd.data[0]);
|
||||
*pf_bd_num = le32_to_cpu(desc_bd.data[1]);
|
||||
if (*mpf_bd_num < mpf_min_bd_num || *pf_bd_num < pf_min_bd_num) {
|
||||
dev_err(dev, "Invalid bd num: mpf(%d), pf(%d)\n",
|
||||
dev_err(dev, "Invalid bd num: mpf(%u), pf(%u)\n",
|
||||
*mpf_bd_num, *pf_bd_num);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "hnae3.h"
|
||||
|
||||
#define HCLGE_NAME "hclge"
|
||||
#define HCLGE_STATS_READ(p, offset) (*((u64 *)((u8 *)(p) + (offset))))
|
||||
#define HCLGE_STATS_READ(p, offset) (*(u64 *)((u8 *)(p) + (offset)))
|
||||
#define HCLGE_MAC_STATS_FIELD_OFF(f) (offsetof(struct hclge_mac_stats, f))
|
||||
|
||||
#define HCLGE_BUF_SIZE_UNIT 256U
|
||||
@ -626,7 +626,7 @@ static u8 *hclge_tqps_get_strings(struct hnae3_handle *handle, u8 *data)
|
||||
for (i = 0; i < kinfo->num_tqps; i++) {
|
||||
struct hclge_tqp *tqp = container_of(handle->kinfo.tqp[i],
|
||||
struct hclge_tqp, q);
|
||||
snprintf(buff, ETH_GSTRING_LEN, "txq%d_pktnum_rcd",
|
||||
snprintf(buff, ETH_GSTRING_LEN, "txq%u_pktnum_rcd",
|
||||
tqp->index);
|
||||
buff = buff + ETH_GSTRING_LEN;
|
||||
}
|
||||
@ -634,7 +634,7 @@ static u8 *hclge_tqps_get_strings(struct hnae3_handle *handle, u8 *data)
|
||||
for (i = 0; i < kinfo->num_tqps; i++) {
|
||||
struct hclge_tqp *tqp = container_of(kinfo->tqp[i],
|
||||
struct hclge_tqp, q);
|
||||
snprintf(buff, ETH_GSTRING_LEN, "rxq%d_pktnum_rcd",
|
||||
snprintf(buff, ETH_GSTRING_LEN, "rxq%u_pktnum_rcd",
|
||||
tqp->index);
|
||||
buff = buff + ETH_GSTRING_LEN;
|
||||
}
|
||||
@ -928,7 +928,7 @@ static int hclge_query_pf_resource(struct hclge_dev *hdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hclge_parse_speed(int speed_cmd, int *speed)
|
||||
static int hclge_parse_speed(u8 speed_cmd, u32 *speed)
|
||||
{
|
||||
switch (speed_cmd) {
|
||||
case 6:
|
||||
@ -5595,7 +5595,7 @@ static int hclge_fd_check_ext_tuple(struct hclge_dev *hdev,
|
||||
if (fs->m_ext.vlan_tci &&
|
||||
be16_to_cpu(fs->h_ext.vlan_tci) >= VLAN_N_VID) {
|
||||
dev_err(&hdev->pdev->dev,
|
||||
"failed to config vlan_tci, invalid vlan_tci: %u, max is %u.\n",
|
||||
"failed to config vlan_tci, invalid vlan_tci: %u, max is %d.\n",
|
||||
ntohs(fs->h_ext.vlan_tci), VLAN_N_VID - 1);
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -10831,7 +10831,7 @@ static void hclge_reset_vf_rate(struct hclge_dev *hdev)
|
||||
}
|
||||
}
|
||||
|
||||
static int hclge_vf_rate_param_check(struct hclge_dev *hdev, int vf,
|
||||
static int hclge_vf_rate_param_check(struct hclge_dev *hdev,
|
||||
int min_tx_rate, int max_tx_rate)
|
||||
{
|
||||
if (min_tx_rate != 0 ||
|
||||
@ -10852,7 +10852,7 @@ static int hclge_set_vf_rate(struct hnae3_handle *handle, int vf,
|
||||
struct hclge_dev *hdev = vport->back;
|
||||
int ret;
|
||||
|
||||
ret = hclge_vf_rate_param_check(hdev, vf, min_tx_rate, max_tx_rate);
|
||||
ret = hclge_vf_rate_param_check(hdev, min_tx_rate, max_tx_rate);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -46,15 +46,12 @@
|
||||
#define HCLGE_CMDQ_RX_DEPTH_REG 0x27020
|
||||
#define HCLGE_CMDQ_RX_TAIL_REG 0x27024
|
||||
#define HCLGE_CMDQ_RX_HEAD_REG 0x27028
|
||||
#define HCLGE_CMDQ_INTR_SRC_REG 0x27100
|
||||
#define HCLGE_CMDQ_INTR_STS_REG 0x27104
|
||||
#define HCLGE_CMDQ_INTR_EN_REG 0x27108
|
||||
#define HCLGE_CMDQ_INTR_GEN_REG 0x2710C
|
||||
|
||||
/* bar registers for common func */
|
||||
#define HCLGE_VECTOR0_OTER_EN_REG 0x20600
|
||||
#define HCLGE_RAS_OTHER_STS_REG 0x20B00
|
||||
#define HCLGE_FUNC_RESET_STS_REG 0x20C00
|
||||
#define HCLGE_GRO_EN_REG 0x28000
|
||||
|
||||
/* bar registers for rcb */
|
||||
@ -728,7 +725,7 @@ struct hclge_vf_vlan_cfg {
|
||||
* x = (~k) & v
|
||||
* y = (k ^ ~v) & k
|
||||
*/
|
||||
#define calc_x(x, k, v) ((x) = (~(k) & (v)))
|
||||
#define calc_x(x, k, v) (x = ~(k) & (v))
|
||||
#define calc_y(y, k, v) \
|
||||
do { \
|
||||
const typeof(k) _k_ = (k); \
|
||||
|
@ -56,7 +56,7 @@ static int hclge_gen_resp_to_vf(struct hclge_vport *vport,
|
||||
resp_pf_to_vf->msg.resp_status = resp;
|
||||
} else {
|
||||
dev_warn(&hdev->pdev->dev,
|
||||
"failed to send response to VF, response status %d is out-of-bound\n",
|
||||
"failed to send response to VF, response status %u is out-of-bound\n",
|
||||
resp);
|
||||
resp_pf_to_vf->msg.resp_status = EIO;
|
||||
}
|
||||
|
@ -41,8 +41,9 @@ static int hclge_shaper_para_calc(u32 ir, u8 shaper_level,
|
||||
struct hclge_shaper_ir_para *ir_para,
|
||||
u32 max_tm_rate)
|
||||
{
|
||||
#define DEFAULT_SHAPER_IR_B 126
|
||||
#define DIVISOR_CLK (1000 * 8)
|
||||
#define DIVISOR_IR_B_126 (126 * DIVISOR_CLK)
|
||||
#define DEFAULT_DIVISOR_IR_B (DEFAULT_SHAPER_IR_B * DIVISOR_CLK)
|
||||
|
||||
static const u16 tick_array[HCLGE_SHAPER_LVL_CNT] = {
|
||||
6 * 256, /* Prioriy level */
|
||||
@ -69,10 +70,10 @@ static int hclge_shaper_para_calc(u32 ir, u8 shaper_level,
|
||||
* ir_calc = ---------------- * 1000
|
||||
* tick * 1
|
||||
*/
|
||||
ir_calc = (DIVISOR_IR_B_126 + (tick >> 1) - 1) / tick;
|
||||
ir_calc = (DEFAULT_DIVISOR_IR_B + (tick >> 1) - 1) / tick;
|
||||
|
||||
if (ir_calc == ir) {
|
||||
ir_para->ir_b = 126;
|
||||
ir_para->ir_b = DEFAULT_SHAPER_IR_B;
|
||||
ir_para->ir_u = 0;
|
||||
ir_para->ir_s = 0;
|
||||
|
||||
@ -81,7 +82,8 @@ static int hclge_shaper_para_calc(u32 ir, u8 shaper_level,
|
||||
/* Increasing the denominator to select ir_s value */
|
||||
while (ir_calc >= ir && ir) {
|
||||
ir_s_calc++;
|
||||
ir_calc = DIVISOR_IR_B_126 / (tick * (1 << ir_s_calc));
|
||||
ir_calc = DEFAULT_DIVISOR_IR_B /
|
||||
(tick * (1 << ir_s_calc));
|
||||
}
|
||||
|
||||
ir_para->ir_b = (ir * tick * (1 << ir_s_calc) +
|
||||
@ -92,12 +94,12 @@ static int hclge_shaper_para_calc(u32 ir, u8 shaper_level,
|
||||
|
||||
while (ir_calc < ir) {
|
||||
ir_u_calc++;
|
||||
numerator = DIVISOR_IR_B_126 * (1 << ir_u_calc);
|
||||
numerator = DEFAULT_DIVISOR_IR_B * (1 << ir_u_calc);
|
||||
ir_calc = (numerator + (tick >> 1)) / tick;
|
||||
}
|
||||
|
||||
if (ir_calc == ir) {
|
||||
ir_para->ir_b = 126;
|
||||
ir_para->ir_b = DEFAULT_SHAPER_IR_B;
|
||||
} else {
|
||||
u32 denominator = DIVISOR_CLK * (1 << --ir_u_calc);
|
||||
ir_para->ir_b = (ir * tick + (denominator >> 1)) /
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
/* SP or DWRR */
|
||||
#define HCLGE_TM_TX_SCHD_DWRR_MSK BIT(0)
|
||||
#define HCLGE_TM_TX_SCHD_SP_MSK (0xFE)
|
||||
#define HCLGE_TM_TX_SCHD_SP_MSK 0xFE
|
||||
|
||||
#define HCLGE_ETHER_MAX_RATE 100000
|
||||
|
||||
@ -214,8 +214,8 @@ struct hclge_pri_shaper_para {
|
||||
(HCLGE_TM_SHAP_##string##_MSK), \
|
||||
(HCLGE_TM_SHAP_##string##_LSH), val)
|
||||
#define hclge_tm_get_field(src, string) \
|
||||
hnae3_get_field((src), (HCLGE_TM_SHAP_##string##_MSK), \
|
||||
(HCLGE_TM_SHAP_##string##_LSH))
|
||||
hnae3_get_field((src), HCLGE_TM_SHAP_##string##_MSK, \
|
||||
HCLGE_TM_SHAP_##string##_LSH)
|
||||
|
||||
int hclge_tm_schd_init(struct hclge_dev *hdev);
|
||||
int hclge_tm_vport_map_update(struct hclge_dev *hdev);
|
||||
|
@ -216,8 +216,8 @@ struct hclgevf_rss_input_tuple_cmd {
|
||||
#define HCLGEVF_RSS_CFG_TBL_SIZE 16
|
||||
|
||||
struct hclgevf_rss_indirection_table_cmd {
|
||||
u16 start_table_index;
|
||||
u16 rss_set_bitmap;
|
||||
__le16 start_table_index;
|
||||
__le16 rss_set_bitmap;
|
||||
u8 rsv[4];
|
||||
u8 rss_result[HCLGEVF_RSS_CFG_TBL_SIZE];
|
||||
};
|
||||
@ -229,7 +229,7 @@ struct hclgevf_rss_indirection_table_cmd {
|
||||
#define HCLGEVF_RSS_TC_VALID_B 15
|
||||
#define HCLGEVF_MAX_TC_NUM 8
|
||||
struct hclgevf_rss_tc_mode_cmd {
|
||||
u16 rss_tc_mode[HCLGEVF_MAX_TC_NUM];
|
||||
__le16 rss_tc_mode[HCLGEVF_MAX_TC_NUM];
|
||||
u8 rsv[8];
|
||||
};
|
||||
|
||||
@ -278,7 +278,6 @@ struct hclgevf_cfg_tx_queue_pointer_cmd {
|
||||
|
||||
#define HCLGEVF_NIC_CMQ_DESC_NUM 1024
|
||||
#define HCLGEVF_NIC_CMQ_DESC_NUM_S 3
|
||||
#define HCLGEVF_NIC_CMDQ_INT_SRC_REG 0x27100
|
||||
|
||||
#define HCLGEVF_QUERY_DEV_SPECS_BD_NUM 4
|
||||
|
||||
@ -315,9 +314,9 @@ static inline u32 hclgevf_read_reg(u8 __iomem *base, u32 reg)
|
||||
}
|
||||
|
||||
#define hclgevf_write_dev(a, reg, value) \
|
||||
hclgevf_write_reg((a)->io_base, (reg), (value))
|
||||
hclgevf_write_reg((a)->io_base, reg, value)
|
||||
#define hclgevf_read_dev(a, reg) \
|
||||
hclgevf_read_reg((a)->io_base, (reg))
|
||||
hclgevf_read_reg((a)->io_base, reg)
|
||||
|
||||
#define HCLGEVF_SEND_SYNC(flag) \
|
||||
((flag) & HCLGEVF_CMD_FLAG_NO_INTR)
|
||||
|
@ -180,7 +180,7 @@ static u8 *hclgevf_tqps_get_strings(struct hnae3_handle *handle, u8 *data)
|
||||
for (i = 0; i < kinfo->num_tqps; i++) {
|
||||
struct hclgevf_tqp *tqp = container_of(kinfo->tqp[i],
|
||||
struct hclgevf_tqp, q);
|
||||
snprintf(buff, ETH_GSTRING_LEN, "txq%d_pktnum_rcd",
|
||||
snprintf(buff, ETH_GSTRING_LEN, "txq%u_pktnum_rcd",
|
||||
tqp->index);
|
||||
buff += ETH_GSTRING_LEN;
|
||||
}
|
||||
@ -188,7 +188,7 @@ static u8 *hclgevf_tqps_get_strings(struct hnae3_handle *handle, u8 *data)
|
||||
for (i = 0; i < kinfo->num_tqps; i++) {
|
||||
struct hclgevf_tqp *tqp = container_of(kinfo->tqp[i],
|
||||
struct hclgevf_tqp, q);
|
||||
snprintf(buff, ETH_GSTRING_LEN, "rxq%d_pktnum_rcd",
|
||||
snprintf(buff, ETH_GSTRING_LEN, "rxq%u_pktnum_rcd",
|
||||
tqp->index);
|
||||
buff += ETH_GSTRING_LEN;
|
||||
}
|
||||
@ -658,8 +658,9 @@ static int hclgevf_set_rss_indir_table(struct hclgevf_dev *hdev)
|
||||
for (i = 0; i < rss_cfg_tbl_num; i++) {
|
||||
hclgevf_cmd_setup_basic_desc(&desc, HCLGEVF_OPC_RSS_INDIR_TABLE,
|
||||
false);
|
||||
req->start_table_index = i * HCLGEVF_RSS_CFG_TBL_SIZE;
|
||||
req->rss_set_bitmap = HCLGEVF_RSS_SET_BITMAP_MSK;
|
||||
req->start_table_index =
|
||||
cpu_to_le16(i * HCLGEVF_RSS_CFG_TBL_SIZE);
|
||||
req->rss_set_bitmap = cpu_to_le16(HCLGEVF_RSS_SET_BITMAP_MSK);
|
||||
for (j = 0; j < HCLGEVF_RSS_CFG_TBL_SIZE; j++)
|
||||
req->rss_result[j] =
|
||||
indir[i * HCLGEVF_RSS_CFG_TBL_SIZE + j];
|
||||
@ -700,12 +701,16 @@ static int hclgevf_set_rss_tc_mode(struct hclgevf_dev *hdev, u16 rss_size)
|
||||
|
||||
hclgevf_cmd_setup_basic_desc(&desc, HCLGEVF_OPC_RSS_TC_MODE, false);
|
||||
for (i = 0; i < HCLGEVF_MAX_TC_NUM; i++) {
|
||||
hnae3_set_bit(req->rss_tc_mode[i], HCLGEVF_RSS_TC_VALID_B,
|
||||
u16 mode = 0;
|
||||
|
||||
hnae3_set_bit(mode, HCLGEVF_RSS_TC_VALID_B,
|
||||
(tc_valid[i] & 0x1));
|
||||
hnae3_set_field(req->rss_tc_mode[i], HCLGEVF_RSS_TC_SIZE_M,
|
||||
hnae3_set_field(mode, HCLGEVF_RSS_TC_SIZE_M,
|
||||
HCLGEVF_RSS_TC_SIZE_S, tc_size[i]);
|
||||
hnae3_set_field(req->rss_tc_mode[i], HCLGEVF_RSS_TC_OFFSET_M,
|
||||
hnae3_set_field(mode, HCLGEVF_RSS_TC_OFFSET_M,
|
||||
HCLGEVF_RSS_TC_OFFSET_S, tc_offset[i]);
|
||||
|
||||
req->rss_tc_mode[i] = cpu_to_le16(mode);
|
||||
}
|
||||
status = hclgevf_cmd_send(&hdev->hw, &desc, 1);
|
||||
if (status)
|
||||
|
Loading…
Reference in New Issue
Block a user