MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ngbe_vf_set_multicast

Function ngbe_vf_set_multicast

dpdk/drivers/net/ngbe/ngbe_pf.c:378–426  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

376}
377
378static int
379ngbe_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
428static int
429ngbe_vf_set_vlan(struct rte_eth_dev *eth_dev, uint32_t vf, uint32_t *msgbuf)

Callers 1

ngbe_rcv_msg_from_vfFunction · 0.85

Calls 4

ngbe_dev_hwFunction · 0.85
rd32Function · 0.50
wr32Function · 0.50

Tested by

no test coverage detected