X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fixgbe%2Fixgbe_pf.c;h=833863af5aa6389ce21eff5b5b3a316f8e287704;hb=b54a1781d267bd52812eb79ab43b34a452578632;hp=493f0f2b9a8f79cc5de6f612295203cd9392d216;hpb=3c42701875186bd8e3d906ee8f897e33f2624f38;p=dpdk.git diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c index 493f0f2b9a..833863af5a 100644 --- a/drivers/net/ixgbe/ixgbe_pf.c +++ b/drivers/net/ixgbe/ixgbe_pf.c @@ -66,7 +66,7 @@ ixgbe_mb_intr_setup(struct rte_eth_dev *dev) return 0; } -void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev) +int ixgbe_pf_host_init(struct rte_eth_dev *eth_dev) { struct ixgbe_vf_info **vfinfo = IXGBE_DEV_PRIVATE_TO_P_VFDATA(eth_dev->data->dev_private); @@ -78,19 +78,30 @@ void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev) IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); uint16_t vf_num; uint8_t nb_queue; + int ret = 0; PMD_INIT_FUNC_TRACE(); RTE_ETH_DEV_SRIOV(eth_dev).active = 0; vf_num = dev_num_vf(eth_dev); if (vf_num == 0) - return; + return ret; *vfinfo = rte_zmalloc("vf_info", sizeof(struct ixgbe_vf_info) * vf_num, 0); - if (*vfinfo == NULL) - rte_panic("Cannot allocate memory for private VF data\n"); + if (*vfinfo == NULL) { + PMD_INIT_LOG(ERR, + "Cannot allocate memory for private VF data"); + return -ENOMEM; + } - rte_eth_switch_domain_alloc(&(*vfinfo)->switch_domain_id); + ret = rte_eth_switch_domain_alloc(&(*vfinfo)->switch_domain_id); + if (ret) { + PMD_INIT_LOG(ERR, + "failed to allocate switch domain for device %d", ret); + rte_free(*vfinfo); + *vfinfo = NULL; + return ret; + } memset(mirror_info, 0, sizeof(struct ixgbe_mirror_info)); memset(uta_info, 0, sizeof(struct ixgbe_uta_info)); @@ -118,6 +129,8 @@ void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev) /* set mb interrupt mask */ ixgbe_mb_intr_setup(eth_dev); + + return ret; } void ixgbe_pf_host_uninit(struct rte_eth_dev *eth_dev) @@ -772,9 +785,6 @@ ixgbe_set_vf_macvlan_msg(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) IXGBE_VT_MSGINFO_SHIFT; if (index) { - if (new_mac == NULL) - return -1; - if (!rte_is_valid_assigned_ether_addr( (struct rte_ether_addr *)new_mac)) { PMD_DRV_LOG(ERR, "set invalid mac vf:%d\n", vf); @@ -786,8 +796,10 @@ ixgbe_set_vf_macvlan_msg(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) hw->mac.ops.set_rar(hw, vf_info[vf].mac_count, new_mac, vf, IXGBE_RAH_AV); } else { - hw->mac.ops.clear_rar(hw, vf_info[vf].mac_count); - vf_info[vf].mac_count = 0; + if (vf_info[vf].mac_count) { + hw->mac.ops.clear_rar(hw, vf_info[vf].mac_count); + vf_info[vf].mac_count = 0; + } } return 0; } @@ -833,7 +845,7 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf) vfinfo[vf].clear_to_send = true; /* notify application about VF reset */ - _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX, + rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX, &ret_param); return ret; } @@ -845,8 +857,7 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf) * if 0, do nothing and send ACK to VF * if ret_param.retval > 1, do nothing and send NAK to VF */ - _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX, - &ret_param); + rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_VF_MBOX, &ret_param); retval = ret_param.retval;