Commit 26d68048 authored by David S. Miller's avatar David S. Miller

Merge branch 'qed-Use-trust-mode-to-override-forced-MAC'

Shahed Shaikh says:

====================
qed* : Use trust mode to override forced MAC

This patchset adds a support to override forced MAC (MAC set by PF for a VF)
when trust mode is enabled using

First patch adds a real change to use .ndo_set_vf_trust to override forced MAC
and allow user to change VFs from VF interface itself.

Second patch takes care of a corner case, where MAC change from VF won't
take effect when VF interface is down, by introducing a new TLV
(a way to send message from VF to PF) to give a hint to PF to update
its bulletin board.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 2ed02125 809c45a0
...@@ -2850,6 +2850,24 @@ static int qed_fp_cqe_completion(struct qed_dev *dev, ...@@ -2850,6 +2850,24 @@ static int qed_fp_cqe_completion(struct qed_dev *dev,
cqe); cqe);
} }
static int qed_req_bulletin_update_mac(struct qed_dev *cdev, u8 *mac)
{
int i, ret;
if (IS_PF(cdev))
return 0;
for_each_hwfn(cdev, i) {
struct qed_hwfn *p_hwfn = &cdev->hwfns[i];
ret = qed_vf_pf_bulletin_update_mac(p_hwfn, mac);
if (ret)
return ret;
}
return 0;
}
#ifdef CONFIG_QED_SRIOV #ifdef CONFIG_QED_SRIOV
extern const struct qed_iov_hv_ops qed_iov_ops_pass; extern const struct qed_iov_hv_ops qed_iov_ops_pass;
#endif #endif
...@@ -2887,6 +2905,7 @@ static const struct qed_eth_ops qed_eth_ops_pass = { ...@@ -2887,6 +2905,7 @@ static const struct qed_eth_ops qed_eth_ops_pass = {
.ntuple_filter_config = &qed_ntuple_arfs_filter_config, .ntuple_filter_config = &qed_ntuple_arfs_filter_config,
.configure_arfs_searcher = &qed_configure_arfs_searcher, .configure_arfs_searcher = &qed_configure_arfs_searcher,
.get_coalesce = &qed_get_coalesce, .get_coalesce = &qed_get_coalesce,
.req_bulletin_update_mac = &qed_req_bulletin_update_mac,
}; };
const struct qed_eth_ops *qed_get_eth_ops(void) const struct qed_eth_ops *qed_get_eth_ops(void)
......
...@@ -48,7 +48,7 @@ static int qed_sriov_eqe_event(struct qed_hwfn *p_hwfn, ...@@ -48,7 +48,7 @@ static int qed_sriov_eqe_event(struct qed_hwfn *p_hwfn,
u8 opcode, u8 opcode,
__le16 echo, __le16 echo,
union event_ring_data *data, u8 fw_return_code); union event_ring_data *data, u8 fw_return_code);
static int qed_iov_bulletin_set_mac(struct qed_hwfn *p_hwfn, u8 *mac, int vfid);
static u8 qed_vf_calculate_legacy(struct qed_vf_info *p_vf) static u8 qed_vf_calculate_legacy(struct qed_vf_info *p_vf)
{ {
...@@ -1790,7 +1790,8 @@ static int qed_iov_configure_vport_forced(struct qed_hwfn *p_hwfn, ...@@ -1790,7 +1790,8 @@ static int qed_iov_configure_vport_forced(struct qed_hwfn *p_hwfn,
if (!p_vf->vport_instance) if (!p_vf->vport_instance)
return -EINVAL; return -EINVAL;
if (events & BIT(MAC_ADDR_FORCED)) { if ((events & BIT(MAC_ADDR_FORCED)) ||
p_vf->p_vf_info.is_trusted_configured) {
/* Since there's no way [currently] of removing the MAC, /* Since there's no way [currently] of removing the MAC,
* we can always assume this means we need to force it. * we can always assume this means we need to force it.
*/ */
...@@ -1809,8 +1810,12 @@ static int qed_iov_configure_vport_forced(struct qed_hwfn *p_hwfn, ...@@ -1809,8 +1810,12 @@ static int qed_iov_configure_vport_forced(struct qed_hwfn *p_hwfn,
"PF failed to configure MAC for VF\n"); "PF failed to configure MAC for VF\n");
return rc; return rc;
} }
if (p_vf->p_vf_info.is_trusted_configured)
p_vf->configured_features |= 1 << MAC_ADDR_FORCED; p_vf->configured_features |=
BIT(VFPF_BULLETIN_MAC_ADDR);
else
p_vf->configured_features |=
BIT(MAC_ADDR_FORCED);
} }
if (events & BIT(VLAN_ADDR_FORCED)) { if (events & BIT(VLAN_ADDR_FORCED)) {
...@@ -3170,6 +3175,10 @@ static int qed_iov_vf_update_mac_shadow(struct qed_hwfn *p_hwfn, ...@@ -3170,6 +3175,10 @@ static int qed_iov_vf_update_mac_shadow(struct qed_hwfn *p_hwfn,
if (p_vf->bulletin.p_virt->valid_bitmap & BIT(MAC_ADDR_FORCED)) if (p_vf->bulletin.p_virt->valid_bitmap & BIT(MAC_ADDR_FORCED))
return 0; return 0;
/* Don't keep track of shadow copy since we don't intend to restore. */
if (p_vf->p_vf_info.is_trusted_configured)
return 0;
/* First remove entries and then add new ones */ /* First remove entries and then add new ones */
if (p_params->opcode == QED_FILTER_REMOVE) { if (p_params->opcode == QED_FILTER_REMOVE) {
for (i = 0; i < QED_ETH_VF_NUM_MAC_FILTERS; i++) { for (i = 0; i < QED_ETH_VF_NUM_MAC_FILTERS; i++) {
...@@ -3244,9 +3253,17 @@ static int qed_iov_chk_ucast(struct qed_hwfn *hwfn, ...@@ -3244,9 +3253,17 @@ static int qed_iov_chk_ucast(struct qed_hwfn *hwfn,
/* No real decision to make; Store the configured MAC */ /* No real decision to make; Store the configured MAC */
if (params->type == QED_FILTER_MAC || if (params->type == QED_FILTER_MAC ||
params->type == QED_FILTER_MAC_VLAN) params->type == QED_FILTER_MAC_VLAN) {
ether_addr_copy(vf->mac, params->mac); ether_addr_copy(vf->mac, params->mac);
if (vf->is_trusted_configured) {
qed_iov_bulletin_set_mac(hwfn, vf->mac, vfid);
/* Update and post bulleitin again */
qed_schedule_iov(hwfn, QED_IOV_WQ_BULLETIN_UPDATE_FLAG);
}
}
return 0; return 0;
} }
...@@ -3803,6 +3820,40 @@ static void qed_iov_get_link(struct qed_hwfn *p_hwfn, ...@@ -3803,6 +3820,40 @@ static void qed_iov_get_link(struct qed_hwfn *p_hwfn,
__qed_vf_get_link_caps(p_hwfn, p_caps, p_bulletin); __qed_vf_get_link_caps(p_hwfn, p_caps, p_bulletin);
} }
static int
qed_iov_vf_pf_bulletin_update_mac(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_vf_info *p_vf)
{
struct qed_bulletin_content *p_bulletin = p_vf->bulletin.p_virt;
struct qed_iov_vf_mbx *mbx = &p_vf->vf_mbx;
struct vfpf_bulletin_update_mac_tlv *p_req;
u8 status = PFVF_STATUS_SUCCESS;
int rc = 0;
if (!p_vf->p_vf_info.is_trusted_configured) {
DP_VERBOSE(p_hwfn,
QED_MSG_IOV,
"Blocking bulletin update request from untrusted VF[%d]\n",
p_vf->abs_vf_id);
status = PFVF_STATUS_NOT_SUPPORTED;
rc = -EINVAL;
goto send_status;
}
p_req = &mbx->req_virt->bulletin_update_mac;
ether_addr_copy(p_bulletin->mac, p_req->mac);
DP_VERBOSE(p_hwfn, QED_MSG_IOV,
"Updated bulletin of VF[%d] with requested MAC[%pM]\n",
p_vf->abs_vf_id, p_req->mac);
send_status:
qed_iov_prepare_resp(p_hwfn, p_ptt, p_vf,
CHANNEL_TLV_BULLETIN_UPDATE_MAC,
sizeof(struct pfvf_def_resp_tlv), status);
return rc;
}
static void qed_iov_process_mbx_req(struct qed_hwfn *p_hwfn, static void qed_iov_process_mbx_req(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt, int vfid) struct qed_ptt *p_ptt, int vfid)
{ {
...@@ -3882,6 +3933,9 @@ static void qed_iov_process_mbx_req(struct qed_hwfn *p_hwfn, ...@@ -3882,6 +3933,9 @@ static void qed_iov_process_mbx_req(struct qed_hwfn *p_hwfn,
case CHANNEL_TLV_COALESCE_READ: case CHANNEL_TLV_COALESCE_READ:
qed_iov_vf_pf_get_coalesce(p_hwfn, p_ptt, p_vf); qed_iov_vf_pf_get_coalesce(p_hwfn, p_ptt, p_vf);
break; break;
case CHANNEL_TLV_BULLETIN_UPDATE_MAC:
qed_iov_vf_pf_bulletin_update_mac(p_hwfn, p_ptt, p_vf);
break;
} }
} else if (qed_iov_tlv_supported(mbx->first_tlv.tl.type)) { } else if (qed_iov_tlv_supported(mbx->first_tlv.tl.type)) {
DP_VERBOSE(p_hwfn, QED_MSG_IOV, DP_VERBOSE(p_hwfn, QED_MSG_IOV,
...@@ -4081,16 +4135,60 @@ static void qed_iov_bulletin_set_forced_mac(struct qed_hwfn *p_hwfn, ...@@ -4081,16 +4135,60 @@ static void qed_iov_bulletin_set_forced_mac(struct qed_hwfn *p_hwfn,
return; return;
} }
feature = 1 << MAC_ADDR_FORCED; if (vf_info->p_vf_info.is_trusted_configured) {
feature = BIT(VFPF_BULLETIN_MAC_ADDR);
/* Trust mode will disable Forced MAC */
vf_info->bulletin.p_virt->valid_bitmap &=
~BIT(MAC_ADDR_FORCED);
} else {
feature = BIT(MAC_ADDR_FORCED);
/* Forced MAC will disable MAC_ADDR */
vf_info->bulletin.p_virt->valid_bitmap &=
~BIT(VFPF_BULLETIN_MAC_ADDR);
}
memcpy(vf_info->bulletin.p_virt->mac, mac, ETH_ALEN); memcpy(vf_info->bulletin.p_virt->mac, mac, ETH_ALEN);
vf_info->bulletin.p_virt->valid_bitmap |= feature; vf_info->bulletin.p_virt->valid_bitmap |= feature;
/* Forced MAC will disable MAC_ADDR */
vf_info->bulletin.p_virt->valid_bitmap &= ~BIT(VFPF_BULLETIN_MAC_ADDR);
qed_iov_configure_vport_forced(p_hwfn, vf_info, feature); qed_iov_configure_vport_forced(p_hwfn, vf_info, feature);
} }
static int qed_iov_bulletin_set_mac(struct qed_hwfn *p_hwfn, u8 *mac, int vfid)
{
struct qed_vf_info *vf_info;
u64 feature;
vf_info = qed_iov_get_vf_info(p_hwfn, (u16)vfid, true);
if (!vf_info) {
DP_NOTICE(p_hwfn->cdev, "Can not set MAC, invalid vfid [%d]\n",
vfid);
return -EINVAL;
}
if (vf_info->b_malicious) {
DP_NOTICE(p_hwfn->cdev, "Can't set MAC to malicious VF [%d]\n",
vfid);
return -EINVAL;
}
if (vf_info->bulletin.p_virt->valid_bitmap & BIT(MAC_ADDR_FORCED)) {
DP_VERBOSE(p_hwfn, QED_MSG_IOV,
"Can not set MAC, Forced MAC is configured\n");
return -EINVAL;
}
feature = BIT(VFPF_BULLETIN_MAC_ADDR);
ether_addr_copy(vf_info->bulletin.p_virt->mac, mac);
vf_info->bulletin.p_virt->valid_bitmap |= feature;
if (vf_info->p_vf_info.is_trusted_configured)
qed_iov_configure_vport_forced(p_hwfn, vf_info, feature);
return 0;
}
static void qed_iov_bulletin_set_forced_vlan(struct qed_hwfn *p_hwfn, static void qed_iov_bulletin_set_forced_vlan(struct qed_hwfn *p_hwfn,
u16 pvid, int vfid) u16 pvid, int vfid)
{ {
...@@ -4204,6 +4302,21 @@ static int qed_iov_spoofchk_set(struct qed_hwfn *p_hwfn, int vfid, bool val) ...@@ -4204,6 +4302,21 @@ static int qed_iov_spoofchk_set(struct qed_hwfn *p_hwfn, int vfid, bool val)
return rc; return rc;
} }
static u8 *qed_iov_bulletin_get_mac(struct qed_hwfn *p_hwfn, u16 rel_vf_id)
{
struct qed_vf_info *p_vf;
p_vf = qed_iov_get_vf_info(p_hwfn, rel_vf_id, true);
if (!p_vf || !p_vf->bulletin.p_virt)
return NULL;
if (!(p_vf->bulletin.p_virt->valid_bitmap &
BIT(VFPF_BULLETIN_MAC_ADDR)))
return NULL;
return p_vf->bulletin.p_virt->mac;
}
static u8 *qed_iov_bulletin_get_forced_mac(struct qed_hwfn *p_hwfn, static u8 *qed_iov_bulletin_get_forced_mac(struct qed_hwfn *p_hwfn,
u16 rel_vf_id) u16 rel_vf_id)
{ {
...@@ -4493,8 +4606,12 @@ static int qed_sriov_pf_set_mac(struct qed_dev *cdev, u8 *mac, int vfid) ...@@ -4493,8 +4606,12 @@ static int qed_sriov_pf_set_mac(struct qed_dev *cdev, u8 *mac, int vfid)
if (!vf_info) if (!vf_info)
continue; continue;
/* Set the forced MAC, and schedule the IOV task */ /* Set the MAC, and schedule the IOV task */
if (vf_info->is_trusted_configured)
ether_addr_copy(vf_info->mac, mac);
else
ether_addr_copy(vf_info->forced_mac, mac); ether_addr_copy(vf_info->forced_mac, mac);
qed_schedule_iov(hwfn, QED_IOV_WQ_SET_UNICAST_FILTER_FLAG); qed_schedule_iov(hwfn, QED_IOV_WQ_SET_UNICAST_FILTER_FLAG);
} }
...@@ -4802,6 +4919,33 @@ static void qed_handle_vf_msg(struct qed_hwfn *hwfn) ...@@ -4802,6 +4919,33 @@ static void qed_handle_vf_msg(struct qed_hwfn *hwfn)
qed_ptt_release(hwfn, ptt); qed_ptt_release(hwfn, ptt);
} }
static bool qed_pf_validate_req_vf_mac(struct qed_hwfn *hwfn,
u8 *mac,
struct qed_public_vf_info *info)
{
if (info->is_trusted_configured) {
if (is_valid_ether_addr(info->mac) &&
(!mac || !ether_addr_equal(mac, info->mac)))
return true;
} else {
if (is_valid_ether_addr(info->forced_mac) &&
(!mac || !ether_addr_equal(mac, info->forced_mac)))
return true;
}
return false;
}
static void qed_set_bulletin_mac(struct qed_hwfn *hwfn,
struct qed_public_vf_info *info,
int vfid)
{
if (info->is_trusted_configured)
qed_iov_bulletin_set_mac(hwfn, info->mac, vfid);
else
qed_iov_bulletin_set_forced_mac(hwfn, info->forced_mac, vfid);
}
static void qed_handle_pf_set_vf_unicast(struct qed_hwfn *hwfn) static void qed_handle_pf_set_vf_unicast(struct qed_hwfn *hwfn)
{ {
int i; int i;
...@@ -4816,18 +4960,20 @@ static void qed_handle_pf_set_vf_unicast(struct qed_hwfn *hwfn) ...@@ -4816,18 +4960,20 @@ static void qed_handle_pf_set_vf_unicast(struct qed_hwfn *hwfn)
continue; continue;
/* Update data on bulletin board */ /* Update data on bulletin board */
if (info->is_trusted_configured)
mac = qed_iov_bulletin_get_mac(hwfn, i);
else
mac = qed_iov_bulletin_get_forced_mac(hwfn, i); mac = qed_iov_bulletin_get_forced_mac(hwfn, i);
if (is_valid_ether_addr(info->forced_mac) &&
(!mac || !ether_addr_equal(mac, info->forced_mac))) { if (qed_pf_validate_req_vf_mac(hwfn, mac, info)) {
DP_VERBOSE(hwfn, DP_VERBOSE(hwfn,
QED_MSG_IOV, QED_MSG_IOV,
"Handling PF setting of VF MAC to VF 0x%02x [Abs 0x%02x]\n", "Handling PF setting of VF MAC to VF 0x%02x [Abs 0x%02x]\n",
i, i,
hwfn->cdev->p_iov_info->first_vf_in_pf + i); hwfn->cdev->p_iov_info->first_vf_in_pf + i);
/* Update bulletin board with forced MAC */ /* Update bulletin board with MAC */
qed_iov_bulletin_set_forced_mac(hwfn, qed_set_bulletin_mac(hwfn, info, i);
info->forced_mac, i);
update = true; update = true;
} }
...@@ -4867,6 +5013,72 @@ static void qed_handle_bulletin_post(struct qed_hwfn *hwfn) ...@@ -4867,6 +5013,72 @@ static void qed_handle_bulletin_post(struct qed_hwfn *hwfn)
qed_ptt_release(hwfn, ptt); qed_ptt_release(hwfn, ptt);
} }
static void qed_update_mac_for_vf_trust_change(struct qed_hwfn *hwfn, int vf_id)
{
struct qed_public_vf_info *vf_info;
struct qed_vf_info *vf;
u8 *force_mac;
int i;
vf_info = qed_iov_get_public_vf_info(hwfn, vf_id, true);
vf = qed_iov_get_vf_info(hwfn, vf_id, true);
if (!vf_info || !vf)
return;
/* Force MAC converted to generic MAC in case of VF trust on */
if (vf_info->is_trusted_configured &&
(vf->bulletin.p_virt->valid_bitmap & BIT(MAC_ADDR_FORCED))) {
force_mac = qed_iov_bulletin_get_forced_mac(hwfn, vf_id);
if (force_mac) {
/* Clear existing shadow copy of MAC to have a clean
* slate.
*/
for (i = 0; i < QED_ETH_VF_NUM_MAC_FILTERS; i++) {
if (ether_addr_equal(vf->shadow_config.macs[i],
vf_info->mac)) {
memset(vf->shadow_config.macs[i], 0,
ETH_ALEN);
DP_VERBOSE(hwfn, QED_MSG_IOV,
"Shadow MAC %pM removed for VF 0x%02x, VF trust mode is ON\n",
vf_info->mac, vf_id);
break;
}
}
ether_addr_copy(vf_info->mac, force_mac);
memset(vf_info->forced_mac, 0, ETH_ALEN);
vf->bulletin.p_virt->valid_bitmap &=
~BIT(MAC_ADDR_FORCED);
qed_schedule_iov(hwfn, QED_IOV_WQ_BULLETIN_UPDATE_FLAG);
}
}
/* Update shadow copy with VF MAC when trust mode is turned off */
if (!vf_info->is_trusted_configured) {
u8 empty_mac[ETH_ALEN];
memset(empty_mac, 0, ETH_ALEN);
for (i = 0; i < QED_ETH_VF_NUM_MAC_FILTERS; i++) {
if (ether_addr_equal(vf->shadow_config.macs[i],
empty_mac)) {
ether_addr_copy(vf->shadow_config.macs[i],
vf_info->mac);
DP_VERBOSE(hwfn, QED_MSG_IOV,
"Shadow is updated with %pM for VF 0x%02x, VF trust mode is OFF\n",
vf_info->mac, vf_id);
break;
}
}
/* Clear bulletin when trust mode is turned off,
* to have a clean slate for next (normal) operations.
*/
qed_iov_bulletin_set_mac(hwfn, empty_mac, vf_id);
qed_schedule_iov(hwfn, QED_IOV_WQ_BULLETIN_UPDATE_FLAG);
}
}
static void qed_iov_handle_trust_change(struct qed_hwfn *hwfn) static void qed_iov_handle_trust_change(struct qed_hwfn *hwfn)
{ {
struct qed_sp_vport_update_params params; struct qed_sp_vport_update_params params;
...@@ -4890,6 +5102,9 @@ static void qed_iov_handle_trust_change(struct qed_hwfn *hwfn) ...@@ -4890,6 +5102,9 @@ static void qed_iov_handle_trust_change(struct qed_hwfn *hwfn)
continue; continue;
vf_info->is_trusted_configured = vf_info->is_trusted_request; vf_info->is_trusted_configured = vf_info->is_trusted_request;
/* Handle forced MAC mode */
qed_update_mac_for_vf_trust_change(hwfn, i);
/* Validate that the VF has a configured vport */ /* Validate that the VF has a configured vport */
vf = qed_iov_get_vf_info(hwfn, i, true); vf = qed_iov_get_vf_info(hwfn, i, true);
if (!vf->vport_instance) if (!vf->vport_instance)
......
...@@ -1374,6 +1374,35 @@ int qed_vf_pf_get_coalesce(struct qed_hwfn *p_hwfn, ...@@ -1374,6 +1374,35 @@ int qed_vf_pf_get_coalesce(struct qed_hwfn *p_hwfn,
return rc; return rc;
} }
int
qed_vf_pf_bulletin_update_mac(struct qed_hwfn *p_hwfn,
u8 *p_mac)
{
struct qed_vf_iov *p_iov = p_hwfn->vf_iov_info;
struct vfpf_bulletin_update_mac_tlv *p_req;
struct pfvf_def_resp_tlv *p_resp;
int rc;
if (!p_mac)
return -EINVAL;
/* clear mailbox and prep header tlv */
p_req = qed_vf_pf_prep(p_hwfn, CHANNEL_TLV_BULLETIN_UPDATE_MAC,
sizeof(*p_req));
ether_addr_copy(p_req->mac, p_mac);
DP_VERBOSE(p_hwfn, QED_MSG_IOV,
"Requesting bulletin update for MAC[%pM]\n", p_mac);
/* add list termination tlv */
qed_add_tlv(p_hwfn, &p_iov->offset, CHANNEL_TLV_LIST_END,
sizeof(struct channel_list_end_tlv));
p_resp = &p_iov->pf2vf_reply->default_resp;
rc = qed_send_msg2pf(p_hwfn, &p_resp->hdr.status, sizeof(*p_resp));
qed_vf_pf_req_end(p_hwfn, rc);
return rc;
}
int int
qed_vf_pf_set_coalesce(struct qed_hwfn *p_hwfn, qed_vf_pf_set_coalesce(struct qed_hwfn *p_hwfn,
u16 rx_coal, u16 tx_coal, struct qed_queue_cid *p_cid) u16 rx_coal, u16 tx_coal, struct qed_queue_cid *p_cid)
......
...@@ -518,6 +518,12 @@ struct pfvf_read_coal_resp_tlv { ...@@ -518,6 +518,12 @@ struct pfvf_read_coal_resp_tlv {
u8 padding[6]; u8 padding[6];
}; };
struct vfpf_bulletin_update_mac_tlv {
struct vfpf_first_tlv first_tlv;
u8 mac[ETH_ALEN];
u8 padding[2];
};
union vfpf_tlvs { union vfpf_tlvs {
struct vfpf_first_tlv first_tlv; struct vfpf_first_tlv first_tlv;
struct vfpf_acquire_tlv acquire; struct vfpf_acquire_tlv acquire;
...@@ -532,6 +538,7 @@ union vfpf_tlvs { ...@@ -532,6 +538,7 @@ union vfpf_tlvs {
struct vfpf_update_tunn_param_tlv tunn_param_update; struct vfpf_update_tunn_param_tlv tunn_param_update;
struct vfpf_update_coalesce update_coalesce; struct vfpf_update_coalesce update_coalesce;
struct vfpf_read_coal_req_tlv read_coal_req; struct vfpf_read_coal_req_tlv read_coal_req;
struct vfpf_bulletin_update_mac_tlv bulletin_update_mac;
struct tlv_buffer_size tlv_buf_size; struct tlv_buffer_size tlv_buf_size;
}; };
...@@ -650,6 +657,7 @@ enum { ...@@ -650,6 +657,7 @@ enum {
CHANNEL_TLV_COALESCE_UPDATE, CHANNEL_TLV_COALESCE_UPDATE,
CHANNEL_TLV_QID, CHANNEL_TLV_QID,
CHANNEL_TLV_COALESCE_READ, CHANNEL_TLV_COALESCE_READ,
CHANNEL_TLV_BULLETIN_UPDATE_MAC,
CHANNEL_TLV_MAX, CHANNEL_TLV_MAX,
/* Required for iterating over vport-update tlvs. /* Required for iterating over vport-update tlvs.
...@@ -1042,6 +1050,13 @@ int qed_vf_pf_tunnel_param_update(struct qed_hwfn *p_hwfn, ...@@ -1042,6 +1050,13 @@ int qed_vf_pf_tunnel_param_update(struct qed_hwfn *p_hwfn,
struct qed_tunnel_info *p_tunn); struct qed_tunnel_info *p_tunn);
u32 qed_vf_hw_bar_size(struct qed_hwfn *p_hwfn, enum BAR_ID bar_id); u32 qed_vf_hw_bar_size(struct qed_hwfn *p_hwfn, enum BAR_ID bar_id);
/**
* @brief - Ask PF to update the MAC address in it's bulletin board
*
* @param p_mac - mac address to be updated in bulletin board
*/
int qed_vf_pf_bulletin_update_mac(struct qed_hwfn *p_hwfn, u8 *p_mac);
#else #else
static inline void qed_vf_get_link_params(struct qed_hwfn *p_hwfn, static inline void qed_vf_get_link_params(struct qed_hwfn *p_hwfn,
struct qed_mcp_link_params *params) struct qed_mcp_link_params *params)
...@@ -1228,6 +1243,12 @@ static inline int qed_vf_pf_tunnel_param_update(struct qed_hwfn *p_hwfn, ...@@ -1228,6 +1243,12 @@ static inline int qed_vf_pf_tunnel_param_update(struct qed_hwfn *p_hwfn,
return -EINVAL; return -EINVAL;
} }
static inline int qed_vf_pf_bulletin_update_mac(struct qed_hwfn *p_hwfn,
u8 *p_mac)
{
return -EINVAL;
}
static inline u32 static inline u32
qed_vf_hw_bar_size(struct qed_hwfn *p_hwfn, qed_vf_hw_bar_size(struct qed_hwfn *p_hwfn,
enum BAR_ID bar_id) enum BAR_ID bar_id)
......
...@@ -550,8 +550,7 @@ void qede_force_mac(void *dev, u8 *mac, bool forced) ...@@ -550,8 +550,7 @@ void qede_force_mac(void *dev, u8 *mac, bool forced)
__qede_lock(edev); __qede_lock(edev);
/* MAC hints take effect only if we haven't set one already */ if (!is_valid_ether_addr(mac)) {
if (is_valid_ether_addr(edev->ndev->dev_addr) && !forced) {
__qede_unlock(edev); __qede_unlock(edev);
return; return;
} }
...@@ -1161,6 +1160,10 @@ int qede_set_mac_addr(struct net_device *ndev, void *p) ...@@ -1161,6 +1160,10 @@ int qede_set_mac_addr(struct net_device *ndev, void *p)
if (edev->state != QEDE_STATE_OPEN) { if (edev->state != QEDE_STATE_OPEN) {
DP_VERBOSE(edev, NETIF_MSG_IFDOWN, DP_VERBOSE(edev, NETIF_MSG_IFDOWN,
"The device is currently down\n"); "The device is currently down\n");
/* Ask PF to explicitly update a copy in bulletin board */
if (IS_VF(edev) && edev->ops->req_bulletin_update_mac)
edev->ops->req_bulletin_update_mac(edev->cdev,
ndev->dev_addr);
goto out; goto out;
} }
......
...@@ -352,6 +352,7 @@ struct qed_eth_ops { ...@@ -352,6 +352,7 @@ struct qed_eth_ops {
int (*configure_arfs_searcher)(struct qed_dev *cdev, int (*configure_arfs_searcher)(struct qed_dev *cdev,
enum qed_filter_config_mode mode); enum qed_filter_config_mode mode);
int (*get_coalesce)(struct qed_dev *cdev, u16 *coal, void *handle); int (*get_coalesce)(struct qed_dev *cdev, u16 *coal, void *handle);
int (*req_bulletin_update_mac)(struct qed_dev *cdev, u8 *mac);
}; };
const struct qed_eth_ops *qed_get_eth_ops(void); const struct qed_eth_ops *qed_get_eth_ops(void);
......
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