Commit 19968430 authored by Chopra, Manish's avatar Chopra, Manish Committed by David S. Miller

qed: refactor tunnelling - API/Structs

This patch changes the tunnel APIs to use per tunnel
info instead of using bitmasks for all tunnels and also
uses single struct to hold the data to prepare multiple
variant of tunnel configuration ramrods to be sent to the hardware.
Signed-off-by: default avatarManish Chopra <manish.chopra@cavium.com>
Signed-off-by: default avatarYuval Mintz <yuval.mintz@cavium.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 36784277
...@@ -149,9 +149,35 @@ enum qed_tunn_clss { ...@@ -149,9 +149,35 @@ enum qed_tunn_clss {
QED_TUNN_CLSS_MAC_VNI, QED_TUNN_CLSS_MAC_VNI,
QED_TUNN_CLSS_INNER_MAC_VLAN, QED_TUNN_CLSS_INNER_MAC_VLAN,
QED_TUNN_CLSS_INNER_MAC_VNI, QED_TUNN_CLSS_INNER_MAC_VNI,
QED_TUNN_CLSS_MAC_VLAN_DUAL_STAGE,
MAX_QED_TUNN_CLSS, MAX_QED_TUNN_CLSS,
}; };
struct qed_tunn_update_type {
bool b_update_mode;
bool b_mode_enabled;
enum qed_tunn_clss tun_cls;
};
struct qed_tunn_update_udp_port {
bool b_update_port;
u16 port;
};
struct qed_tunnel_info {
struct qed_tunn_update_type vxlan;
struct qed_tunn_update_type l2_geneve;
struct qed_tunn_update_type ip_geneve;
struct qed_tunn_update_type l2_gre;
struct qed_tunn_update_type ip_gre;
struct qed_tunn_update_udp_port vxlan_port;
struct qed_tunn_update_udp_port geneve_port;
bool b_update_rx_cls;
bool b_update_tx_cls;
};
struct qed_tunn_start_params { struct qed_tunn_start_params {
unsigned long tunn_mode; unsigned long tunn_mode;
u16 vxlan_udp_port; u16 vxlan_udp_port;
...@@ -648,9 +674,7 @@ struct qed_dev { ...@@ -648,9 +674,7 @@ struct qed_dev {
/* SRIOV */ /* SRIOV */
struct qed_hw_sriov_info *p_iov_info; struct qed_hw_sriov_info *p_iov_info;
#define IS_QED_SRIOV(cdev) (!!(cdev)->p_iov_info) #define IS_QED_SRIOV(cdev) (!!(cdev)->p_iov_info)
struct qed_tunnel_info tunnel;
unsigned long tunn_mode;
bool b_is_vf; bool b_is_vf;
u32 drv_type; u32 drv_type;
struct qed_eth_stats *reset_stats; struct qed_eth_stats *reset_stats;
......
...@@ -1453,7 +1453,7 @@ static int qed_hw_init_port(struct qed_hwfn *p_hwfn, ...@@ -1453,7 +1453,7 @@ static int qed_hw_init_port(struct qed_hwfn *p_hwfn,
static int qed_hw_init_pf(struct qed_hwfn *p_hwfn, static int qed_hw_init_pf(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt, struct qed_ptt *p_ptt,
struct qed_tunn_start_params *p_tunn, struct qed_tunnel_info *p_tunn,
int hw_mode, int hw_mode,
bool b_hw_start, bool b_hw_start,
enum qed_int_mode int_mode, enum qed_int_mode int_mode,
......
...@@ -113,7 +113,7 @@ struct qed_drv_load_params { ...@@ -113,7 +113,7 @@ struct qed_drv_load_params {
struct qed_hw_init_params { struct qed_hw_init_params {
/* Tunneling parameters */ /* Tunneling parameters */
struct qed_tunn_start_params *p_tunn; struct qed_tunnel_info *p_tunn;
bool b_hw_start; bool b_hw_start;
......
...@@ -2285,21 +2285,21 @@ static int qed_stop_txq(struct qed_dev *cdev, u8 rss_id, void *handle) ...@@ -2285,21 +2285,21 @@ static int qed_stop_txq(struct qed_dev *cdev, u8 rss_id, void *handle)
static int qed_tunn_configure(struct qed_dev *cdev, static int qed_tunn_configure(struct qed_dev *cdev,
struct qed_tunn_params *tunn_params) struct qed_tunn_params *tunn_params)
{ {
struct qed_tunn_update_params tunn_info; struct qed_tunnel_info tunn_info;
int i, rc; int i, rc;
if (IS_VF(cdev)) if (IS_VF(cdev))
return 0; return 0;
memset(&tunn_info, 0, sizeof(tunn_info)); memset(&tunn_info, 0, sizeof(tunn_info));
if (tunn_params->update_vxlan_port == 1) { if (tunn_params->update_vxlan_port) {
tunn_info.update_vxlan_udp_port = 1; tunn_info.vxlan_port.b_update_port = true;
tunn_info.vxlan_udp_port = tunn_params->vxlan_port; tunn_info.vxlan_port.port = tunn_params->vxlan_port;
} }
if (tunn_params->update_geneve_port == 1) { if (tunn_params->update_geneve_port) {
tunn_info.update_geneve_udp_port = 1; tunn_info.geneve_port.b_update_port = true;
tunn_info.geneve_udp_port = tunn_params->geneve_port; tunn_info.geneve_port.port = tunn_params->geneve_port;
} }
for_each_hwfn(cdev, i) { for_each_hwfn(cdev, i) {
...@@ -2307,7 +2307,6 @@ static int qed_tunn_configure(struct qed_dev *cdev, ...@@ -2307,7 +2307,6 @@ static int qed_tunn_configure(struct qed_dev *cdev,
rc = qed_sp_pf_update_tunn_cfg(hwfn, &tunn_info, rc = qed_sp_pf_update_tunn_cfg(hwfn, &tunn_info,
QED_SPQ_MODE_EBLOCK, NULL); QED_SPQ_MODE_EBLOCK, NULL);
if (rc) if (rc)
return rc; return rc;
} }
......
...@@ -909,8 +909,8 @@ static int qed_slowpath_start(struct qed_dev *cdev, ...@@ -909,8 +909,8 @@ static int qed_slowpath_start(struct qed_dev *cdev,
{ {
struct qed_drv_load_params drv_load_params; struct qed_drv_load_params drv_load_params;
struct qed_hw_init_params hw_init_params; struct qed_hw_init_params hw_init_params;
struct qed_tunn_start_params tunn_info;
struct qed_mcp_drv_version drv_version; struct qed_mcp_drv_version drv_version;
struct qed_tunnel_info tunn_info;
const u8 *data = NULL; const u8 *data = NULL;
struct qed_hwfn *hwfn; struct qed_hwfn *hwfn;
struct qed_ptt *p_ptt; struct qed_ptt *p_ptt;
...@@ -974,19 +974,19 @@ static int qed_slowpath_start(struct qed_dev *cdev, ...@@ -974,19 +974,19 @@ static int qed_slowpath_start(struct qed_dev *cdev,
qed_dbg_pf_init(cdev); qed_dbg_pf_init(cdev);
} }
memset(&tunn_info, 0, sizeof(tunn_info));
tunn_info.tunn_mode |= 1 << QED_MODE_VXLAN_TUNN |
1 << QED_MODE_L2GRE_TUNN |
1 << QED_MODE_IPGRE_TUNN |
1 << QED_MODE_L2GENEVE_TUNN |
1 << QED_MODE_IPGENEVE_TUNN;
tunn_info.tunn_clss_vxlan = QED_TUNN_CLSS_MAC_VLAN;
tunn_info.tunn_clss_l2gre = QED_TUNN_CLSS_MAC_VLAN;
tunn_info.tunn_clss_ipgre = QED_TUNN_CLSS_MAC_VLAN;
/* Start the slowpath */ /* Start the slowpath */
memset(&hw_init_params, 0, sizeof(hw_init_params)); memset(&hw_init_params, 0, sizeof(hw_init_params));
memset(&tunn_info, 0, sizeof(tunn_info));
tunn_info.vxlan.b_mode_enabled = true;
tunn_info.l2_gre.b_mode_enabled = true;
tunn_info.ip_gre.b_mode_enabled = true;
tunn_info.l2_geneve.b_mode_enabled = true;
tunn_info.ip_geneve.b_mode_enabled = true;
tunn_info.vxlan.tun_cls = QED_TUNN_CLSS_MAC_VLAN;
tunn_info.l2_gre.tun_cls = QED_TUNN_CLSS_MAC_VLAN;
tunn_info.ip_gre.tun_cls = QED_TUNN_CLSS_MAC_VLAN;
tunn_info.l2_geneve.tun_cls = QED_TUNN_CLSS_MAC_VLAN;
tunn_info.ip_geneve.tun_cls = QED_TUNN_CLSS_MAC_VLAN;
hw_init_params.p_tunn = &tunn_info; hw_init_params.p_tunn = &tunn_info;
hw_init_params.b_hw_start = true; hw_init_params.b_hw_start = true;
hw_init_params.int_mode = cdev->int_params.out.int_mode; hw_init_params.int_mode = cdev->int_params.out.int_mode;
......
...@@ -409,7 +409,7 @@ int qed_sp_init_request(struct qed_hwfn *p_hwfn, ...@@ -409,7 +409,7 @@ int qed_sp_init_request(struct qed_hwfn *p_hwfn,
*/ */
int qed_sp_pf_start(struct qed_hwfn *p_hwfn, int qed_sp_pf_start(struct qed_hwfn *p_hwfn,
struct qed_tunn_start_params *p_tunn, struct qed_tunnel_info *p_tunn,
enum qed_mf_mode mode, bool allow_npar_tx_switch); enum qed_mf_mode mode, bool allow_npar_tx_switch);
/** /**
...@@ -442,7 +442,7 @@ int qed_sp_pf_update(struct qed_hwfn *p_hwfn); ...@@ -442,7 +442,7 @@ int qed_sp_pf_update(struct qed_hwfn *p_hwfn);
int qed_sp_pf_stop(struct qed_hwfn *p_hwfn); int qed_sp_pf_stop(struct qed_hwfn *p_hwfn);
int qed_sp_pf_update_tunn_cfg(struct qed_hwfn *p_hwfn, int qed_sp_pf_update_tunn_cfg(struct qed_hwfn *p_hwfn,
struct qed_tunn_update_params *p_tunn, struct qed_tunnel_info *p_tunn,
enum spq_mode comp_mode, enum spq_mode comp_mode,
struct qed_spq_comp_cb *p_comp_data); struct qed_spq_comp_cb *p_comp_data);
/** /**
......
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