cint_reset(); int cint_field_group_create(int unit, bcm_field_group_t grp) { int rv; bcm_field_qset_t qset; bcm_field_aset_t aset; BCM_FIELD_QSET_INIT(qset); BCM_FIELD_QSET_ADD(qset,bcmFieldQualifyDstMac); BCM_FIELD_QSET_ADD(qset, bcmFieldQualifyStageIngress); BCM_FIELD_ASET_INIT(aset); BCM_FIELD_ASET_ADD(aset, bcmFieldActionCopyToCpu); rv = bcm_field_group_create_mode_id(unit, qset, 103, bcmFieldGroupModeAuto, grp); if (rv != BCM_E_NONE) { printf("bcm_field_group_create_mode_id failed, rv = %d\r\n", rv); return -1; } printf("cint_field_group_create success!!!, rv = %d\r\n", rv); bcm_field_group_dump(unit,grp); return 0; } int cint_field_entry_create1(int unit, bcm_field_group_t grp,bcm_field_entry_t entry) { int rv; bcm_mac_t dst_mac = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; bcm_mac_t mac_mask = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; rv = bcm_field_entry_create_id(unit, grp, entry); if (rv != BCM_E_NONE) { printf("bcm_field_entry_create_id failed, rv = %d\r\n", rv); return -1; } rv =bcm_field_qualify_DstMac(unit, entry, dst_mac, mac_mask); if (rv != BCM_E_NONE) { printf("bcm_field_qualify_DstMac failed,ret = %d\r\n", rv); bcm_field_entry_destroy(unit, entry); return -1; } rv = bcm_field_action_add(unit, entry, bcmFieldActionCopyToCpu, 1, 0); if (rv != BCM_E_NONE) { printf("bcm_field_action_add failed, rv = %d \r\n", rv); bcm_field_entry_destroy(unit, entry); return -1; } rv = bcm_field_action_add(unit, entry, bcmFieldActionDrop, 1, 0); if (rv != BCM_E_NONE) { printf("bcm_field_action_add failed, rv = %d \r\n", rv); bcm_field_entry_destroy(unit, entry); return -1; } rv = bcm_field_entry_install(unit, entry); if (rv != BCM_E_NONE) { printf("bcm_field_entry_install failed,ret = %d\r\n", rv); bcm_field_entry_destroy(unit, entry); return -1; } printf("********************* BEGIN ****************************\r\n"); bcm_field_entry_dump(unit, entry); printf("*********************** END ****************************\r\n"); return 0; } cint_field_group_create(0,5); cint_field_entry_create1(0,5,2048); //bcm_field_entry_destroy(0, 2048); //bcm_field_group_destroy(0, 5);