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)
......
This diff is collapsed.
...@@ -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