Commit 89a44093 authored by Yisen.Zhuang\(Zhuangyuzeng\)'s avatar Yisen.Zhuang\(Zhuangyuzeng\) Committed by David S. Miller

net: hns: add a new dsaf mode for debug port

This patch adds a new dsaf mode named "single-port" mode for debug port.
This mode only contains one debug port. This patch also changes the
method of distinguishing the port type.
Signed-off-by: default avatarDaode Huang <huangdaode@hisilicon.com>
Signed-off-by: default avatarYisen Zhuang <yisen.zhuang@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5a5f0792
...@@ -96,7 +96,7 @@ static struct ring_pair_cb *hns_ae_get_base_ring_pair( ...@@ -96,7 +96,7 @@ static struct ring_pair_cb *hns_ae_get_base_ring_pair(
int q_num = rcb_comm->max_q_per_vf; int q_num = rcb_comm->max_q_per_vf;
int vf_num = rcb_comm->max_vfn; int vf_num = rcb_comm->max_vfn;
if (common_idx == HNS_DSAF_COMM_SERVICE_NW_IDX) if (!HNS_DSAF_IS_DEBUG(dsaf_dev))
return &rcb_comm->ring_pair_cb[port * q_num * vf_num]; return &rcb_comm->ring_pair_cb[port * q_num * vf_num];
else else
return &rcb_comm->ring_pair_cb[0]; return &rcb_comm->ring_pair_cb[0];
......
...@@ -249,7 +249,7 @@ int hns_mac_change_vf_addr(struct hns_mac_cb *mac_cb, ...@@ -249,7 +249,7 @@ int hns_mac_change_vf_addr(struct hns_mac_cb *mac_cb,
struct mac_entry_idx *old_entry; struct mac_entry_idx *old_entry;
old_entry = &mac_cb->addr_entry_idx[vmid]; old_entry = &mac_cb->addr_entry_idx[vmid];
if (dsaf_dev) { if (!HNS_DSAF_IS_DEBUG(dsaf_dev)) {
memcpy(mac_entry.addr, addr, sizeof(mac_entry.addr)); memcpy(mac_entry.addr, addr, sizeof(mac_entry.addr));
mac_entry.in_vlan_id = old_entry->vlan_id; mac_entry.in_vlan_id = old_entry->vlan_id;
mac_entry.in_port_num = mac_cb->mac_id; mac_entry.in_port_num = mac_cb->mac_id;
...@@ -289,7 +289,7 @@ int hns_mac_set_multi(struct hns_mac_cb *mac_cb, ...@@ -289,7 +289,7 @@ int hns_mac_set_multi(struct hns_mac_cb *mac_cb,
struct dsaf_device *dsaf_dev = mac_cb->dsaf_dev; struct dsaf_device *dsaf_dev = mac_cb->dsaf_dev;
struct dsaf_drv_mac_single_dest_entry mac_entry; struct dsaf_drv_mac_single_dest_entry mac_entry;
if (dsaf_dev && addr) { if (!HNS_DSAF_IS_DEBUG(dsaf_dev) && addr) {
memcpy(mac_entry.addr, addr, sizeof(mac_entry.addr)); memcpy(mac_entry.addr, addr, sizeof(mac_entry.addr));
mac_entry.in_vlan_id = 0;/*vlan_id;*/ mac_entry.in_vlan_id = 0;/*vlan_id;*/
mac_entry.in_port_num = mac_cb->mac_id; mac_entry.in_port_num = mac_cb->mac_id;
...@@ -380,7 +380,7 @@ static int hns_mac_port_config_bc_en(struct hns_mac_cb *mac_cb, ...@@ -380,7 +380,7 @@ static int hns_mac_port_config_bc_en(struct hns_mac_cb *mac_cb,
if (mac_cb->mac_type == HNAE_PORT_DEBUG) if (mac_cb->mac_type == HNAE_PORT_DEBUG)
return 0; return 0;
if (dsaf_dev) { if (!HNS_DSAF_IS_DEBUG(dsaf_dev)) {
memcpy(mac_entry.addr, addr, sizeof(mac_entry.addr)); memcpy(mac_entry.addr, addr, sizeof(mac_entry.addr));
mac_entry.in_vlan_id = vlan_id; mac_entry.in_vlan_id = vlan_id;
mac_entry.in_port_num = mac_cb->mac_id; mac_entry.in_port_num = mac_cb->mac_id;
...@@ -418,7 +418,7 @@ int hns_mac_vm_config_bc_en(struct hns_mac_cb *mac_cb, u32 vmid, bool enable) ...@@ -418,7 +418,7 @@ int hns_mac_vm_config_bc_en(struct hns_mac_cb *mac_cb, u32 vmid, bool enable)
uc_mac_entry = &mac_cb->addr_entry_idx[vmid]; uc_mac_entry = &mac_cb->addr_entry_idx[vmid];
if (dsaf_dev) { if (!HNS_DSAF_IS_DEBUG(dsaf_dev)) {
memcpy(mac_entry.addr, addr, sizeof(mac_entry.addr)); memcpy(mac_entry.addr, addr, sizeof(mac_entry.addr));
mac_entry.in_vlan_id = uc_mac_entry->vlan_id; mac_entry.in_vlan_id = uc_mac_entry->vlan_id;
mac_entry.in_port_num = mac_cb->mac_id; mac_entry.in_port_num = mac_cb->mac_id;
......
...@@ -28,6 +28,7 @@ const char *g_dsaf_mode_match[DSAF_MODE_MAX] = { ...@@ -28,6 +28,7 @@ const char *g_dsaf_mode_match[DSAF_MODE_MAX] = {
[DSAF_MODE_DISABLE_2PORT_64VM] = "2port-64vf", [DSAF_MODE_DISABLE_2PORT_64VM] = "2port-64vf",
[DSAF_MODE_DISABLE_6PORT_0VM] = "6port-16rss", [DSAF_MODE_DISABLE_6PORT_0VM] = "6port-16rss",
[DSAF_MODE_DISABLE_6PORT_16VM] = "6port-16vf", [DSAF_MODE_DISABLE_6PORT_16VM] = "6port-16vf",
[DSAF_MODE_DISABLE_SP] = "single-port",
}; };
int hns_dsaf_get_cfg(struct dsaf_device *dsaf_dev) int hns_dsaf_get_cfg(struct dsaf_device *dsaf_dev)
...@@ -217,9 +218,7 @@ static void hns_dsaf_mix_def_qid_cfg(struct dsaf_device *dsaf_dev) ...@@ -217,9 +218,7 @@ static void hns_dsaf_mix_def_qid_cfg(struct dsaf_device *dsaf_dev)
u32 q_id, q_num_per_port; u32 q_id, q_num_per_port;
u32 i; u32 i;
hns_rcb_get_queue_mode(dsaf_dev->dsaf_mode, hns_rcb_get_queue_mode(dsaf_dev->dsaf_mode, &max_vfn, &max_q_per_vf);
HNS_DSAF_COMM_SERVICE_NW_IDX,
&max_vfn, &max_q_per_vf);
q_num_per_port = max_vfn * max_q_per_vf; q_num_per_port = max_vfn * max_q_per_vf;
for (i = 0, q_id = 0; i < DSAF_SERVICE_NW_NUM; i++) { for (i = 0, q_id = 0; i < DSAF_SERVICE_NW_NUM; i++) {
...@@ -239,9 +238,7 @@ static void hns_dsaf_inner_qid_cfg(struct dsaf_device *dsaf_dev) ...@@ -239,9 +238,7 @@ static void hns_dsaf_inner_qid_cfg(struct dsaf_device *dsaf_dev)
if (AE_IS_VER1(dsaf_dev->dsaf_ver)) if (AE_IS_VER1(dsaf_dev->dsaf_ver))
return; return;
hns_rcb_get_queue_mode(dsaf_dev->dsaf_mode, hns_rcb_get_queue_mode(dsaf_dev->dsaf_mode, &max_vfn, &max_q_per_vf);
HNS_DSAF_COMM_SERVICE_NW_IDX,
&max_vfn, &max_q_per_vf);
q_num_per_port = max_vfn * max_q_per_vf; q_num_per_port = max_vfn * max_q_per_vf;
for (mac_id = 0, q_id = 0; mac_id < DSAF_SERVICE_NW_NUM; mac_id++) { for (mac_id = 0, q_id = 0; mac_id < DSAF_SERVICE_NW_NUM; mac_id++) {
...@@ -712,7 +709,9 @@ static void hns_dsaf_tbl_tcam_data_ucast_pul( ...@@ -712,7 +709,9 @@ static void hns_dsaf_tbl_tcam_data_ucast_pul(
void hns_dsaf_set_promisc_mode(struct dsaf_device *dsaf_dev, u32 en) void hns_dsaf_set_promisc_mode(struct dsaf_device *dsaf_dev, u32 en)
{ {
dsaf_set_dev_bit(dsaf_dev, DSAF_CFG_0_REG, DSAF_CFG_MIX_MODE_S, !!en); if (!HNS_DSAF_IS_DEBUG(dsaf_dev))
dsaf_set_dev_bit(dsaf_dev, DSAF_CFG_0_REG,
DSAF_CFG_MIX_MODE_S, !!en);
} }
void hns_dsaf_set_inner_lb(struct dsaf_device *dsaf_dev, u32 mac_id, u32 en) void hns_dsaf_set_inner_lb(struct dsaf_device *dsaf_dev, u32 mac_id, u32 en)
...@@ -1307,6 +1306,9 @@ static int hns_dsaf_init(struct dsaf_device *dsaf_dev) ...@@ -1307,6 +1306,9 @@ static int hns_dsaf_init(struct dsaf_device *dsaf_dev)
u32 i; u32 i;
int ret; int ret;
if (HNS_DSAF_IS_DEBUG(dsaf_dev))
return 0;
ret = hns_dsaf_init_hw(dsaf_dev); ret = hns_dsaf_init_hw(dsaf_dev);
if (ret) if (ret)
return ret; return ret;
......
...@@ -41,6 +41,7 @@ struct hns_mac_cb; ...@@ -41,6 +41,7 @@ struct hns_mac_cb;
#define DSAF_STATIC_NUM 28 #define DSAF_STATIC_NUM 28
#define DSAF_STATS_READ(p, offset) (*((u64 *)((u8 *)(p) + (offset)))) #define DSAF_STATS_READ(p, offset) (*((u64 *)((u8 *)(p) + (offset))))
#define HNS_DSAF_IS_DEBUG(dev) (dev->dsaf_mode == DSAF_MODE_DISABLE_SP)
enum hal_dsaf_mode { enum hal_dsaf_mode {
HRD_DSAF_NO_DSAF_MODE = 0x0, HRD_DSAF_NO_DSAF_MODE = 0x0,
...@@ -117,6 +118,7 @@ enum dsaf_mode { ...@@ -117,6 +118,7 @@ enum dsaf_mode {
DSAF_MODE_ENABLE_32VM, /**< en DSAF-mode, support 32 VM */ DSAF_MODE_ENABLE_32VM, /**< en DSAF-mode, support 32 VM */
DSAF_MODE_ENABLE_128VM, /**< en DSAF-mode, support 128 VM */ DSAF_MODE_ENABLE_128VM, /**< en DSAF-mode, support 128 VM */
DSAF_MODE_ENABLE, /**< before is enable DSAF mode*/ DSAF_MODE_ENABLE, /**< before is enable DSAF mode*/
DSAF_MODE_DISABLE_SP, /* <non-dsaf, single port mode */
DSAF_MODE_DISABLE_FIX, /**< non-dasf, fixed to queue*/ DSAF_MODE_DISABLE_FIX, /**< non-dasf, fixed to queue*/
DSAF_MODE_DISABLE_2PORT_8VM, /**< non-dasf, 2port 8VM */ DSAF_MODE_DISABLE_2PORT_8VM, /**< non-dasf, 2port 8VM */
DSAF_MODE_DISABLE_2PORT_16VM, /**< non-dasf, 2port 16VM */ DSAF_MODE_DISABLE_2PORT_16VM, /**< non-dasf, 2port 16VM */
......
...@@ -147,7 +147,7 @@ void hns_dsaf_ge_srst_by_port(struct dsaf_device *dsaf_dev, u32 port, u32 val) ...@@ -147,7 +147,7 @@ void hns_dsaf_ge_srst_by_port(struct dsaf_device *dsaf_dev, u32 port, u32 val)
if (port >= DSAF_GE_NUM) if (port >= DSAF_GE_NUM)
return; return;
if (port < DSAF_SERVICE_NW_NUM) { if (!HNS_DSAF_IS_DEBUG(dsaf_dev)) {
reg_val_1 = 0x1 << port; reg_val_1 = 0x1 << port;
/* there is difference between V1 and V2 in register.*/ /* there is difference between V1 and V2 in register.*/
if (AE_IS_VER1(dsaf_dev->dsaf_ver)) if (AE_IS_VER1(dsaf_dev->dsaf_ver))
...@@ -218,7 +218,7 @@ void hns_ppe_com_srst(struct ppe_common_cb *ppe_common, u32 val) ...@@ -218,7 +218,7 @@ void hns_ppe_com_srst(struct ppe_common_cb *ppe_common, u32 val)
u32 reg_val; u32 reg_val;
u32 reg_addr; u32 reg_addr;
if (comm_index == HNS_DSAF_COMM_SERVICE_NW_IDX) { if (!HNS_DSAF_IS_DEBUG(dsaf_dev)) {
reg_val = RESET_REQ_OR_DREQ; reg_val = RESET_REQ_OR_DREQ;
if (val == 0) if (val == 0)
reg_addr = DSAF_SUB_SC_RCB_PPE_COM_RESET_REQ_REG; reg_addr = DSAF_SUB_SC_RCB_PPE_COM_RESET_REQ_REG;
......
...@@ -68,7 +68,7 @@ static void __iomem *hns_ppe_common_get_ioaddr( ...@@ -68,7 +68,7 @@ static void __iomem *hns_ppe_common_get_ioaddr(
int idx = ppe_common->comm_index; int idx = ppe_common->comm_index;
if (idx == HNS_DSAF_COMM_SERVICE_NW_IDX) if (!HNS_DSAF_IS_DEBUG(ppe_common->dsaf_dev))
base_addr = ppe_common->dsaf_dev->ppe_base base_addr = ppe_common->dsaf_dev->ppe_base
+ PPE_COMMON_REG_OFFSET; + PPE_COMMON_REG_OFFSET;
else else
...@@ -90,7 +90,7 @@ int hns_ppe_common_get_cfg(struct dsaf_device *dsaf_dev, int comm_index) ...@@ -90,7 +90,7 @@ int hns_ppe_common_get_cfg(struct dsaf_device *dsaf_dev, int comm_index)
struct ppe_common_cb *ppe_common; struct ppe_common_cb *ppe_common;
int ppe_num; int ppe_num;
if (comm_index == HNS_DSAF_COMM_SERVICE_NW_IDX) if (!HNS_DSAF_IS_DEBUG(dsaf_dev))
ppe_num = HNS_PPE_SERVICE_NW_ENGINE_NUM; ppe_num = HNS_PPE_SERVICE_NW_ENGINE_NUM;
else else
ppe_num = HNS_PPE_DEBUG_NW_ENGINE_NUM; ppe_num = HNS_PPE_DEBUG_NW_ENGINE_NUM;
...@@ -103,7 +103,7 @@ int hns_ppe_common_get_cfg(struct dsaf_device *dsaf_dev, int comm_index) ...@@ -103,7 +103,7 @@ int hns_ppe_common_get_cfg(struct dsaf_device *dsaf_dev, int comm_index)
ppe_common->ppe_num = ppe_num; ppe_common->ppe_num = ppe_num;
ppe_common->dsaf_dev = dsaf_dev; ppe_common->dsaf_dev = dsaf_dev;
ppe_common->comm_index = comm_index; ppe_common->comm_index = comm_index;
if (comm_index == HNS_DSAF_COMM_SERVICE_NW_IDX) if (!HNS_DSAF_IS_DEBUG(dsaf_dev))
ppe_common->ppe_mode = PPE_COMMON_MODE_SERVICE; ppe_common->ppe_mode = PPE_COMMON_MODE_SERVICE;
else else
ppe_common->ppe_mode = PPE_COMMON_MODE_DEBUG; ppe_common->ppe_mode = PPE_COMMON_MODE_DEBUG;
......
...@@ -270,7 +270,7 @@ static void hns_rcb_set_port_timeout( ...@@ -270,7 +270,7 @@ static void hns_rcb_set_port_timeout(
static int hns_rcb_common_get_port_num(struct rcb_common_cb *rcb_common) static int hns_rcb_common_get_port_num(struct rcb_common_cb *rcb_common)
{ {
if (rcb_common->comm_index == HNS_DSAF_COMM_SERVICE_NW_IDX) if (!HNS_DSAF_IS_DEBUG(rcb_common->dsaf_dev))
return HNS_RCB_SERVICE_NW_ENGINE_NUM; return HNS_RCB_SERVICE_NW_ENGINE_NUM;
else else
return HNS_RCB_DEBUG_NW_ENGINE_NUM; return HNS_RCB_DEBUG_NW_ENGINE_NUM;
...@@ -430,11 +430,10 @@ static void hns_rcb_ring_pair_get_cfg(struct ring_pair_cb *ring_pair_cb) ...@@ -430,11 +430,10 @@ static void hns_rcb_ring_pair_get_cfg(struct ring_pair_cb *ring_pair_cb)
static int hns_rcb_get_port_in_comm( static int hns_rcb_get_port_in_comm(
struct rcb_common_cb *rcb_common, int ring_idx) struct rcb_common_cb *rcb_common, int ring_idx)
{ {
int comm_index = rcb_common->comm_index;
int port; int port;
int q_num; int q_num;
if (comm_index == HNS_DSAF_COMM_SERVICE_NW_IDX) { if (!HNS_DSAF_IS_DEBUG(rcb_common->dsaf_dev)) {
q_num = (int)rcb_common->max_q_per_vf * rcb_common->max_vfn; q_num = (int)rcb_common->max_q_per_vf * rcb_common->max_vfn;
port = ring_idx / q_num; port = ring_idx / q_num;
} else { } else {
...@@ -455,7 +454,7 @@ static int hns_rcb_get_base_irq_idx(struct rcb_common_cb *rcb_common) ...@@ -455,7 +454,7 @@ static int hns_rcb_get_base_irq_idx(struct rcb_common_cb *rcb_common)
int comm_index = rcb_common->comm_index; int comm_index = rcb_common->comm_index;
bool is_ver1 = AE_IS_VER1(rcb_common->dsaf_dev->dsaf_ver); bool is_ver1 = AE_IS_VER1(rcb_common->dsaf_dev->dsaf_ver);
if (comm_index == HNS_DSAF_COMM_SERVICE_NW_IDX) if (!HNS_DSAF_IS_DEBUG(rcb_common->dsaf_dev))
return SERVICE_RING_IRQ_IDX(is_ver1); return SERVICE_RING_IRQ_IDX(is_ver1);
else else
return DEBUG_RING_IRQ_IDX(is_ver1) + return DEBUG_RING_IRQ_IDX(is_ver1) +
...@@ -549,7 +548,7 @@ int hns_rcb_set_coalesce_usecs( ...@@ -549,7 +548,7 @@ int hns_rcb_set_coalesce_usecs(
return 0; return 0;
if (AE_IS_VER1(rcb_common->dsaf_dev->dsaf_ver)) { if (AE_IS_VER1(rcb_common->dsaf_dev->dsaf_ver)) {
if (rcb_common->comm_index == HNS_DSAF_COMM_SERVICE_NW_IDX) { if (!HNS_DSAF_IS_DEBUG(rcb_common->dsaf_dev)) {
dev_err(rcb_common->dsaf_dev->dev, dev_err(rcb_common->dsaf_dev->dev,
"error: not support coalesce_usecs setting!\n"); "error: not support coalesce_usecs setting!\n");
return -EINVAL; return -EINVAL;
...@@ -601,74 +600,67 @@ int hns_rcb_set_coalesced_frames( ...@@ -601,74 +600,67 @@ int hns_rcb_set_coalesced_frames(
*@max_vfn : max vfn number *@max_vfn : max vfn number
*@max_q_per_vf:max ring number per vm *@max_q_per_vf:max ring number per vm
*/ */
void hns_rcb_get_queue_mode(enum dsaf_mode dsaf_mode, int comm_index, void hns_rcb_get_queue_mode(enum dsaf_mode dsaf_mode, u16 *max_vfn,
u16 *max_vfn, u16 *max_q_per_vf) u16 *max_q_per_vf)
{ {
if (comm_index == HNS_DSAF_COMM_SERVICE_NW_IDX) { switch (dsaf_mode) {
switch (dsaf_mode) { case DSAF_MODE_DISABLE_6PORT_0VM:
case DSAF_MODE_DISABLE_6PORT_0VM: *max_vfn = 1;
*max_vfn = 1; *max_q_per_vf = 16;
*max_q_per_vf = 16; break;
break; case DSAF_MODE_DISABLE_FIX:
case DSAF_MODE_DISABLE_FIX: case DSAF_MODE_DISABLE_SP:
*max_vfn = 1;
*max_q_per_vf = 1;
break;
case DSAF_MODE_DISABLE_2PORT_64VM:
*max_vfn = 64;
*max_q_per_vf = 1;
break;
case DSAF_MODE_DISABLE_6PORT_16VM:
*max_vfn = 16;
*max_q_per_vf = 1;
break;
default:
*max_vfn = 1;
*max_q_per_vf = 16;
break;
}
} else {
*max_vfn = 1; *max_vfn = 1;
*max_q_per_vf = 1; *max_q_per_vf = 1;
break;
case DSAF_MODE_DISABLE_2PORT_64VM:
*max_vfn = 64;
*max_q_per_vf = 1;
break;
case DSAF_MODE_DISABLE_6PORT_16VM:
*max_vfn = 16;
*max_q_per_vf = 1;
break;
default:
*max_vfn = 1;
*max_q_per_vf = 16;
break;
} }
} }
int hns_rcb_get_ring_num(struct dsaf_device *dsaf_dev, int comm_index) int hns_rcb_get_ring_num(struct dsaf_device *dsaf_dev)
{ {
if (comm_index == HNS_DSAF_COMM_SERVICE_NW_IDX) { switch (dsaf_dev->dsaf_mode) {
switch (dsaf_dev->dsaf_mode) { case DSAF_MODE_ENABLE_FIX:
case DSAF_MODE_ENABLE_FIX: case DSAF_MODE_DISABLE_SP:
return 1;
case DSAF_MODE_DISABLE_FIX:
return 6;
case DSAF_MODE_ENABLE_0VM:
return 32;
case DSAF_MODE_DISABLE_6PORT_0VM:
case DSAF_MODE_ENABLE_16VM:
case DSAF_MODE_DISABLE_6PORT_2VM:
case DSAF_MODE_DISABLE_6PORT_16VM:
case DSAF_MODE_DISABLE_6PORT_4VM:
case DSAF_MODE_ENABLE_8VM:
return 96;
case DSAF_MODE_DISABLE_2PORT_16VM:
case DSAF_MODE_DISABLE_2PORT_8VM:
case DSAF_MODE_ENABLE_32VM:
case DSAF_MODE_DISABLE_2PORT_64VM:
case DSAF_MODE_ENABLE_128VM:
return 128;
default:
dev_warn(dsaf_dev->dev,
"get ring num fail,use default!dsaf_mode=%d\n",
dsaf_dev->dsaf_mode);
return 128;
}
} else {
return 1; return 1;
case DSAF_MODE_DISABLE_FIX:
return 6;
case DSAF_MODE_ENABLE_0VM:
return 32;
case DSAF_MODE_DISABLE_6PORT_0VM:
case DSAF_MODE_ENABLE_16VM:
case DSAF_MODE_DISABLE_6PORT_2VM:
case DSAF_MODE_DISABLE_6PORT_16VM:
case DSAF_MODE_DISABLE_6PORT_4VM:
case DSAF_MODE_ENABLE_8VM:
return 96;
case DSAF_MODE_DISABLE_2PORT_16VM:
case DSAF_MODE_DISABLE_2PORT_8VM:
case DSAF_MODE_ENABLE_32VM:
case DSAF_MODE_DISABLE_2PORT_64VM:
case DSAF_MODE_ENABLE_128VM:
return 128;
default:
dev_warn(dsaf_dev->dev,
"get ring num fail,use default!dsaf_mode=%d\n",
dsaf_dev->dsaf_mode);
return 128;
} }
} }
...@@ -677,7 +669,7 @@ void __iomem *hns_rcb_common_get_vaddr(struct dsaf_device *dsaf_dev, ...@@ -677,7 +669,7 @@ void __iomem *hns_rcb_common_get_vaddr(struct dsaf_device *dsaf_dev,
{ {
void __iomem *base_addr; void __iomem *base_addr;
if (comm_index == HNS_DSAF_COMM_SERVICE_NW_IDX) if (!HNS_DSAF_IS_DEBUG(dsaf_dev))
base_addr = dsaf_dev->ppe_base + RCB_COMMON_REG_OFFSET; base_addr = dsaf_dev->ppe_base + RCB_COMMON_REG_OFFSET;
else else
base_addr = dsaf_dev->sds_base base_addr = dsaf_dev->sds_base
...@@ -697,7 +689,7 @@ static phys_addr_t hns_rcb_common_get_paddr(struct dsaf_device *dsaf_dev, ...@@ -697,7 +689,7 @@ static phys_addr_t hns_rcb_common_get_paddr(struct dsaf_device *dsaf_dev,
u64 size = 0; u64 size = 0;
int index = 0; int index = 0;
if (comm_index == HNS_DSAF_COMM_SERVICE_NW_IDX) { if (!HNS_DSAF_IS_DEBUG(dsaf_dev)) {
index = 2; index = 2;
addr_offset = RCB_COMMON_REG_OFFSET; addr_offset = RCB_COMMON_REG_OFFSET;
} else { } else {
...@@ -717,7 +709,7 @@ int hns_rcb_common_get_cfg(struct dsaf_device *dsaf_dev, ...@@ -717,7 +709,7 @@ int hns_rcb_common_get_cfg(struct dsaf_device *dsaf_dev,
enum dsaf_mode dsaf_mode = dsaf_dev->dsaf_mode; enum dsaf_mode dsaf_mode = dsaf_dev->dsaf_mode;
u16 max_vfn; u16 max_vfn;
u16 max_q_per_vf; u16 max_q_per_vf;
int ring_num = hns_rcb_get_ring_num(dsaf_dev, comm_index); int ring_num = hns_rcb_get_ring_num(dsaf_dev);
rcb_common = rcb_common =
devm_kzalloc(dsaf_dev->dev, sizeof(*rcb_common) + devm_kzalloc(dsaf_dev->dev, sizeof(*rcb_common) +
...@@ -732,7 +724,7 @@ int hns_rcb_common_get_cfg(struct dsaf_device *dsaf_dev, ...@@ -732,7 +724,7 @@ int hns_rcb_common_get_cfg(struct dsaf_device *dsaf_dev,
rcb_common->desc_num = dsaf_dev->desc_num; rcb_common->desc_num = dsaf_dev->desc_num;
hns_rcb_get_queue_mode(dsaf_mode, comm_index, &max_vfn, &max_q_per_vf); hns_rcb_get_queue_mode(dsaf_mode, &max_vfn, &max_q_per_vf);
rcb_common->max_vfn = max_vfn; rcb_common->max_vfn = max_vfn;
rcb_common->max_q_per_vf = max_q_per_vf; rcb_common->max_q_per_vf = max_q_per_vf;
...@@ -932,7 +924,7 @@ void hns_rcb_get_common_regs(struct rcb_common_cb *rcb_com, void *data) ...@@ -932,7 +924,7 @@ void hns_rcb_get_common_regs(struct rcb_common_cb *rcb_com, void *data)
{ {
u32 *regs = data; u32 *regs = data;
bool is_ver1 = AE_IS_VER1(rcb_com->dsaf_dev->dsaf_ver); bool is_ver1 = AE_IS_VER1(rcb_com->dsaf_dev->dsaf_ver);
bool is_dbg = (rcb_com->comm_index != HNS_DSAF_COMM_SERVICE_NW_IDX); bool is_dbg = HNS_DSAF_IS_DEBUG(rcb_com->dsaf_dev);
u32 reg_tmp; u32 reg_tmp;
u32 reg_num_tmp; u32 reg_num_tmp;
u32 i = 0; u32 i = 0;
......
...@@ -111,7 +111,7 @@ void hns_rcb_common_free_cfg(struct dsaf_device *dsaf_dev, u32 comm_index); ...@@ -111,7 +111,7 @@ void hns_rcb_common_free_cfg(struct dsaf_device *dsaf_dev, u32 comm_index);
int hns_rcb_common_init_hw(struct rcb_common_cb *rcb_common); int hns_rcb_common_init_hw(struct rcb_common_cb *rcb_common);
void hns_rcb_start(struct hnae_queue *q, u32 val); void hns_rcb_start(struct hnae_queue *q, u32 val);
void hns_rcb_get_cfg(struct rcb_common_cb *rcb_common); void hns_rcb_get_cfg(struct rcb_common_cb *rcb_common);
void hns_rcb_get_queue_mode(enum dsaf_mode dsaf_mode, int comm_index, void hns_rcb_get_queue_mode(enum dsaf_mode dsaf_mode,
u16 *max_vfn, u16 *max_q_per_vf); u16 *max_vfn, u16 *max_q_per_vf);
void hns_rcb_common_init_commit_hw(struct rcb_common_cb *rcb_common); void hns_rcb_common_init_commit_hw(struct rcb_common_cb *rcb_common);
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#define DSAF_COMM_DEV_NUM 3 #define DSAF_COMM_DEV_NUM 3
#define DSAF_PPE_INODE_BASE 6 #define DSAF_PPE_INODE_BASE 6
#define HNS_DSAF_COMM_SERVICE_NW_IDX 0
#define DSAF_DEBUG_NW_NUM 2 #define DSAF_DEBUG_NW_NUM 2
#define DSAF_SERVICE_NW_NUM 6 #define DSAF_SERVICE_NW_NUM 6
#define DSAF_COMM_CHN DSAF_SERVICE_NW_NUM #define DSAF_COMM_CHN DSAF_SERVICE_NW_NUM
......
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