/** * i40e_client_get_params - Get the params that can change at runtime * @vsi: the VSI with the message * @params: client param struct *
**/ static int i40e_client_get_params(struct i40e_vsi *vsi, struct i40e_params *params)
{ struct i40e_dcbx_config *dcb_cfg = &vsi->back->hw.local_dcbx_config; int i = 0;
for (i = 0; i < I40E_MAX_USER_PRIORITY; i++) {
u8 tc = dcb_cfg->etscfg.prioritytable[i];
u16 qs_handle;
/* If TC is not enabled for VSI use TC0 for UP */ if (!(vsi->tc_config.enabled_tc & BIT(tc)))
tc = 0;
qs_handle = le16_to_cpu(vsi->info.qs_handle[tc]);
params->qos.prio_qos[i].tc = tc;
params->qos.prio_qos[i].qs_handle = qs_handle; if (qs_handle == I40E_AQ_VSI_QS_HANDLE_INVALID) {
dev_err(&vsi->back->pdev->dev, "Invalid queue set handle for TC = %d, vsi id = %d\n",
tc, vsi->id); return -EINVAL;
}
}
params->mtu = vsi->netdev->mtu; return 0;
}
/** * i40e_notify_client_of_vf_msg - call the client vf message callback * @vsi: the VSI with the message * @vf_id: the absolute VF id that sent the message * @msg: message buffer * @len: length of the message * * If there is a client to this VSI, call the client
**/ void
i40e_notify_client_of_vf_msg(struct i40e_vsi *vsi, u32 vf_id, u8 *msg, u16 len)
{ struct i40e_pf *pf = vsi->back; struct i40e_client_instance *cdev = pf->cinst;
if (!cdev || !cdev->client) return; if (!cdev->client->ops || !cdev->client->ops->virtchnl_receive) {
dev_dbg(&pf->pdev->dev, "Cannot locate client instance virtual channel receive routine\n"); return;
} if (!test_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state)) {
dev_dbg(&pf->pdev->dev, "Client is not open, abort virtchnl_receive\n"); return;
}
cdev->client->ops->virtchnl_receive(&cdev->lan_info, cdev->client,
vf_id, msg, len);
}
/** * i40e_notify_client_of_l2_param_changes - call the client notify callback * @pf: PF device pointer * * If there is a client, call its callback
**/ void i40e_notify_client_of_l2_param_changes(struct i40e_pf *pf)
{ struct i40e_vsi *vsi = i40e_pf_get_main_vsi(pf); struct i40e_client_instance *cdev = pf->cinst; struct i40e_params params;
if (!cdev || !cdev->client) return; if (!cdev->client->ops || !cdev->client->ops->l2_param_change) {
dev_dbg(&pf->pdev->dev, "Cannot locate client instance l2_param_change routine\n"); return;
} if (!test_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state)) {
dev_dbg(&pf->pdev->dev, "Client is not open, abort l2 param change\n"); return;
}
memset(¶ms, 0, sizeof(params));
i40e_client_get_params(vsi, ¶ms);
memcpy(&cdev->lan_info.params, ¶ms, sizeof(struct i40e_params));
cdev->client->ops->l2_param_change(&cdev->lan_info, cdev->client,
¶ms);
}
/** * i40e_notify_client_of_netdev_close - call the client close callback * @pf: PF device pointer * @reset: true when close called due to a reset pending * * If there is a client to this netdev, call the client with close
**/ void i40e_notify_client_of_netdev_close(struct i40e_pf *pf, bool reset)
{ struct i40e_client_instance *cdev = pf->cinst;
if (!cdev || !cdev->client) return; if (!cdev->client->ops || !cdev->client->ops->close) {
dev_dbg(&pf->pdev->dev, "Cannot locate client instance close routine\n"); return;
} if (!test_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state)) {
dev_dbg(&pf->pdev->dev, "Client is not open, abort close\n"); return;
}
cdev->client->ops->close(&cdev->lan_info, cdev->client, reset);
clear_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state);
i40e_client_release_qvlist(&cdev->lan_info);
}
/** * i40e_notify_client_of_vf_reset - call the client vf reset callback * @pf: PF device pointer * @vf_id: asolute id of VF being reset * * If there is a client attached to this PF, notify when a VF is reset
**/ void i40e_notify_client_of_vf_reset(struct i40e_pf *pf, u32 vf_id)
{ struct i40e_client_instance *cdev = pf->cinst;
if (!cdev || !cdev->client) return; if (!cdev->client->ops || !cdev->client->ops->vf_reset) {
dev_dbg(&pf->pdev->dev, "Cannot locate client instance VF reset routine\n"); return;
} if (!test_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state)) {
dev_dbg(&pf->pdev->dev, "Client is not open, abort vf-reset\n"); return;
}
cdev->client->ops->vf_reset(&cdev->lan_info, cdev->client, vf_id);
}
/** * i40e_notify_client_of_vf_enable - call the client vf notification callback * @pf: PF device pointer * @num_vfs: the number of VFs currently enabled, 0 for disable * * If there is a client attached to this PF, call its VF notification routine
**/ void i40e_notify_client_of_vf_enable(struct i40e_pf *pf, u32 num_vfs)
{ struct i40e_client_instance *cdev = pf->cinst;
if (!cdev || !cdev->client) return; if (!cdev->client->ops || !cdev->client->ops->vf_enable) {
dev_dbg(&pf->pdev->dev, "Cannot locate client instance VF enable routine\n"); return;
} if (!test_bit(__I40E_CLIENT_INSTANCE_OPENED,
&cdev->state)) {
dev_dbg(&pf->pdev->dev, "Client is not open, abort vf-enable\n"); return;
}
cdev->client->ops->vf_enable(&cdev->lan_info, cdev->client, num_vfs);
}
/** * i40e_vf_client_capable - ask the client if it likes the specified VF * @pf: PF device pointer * @vf_id: the VF in question * * If there is a client of the specified type attached to this PF, call * its vf_capable routine
**/ int i40e_vf_client_capable(struct i40e_pf *pf, u32 vf_id)
{ struct i40e_client_instance *cdev = pf->cinst; int capable = false;
if (!cdev || !cdev->client) goto out; if (!cdev->client->ops || !cdev->client->ops->vf_capable) {
dev_dbg(&pf->pdev->dev, "Cannot locate client instance VF capability routine\n"); goto out;
} if (!test_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state)) goto out;
if (i40e_client_get_params(vsi, &cdev->lan_info.params)) goto free_cdev;
mac = list_first_entry_or_null(&cdev->lan_info.netdev->dev_addrs.list, struct netdev_hw_addr, list); if (mac)
ether_addr_copy(cdev->lan_info.lanmac, mac->addr); else
dev_err(&pf->pdev->dev, "MAC address list is empty!\n");
if (!test_and_clear_bit(__I40E_CLIENT_SERVICE_REQUESTED, pf->state)) return;
cdev = pf->cinst;
/* If we're down or resetting, just bail */ if (test_bit(__I40E_DOWN, pf->state) ||
test_bit(__I40E_CONFIG_BUSY, pf->state)) return;
if (!cdev || !cdev->client) return;
client = cdev->client;
/* Here we handle client opens. If the client is down, and * the netdev is registered, then open the client.
*/ if (!test_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state)) { if (vsi->netdev_registered &&
client->ops && client->ops->open) {
set_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state);
ret = client->ops->open(&cdev->lan_info, client); if (ret) { /* Remove failed client instance */
clear_bit(__I40E_CLIENT_INSTANCE_OPENED,
&cdev->state); return;
}
}
}
/* enable/disable PE TCP_ENA flag based on netdev down/up
*/ if (test_bit(__I40E_VSI_DOWN, vsi->state))
i40e_client_update_vsi_ctxt(&cdev->lan_info, client,
0, 0, 0,
I40E_CLIENT_VSI_FLAG_TCP_ENABLE); else
i40e_client_update_vsi_ctxt(&cdev->lan_info, client,
0, 0,
I40E_CLIENT_VSI_FLAG_TCP_ENABLE,
I40E_CLIENT_VSI_FLAG_TCP_ENABLE);
}
/** * i40e_lan_add_device - add a lan device struct to the list of lan devices * @pf: pointer to the board struct * * Returns 0 on success or none 0 on error
**/ int i40e_lan_add_device(struct i40e_pf *pf)
{ struct i40e_device *ldev; int ret = 0;
mutex_lock(&i40e_device_mutex);
list_for_each_entry(ldev, &i40e_devices, list) { if (ldev->pf == pf) {
ret = -EEXIST; goto out;
}
}
ldev = kzalloc(sizeof(*ldev), GFP_KERNEL); if (!ldev) {
ret = -ENOMEM; goto out;
}
ldev->pf = pf;
INIT_LIST_HEAD(&ldev->list);
list_add(&ldev->list, &i40e_devices);
dev_info(&pf->pdev->dev, "Added LAN device PF%d bus=0x%02x dev=0x%02x func=0x%02x\n",
pf->hw.pf_id, pf->hw.bus.bus_id,
pf->hw.bus.device, pf->hw.bus.func);
/** * i40e_lan_del_device - removes a lan device from the device list * @pf: pointer to the board struct * * Returns 0 on success or non-0 on error
**/ int i40e_lan_del_device(struct i40e_pf *pf)
{ struct auxiliary_device *aux_dev = pf->cinst->lan_info.aux_dev; struct i40e_device *ldev, *tmp; int ret = -ENODEV;
switch (reset_level) { case I40E_CLIENT_RESET_LEVEL_PF:
set_bit(__I40E_PF_RESET_REQUESTED, pf->state); break; case I40E_CLIENT_RESET_LEVEL_CORE:
set_bit(__I40E_PF_RESET_REQUESTED, pf->state); break; default:
dev_warn(&pf->pdev->dev, "Client for PF id %d requested an unsupported reset: %d.\n",
pf->hw.pf_id, reset_level); break;
}
i40e_service_event_schedule(pf);
}
/** * i40e_client_update_vsi_ctxt * @ldev: pointer to L2 context. * @client: Client pointer. * @is_vf: if this for the VF * @vf_id: if is_vf true this carries the vf_id * @flag: Any device level setting that needs to be done for PE * @valid_flag: Bits in this match up and enable changing of flag bits * * Return 0 on success or < 0 on error
**/ staticint i40e_client_update_vsi_ctxt(struct i40e_info *ldev, struct i40e_client *client, bool is_vf, u32 vf_id,
u32 flag, u32 valid_flag)
{ struct i40e_vsi *vsi = i40e_pf_get_main_vsi(ldev->pf); struct i40e_pf *pf = ldev->pf; struct i40e_vsi_context ctxt; bool update = true; int err;
/* TODO: for now do not allow setting VF's VSI setting */ if (is_vf) return -EINVAL;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.