Commit e92a0843 authored by Yunsheng Lin's avatar Yunsheng Lin Committed by David S. Miller

net: hns3: Cleanup for ROCE capability flag in ae_dev

This patch add the ROCE supported flag in the driver_data
field of pci_device_id, delete roce_pci_tbl and change
HNAE_DEV_SUPPORT_ROCE_B to HNAE3_DEV_SUPPORT_ROCE_B.
This cleanup is done in order to support adding capability
in pci_device_id and to fix initialization failure when
cmd is not supported.
Signed-off-by: default avatarYunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4c4d11b9
...@@ -49,7 +49,10 @@ ...@@ -49,7 +49,10 @@
#define HNAE3_CLASS_NAME_SIZE 16 #define HNAE3_CLASS_NAME_SIZE 16
#define HNAE3_DEV_INITED_B 0x0 #define HNAE3_DEV_INITED_B 0x0
#define HNAE_DEV_SUPPORT_ROCE_B 0x1 #define HNAE3_DEV_SUPPORT_ROCE_B 0x1
#define hnae3_dev_roce_supported(hdev) \
hnae_get_bit(hdev->ae_dev->flag, HNAE3_DEV_SUPPORT_ROCE_B)
#define ring_ptr_move_fw(ring, p) \ #define ring_ptr_move_fw(ring, p) \
((ring)->p = ((ring)->p + 1) % (ring)->desc_num) ((ring)->p = ((ring)->p + 1) % (ring)->desc_num)
......
...@@ -46,17 +46,7 @@ static const struct pci_device_id ae_algo_pci_tbl[] = { ...@@ -46,17 +46,7 @@ static const struct pci_device_id ae_algo_pci_tbl[] = {
{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_50GE_RDMA), 0}, {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_50GE_RDMA), 0},
{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_50GE_RDMA_MACSEC), 0}, {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_50GE_RDMA_MACSEC), 0},
{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_100G_RDMA_MACSEC), 0}, {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_100G_RDMA_MACSEC), 0},
/* Required last entry */ /* required last entry */
{0, }
};
static const struct pci_device_id roce_pci_tbl[] = {
{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_25GE_RDMA), 0},
{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_25GE_RDMA_MACSEC), 0},
{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_50GE_RDMA), 0},
{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_50GE_RDMA_MACSEC), 0},
{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_100G_RDMA_MACSEC), 0},
/* Required last entry */
{0, } {0, }
}; };
...@@ -894,7 +884,7 @@ static int hclge_query_pf_resource(struct hclge_dev *hdev) ...@@ -894,7 +884,7 @@ static int hclge_query_pf_resource(struct hclge_dev *hdev)
hdev->num_tqps = __le16_to_cpu(req->tqp_num); hdev->num_tqps = __le16_to_cpu(req->tqp_num);
hdev->pkt_buf_size = __le16_to_cpu(req->buf_size) << HCLGE_BUF_UNIT_S; hdev->pkt_buf_size = __le16_to_cpu(req->buf_size) << HCLGE_BUF_UNIT_S;
if (hnae_get_bit(hdev->ae_dev->flag, HNAE_DEV_SUPPORT_ROCE_B)) { if (hnae3_dev_roce_supported(hdev)) {
hdev->num_roce_msix = hdev->num_roce_msix =
hnae_get_field(__le16_to_cpu(req->pf_intr_vector_number), hnae_get_field(__le16_to_cpu(req->pf_intr_vector_number),
HCLGE_PF_VEC_NUM_M, HCLGE_PF_VEC_NUM_S); HCLGE_PF_VEC_NUM_M, HCLGE_PF_VEC_NUM_S);
...@@ -3932,8 +3922,7 @@ static int hclge_init_client_instance(struct hnae3_client *client, ...@@ -3932,8 +3922,7 @@ static int hclge_init_client_instance(struct hnae3_client *client,
goto err; goto err;
if (hdev->roce_client && if (hdev->roce_client &&
hnae_get_bit(hdev->ae_dev->flag, hnae3_dev_roce_supported(hdev)) {
HNAE_DEV_SUPPORT_ROCE_B)) {
struct hnae3_client *rc = hdev->roce_client; struct hnae3_client *rc = hdev->roce_client;
ret = hclge_init_roce_base_info(vport); ret = hclge_init_roce_base_info(vport);
...@@ -3956,8 +3945,7 @@ static int hclge_init_client_instance(struct hnae3_client *client, ...@@ -3956,8 +3945,7 @@ static int hclge_init_client_instance(struct hnae3_client *client,
break; break;
case HNAE3_CLIENT_ROCE: case HNAE3_CLIENT_ROCE:
if (hnae_get_bit(hdev->ae_dev->flag, if (hnae3_dev_roce_supported(hdev)) {
HNAE_DEV_SUPPORT_ROCE_B)) {
hdev->roce_client = client; hdev->roce_client = client;
vport->roce.client = client; vport->roce.client = client;
} }
...@@ -4069,7 +4057,6 @@ static void hclge_pci_uninit(struct hclge_dev *hdev) ...@@ -4069,7 +4057,6 @@ static void hclge_pci_uninit(struct hclge_dev *hdev)
static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev) static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)
{ {
struct pci_dev *pdev = ae_dev->pdev; struct pci_dev *pdev = ae_dev->pdev;
const struct pci_device_id *id;
struct hclge_dev *hdev; struct hclge_dev *hdev;
int ret; int ret;
...@@ -4084,10 +4071,6 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev) ...@@ -4084,10 +4071,6 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)
hdev->ae_dev = ae_dev; hdev->ae_dev = ae_dev;
ae_dev->priv = hdev; ae_dev->priv = hdev;
id = pci_match_id(roce_pci_tbl, ae_dev->pdev);
if (id)
hnae_set_bit(ae_dev->flag, HNAE_DEV_SUPPORT_ROCE_B, 1);
ret = hclge_pci_init(hdev); ret = hclge_pci_init(hdev);
if (ret) { if (ret) {
dev_err(&pdev->dev, "PCI init failed\n"); dev_err(&pdev->dev, "PCI init failed\n");
......
...@@ -41,11 +41,16 @@ static struct hnae3_client client; ...@@ -41,11 +41,16 @@ static struct hnae3_client client;
static const struct pci_device_id hns3_pci_tbl[] = { static const struct pci_device_id hns3_pci_tbl[] = {
{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_GE), 0}, {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_GE), 0},
{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_25GE), 0}, {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_25GE), 0},
{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_25GE_RDMA), 0}, {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_25GE_RDMA),
{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_25GE_RDMA_MACSEC), 0}, BIT(HNAE3_DEV_SUPPORT_ROCE_B)},
{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_50GE_RDMA), 0}, {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_25GE_RDMA_MACSEC),
{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_50GE_RDMA_MACSEC), 0}, BIT(HNAE3_DEV_SUPPORT_ROCE_B)},
{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_100G_RDMA_MACSEC), 0}, {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_50GE_RDMA),
BIT(HNAE3_DEV_SUPPORT_ROCE_B)},
{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_50GE_RDMA_MACSEC),
BIT(HNAE3_DEV_SUPPORT_ROCE_B)},
{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_100G_RDMA_MACSEC),
BIT(HNAE3_DEV_SUPPORT_ROCE_B)},
/* required last entry */ /* required last entry */
{0, } {0, }
}; };
...@@ -1348,6 +1353,7 @@ static int hns3_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1348,6 +1353,7 @@ static int hns3_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
} }
ae_dev->pdev = pdev; ae_dev->pdev = pdev;
ae_dev->flag = ent->driver_data;
ae_dev->dev_type = HNAE3_DEV_KNIC; ae_dev->dev_type = HNAE3_DEV_KNIC;
pci_set_drvdata(pdev, ae_dev); pci_set_drvdata(pdev, ae_dev);
......
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