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

Function vnic_dev_flowman_enable

dpdk/drivers/net/enic/base/vnic_dev.c:589–648  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

587}
588
589static int vnic_dev_flowman_enable(struct vnic_dev *vdev, uint32_t *mode,
590 uint8_t *filter_actions)
591{
592 char name[RTE_MEMZONE_NAMESIZE];
593 uint64_t args[3];
594 uint64_t ops;
595 static uint32_t instance;
596
597 /* Advanced filtering is a prerequisite */
598 if (!vnic_dev_capable_adv_filters(vdev))
599 return 0;
600 /* flowman devcmd available? */
601 if (!vnic_dev_capable(vdev, CMD_FLOW_MANAGER_OP))
602 return 0;
603 /* Have the version we are using? */
604 args[0] = FM_API_VERSION_QUERY;
605 if (vnic_dev_flowman_cmd(vdev, args, 1))
606 return 0;
607 if ((args[0] & (1ULL << FM_VERSION)) == 0)
608 return 0;
609 /* Select the version */
610 args[0] = FM_API_VERSION_SELECT;
611 args[1] = FM_VERSION;
612 if (vnic_dev_flowman_cmd(vdev, args, 2))
613 return 0;
614 /* Can we get fm_info? */
615 if (!vdev->flowman_info) {
616 snprintf((char *)name, sizeof(name), "vnic_fm_info-%u",
617 instance++);
618 vdev->flowman_info = vdev->alloc_consistent(vdev->priv,
619 sizeof(struct fm_info),
620 &vdev->flowman_info_pa, (uint8_t *)name);
621 if (!vdev->flowman_info)
622 return 0;
623 }
624 args[0] = FM_INFO_QUERY;
625 args[1] = vdev->flowman_info_pa;
626 args[2] = sizeof(struct fm_info);
627 if (vnic_dev_flowman_cmd(vdev, args, 3))
628 return 0;
629 /* Have required operations? */
630 ops = (1ULL << FMOP_END) |
631 (1ULL << FMOP_DROP) |
632 (1ULL << FMOP_RQ_STEER) |
633 (1ULL << FMOP_EXACT_MATCH) |
634 (1ULL << FMOP_MARK) |
635 (1ULL << FMOP_TAG) |
636 (1ULL << FMOP_EG_HAIRPIN) |
637 (1ULL << FMOP_ENCAP) |
638 (1ULL << FMOP_DECAP_NOSTRIP);
639 if ((vdev->flowman_info->fm_op_mask & ops) != ops)
640 return 0;
641 /* Good to use flowman now */
642 *mode = FILTER_FLOWMAN;
643 *filter_actions = FILTER_ACTION_RQ_STEERING_FLAG |
644 FILTER_ACTION_FILTER_ID_FLAG |
645 FILTER_ACTION_COUNTER_FLAG |
646 FILTER_ACTION_DROP_FLAG;

Callers 1

Calls 4

vnic_dev_capableFunction · 0.85
vnic_dev_flowman_cmdFunction · 0.85
snprintfFunction · 0.85

Tested by

no test coverage detected