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

Function ngbe_set_vf_mc_promisc

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

Source from the content-addressed store, hash-verified

518}
519
520static int
521ngbe_set_vf_mc_promisc(struct rte_eth_dev *eth_dev,
522 uint32_t vf, uint32_t *msgbuf)
523{
524 struct ngbe_vf_info *vfinfo = *(NGBE_DEV_VFDATA(eth_dev));
525 struct ngbe_hw *hw = ngbe_dev_hw(eth_dev);
526 int xcast_mode = msgbuf[1]; /* msgbuf contains the flag to enable */
527 u32 vmolr, fctrl, disable, enable;
528
529 switch (vfinfo[vf].api_version) {
530 case ngbe_mbox_api_12:
531 /* promisc introduced in 1.3 version */
532 if (xcast_mode == NGBEVF_XCAST_MODE_PROMISC)
533 return -EOPNOTSUPP;
534 break;
535 /* Fall threw */
536 case ngbe_mbox_api_13:
537 break;
538 default:
539 return -1;
540 }
541
542 if (vfinfo[vf].xcast_mode == xcast_mode)
543 goto out;
544
545 switch (xcast_mode) {
546 case NGBEVF_XCAST_MODE_NONE:
547 disable = NGBE_POOLETHCTL_BCA | NGBE_POOLETHCTL_MCHA |
548 NGBE_POOLETHCTL_MCP | NGBE_POOLETHCTL_UCP |
549 NGBE_POOLETHCTL_VLP;
550 enable = 0;
551 break;
552 case NGBEVF_XCAST_MODE_MULTI:
553 disable = NGBE_POOLETHCTL_MCP | NGBE_POOLETHCTL_UCP |
554 NGBE_POOLETHCTL_VLP;
555 enable = NGBE_POOLETHCTL_BCA | NGBE_POOLETHCTL_MCHA;
556 break;
557 case NGBEVF_XCAST_MODE_ALLMULTI:
558 disable = NGBE_POOLETHCTL_UCP | NGBE_POOLETHCTL_VLP;
559 enable = NGBE_POOLETHCTL_BCA | NGBE_POOLETHCTL_MCHA |
560 NGBE_POOLETHCTL_MCP;
561 break;
562 case NGBEVF_XCAST_MODE_PROMISC:
563 fctrl = rd32(hw, NGBE_PSRCTL);
564 if (!(fctrl & NGBE_PSRCTL_UCP)) {
565 /* VF promisc requires PF in promisc */
566 PMD_DRV_LOG(ERR,
567 "Enabling VF promisc requires PF in promisc");
568 return -1;
569 }
570
571 disable = 0;
572 enable = NGBE_POOLETHCTL_BCA | NGBE_POOLETHCTL_MCHA |
573 NGBE_POOLETHCTL_MCP | NGBE_POOLETHCTL_UCP |
574 NGBE_POOLETHCTL_VLP;
575 break;
576 default:
577 return -1;

Callers 1

ngbe_rcv_msg_from_vfFunction · 0.85

Calls 3

ngbe_dev_hwFunction · 0.85
rd32Function · 0.50
wr32Function · 0.50

Tested by

no test coverage detected