Commit a425b6e1 authored by Luo bin's avatar Luo bin Committed by David S. Miller
Browse files

hinic: add mailbox function support



virtual function and physical function can communicate with each
other through mailbox channel supported by hw

Signed-off-by: default avatarLuo bin <luobin9@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c90af587
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4,4 +4,4 @@ obj-$(CONFIG_HINIC) += hinic.o
hinic-y := hinic_main.o hinic_tx.o hinic_rx.o hinic_port.o hinic_hw_dev.o \
	   hinic_hw_io.o hinic_hw_qp.o hinic_hw_cmdq.o hinic_hw_wq.o \
	   hinic_hw_mgmt.o hinic_hw_api_cmd.o hinic_hw_eqs.o hinic_hw_if.o \
	   hinic_common.o hinic_ethtool.o
	   hinic_common.o hinic_ethtool.o hinic_hw_mbox.o
+1 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@
/* HW interface registers */
#define HINIC_CSR_FUNC_ATTR0_ADDR                       0x0
#define HINIC_CSR_FUNC_ATTR1_ADDR                       0x4

#define HINIC_CSR_FUNC_ATTR2_ADDR			0x8
#define HINIC_CSR_FUNC_ATTR4_ADDR                       0x10
#define HINIC_CSR_FUNC_ATTR5_ADDR                       0x14

+22 −3
Original line number Diff line number Diff line
@@ -676,10 +676,23 @@ static int init_pfhwdev(struct hinic_pfhwdev *pfhwdev)
		return err;
	}

	hinic_register_mgmt_msg_cb(&pfhwdev->pf_to_mgmt, HINIC_MOD_L2NIC,
				   pfhwdev, nic_mgmt_msg_handler);
	err = hinic_func_to_func_init(hwdev);
	if (err) {
		dev_err(&hwif->pdev->dev, "Failed to init mailbox\n");
		hinic_pf_to_mgmt_free(&pfhwdev->pf_to_mgmt);
		return err;
	}

	if (!HINIC_IS_VF(hwif))
		hinic_register_mgmt_msg_cb(&pfhwdev->pf_to_mgmt,
					   HINIC_MOD_L2NIC, pfhwdev,
					   nic_mgmt_msg_handler);
	else
		hinic_register_vf_mbox_cb(hwdev, HINIC_MOD_L2NIC,
					  nic_mgmt_msg_handler);

	hinic_set_pf_action(hwif, HINIC_PF_MGMT_ACTIVE);

	return 0;
}

@@ -693,7 +706,13 @@ static void free_pfhwdev(struct hinic_pfhwdev *pfhwdev)

	hinic_set_pf_action(hwdev->hwif, HINIC_PF_MGMT_INIT);

	hinic_unregister_mgmt_msg_cb(&pfhwdev->pf_to_mgmt, HINIC_MOD_L2NIC);
	if (!HINIC_IS_VF(hwdev->hwif))
		hinic_unregister_mgmt_msg_cb(&pfhwdev->pf_to_mgmt,
					     HINIC_MOD_L2NIC);
	else
		hinic_unregister_vf_mbox_cb(hwdev, HINIC_MOD_L2NIC);

	hinic_func_to_func_free(hwdev);

	hinic_pf_to_mgmt_free(&pfhwdev->pf_to_mgmt);
}
+2 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
#include "hinic_hw_mgmt.h"
#include "hinic_hw_qp.h"
#include "hinic_hw_io.h"
#include "hinic_hw_mbox.h"

#define HINIC_MAX_QPS   32

@@ -225,6 +226,7 @@ struct hinic_hwdev {

	struct hinic_aeqs               aeqs;
	struct hinic_func_to_io         func_to_io;
	struct hinic_mbox_func_to_func  *func_to_func;

	struct hinic_cap                nic_cap;
};
+2 −1
Original line number Diff line number Diff line
@@ -143,8 +143,9 @@ enum hinic_eq_type {
};

enum hinic_aeq_type {
	HINIC_MBX_FROM_FUNC = 1,
	HINIC_MSG_FROM_MGMT_CPU = 2,

	HINIC_MBX_SEND_RSLT = 5,
	HINIC_MAX_AEQ_EVENTS,
};

Loading