Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 97379f15 authored by Chopra, Manish's avatar Chopra, Manish Committed by David S. Miller
Browse files

qed/qede: Add UDP ports in bulletin board



This patch adds support for UDP ports in bulletin board
to notify UDP ports change to the VFs

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 327a2b75
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -2304,11 +2304,30 @@ static int qed_tunn_configure(struct qed_dev *cdev,

	for_each_hwfn(cdev, i) {
		struct qed_hwfn *hwfn = &cdev->hwfns[i];
		struct qed_tunnel_info *tun;

		tun = &hwfn->cdev->tunnel;

		rc = qed_sp_pf_update_tunn_cfg(hwfn, &tunn_info,
					       QED_SPQ_MODE_EBLOCK, NULL);
		if (rc)
			return rc;

		if (IS_PF_SRIOV(hwfn)) {
			u16 vxlan_port, geneve_port;
			int j;

			vxlan_port = tun->vxlan_port.port;
			geneve_port = tun->geneve_port.port;

			qed_for_each_vf(hwfn, j) {
				qed_iov_bulletin_set_udp_ports(hwfn, j,
							       vxlan_port,
							       geneve_port);
			}

			qed_schedule_iov(hwfn, QED_IOV_WQ_BULLETIN_UPDATE_FLAG);
		}
	}

	return 0;
+23 −0
Original line number Diff line number Diff line
@@ -3511,6 +3511,29 @@ static void qed_iov_bulletin_set_forced_vlan(struct qed_hwfn *p_hwfn,
	qed_iov_configure_vport_forced(p_hwfn, vf_info, feature);
}

void qed_iov_bulletin_set_udp_ports(struct qed_hwfn *p_hwfn,
				    int vfid, u16 vxlan_port, u16 geneve_port)
{
	struct qed_vf_info *vf_info;

	vf_info = qed_iov_get_vf_info(p_hwfn, (u16)vfid, true);
	if (!vf_info) {
		DP_NOTICE(p_hwfn->cdev,
			  "Can not set udp ports, invalid vfid [%d]\n", vfid);
		return;
	}

	if (vf_info->b_malicious) {
		DP_VERBOSE(p_hwfn, QED_MSG_IOV,
			   "Can not set udp ports to malicious VF [%d]\n",
			   vfid);
		return;
	}

	vf_info->bulletin.p_virt->vxlan_udp_port = vxlan_port;
	vf_info->bulletin.p_virt->geneve_udp_port = geneve_port;
}

static bool qed_iov_vf_has_vport_instance(struct qed_hwfn *p_hwfn, int vfid)
{
	struct qed_vf_info *p_vf_info;
+9 −0
Original line number Diff line number Diff line
@@ -270,6 +270,9 @@ enum qed_iov_wq_flag {
 */
u16 qed_iov_get_next_active_vf(struct qed_hwfn *p_hwfn, u16 rel_vf_id);

void qed_iov_bulletin_set_udp_ports(struct qed_hwfn *p_hwfn,
				    int vfid, u16 vxlan_port, u16 geneve_port);

/**
 * @brief Read sriov related information and allocated resources
 *  reads from configuraiton space, shmem, etc.
@@ -378,6 +381,12 @@ static inline u16 qed_iov_get_next_active_vf(struct qed_hwfn *p_hwfn,
	return MAX_NUM_VFS;
}

static inline void
qed_iov_bulletin_set_udp_ports(struct qed_hwfn *p_hwfn, int vfid,
			       u16 vxlan_port, u16 geneve_port)
{
}

static inline int qed_iov_hw_info(struct qed_hwfn *p_hwfn)
{
	return 0;
+16 −0
Original line number Diff line number Diff line
@@ -1251,6 +1251,18 @@ static bool qed_vf_bulletin_get_forced_mac(struct qed_hwfn *hwfn,
	return true;
}

static void
qed_vf_bulletin_get_udp_ports(struct qed_hwfn *p_hwfn,
			      u16 *p_vxlan_port, u16 *p_geneve_port)
{
	struct qed_bulletin_content *p_bulletin;

	p_bulletin = &p_hwfn->vf_iov_info->bulletin_shadow;

	*p_vxlan_port = p_bulletin->vxlan_udp_port;
	*p_geneve_port = p_bulletin->geneve_udp_port;
}

void qed_vf_get_fw_version(struct qed_hwfn *p_hwfn,
			   u16 *fw_major, u16 *fw_minor,
			   u16 *fw_rev, u16 *fw_eng)
@@ -1270,12 +1282,16 @@ static void qed_handle_bulletin_change(struct qed_hwfn *hwfn)
	struct qed_eth_cb_ops *ops = hwfn->cdev->protocol_ops.eth;
	u8 mac[ETH_ALEN], is_mac_exist, is_mac_forced;
	void *cookie = hwfn->cdev->ops_cookie;
	u16 vxlan_port, geneve_port;

	qed_vf_bulletin_get_udp_ports(hwfn, &vxlan_port, &geneve_port);
	is_mac_exist = qed_vf_bulletin_get_forced_mac(hwfn, mac,
						      &is_mac_forced);
	if (is_mac_exist && cookie)
		ops->force_mac(cookie, mac, !!is_mac_forced);

	ops->ports_update(cookie, vxlan_port, geneve_port);

	/* Always update link configuration according to bulletin */
	qed_link_update(hwfn);
}
+3 −1
Original line number Diff line number Diff line
@@ -513,7 +513,9 @@ struct qed_bulletin_content {
	u8 partner_rx_flow_ctrl_en;
	u8 partner_adv_pause;
	u8 sfp_tx_fault;
	u8 padding4[6];
	u16 vxlan_udp_port;
	u16 geneve_udp_port;
	u8 padding4[2];

	u32 speed;
	u32 partner_adv_speed;
Loading