Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ixl/if_ixl.c
Show First 20 Lines • Show All 5,694 Lines • ▼ Show 20 Lines | ixl_vf_config_rx_queue(struct ixl_pf *pf, struct ixl_vf *vf, | ||||
rxq.base = info->dma_ring_addr / IXL_RX_CTX_BASE_UNITS; | rxq.base = info->dma_ring_addr / IXL_RX_CTX_BASE_UNITS; | ||||
rxq.qlen = info->ring_len; | rxq.qlen = info->ring_len; | ||||
rxq.dbuff = info->databuffer_size >> I40E_RXQ_CTX_DBUFF_SHIFT; | rxq.dbuff = info->databuffer_size >> I40E_RXQ_CTX_DBUFF_SHIFT; | ||||
rxq.dsize = 1; | rxq.dsize = 1; | ||||
rxq.crcstrip = 1; | rxq.crcstrip = 1; | ||||
rxq.l2tsel = 1; | |||||
rxq.rxmax = info->max_pkt_size; | rxq.rxmax = info->max_pkt_size; | ||||
rxq.tphrdesc_ena = 1; | rxq.tphrdesc_ena = 1; | ||||
rxq.tphwdesc_ena = 1; | rxq.tphwdesc_ena = 1; | ||||
rxq.tphdata_ena = 1; | rxq.tphdata_ena = 1; | ||||
rxq.tphhead_ena = 1; | rxq.tphhead_ena = 1; | ||||
rxq.lrxqthresh = 2; | rxq.lrxqthresh = 2; | ||||
rxq.prefena = 1; | rxq.prefena = 1; | ||||
▲ Show 20 Lines • Show All 406 Lines • ▼ Show 20 Lines | ixl_vf_del_mac_msg(struct ixl_pf *pf, struct ixl_vf *vf, void *msg, | ||||
for (i = 0; i < addr_list->num_elements; i++) { | for (i = 0; i < addr_list->num_elements; i++) { | ||||
addr = &addr_list->list[i]; | addr = &addr_list->list[i]; | ||||
ixl_del_filter(&vf->vsi, addr->addr, IXL_VLAN_ANY); | ixl_del_filter(&vf->vsi, addr->addr, IXL_VLAN_ANY); | ||||
} | } | ||||
ixl_send_vf_ack(pf, vf, I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS); | ixl_send_vf_ack(pf, vf, I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS); | ||||
} | } | ||||
static enum i40e_status_code | |||||
ixl_vf_enable_vlan_strip(struct ixl_pf *pf, struct ixl_vf *vf) | |||||
{ | |||||
struct i40e_vsi_context vsi_ctx; | |||||
vsi_ctx.seid = vf->vsi.seid; | |||||
bzero(&vsi_ctx.info, sizeof(vsi_ctx.info)); | |||||
vsi_ctx.info.valid_sections = htole16(I40E_AQ_VSI_PROP_VLAN_VALID); | |||||
vsi_ctx.info.port_vlan_flags = I40E_AQ_VSI_PVLAN_MODE_ALL | | |||||
I40E_AQ_VSI_PVLAN_EMOD_STR_BOTH; | |||||
return (i40e_aq_update_vsi_params(&pf->hw, &vsi_ctx, NULL)); | |||||
} | |||||
static void | static void | ||||
ixl_vf_add_vlan_msg(struct ixl_pf *pf, struct ixl_vf *vf, void *msg, | |||||
uint16_t msg_size) | |||||
{ | |||||
struct i40e_virtchnl_vlan_filter_list *filter_list; | |||||
enum i40e_status_code code; | |||||
size_t expected_size; | |||||
int i; | |||||
if (msg_size < sizeof(*filter_list)) { | |||||
i40e_send_vf_nack(pf, vf, I40E_VIRTCHNL_OP_ADD_VLAN, | |||||
I40E_ERR_PARAM); | |||||
return; | |||||
} | |||||
filter_list = msg; | |||||
expected_size = sizeof(*filter_list) + | |||||
filter_list->num_elements * sizeof(uint16_t); | |||||
if (filter_list->num_elements == 0 || | |||||
filter_list->vsi_id != vf->vsi.vsi_num || | |||||
msg_size != expected_size) { | |||||
i40e_send_vf_nack(pf, vf, I40E_VIRTCHNL_OP_ADD_VLAN, | |||||
I40E_ERR_PARAM); | |||||
return; | |||||
} | |||||
if (!(vf->vf_flags & VF_FLAG_VLAN_CAP)) { | |||||
i40e_send_vf_nack(pf, vf, I40E_VIRTCHNL_OP_ADD_VLAN, | |||||
I40E_ERR_PARAM); | |||||
return; | |||||
} | |||||
for (i = 0; i < filter_list->num_elements; i++) { | |||||
if (filter_list->vlan_id[i] > EVL_VLID_MASK) { | |||||
i40e_send_vf_nack(pf, vf, I40E_VIRTCHNL_OP_ADD_VLAN, | |||||
I40E_ERR_PARAM); | |||||
return; | |||||
} | |||||
} | |||||
code = ixl_vf_enable_vlan_strip(pf, vf); | |||||
if (code != I40E_SUCCESS) { | |||||
i40e_send_vf_nack(pf, vf, I40E_VIRTCHNL_OP_ADD_VLAN, | |||||
I40E_ERR_PARAM); | |||||
} | |||||
for (i = 0; i < filter_list->num_elements; i++) | |||||
ixl_add_filter(&vf->vsi, vf->mac, filter_list->vlan_id[i]); | |||||
ixl_send_vf_ack(pf, vf, I40E_VIRTCHNL_OP_ADD_VLAN); | |||||
} | |||||
static void | |||||
ixl_vf_del_vlan_msg(struct ixl_pf *pf, struct ixl_vf *vf, void *msg, | |||||
uint16_t msg_size) | |||||
{ | |||||
struct i40e_virtchnl_vlan_filter_list *filter_list; | |||||
int i; | |||||
size_t expected_size; | |||||
if (msg_size < sizeof(*filter_list)) { | |||||
i40e_send_vf_nack(pf, vf, I40E_VIRTCHNL_OP_DEL_VLAN, | |||||
I40E_ERR_PARAM); | |||||
return; | |||||
} | |||||
filter_list = msg; | |||||
expected_size = sizeof(*filter_list) + | |||||
filter_list->num_elements * sizeof(uint16_t); | |||||
if (filter_list->num_elements == 0 || | |||||
filter_list->vsi_id != vf->vsi.vsi_num || | |||||
msg_size != expected_size) { | |||||
i40e_send_vf_nack(pf, vf, I40E_VIRTCHNL_OP_DEL_VLAN, | |||||
I40E_ERR_PARAM); | |||||
return; | |||||
} | |||||
for (i = 0; i < filter_list->num_elements; i++) { | |||||
if (filter_list->vlan_id[i] > EVL_VLID_MASK) { | |||||
i40e_send_vf_nack(pf, vf, I40E_VIRTCHNL_OP_ADD_VLAN, | |||||
I40E_ERR_PARAM); | |||||
return; | |||||
} | |||||
} | |||||
if (!(vf->vf_flags & VF_FLAG_VLAN_CAP)) { | |||||
i40e_send_vf_nack(pf, vf, I40E_VIRTCHNL_OP_ADD_VLAN, | |||||
I40E_ERR_PARAM); | |||||
return; | |||||
} | |||||
for (i = 0; i < filter_list->num_elements; i++) | |||||
ixl_del_filter(&vf->vsi, vf->mac, filter_list->vlan_id[i]); | |||||
ixl_send_vf_ack(pf, vf, I40E_VIRTCHNL_OP_DEL_VLAN); | |||||
} | |||||
static void | |||||
ixl_handle_vf_msg(struct ixl_pf *pf, struct i40e_arq_event_info *event) | ixl_handle_vf_msg(struct ixl_pf *pf, struct i40e_arq_event_info *event) | ||||
{ | { | ||||
struct ixl_vf *vf; | struct ixl_vf *vf; | ||||
void *msg; | void *msg; | ||||
uint16_t vf_num, msg_size; | uint16_t vf_num, msg_size; | ||||
uint32_t opcode; | uint32_t opcode; | ||||
vf_num = le16toh(event->desc.retval); | vf_num = le16toh(event->desc.retval); | ||||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | case I40E_VIRTCHNL_OP_DISABLE_QUEUES: | ||||
ixl_vf_disable_queues_msg(pf, vf, msg, msg_size); | ixl_vf_disable_queues_msg(pf, vf, msg, msg_size); | ||||
break; | break; | ||||
case I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS: | case I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS: | ||||
ixl_vf_add_mac_msg(pf, vf, msg, msg_size); | ixl_vf_add_mac_msg(pf, vf, msg, msg_size); | ||||
break; | break; | ||||
case I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS: | case I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS: | ||||
ixl_vf_del_mac_msg(pf, vf, msg, msg_size); | ixl_vf_del_mac_msg(pf, vf, msg, msg_size); | ||||
break; | break; | ||||
case I40E_VIRTCHNL_OP_ADD_VLAN: | |||||
ixl_vf_add_vlan_msg(pf, vf, msg, msg_size); | |||||
break; | |||||
case I40E_VIRTCHNL_OP_DEL_VLAN: | |||||
ixl_vf_del_vlan_msg(pf, vf, msg, msg_size); | |||||
break; | |||||
default: | default: | ||||
i40e_send_vf_nack(pf, vf, opcode, I40E_ERR_NOT_IMPLEMENTED); | i40e_send_vf_nack(pf, vf, opcode, I40E_ERR_NOT_IMPLEMENTED); | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
static int | static int | ||||
ixl_adminq_err_to_errno(enum i40e_admin_queue_err err) | ixl_adminq_err_to_errno(enum i40e_admin_queue_err err) | ||||
▲ Show 20 Lines • Show All 133 Lines • ▼ Show 20 Lines | ixl_add_vf(device_t dev, uint16_t vfnum, const nvlist_t *params) | ||||
vf->vsi.back = pf; | vf->vsi.back = pf; | ||||
vf->vf_flags = VF_FLAG_ENABLED; | vf->vf_flags = VF_FLAG_ENABLED; | ||||
SLIST_INIT(&vf->vsi.ftl); | SLIST_INIT(&vf->vsi.ftl); | ||||
error = ixl_vf_setup_vsi(pf, vf); | error = ixl_vf_setup_vsi(pf, vf); | ||||
if (error != 0) | if (error != 0) | ||||
goto out; | goto out; | ||||
vf->vf_flags |= VF_FLAG_VLAN_CAP; | |||||
ixl_reset_vf(pf, vf); | ixl_reset_vf(pf, vf); | ||||
out: | out: | ||||
IXL_PF_UNLOCK(pf); | IXL_PF_UNLOCK(pf); | ||||
return (error); | return (error); | ||||
} | } | ||||
#endif /* PCI_IOV */ | #endif /* PCI_IOV */ |