| 376 | } |
| 377 | |
| 378 | static int |
| 379 | ngbe_vf_set_multicast(struct rte_eth_dev *eth_dev, |
| 380 | uint32_t vf, uint32_t *msgbuf) |
| 381 | { |
| 382 | struct ngbe_hw *hw = ngbe_dev_hw(eth_dev); |
| 383 | struct ngbe_vf_info *vfinfo = *(NGBE_DEV_VFDATA(eth_dev)); |
| 384 | int nb_entries = (msgbuf[0] & NGBE_VT_MSGINFO_MASK) >> |
| 385 | NGBE_VT_MSGINFO_SHIFT; |
| 386 | uint16_t *hash_list = (uint16_t *)&msgbuf[1]; |
| 387 | uint32_t mta_idx; |
| 388 | uint32_t mta_shift; |
| 389 | const uint32_t NGBE_MTA_INDEX_MASK = 0x7F; |
| 390 | const uint32_t NGBE_MTA_BIT_SHIFT = 5; |
| 391 | const uint32_t NGBE_MTA_BIT_MASK = (0x1 << NGBE_MTA_BIT_SHIFT) - 1; |
| 392 | uint32_t reg_val; |
| 393 | int i; |
| 394 | u32 vmolr = rd32(hw, NGBE_POOLETHCTL(vf)); |
| 395 | |
| 396 | /* Disable multicast promiscuous first */ |
| 397 | ngbe_disable_vf_mc_promisc(eth_dev, vf); |
| 398 | |
| 399 | /* only so many hash values supported */ |
| 400 | nb_entries = RTE_MIN(nb_entries, NGBE_MAX_VF_MC_ENTRIES); |
| 401 | |
| 402 | /* store the mc entries */ |
| 403 | vfinfo->num_vf_mc_hashes = (uint16_t)nb_entries; |
| 404 | for (i = 0; i < nb_entries; i++) |
| 405 | vfinfo->vf_mc_hashes[i] = hash_list[i]; |
| 406 | |
| 407 | if (nb_entries == 0) { |
| 408 | vmolr &= ~NGBE_POOLETHCTL_MCHA; |
| 409 | wr32(hw, NGBE_POOLETHCTL(vf), vmolr); |
| 410 | return 0; |
| 411 | } |
| 412 | |
| 413 | for (i = 0; i < vfinfo->num_vf_mc_hashes; i++) { |
| 414 | mta_idx = (vfinfo->vf_mc_hashes[i] >> NGBE_MTA_BIT_SHIFT) |
| 415 | & NGBE_MTA_INDEX_MASK; |
| 416 | mta_shift = vfinfo->vf_mc_hashes[i] & NGBE_MTA_BIT_MASK; |
| 417 | reg_val = rd32(hw, NGBE_MCADDRTBL(mta_idx)); |
| 418 | reg_val |= (1 << mta_shift); |
| 419 | wr32(hw, NGBE_MCADDRTBL(mta_idx), reg_val); |
| 420 | } |
| 421 | |
| 422 | vmolr |= NGBE_POOLETHCTL_MCHA; |
| 423 | wr32(hw, NGBE_POOLETHCTL(vf), vmolr); |
| 424 | |
| 425 | return 0; |
| 426 | } |
| 427 | |
| 428 | static int |
| 429 | ngbe_vf_set_vlan(struct rte_eth_dev *eth_dev, uint32_t vf, uint32_t *msgbuf) |
no test coverage detected