Commit 13ac695e authored by Salil's avatar Salil Committed by David S. Miller

net:hns: Add support of Hip06 SoC to the Hislicon Network Subsystem

This patchset adds support of Hisilicon Hip06 SoC to the existing HNS
ethernet driver.

The changes in the driver are mainly due to changes in the DMA
descriptor provided by the Hip06 ethernet hardware. These changes
need to co-exist with already present Hip05 DMA descriptor and its
operating functions. The decision to choose the correct type of DMA
descriptor is taken dynamically depending upon the version of the
hardware (i.e. V1/hip05 or V2/hip06, see already existing
hisilicon-hns-nic.txt binding file for detailed description). other
changes includes in SBM, DSAF and PPE modules as well. Changes
affecting the driver related to the newly added ethernet hardware
features in Hip06 would be added as separate patch over this and
subsequent patches.
Signed-off-by: default avatarSalil Mehta <salil.mehta@huawei.com>
Signed-off-by: default avataryankejian <yankejian@huawei.com>
Signed-off-by: default avatarhuangdaode <huangdaode@hisilicon.com>
Signed-off-by: default avatarlipeng <lipeng321@huawei.com>
Signed-off-by: default avatarlisheng <lisheng011@huawei.com>
Signed-off-by: default avatarFengguang Wu <fengguang.wu@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ce3ea1c7
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include <linux/phy.h> #include <linux/phy.h>
#include <linux/types.h> #include <linux/types.h>
#define HNAE_DRIVER_VERSION "1.3.0" #define HNAE_DRIVER_VERSION "2.0"
#define HNAE_DRIVER_NAME "hns" #define HNAE_DRIVER_NAME "hns"
#define HNAE_COPYRIGHT "Copyright(c) 2015 Huawei Corporation." #define HNAE_COPYRIGHT "Copyright(c) 2015 Huawei Corporation."
#define HNAE_DRIVER_STRING "Hisilicon Network Subsystem Driver" #define HNAE_DRIVER_STRING "Hisilicon Network Subsystem Driver"
...@@ -63,6 +63,7 @@ do { \ ...@@ -63,6 +63,7 @@ do { \
#define AE_VERSION_1 ('6' << 16 | '6' << 8 | '0') #define AE_VERSION_1 ('6' << 16 | '6' << 8 | '0')
#define AE_VERSION_2 ('1' << 24 | '6' << 16 | '1' << 8 | '0') #define AE_VERSION_2 ('1' << 24 | '6' << 16 | '1' << 8 | '0')
#define AE_IS_VER1(ver) ((ver) == AE_VERSION_1)
#define AE_NAME_SIZE 16 #define AE_NAME_SIZE 16
/* some said the RX and TX RCB format should not be the same in the future. But /* some said the RX and TX RCB format should not be the same in the future. But
...@@ -144,23 +145,61 @@ enum hnae_led_state { ...@@ -144,23 +145,61 @@ enum hnae_led_state {
#define HNS_RXD_ASID_S 24 #define HNS_RXD_ASID_S 24
#define HNS_RXD_ASID_M (0xff << HNS_RXD_ASID_S) #define HNS_RXD_ASID_M (0xff << HNS_RXD_ASID_S)
#define HNSV2_TXD_BUFNUM_S 0
#define HNSV2_TXD_BUFNUM_M (0x7 << HNSV2_TXD_BUFNUM_S)
#define HNSV2_TXD_RI_B 1
#define HNSV2_TXD_L4CS_B 2
#define HNSV2_TXD_L3CS_B 3
#define HNSV2_TXD_FE_B 4
#define HNSV2_TXD_VLD_B 5
#define HNSV2_TXD_TSE_B 0
#define HNSV2_TXD_VLAN_EN_B 1
#define HNSV2_TXD_SNAP_B 2
#define HNSV2_TXD_IPV6_B 3
#define HNSV2_TXD_SCTP_B 4
/* hardware spec ring buffer format */ /* hardware spec ring buffer format */
struct __packed hnae_desc { struct __packed hnae_desc {
__le64 addr; __le64 addr;
union { union {
struct { struct {
__le16 asid_bufnum_pid; union {
__le16 asid_bufnum_pid;
__le16 asid;
};
__le16 send_size; __le16 send_size;
__le32 flag_ipoffset; union {
__le32 reserved_3[4]; __le32 flag_ipoffset;
struct {
__u8 bn_pid;
__u8 ra_ri_cs_fe_vld;
__u8 ip_offset;
__u8 tse_vlan_snap_v6_sctp_nth;
};
};
__le16 mss;
__u8 l4_len;
__u8 reserved1;
__le16 paylen;
__u8 vmid;
__u8 qid;
__le32 reserved2[2];
} tx; } tx;
struct { struct {
__le32 ipoff_bnum_pid_flag; __le32 ipoff_bnum_pid_flag;
__le16 pkt_len; __le16 pkt_len;
__le16 size; __le16 size;
__le32 vlan_pri_asid; union {
__le32 reserved_2[3]; __le32 vlan_pri_asid;
struct {
__le16 asid;
__le16 vlan_cfi_pri;
};
};
__le32 rss_hash;
__le32 reserved_1[2];
} rx; } rx;
}; };
}; };
......
...@@ -252,7 +252,7 @@ static int hns_ae_set_multicast_one(struct hnae_handle *handle, void *addr) ...@@ -252,7 +252,7 @@ static int hns_ae_set_multicast_one(struct hnae_handle *handle, void *addr)
if (mac_cb->mac_type != HNAE_PORT_SERVICE) if (mac_cb->mac_type != HNAE_PORT_SERVICE)
return 0; return 0;
ret = hns_mac_set_multi(mac_cb, mac_cb->mac_id, mac_addr, ENABLE); ret = hns_mac_set_multi(mac_cb, mac_cb->mac_id, mac_addr, true);
if (ret) { if (ret) {
dev_err(handle->owner_dev, dev_err(handle->owner_dev,
"mac add mul_mac:%pM port%d fail, ret = %#x!\n", "mac add mul_mac:%pM port%d fail, ret = %#x!\n",
...@@ -261,7 +261,7 @@ static int hns_ae_set_multicast_one(struct hnae_handle *handle, void *addr) ...@@ -261,7 +261,7 @@ static int hns_ae_set_multicast_one(struct hnae_handle *handle, void *addr)
} }
ret = hns_mac_set_multi(mac_cb, DSAF_BASE_INNER_PORT_NUM, ret = hns_mac_set_multi(mac_cb, DSAF_BASE_INNER_PORT_NUM,
mac_addr, ENABLE); mac_addr, true);
if (ret) if (ret)
dev_err(handle->owner_dev, dev_err(handle->owner_dev,
"mac add mul_mac:%pM port%d fail, ret = %#x!\n", "mac add mul_mac:%pM port%d fail, ret = %#x!\n",
...@@ -282,7 +282,7 @@ static int hns_ae_start(struct hnae_handle *handle) ...@@ -282,7 +282,7 @@ static int hns_ae_start(struct hnae_handle *handle)
int ret; int ret;
struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle); struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle);
ret = hns_mac_vm_config_bc_en(mac_cb, 0, ENABLE); ret = hns_mac_vm_config_bc_en(mac_cb, 0, true);
if (ret) if (ret)
return ret; return ret;
...@@ -309,7 +309,7 @@ void hns_ae_stop(struct hnae_handle *handle) ...@@ -309,7 +309,7 @@ void hns_ae_stop(struct hnae_handle *handle)
hns_ae_ring_enable_all(handle, 0); hns_ae_ring_enable_all(handle, 0);
(void)hns_mac_vm_config_bc_en(mac_cb, 0, DISABLE); (void)hns_mac_vm_config_bc_en(mac_cb, 0, false);
} }
static void hns_ae_reset(struct hnae_handle *handle) static void hns_ae_reset(struct hnae_handle *handle)
...@@ -338,8 +338,27 @@ void hns_ae_toggle_ring_irq(struct hnae_ring *ring, u32 mask) ...@@ -338,8 +338,27 @@ void hns_ae_toggle_ring_irq(struct hnae_ring *ring, u32 mask)
hns_rcb_int_ctrl_hw(ring->q, flag, mask); hns_rcb_int_ctrl_hw(ring->q, flag, mask);
} }
static void hns_aev2_toggle_ring_irq(struct hnae_ring *ring, u32 mask)
{
u32 flag;
if (is_tx_ring(ring))
flag = RCB_INT_FLAG_TX;
else
flag = RCB_INT_FLAG_RX;
hns_rcbv2_int_ctrl_hw(ring->q, flag, mask);
}
static void hns_ae_toggle_queue_status(struct hnae_queue *queue, u32 val) static void hns_ae_toggle_queue_status(struct hnae_queue *queue, u32 val)
{ {
struct dsaf_device *dsaf_dev = hns_ae_get_dsaf_dev(queue->dev);
if (AE_IS_VER1(dsaf_dev->dsaf_ver))
hns_rcb_int_clr_hw(queue, RCB_INT_FLAG_TX | RCB_INT_FLAG_RX);
else
hns_rcbv2_int_clr_hw(queue, RCB_INT_FLAG_TX | RCB_INT_FLAG_RX);
hns_rcb_start(queue, val); hns_rcb_start(queue, val);
} }
...@@ -771,6 +790,16 @@ int hns_dsaf_ae_init(struct dsaf_device *dsaf_dev) ...@@ -771,6 +790,16 @@ int hns_dsaf_ae_init(struct dsaf_device *dsaf_dev)
{ {
struct hnae_ae_dev *ae_dev = &dsaf_dev->ae_dev; struct hnae_ae_dev *ae_dev = &dsaf_dev->ae_dev;
switch (dsaf_dev->dsaf_ver) {
case AE_VERSION_1:
hns_dsaf_ops.toggle_ring_irq = hns_ae_toggle_ring_irq;
break;
case AE_VERSION_2:
hns_dsaf_ops.toggle_ring_irq = hns_aev2_toggle_ring_irq;
break;
default:
break;
}
ae_dev->ops = &hns_dsaf_ops; ae_dev->ops = &hns_dsaf_ops;
ae_dev->dev = dsaf_dev->dev; ae_dev->dev = dsaf_dev->dev;
......
...@@ -283,7 +283,7 @@ int hns_mac_change_vf_addr(struct hns_mac_cb *mac_cb, ...@@ -283,7 +283,7 @@ int hns_mac_change_vf_addr(struct hns_mac_cb *mac_cb,
} }
int hns_mac_set_multi(struct hns_mac_cb *mac_cb, int hns_mac_set_multi(struct hns_mac_cb *mac_cb,
u32 port_num, char *addr, u8 en) u32 port_num, char *addr, bool enable)
{ {
int ret; int ret;
struct dsaf_device *dsaf_dev = mac_cb->dsaf_dev; struct dsaf_device *dsaf_dev = mac_cb->dsaf_dev;
...@@ -295,7 +295,7 @@ int hns_mac_set_multi(struct hns_mac_cb *mac_cb, ...@@ -295,7 +295,7 @@ int hns_mac_set_multi(struct hns_mac_cb *mac_cb,
mac_entry.in_port_num = mac_cb->mac_id; mac_entry.in_port_num = mac_cb->mac_id;
mac_entry.port_num = port_num; mac_entry.port_num = port_num;
if (en == DISABLE) if (!enable)
ret = hns_dsaf_del_mac_mc_port(dsaf_dev, &mac_entry); ret = hns_dsaf_del_mac_mc_port(dsaf_dev, &mac_entry);
else else
ret = hns_dsaf_add_mac_mc_port(dsaf_dev, &mac_entry); ret = hns_dsaf_add_mac_mc_port(dsaf_dev, &mac_entry);
...@@ -368,7 +368,7 @@ static void hns_mac_param_get(struct mac_params *param, ...@@ -368,7 +368,7 @@ static void hns_mac_param_get(struct mac_params *param,
*retuen 0 - success , negative --fail *retuen 0 - success , negative --fail
*/ */
static int hns_mac_port_config_bc_en(struct hns_mac_cb *mac_cb, static int hns_mac_port_config_bc_en(struct hns_mac_cb *mac_cb,
u32 port_num, u16 vlan_id, u8 en) u32 port_num, u16 vlan_id, bool enable)
{ {
int ret; int ret;
struct dsaf_device *dsaf_dev = mac_cb->dsaf_dev; struct dsaf_device *dsaf_dev = mac_cb->dsaf_dev;
...@@ -386,7 +386,7 @@ static int hns_mac_port_config_bc_en(struct hns_mac_cb *mac_cb, ...@@ -386,7 +386,7 @@ static int hns_mac_port_config_bc_en(struct hns_mac_cb *mac_cb,
mac_entry.in_port_num = mac_cb->mac_id; mac_entry.in_port_num = mac_cb->mac_id;
mac_entry.port_num = port_num; mac_entry.port_num = port_num;
if (en == DISABLE) if (!enable)
ret = hns_dsaf_del_mac_mc_port(dsaf_dev, &mac_entry); ret = hns_dsaf_del_mac_mc_port(dsaf_dev, &mac_entry);
else else
ret = hns_dsaf_add_mac_mc_port(dsaf_dev, &mac_entry); ret = hns_dsaf_add_mac_mc_port(dsaf_dev, &mac_entry);
...@@ -403,7 +403,7 @@ static int hns_mac_port_config_bc_en(struct hns_mac_cb *mac_cb, ...@@ -403,7 +403,7 @@ static int hns_mac_port_config_bc_en(struct hns_mac_cb *mac_cb,
*@en:enable *@en:enable
*retuen 0 - success , negative --fail *retuen 0 - success , negative --fail
*/ */
int hns_mac_vm_config_bc_en(struct hns_mac_cb *mac_cb, u32 vmid, u8 en) int hns_mac_vm_config_bc_en(struct hns_mac_cb *mac_cb, u32 vmid, bool enable)
{ {
int ret; int ret;
struct dsaf_device *dsaf_dev = mac_cb->dsaf_dev; struct dsaf_device *dsaf_dev = mac_cb->dsaf_dev;
...@@ -427,7 +427,7 @@ int hns_mac_vm_config_bc_en(struct hns_mac_cb *mac_cb, u32 vmid, u8 en) ...@@ -427,7 +427,7 @@ int hns_mac_vm_config_bc_en(struct hns_mac_cb *mac_cb, u32 vmid, u8 en)
return ret; return ret;
mac_entry.port_num = port_num; mac_entry.port_num = port_num;
if (en == DISABLE) if (!enable)
ret = hns_dsaf_del_mac_mc_port(dsaf_dev, &mac_entry); ret = hns_dsaf_del_mac_mc_port(dsaf_dev, &mac_entry);
else else
ret = hns_dsaf_add_mac_mc_port(dsaf_dev, &mac_entry); ret = hns_dsaf_add_mac_mc_port(dsaf_dev, &mac_entry);
...@@ -648,7 +648,7 @@ static int hns_mac_init_ex(struct hns_mac_cb *mac_cb) ...@@ -648,7 +648,7 @@ static int hns_mac_init_ex(struct hns_mac_cb *mac_cb)
hns_mac_adjust_link(mac_cb, mac_cb->speed, !mac_cb->half_duplex); hns_mac_adjust_link(mac_cb, mac_cb->speed, !mac_cb->half_duplex);
ret = hns_mac_port_config_bc_en(mac_cb, mac_cb->mac_id, 0, ENABLE); ret = hns_mac_port_config_bc_en(mac_cb, mac_cb->mac_id, 0, true);
if (ret) if (ret)
goto free_mac_drv; goto free_mac_drv;
......
...@@ -425,8 +425,8 @@ void mac_adjust_link(struct net_device *net_dev); ...@@ -425,8 +425,8 @@ void mac_adjust_link(struct net_device *net_dev);
void hns_mac_get_link_status(struct hns_mac_cb *mac_cb, u32 *link_status); void hns_mac_get_link_status(struct hns_mac_cb *mac_cb, u32 *link_status);
int hns_mac_change_vf_addr(struct hns_mac_cb *mac_cb, u32 vmid, char *addr); int hns_mac_change_vf_addr(struct hns_mac_cb *mac_cb, u32 vmid, char *addr);
int hns_mac_set_multi(struct hns_mac_cb *mac_cb, int hns_mac_set_multi(struct hns_mac_cb *mac_cb,
u32 port_num, char *addr, u8 en); u32 port_num, char *addr, bool enable);
int hns_mac_vm_config_bc_en(struct hns_mac_cb *mac_cb, u32 vm, u8 en); int hns_mac_vm_config_bc_en(struct hns_mac_cb *mac_cb, u32 vm, bool enable);
void hns_mac_start(struct hns_mac_cb *mac_cb); void hns_mac_start(struct hns_mac_cb *mac_cb);
void hns_mac_stop(struct hns_mac_cb *mac_cb); void hns_mac_stop(struct hns_mac_cb *mac_cb);
int hns_mac_del_mac(struct hns_mac_cb *mac_cb, u32 vfn, char *mac); int hns_mac_del_mac(struct hns_mac_cb *mac_cb, u32 vfn, char *mac);
......
...@@ -19,24 +19,20 @@ struct hns_mac_cb; ...@@ -19,24 +19,20 @@ struct hns_mac_cb;
#define DSAF_DRV_NAME "hns_dsaf" #define DSAF_DRV_NAME "hns_dsaf"
#define DSAF_MOD_VERSION "v1.0" #define DSAF_MOD_VERSION "v1.0"
#define ENABLE (0x1) #define HNS_DSAF_DEBUG_NW_REG_OFFSET 0x100000
#define DISABLE (0x0)
#define HNS_DSAF_DEBUG_NW_REG_OFFSET (0x100000) #define DSAF_BASE_INNER_PORT_NUM 127/* mac tbl qid*/
#define DSAF_BASE_INNER_PORT_NUM (127) /* mac tbl qid*/ #define DSAF_MAX_CHIP_NUM 2 /*max 2 chips */
#define DSAF_MAX_CHIP_NUM (2) /*max 2 chips */ #define DSAF_DEFAUTL_QUEUE_NUM_PER_PPE 22
#define DSAF_DEFAUTL_QUEUE_NUM_PER_PPE (22) #define HNS_DSAF_MAX_DESC_CNT 1024
#define HNS_DSAF_MIN_DESC_CNT 16
#define HNS_DSAF_MAX_DESC_CNT (1024) #define DSAF_INVALID_ENTRY_IDX 0xffff
#define HNS_DSAF_MIN_DESC_CNT (16)
#define DSAF_INVALID_ENTRY_IDX (0xffff) #define DSAF_CFG_READ_CNT 30
#define DSAF_CFG_READ_CNT (30)
#define DSAF_SRAM_INIT_FINISH_FLAG (0xff)
#define MAC_NUM_OCTETS_PER_ADDR 6 #define MAC_NUM_OCTETS_PER_ADDR 6
...@@ -274,10 +270,6 @@ struct dsaf_device { ...@@ -274,10 +270,6 @@ struct dsaf_device {
struct device *dev; struct device *dev;
struct hnae_ae_dev ae_dev; struct hnae_ae_dev ae_dev;
void *priv;
int virq[DSAF_IRQ_NUM];
u8 __iomem *sc_base; u8 __iomem *sc_base;
u8 __iomem *sds_base; u8 __iomem *sds_base;
u8 __iomem *ppe_base; u8 __iomem *ppe_base;
......
...@@ -149,7 +149,11 @@ void hns_dsaf_ge_srst_by_port(struct dsaf_device *dsaf_dev, u32 port, u32 val) ...@@ -149,7 +149,11 @@ void hns_dsaf_ge_srst_by_port(struct dsaf_device *dsaf_dev, u32 port, u32 val)
if (port < DSAF_SERVICE_NW_NUM) { if (port < DSAF_SERVICE_NW_NUM) {
reg_val_1 = 0x1 << port; reg_val_1 = 0x1 << port;
reg_val_2 = 0x1041041 << port; /* there is difference between V1 and V2 in register.*/
if (AE_IS_VER1(dsaf_dev->dsaf_ver))
reg_val_2 = 0x1041041 << port;
else
reg_val_2 = 0x2082082 << port;
if (val == 0) { if (val == 0) {
dsaf_write_reg(dsaf_dev->sc_base, dsaf_write_reg(dsaf_dev->sc_base,
......
...@@ -341,13 +341,13 @@ void hns_ppe_reset_common(struct dsaf_device *dsaf_dev, u8 ppe_common_index) ...@@ -341,13 +341,13 @@ void hns_ppe_reset_common(struct dsaf_device *dsaf_dev, u8 ppe_common_index)
if (ret) if (ret)
return; return;
for (i = 0; i < ppe_common->ppe_num; i++)
hns_ppe_init_hw(&ppe_common->ppe_cb[i]);
ret = hns_rcb_common_init_hw(dsaf_dev->rcb_common[ppe_common_index]); ret = hns_rcb_common_init_hw(dsaf_dev->rcb_common[ppe_common_index]);
if (ret) if (ret)
return; return;
for (i = 0; i < ppe_common->ppe_num; i++)
hns_ppe_init_hw(&ppe_common->ppe_cb[i]);
hns_rcb_common_init_commit_hw(dsaf_dev->rcb_common[ppe_common_index]); hns_rcb_common_init_commit_hw(dsaf_dev->rcb_common[ppe_common_index]);
} }
......
...@@ -136,19 +136,37 @@ void hns_rcb_int_ctrl_hw(struct hnae_queue *q, u32 flag, u32 mask) ...@@ -136,19 +136,37 @@ void hns_rcb_int_ctrl_hw(struct hnae_queue *q, u32 flag, u32 mask)
void hns_rcb_int_clr_hw(struct hnae_queue *q, u32 flag) void hns_rcb_int_clr_hw(struct hnae_queue *q, u32 flag)
{ {
u32 clr = 1;
if (flag & RCB_INT_FLAG_TX) { if (flag & RCB_INT_FLAG_TX) {
dsaf_write_dev(q, RCB_RING_INTSTS_TX_RING_REG, clr); dsaf_write_dev(q, RCB_RING_INTSTS_TX_RING_REG, 1);
dsaf_write_dev(q, RCB_RING_INTSTS_TX_OVERTIME_REG, clr); dsaf_write_dev(q, RCB_RING_INTSTS_TX_OVERTIME_REG, 1);
} }
if (flag & RCB_INT_FLAG_RX) { if (flag & RCB_INT_FLAG_RX) {
dsaf_write_dev(q, RCB_RING_INTSTS_RX_RING_REG, clr); dsaf_write_dev(q, RCB_RING_INTSTS_RX_RING_REG, 1);
dsaf_write_dev(q, RCB_RING_INTSTS_RX_OVERTIME_REG, clr); dsaf_write_dev(q, RCB_RING_INTSTS_RX_OVERTIME_REG, 1);
} }
} }
void hns_rcbv2_int_ctrl_hw(struct hnae_queue *q, u32 flag, u32 mask)
{
u32 int_mask_en = !!mask;
if (flag & RCB_INT_FLAG_TX)
dsaf_write_dev(q, RCB_RING_INTMSK_TXWL_REG, int_mask_en);
if (flag & RCB_INT_FLAG_RX)
dsaf_write_dev(q, RCB_RING_INTMSK_RXWL_REG, int_mask_en);
}
void hns_rcbv2_int_clr_hw(struct hnae_queue *q, u32 flag)
{
if (flag & RCB_INT_FLAG_TX)
dsaf_write_dev(q, RCBV2_TX_RING_INT_STS_REG, 1);
if (flag & RCB_INT_FLAG_RX)
dsaf_write_dev(q, RCBV2_RX_RING_INT_STS_REG, 1);
}
/** /**
*hns_rcb_ring_enable_hw - enable ring *hns_rcb_ring_enable_hw - enable ring
*@ring: rcb ring *@ring: rcb ring
...@@ -193,6 +211,7 @@ static void hns_rcb_ring_init(struct ring_pair_cb *ring_pair, int ring_type) ...@@ -193,6 +211,7 @@ static void hns_rcb_ring_init(struct ring_pair_cb *ring_pair, int ring_type)
(u32)dma); (u32)dma);
dsaf_write_dev(q, RCB_RING_RX_RING_BASEADDR_H_REG, dsaf_write_dev(q, RCB_RING_RX_RING_BASEADDR_H_REG,
(u32)((dma >> 31) >> 1)); (u32)((dma >> 31) >> 1));
dsaf_write_dev(q, RCB_RING_RX_RING_BD_LEN_REG, dsaf_write_dev(q, RCB_RING_RX_RING_BD_LEN_REG,
bd_size_type); bd_size_type);
dsaf_write_dev(q, RCB_RING_RX_RING_BD_NUM_REG, dsaf_write_dev(q, RCB_RING_RX_RING_BD_NUM_REG,
...@@ -204,6 +223,7 @@ static void hns_rcb_ring_init(struct ring_pair_cb *ring_pair, int ring_type) ...@@ -204,6 +223,7 @@ static void hns_rcb_ring_init(struct ring_pair_cb *ring_pair, int ring_type)
(u32)dma); (u32)dma);
dsaf_write_dev(q, RCB_RING_TX_RING_BASEADDR_H_REG, dsaf_write_dev(q, RCB_RING_TX_RING_BASEADDR_H_REG,
(u32)((dma >> 31) >> 1)); (u32)((dma >> 31) >> 1));
dsaf_write_dev(q, RCB_RING_TX_RING_BD_LEN_REG, dsaf_write_dev(q, RCB_RING_TX_RING_BD_LEN_REG,
bd_size_type); bd_size_type);
dsaf_write_dev(q, RCB_RING_TX_RING_BD_NUM_REG, dsaf_write_dev(q, RCB_RING_TX_RING_BD_NUM_REG,
...@@ -232,9 +252,6 @@ void hns_rcb_init_hw(struct ring_pair_cb *ring) ...@@ -232,9 +252,6 @@ void hns_rcb_init_hw(struct ring_pair_cb *ring)
static void hns_rcb_set_port_desc_cnt(struct rcb_common_cb *rcb_common, static void hns_rcb_set_port_desc_cnt(struct rcb_common_cb *rcb_common,
u32 port_idx, u32 desc_cnt) u32 port_idx, u32 desc_cnt)
{ {
if (port_idx >= HNS_RCB_SERVICE_NW_ENGINE_NUM)
port_idx = 0;
dsaf_write_dev(rcb_common, RCB_CFG_BD_NUM_REG + port_idx * 4, dsaf_write_dev(rcb_common, RCB_CFG_BD_NUM_REG + port_idx * 4,
desc_cnt); desc_cnt);
} }
...@@ -249,8 +266,6 @@ static int hns_rcb_set_port_coalesced_frames(struct rcb_common_cb *rcb_common, ...@@ -249,8 +266,6 @@ static int hns_rcb_set_port_coalesced_frames(struct rcb_common_cb *rcb_common,
u32 port_idx, u32 port_idx,
u32 coalesced_frames) u32 coalesced_frames)
{ {
if (port_idx >= HNS_RCB_SERVICE_NW_ENGINE_NUM)
port_idx = 0;
if (coalesced_frames >= rcb_common->desc_num || if (coalesced_frames >= rcb_common->desc_num ||
coalesced_frames > HNS_RCB_MAX_COALESCED_FRAMES) coalesced_frames > HNS_RCB_MAX_COALESCED_FRAMES)
return -EINVAL; return -EINVAL;
...@@ -354,6 +369,9 @@ int hns_rcb_common_init_hw(struct rcb_common_cb *rcb_common) ...@@ -354,6 +369,9 @@ int hns_rcb_common_init_hw(struct rcb_common_cb *rcb_common)
dsaf_write_dev(rcb_common, RCB_COM_CFG_ENDIAN_REG, dsaf_write_dev(rcb_common, RCB_COM_CFG_ENDIAN_REG,
HNS_RCB_COMMON_ENDIAN); HNS_RCB_COMMON_ENDIAN);
dsaf_write_dev(rcb_common, RCB_COM_CFG_FNA_REG, 0x0);
dsaf_write_dev(rcb_common, RCB_COM_CFG_FA_REG, 0x1);
return 0; return 0;
} }
...@@ -387,19 +405,23 @@ static void hns_rcb_ring_get_cfg(struct hnae_queue *q, int ring_type) ...@@ -387,19 +405,23 @@ static void hns_rcb_ring_get_cfg(struct hnae_queue *q, int ring_type)
struct rcb_common_cb *rcb_common; struct rcb_common_cb *rcb_common;
struct ring_pair_cb *ring_pair_cb; struct ring_pair_cb *ring_pair_cb;
u32 buf_size; u32 buf_size;
u16 desc_num; u16 desc_num, mdnum_ppkt;
int irq_idx; bool irq_idx, is_ver1;
ring_pair_cb = container_of(q, struct ring_pair_cb, q); ring_pair_cb = container_of(q, struct ring_pair_cb, q);
is_ver1 = AE_IS_VER1(ring_pair_cb->rcb_common->dsaf_dev->dsaf_ver);
if (ring_type == RX_RING) { if (ring_type == RX_RING) {
ring = &q->rx_ring; ring = &q->rx_ring;
ring->io_base = ring_pair_cb->q.io_base; ring->io_base = ring_pair_cb->q.io_base;
irq_idx = HNS_RCB_IRQ_IDX_RX; irq_idx = HNS_RCB_IRQ_IDX_RX;
mdnum_ppkt = HNS_RCB_RING_MAX_BD_PER_PKT;
} else { } else {
ring = &q->tx_ring; ring = &q->tx_ring;
ring->io_base = (u8 __iomem *)ring_pair_cb->q.io_base + ring->io_base = (u8 __iomem *)ring_pair_cb->q.io_base +
HNS_RCB_TX_REG_OFFSET; HNS_RCB_TX_REG_OFFSET;
irq_idx = HNS_RCB_IRQ_IDX_TX; irq_idx = HNS_RCB_IRQ_IDX_TX;
mdnum_ppkt = is_ver1 ? HNS_RCB_RING_MAX_TXBD_PER_PKT :
HNS_RCBV2_RING_MAX_TXBD_PER_PKT;
} }
rcb_common = ring_pair_cb->rcb_common; rcb_common = ring_pair_cb->rcb_common;
...@@ -414,7 +436,7 @@ static void hns_rcb_ring_get_cfg(struct hnae_queue *q, int ring_type) ...@@ -414,7 +436,7 @@ static void hns_rcb_ring_get_cfg(struct hnae_queue *q, int ring_type)
ring->buf_size = buf_size; ring->buf_size = buf_size;
ring->desc_num = desc_num; ring->desc_num = desc_num;
ring->max_desc_num_per_pkt = HNS_RCB_RING_MAX_BD_PER_PKT; ring->max_desc_num_per_pkt = mdnum_ppkt;
ring->max_raw_data_sz_per_desc = HNS_RCB_MAX_PKT_SIZE; ring->max_raw_data_sz_per_desc = HNS_RCB_MAX_PKT_SIZE;
ring->max_pkt_size = HNS_RCB_MAX_PKT_SIZE; ring->max_pkt_size = HNS_RCB_MAX_PKT_SIZE;
ring->next_to_use = 0; ring->next_to_use = 0;
...@@ -445,14 +467,22 @@ static int hns_rcb_get_port(struct rcb_common_cb *rcb_common, int ring_idx) ...@@ -445,14 +467,22 @@ static int hns_rcb_get_port(struct rcb_common_cb *rcb_common, int ring_idx)
return port; return port;
} }
#define SERVICE_RING_IRQ_IDX(v1) \
((v1) ? HNS_SERVICE_RING_IRQ_IDX : HNSV2_SERVICE_RING_IRQ_IDX)
#define DEBUG_RING_IRQ_IDX(v1) \
((v1) ? HNS_DEBUG_RING_IRQ_IDX : HNSV2_DEBUG_RING_IRQ_IDX)
#define DEBUG_RING_IRQ_OFFSET(v1) \
((v1) ? HNS_DEBUG_RING_IRQ_OFFSET : HNSV2_DEBUG_RING_IRQ_OFFSET)
static int hns_rcb_get_base_irq_idx(struct rcb_common_cb *rcb_common) 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);
if (comm_index == HNS_DSAF_COMM_SERVICE_NW_IDX) if (comm_index == HNS_DSAF_COMM_SERVICE_NW_IDX)
return HNS_SERVICE_RING_IRQ_IDX; return SERVICE_RING_IRQ_IDX(is_ver1);
else else
return HNS_DEBUG_RING_IRQ_IDX + (comm_index - 1) * 2; return DEBUG_RING_IRQ_IDX(is_ver1) +
(comm_index - 1) * DEBUG_RING_IRQ_OFFSET(is_ver1);
} }
#define RCB_COMM_BASE_TO_RING_BASE(base, ringid)\ #define RCB_COMM_BASE_TO_RING_BASE(base, ringid)\
...@@ -468,6 +498,10 @@ void hns_rcb_get_cfg(struct rcb_common_cb *rcb_common) ...@@ -468,6 +498,10 @@ void hns_rcb_get_cfg(struct rcb_common_cb *rcb_common)
u32 ring_num = rcb_common->ring_num; u32 ring_num = rcb_common->ring_num;
int base_irq_idx = hns_rcb_get_base_irq_idx(rcb_common); int base_irq_idx = hns_rcb_get_base_irq_idx(rcb_common);
struct device_node *np = rcb_common->dsaf_dev->dev->of_node; struct device_node *np = rcb_common->dsaf_dev->dev->of_node;
struct platform_device *pdev =
container_of(rcb_common->dsaf_dev->dev,
struct platform_device, dev);
bool is_ver1 = AE_IS_VER1(rcb_common->dsaf_dev->dsaf_ver);
for (i = 0; i < ring_num; i++) { for (i = 0; i < ring_num; i++) {
ring_pair_cb = &rcb_common->ring_pair_cb[i]; ring_pair_cb = &rcb_common->ring_pair_cb[i];
...@@ -477,10 +511,12 @@ void hns_rcb_get_cfg(struct rcb_common_cb *rcb_common) ...@@ -477,10 +511,12 @@ void hns_rcb_get_cfg(struct rcb_common_cb *rcb_common)
ring_pair_cb->q.io_base = ring_pair_cb->q.io_base =
RCB_COMM_BASE_TO_RING_BASE(rcb_common->io_base, i); RCB_COMM_BASE_TO_RING_BASE(rcb_common->io_base, i);
ring_pair_cb->port_id_in_dsa = hns_rcb_get_port(rcb_common, i); ring_pair_cb->port_id_in_dsa = hns_rcb_get_port(rcb_common, i);
ring_pair_cb->virq[HNS_RCB_IRQ_IDX_TX] ring_pair_cb->virq[HNS_RCB_IRQ_IDX_TX] =
= irq_of_parse_and_map(np, base_irq_idx + i * 2); is_ver1 ? irq_of_parse_and_map(np, base_irq_idx + i * 2) :
ring_pair_cb->virq[HNS_RCB_IRQ_IDX_RX] platform_get_irq(pdev, base_irq_idx + i * 3 + 1);
= irq_of_parse_and_map(np, base_irq_idx + i * 2 + 1); ring_pair_cb->virq[HNS_RCB_IRQ_IDX_RX] =
is_ver1 ? irq_of_parse_and_map(np, base_irq_idx + i * 2 + 1) :
platform_get_irq(pdev, base_irq_idx + i * 3);
ring_pair_cb->q.phy_base = ring_pair_cb->q.phy_base =
RCB_COMM_BASE_TO_RING_BASE(rcb_common->phy_base, i); RCB_COMM_BASE_TO_RING_BASE(rcb_common->phy_base, i);
hns_rcb_ring_pair_get_cfg(ring_pair_cb); hns_rcb_ring_pair_get_cfg(ring_pair_cb);
......
...@@ -26,6 +26,8 @@ struct rcb_common_cb; ...@@ -26,6 +26,8 @@ struct rcb_common_cb;
#define HNS_RCB_SERVICE_NW_ENGINE_NUM DSAF_COMM_CHN #define HNS_RCB_SERVICE_NW_ENGINE_NUM DSAF_COMM_CHN
#define HNS_RCB_DEBUG_NW_ENGINE_NUM 1 #define HNS_RCB_DEBUG_NW_ENGINE_NUM 1
#define HNS_RCB_RING_MAX_BD_PER_PKT 3 #define HNS_RCB_RING_MAX_BD_PER_PKT 3
#define HNS_RCB_RING_MAX_TXBD_PER_PKT 3
#define HNS_RCBV2_RING_MAX_TXBD_PER_PKT 8
#define HNS_RCB_MAX_PKT_SIZE MAC_MAX_MTU #define HNS_RCB_MAX_PKT_SIZE MAC_MAX_MTU
#define HNS_RCB_RING_MAX_PENDING_BD 1024 #define HNS_RCB_RING_MAX_PENDING_BD 1024
...@@ -106,13 +108,17 @@ void hns_rcb_common_free_cfg(struct dsaf_device *dsaf_dev, u32 comm_index); ...@@ -106,13 +108,17 @@ 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_common_init_commit_hw(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, int comm_index,
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_ring_enable_hw(struct hnae_queue *q, u32 val); void hns_rcb_ring_enable_hw(struct hnae_queue *q, u32 val);
void hns_rcb_int_clr_hw(struct hnae_queue *q, u32 flag); void hns_rcb_int_clr_hw(struct hnae_queue *q, u32 flag);
void hns_rcb_int_ctrl_hw(struct hnae_queue *q, u32 flag, u32 enable); void hns_rcb_int_ctrl_hw(struct hnae_queue *q, u32 flag, u32 enable);
void hns_rcbv2_int_ctrl_hw(struct hnae_queue *q, u32 flag, u32 mask);
void hns_rcbv2_int_clr_hw(struct hnae_queue *q, u32 flag);
void hns_rcb_init_hw(struct ring_pair_cb *ring); void hns_rcb_init_hw(struct ring_pair_cb *ring);
void hns_rcb_reset_ring_hw(struct hnae_queue *q); void hns_rcb_reset_ring_hw(struct hnae_queue *q);
void hns_rcb_wait_fbd_clean(struct hnae_queue **qs, int q_num, u32 flag); void hns_rcb_wait_fbd_clean(struct hnae_queue **qs, int q_num, u32 flag);
......
...@@ -10,21 +10,12 @@ ...@@ -10,21 +10,12 @@
#ifndef _DSAF_REG_H_ #ifndef _DSAF_REG_H_
#define _DSAF_REG_H_ #define _DSAF_REG_H_
#define HNS_GE_FIFO_ERR_INTNUM 8 #define HNS_DEBUG_RING_IRQ_IDX 55
#define HNS_XGE_ERR_INTNUM 6 #define HNS_SERVICE_RING_IRQ_IDX 59
#define HNS_RCB_COMM_ERR_INTNUM 12 #define HNS_DEBUG_RING_IRQ_OFFSET 2
#define HNS_PPE_TNL_ERR_INTNUM 8 #define HNSV2_DEBUG_RING_IRQ_IDX 409
#define HNS_DSAF_EVENT_INTNUM 21 #define HNSV2_SERVICE_RING_IRQ_IDX 25
#define HNS_DEBUG_RING_INTNUM 4 #define HNSV2_DEBUG_RING_IRQ_OFFSET 9
#define HNS_SERVICE_RING_INTNUM 256
#define HNS_DEBUG_RING_IRQ_IDX (HNS_GE_FIFO_ERR_INTNUM + HNS_XGE_ERR_INTNUM +\
HNS_RCB_COMM_ERR_INTNUM + HNS_PPE_TNL_ERR_INTNUM +\
HNS_DSAF_EVENT_INTNUM)
#define HNS_SERVICE_RING_IRQ_IDX (HNS_DEBUG_RING_IRQ_IDX +\
HNS_DEBUG_RING_INTNUM)
#define DSAF_IRQ_NUM 18
#define DSAF_MAX_PORT_NUM_PER_CHIP 8 #define DSAF_MAX_PORT_NUM_PER_CHIP 8
#define DSAF_SERVICE_PORT_NUM_PER_DSAF 6 #define DSAF_SERVICE_PORT_NUM_PER_DSAF 6
...@@ -39,9 +30,15 @@ ...@@ -39,9 +30,15 @@
#define DSAF_GE_NUM ((DSAF_SERVICE_NW_NUM) + (DSAF_DEBUG_NW_NUM)) #define DSAF_GE_NUM ((DSAF_SERVICE_NW_NUM) + (DSAF_DEBUG_NW_NUM))
#define DSAF_PORT_NUM ((DSAF_SERVICE_NW_NUM) + (DSAF_DEBUG_NW_NUM)) #define DSAF_PORT_NUM ((DSAF_SERVICE_NW_NUM) + (DSAF_DEBUG_NW_NUM))
#define DSAF_XGE_NUM DSAF_SERVICE_NW_NUM #define DSAF_XGE_NUM DSAF_SERVICE_NW_NUM
#define DSAF_PORT_TYPE_NUM 3
#define DSAF_NODE_NUM 18 #define DSAF_NODE_NUM 18
#define DSAF_XOD_BIG_NUM DSAF_NODE_NUM #define DSAF_XOD_BIG_NUM DSAF_NODE_NUM
#define DSAF_SBM_NUM DSAF_NODE_NUM #define DSAF_SBM_NUM DSAF_NODE_NUM
#define DSAFV2_SBM_NUM 8
#define DSAFV2_SBM_XGE_CHN 6
#define DSAFV2_SBM_PPE_CHN 1
#define DASFV2_ROCEE_CRD_NUM 8
#define DSAF_VOQ_NUM DSAF_NODE_NUM #define DSAF_VOQ_NUM DSAF_NODE_NUM
#define DSAF_INODE_NUM DSAF_NODE_NUM #define DSAF_INODE_NUM DSAF_NODE_NUM
#define DSAF_XOD_NUM 8 #define DSAF_XOD_NUM 8
...@@ -178,6 +175,7 @@ ...@@ -178,6 +175,7 @@
#define DSAF_SBM_BP_CFG_2_XGE_REG_0_REG 0x200C #define DSAF_SBM_BP_CFG_2_XGE_REG_0_REG 0x200C
#define DSAF_SBM_BP_CFG_2_PPE_REG_0_REG 0x230C #define DSAF_SBM_BP_CFG_2_PPE_REG_0_REG 0x230C
#define DSAF_SBM_BP_CFG_2_ROCEE_REG_0_REG 0x260C #define DSAF_SBM_BP_CFG_2_ROCEE_REG_0_REG 0x260C
#define DSAFV2_SBM_BP_CFG_2_ROCEE_REG_0_REG 0x238C
#define DSAF_SBM_FREE_CNT_0_0_REG 0x2010 #define DSAF_SBM_FREE_CNT_0_0_REG 0x2010
#define DSAF_SBM_FREE_CNT_1_0_REG 0x2014 #define DSAF_SBM_FREE_CNT_1_0_REG 0x2014
#define DSAF_SBM_BP_CNT_0_0_REG 0x2018 #define DSAF_SBM_BP_CNT_0_0_REG 0x2018
...@@ -431,8 +429,10 @@ ...@@ -431,8 +429,10 @@
#define RCB_RING_INTMSK_RXWL_REG 0x000A0 #define RCB_RING_INTMSK_RXWL_REG 0x000A0
#define RCB_RING_INTSTS_RX_RING_REG 0x000A4 #define RCB_RING_INTSTS_RX_RING_REG 0x000A4
#define RCBV2_RX_RING_INT_STS_REG 0x000A8
#define RCB_RING_INTMSK_TXWL_REG 0x000AC #define RCB_RING_INTMSK_TXWL_REG 0x000AC
#define RCB_RING_INTSTS_TX_RING_REG 0x000B0 #define RCB_RING_INTSTS_TX_RING_REG 0x000B0
#define RCBV2_TX_RING_INT_STS_REG 0x000B4
#define RCB_RING_INTMSK_RX_OVERTIME_REG 0x000B8 #define RCB_RING_INTMSK_RX_OVERTIME_REG 0x000B8
#define RCB_RING_INTSTS_RX_OVERTIME_REG 0x000BC #define RCB_RING_INTSTS_RX_OVERTIME_REG 0x000BC
#define RCB_RING_INTMSK_TX_OVERTIME_REG 0x000C4 #define RCB_RING_INTMSK_TX_OVERTIME_REG 0x000C4
...@@ -678,6 +678,10 @@ ...@@ -678,6 +678,10 @@
#define XGMAC_TRX_CORE_SRST_M 0x2080 #define XGMAC_TRX_CORE_SRST_M 0x2080
#define DSAF_SRAM_INIT_OVER_M 0xff
#define DSAFV2_SRAM_INIT_OVER_M 0x3ff
#define DSAF_SRAM_INIT_OVER_S 0
#define DSAF_CFG_EN_S 0 #define DSAF_CFG_EN_S 0
#define DSAF_CFG_TC_MODE_S 1 #define DSAF_CFG_TC_MODE_S 1
#define DSAF_CFG_CRC_EN_S 2 #define DSAF_CFG_CRC_EN_S 2
...@@ -685,6 +689,7 @@ ...@@ -685,6 +689,7 @@
#define DSAF_CFG_MIX_MODE_S 4 #define DSAF_CFG_MIX_MODE_S 4
#define DSAF_CFG_STP_MODE_S 5 #define DSAF_CFG_STP_MODE_S 5
#define DSAF_CFG_LOCA_ADDR_EN_S 6 #define DSAF_CFG_LOCA_ADDR_EN_S 6
#define DSAFV2_CFG_VLAN_TAG_MODE_S 17
#define DSAF_CNT_CLR_CE_S 0 #define DSAF_CNT_CLR_CE_S 0
#define DSAF_SNAP_EN_S 1 #define DSAF_SNAP_EN_S 1
...@@ -707,6 +712,16 @@ ...@@ -707,6 +712,16 @@
#define DSAF_INODE_IN_PORT_NUM_M 7 #define DSAF_INODE_IN_PORT_NUM_M 7
#define DSAF_INODE_IN_PORT_NUM_S 0 #define DSAF_INODE_IN_PORT_NUM_S 0
#define DSAFV2_INODE_IN_PORT1_NUM_M (7ULL << 3)
#define DSAFV2_INODE_IN_PORT1_NUM_S 3
#define DSAFV2_INODE_IN_PORT2_NUM_M (7ULL << 6)
#define DSAFV2_INODE_IN_PORT2_NUM_S 6
#define DSAFV2_INODE_IN_PORT3_NUM_M (7ULL << 9)
#define DSAFV2_INODE_IN_PORT3_NUM_S 9
#define DSAFV2_INODE_IN_PORT4_NUM_M (7ULL << 12)
#define DSAFV2_INODE_IN_PORT4_NUM_S 12
#define DSAFV2_INODE_IN_PORT5_NUM_M (7ULL << 15)
#define DSAFV2_INODE_IN_PORT5_NUM_S 15
#define HNS_DSAF_I4TC_CFG 0x18688688 #define HNS_DSAF_I4TC_CFG 0x18688688
#define HNS_DSAF_I8TC_CFG 0x18FAC688 #define HNS_DSAF_I8TC_CFG 0x18FAC688
...@@ -738,6 +753,33 @@ ...@@ -738,6 +753,33 @@
#define DSAF_SBM_CFG3_RESET_BUF_NUM_NO_PFC_S 10 #define DSAF_SBM_CFG3_RESET_BUF_NUM_NO_PFC_S 10
#define DSAF_SBM_CFG3_RESET_BUF_NUM_NO_PFC_M (((1ULL << 10) - 1) << 10) #define DSAF_SBM_CFG3_RESET_BUF_NUM_NO_PFC_M (((1ULL << 10) - 1) << 10)
#define DSAFV2_SBM_CFG0_VC1_MAX_BUF_NUM_S 0
#define DSAFV2_SBM_CFG0_VC1_MAX_BUF_NUM_M (((1ULL << 9) - 1) << 0)
#define DSAFV2_SBM_CFG0_VC0_MAX_BUF_NUM_S 9
#define DSAFV2_SBM_CFG0_VC0_MAX_BUF_NUM_M (((1ULL << 9) - 1) << 9)
#define DSAFV2_SBM_CFG0_COM_MAX_BUF_NUM_S 18
#define DSAFV2_SBM_CFG0_COM_MAX_BUF_NUM_M (((1ULL << 10) - 1) << 18)
#define DSAFV2_SBM_CFG1_TC4_MAX_BUF_NUM_S 0
#define DSAFV2_SBM_CFG1_TC4_MAX_BUF_NUM_M (((1ULL << 9) - 1) << 0)
#define DSAFV2_SBM_CFG1_TC0_MAX_BUF_NUM_S 9
#define DSAFV2_SBM_CFG1_TC0_MAX_BUF_NUM_M (((1ULL << 9) - 1) << 9)
#define DSAFV2_SBM_CFG2_SET_BUF_NUM_S 0
#define DSAFV2_SBM_CFG2_SET_BUF_NUM_M (((1ULL << 9) - 1) << 0)
#define DSAFV2_SBM_CFG2_RESET_BUF_NUM_S 9
#define DSAFV2_SBM_CFG2_RESET_BUF_NUM_M (((1ULL << 9) - 1) << 9)
#define DSAFV2_SBM_CFG3_SET_BUF_NUM_NO_PFC_S 0
#define DSAFV2_SBM_CFG3_SET_BUF_NUM_NO_PFC_M (((1ULL << 9) - 1) << 0)
#define DSAFV2_SBM_CFG3_RESET_BUF_NUM_NO_PFC_S 9
#define DSAFV2_SBM_CFG3_RESET_BUF_NUM_NO_PFC_M (((1ULL << 9) - 1) << 9)
#define DSAFV2_SBM_CFG4_SET_BUF_NUM_NO_PFC_S 0
#define DSAFV2_SBM_CFG4_SET_BUF_NUM_NO_PFC_M (((1ULL << 9) - 1) << 0)
#define DSAFV2_SBM_CFG4_RESET_BUF_NUM_NO_PFC_S 9
#define DSAFV2_SBM_CFG4_RESET_BUF_NUM_NO_PFC_M (((1ULL << 9) - 1) << 9)
#define DSAF_TBL_TCAM_ADDR_S 0 #define DSAF_TBL_TCAM_ADDR_S 0
#define DSAF_TBL_TCAM_ADDR_M ((1ULL << 9) - 1) #define DSAF_TBL_TCAM_ADDR_M ((1ULL << 9) - 1)
......
...@@ -40,6 +40,16 @@ struct hns_nic_ring_data { ...@@ -40,6 +40,16 @@ struct hns_nic_ring_data {
void (*fini_process)(struct hns_nic_ring_data *); void (*fini_process)(struct hns_nic_ring_data *);
}; };
/* compatible the difference between two versions */
struct hns_nic_ops {
void (*fill_desc)(struct hnae_ring *ring, void *priv,
int size, dma_addr_t dma, int frag_end,
int buf_num, enum hns_desc_type type, int mtu);
int (*maybe_stop_tx)(struct sk_buff **out_skb,
int *bnum, struct hnae_ring *ring);
void (*get_rxd_bnum)(u32 bnum_flag, int *out_bnum);
};
struct hns_nic_priv { struct hns_nic_priv {
const char *ae_name; const char *ae_name;
u32 enet_ver; u32 enet_ver;
...@@ -51,6 +61,8 @@ struct hns_nic_priv { ...@@ -51,6 +61,8 @@ struct hns_nic_priv {
struct device *dev; struct device *dev;
struct hnae_handle *ae_handle; struct hnae_handle *ae_handle;
struct hns_nic_ops ops;
/* the cb for nic to manage the ring buffer, the first half of the /* the cb for nic to manage the ring buffer, the first half of the
* array is for tx_ring and vice versa for the second half * array is for tx_ring and vice versa for the second half
*/ */
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include "hns_enet.h" #include "hns_enet.h"
#define HNS_PHY_PAGE_MDIX 0 #define HNS_PHY_PAGE_MDIX 0
...@@ -667,6 +666,7 @@ static void hns_nic_get_drvinfo(struct net_device *net_dev, ...@@ -667,6 +666,7 @@ static void hns_nic_get_drvinfo(struct net_device *net_dev,
drvinfo->bus_info[ETHTOOL_BUSINFO_LEN - 1] = '\0'; drvinfo->bus_info[ETHTOOL_BUSINFO_LEN - 1] = '\0';
strncpy(drvinfo->fw_version, "N/A", ETHTOOL_FWVERS_LEN); strncpy(drvinfo->fw_version, "N/A", ETHTOOL_FWVERS_LEN);
drvinfo->eedump_len = 0;
} }
/** /**
......
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