Lines Matching +full:num +full:- +full:macs

32  * ----------------------
36 * - PR223573 multicast rx filter
37 * - PR223575 non-promiscuous mode (driver currently forces promisc)
89 /* Structure to be used by the SR-IOV for VF configuration schemas */
116 /* MSI-X */
138 /* PCI SR-IOV interface */
196 nic->dev = dev; in nicpf_attach()
208 nic->node = nic_get_node_id(nic->reg_base); in nicpf_attach()
211 nic->flags &= ~NIC_TNS_ENABLED; in nicpf_attach()
218 nic->rss_ind_tbl_size = NIC_MAX_RSS_IDR_TBL_SIZE; in nicpf_attach()
230 if (nic->flags & NIC_TNS_ENABLED) in nicpf_attach()
233 mtx_init(&nic->check_link_mtx, "VNIC PF link poll", NULL, MTX_DEF); in nicpf_attach()
235 callout_init_mtx(&nic->check_link, &nic->check_link_mtx, 0); in nicpf_attach()
236 mtx_lock(&nic->check_link_mtx); in nicpf_attach()
238 mtx_unlock(&nic->check_link_mtx); in nicpf_attach()
260 callout_drain(&nic->check_link); in nicpf_detach()
261 mtx_destroy(&nic->check_link_mtx); in nicpf_detach()
270 device_printf(dev, "SR-IOV in use. Detach first.\n"); in nicpf_detach()
276 * SR-IOV interface
289 nic->flags |= NIC_SRIOV_ENABLED; in nicpf_iov_init()
311 if ((nic->flags & NIC_SRIOV_ENABLED) == 0) in nicpf_iov_add_vf()
314 if (vfnum > (nic->num_vf_en - 1)) in nicpf_iov_add_vf()
317 if (nvlist_exists_binary(params, "mac-addr") != 0) { in nicpf_iov_add_vf()
318 mac = nvlist_get_binary(params, "mac-addr", &size); in nicpf_iov_add_vf()
319 bgx = NIC_GET_BGX_FROM_VF_LMAC_MAP(nic->vf_lmac_map[vfnum]); in nicpf_iov_add_vf()
320 lmac = NIC_GET_LMAC_FROM_VF_LMAC_MAP(nic->vf_lmac_map[vfnum]); in nicpf_iov_add_vf()
321 bgx_set_lmac_mac(nic->node, bgx, lmac, mac); in nicpf_iov_add_vf()
337 dev = nic->dev; in nicpf_alloc_res()
340 nic->reg_base = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, in nicpf_alloc_res()
342 if (nic->reg_base == NULL) { in nicpf_alloc_res()
359 dev = nic->dev; in nicpf_free_res()
361 if (nic->reg_base != NULL) { in nicpf_free_res()
363 rman_get_rid(nic->reg_base), nic->reg_base); in nicpf_free_res()
373 bus_write_8(nic->reg_base, offset, val); in nic_reg_write()
381 val = bus_read_8(nic->reg_base, offset); in nic_reg_read()
385 /* PF -> VF mailbox communication APIs */
425 if (pass1_silicon(nic->dev)) { in nic_send_msg_to_vf()
449 if (nic->flags & NIC_TNS_ENABLED) in nic_mbx_send_ready()
455 bgx_idx = NIC_GET_BGX_FROM_VF_LMAC_MAP(nic->vf_lmac_map[vf]); in nic_mbx_send_ready()
456 lmac = NIC_GET_LMAC_FROM_VF_LMAC_MAP(nic->vf_lmac_map[vf]); in nic_mbx_send_ready()
458 mac = bgx_get_lmac_mac(nic->node, bgx_idx, lmac); in nic_mbx_send_ready()
464 mbx.nic_cfg.node_id = nic->node; in nic_mbx_send_ready()
512 timeout--; in nic_rcv_queue_sw_sync()
516 device_printf(nic->dev, "Receive queue software sync failed\n"); in nic_rcv_queue_sw_sync()
529 bgx_idx = NIC_GET_BGX_FROM_VF_LMAC_MAP(nic->vf_lmac_map[bgx->vf_id]); in nic_get_bgx_stats()
530 lmac = NIC_GET_LMAC_FROM_VF_LMAC_MAP(nic->vf_lmac_map[bgx->vf_id]); in nic_get_bgx_stats()
533 mbx.bgx_stats.vf_id = bgx->vf_id; in nic_get_bgx_stats()
534 mbx.bgx_stats.rx = bgx->rx; in nic_get_bgx_stats()
535 mbx.bgx_stats.idx = bgx->idx; in nic_get_bgx_stats()
536 if (bgx->rx != 0) { in nic_get_bgx_stats()
538 bgx_get_rx_stats(nic->node, bgx_idx, lmac, bgx->idx); in nic_get_bgx_stats()
541 bgx_get_tx_stats(nic->node, bgx_idx, lmac, bgx->idx); in nic_get_bgx_stats()
543 nic_send_msg_to_vf(nic, bgx->vf_id, &mbx); in nic_get_bgx_stats()
552 device_printf(nic->dev, in nic_update_hw_frs()
559 if (new_frs <= nic->pkind.maxlen) in nic_update_hw_frs()
562 nic->pkind.maxlen = new_frs; in nic_update_hw_frs()
563 nic_reg_write(nic, NIC_PF_PKIND_0_15_CFG, *(uint64_t *)&nic->pkind); in nic_update_hw_frs()
593 unsigned bgx_map = bgx_get_map(nic->node); in nic_set_lmac_vf_mapping()
598 nic->num_vf_en = 0; in nic_set_lmac_vf_mapping()
599 if (nic->flags & NIC_TNS_ENABLED) { in nic_set_lmac_vf_mapping()
600 nic->num_vf_en = DEFAULT_NUM_VF_ENABLED; in nic_set_lmac_vf_mapping()
607 lmac_cnt = bgx_get_lmac_count(nic->node, bgx); in nic_set_lmac_vf_mapping()
609 nic->vf_lmac_map[next_bgx_lmac++] = in nic_set_lmac_vf_mapping()
611 nic->num_vf_en += lmac_cnt; in nic_set_lmac_vf_mapping()
617 lmac_credit |= (((((48 * 1024) / lmac_cnt) - in nic_set_lmac_vf_mapping()
643 if (nic->flags & NIC_TNS_ENABLED) { in nic_init_hw()
666 nic->pkind.minlen = 0; in nic_init_hw()
667 nic->pkind.maxlen = NIC_HW_MAX_FRS + ETHER_HDR_LEN; in nic_init_hw()
668 nic->pkind.lenerr_en = 1; in nic_init_hw()
669 nic->pkind.rx_hdr = 0; in nic_init_hw()
670 nic->pkind.hdr_sl = 0; in nic_init_hw()
674 *(uint64_t *)&nic->pkind); in nic_init_hw()
696 vnic = cfg->vf_id; in nic_config_cpi()
697 bgx = NIC_GET_BGX_FROM_VF_LMAC_MAP(nic->vf_lmac_map[vnic]); in nic_config_cpi()
698 lmac = NIC_GET_LMAC_FROM_VF_LMAC_MAP(nic->vf_lmac_map[vnic]); in nic_config_cpi()
702 rssi_base = (lmac * nic->rss_ind_tbl_size) + (bgx * NIC_RSSI_PER_BGX); in nic_config_cpi()
708 ((uint64_t)cfg->cpi_alg << 62) | (cpi_base << 48)); in nic_config_cpi()
710 if (cfg->cpi_alg == CPI_ALG_NONE) in nic_config_cpi()
712 else if (cfg->cpi_alg == CPI_ALG_VLAN) /* 3 bits of PCP */ in nic_config_cpi()
714 else if (cfg->cpi_alg == CPI_ALG_VLAN16) /* 3 bits PCP + DEI */ in nic_config_cpi()
716 else if (cfg->cpi_alg == CPI_ALG_DIFF) /* 6bits DSCP */ in nic_config_cpi()
720 qset = cfg->vf_id; in nic_config_cpi()
722 for (; rssi < (rssi_base + cfg->rq_cnt); rssi++) { in nic_config_cpi()
732 if (cfg->cpi_alg != CPI_ALG_DIFF) in nic_config_cpi()
738 if (pass1_silicon(nic->dev)) { in nic_config_cpi()
750 if ((rssi + 1) >= cfg->rq_cnt) in nic_config_cpi()
753 if (cfg->cpi_alg == CPI_ALG_VLAN) in nic_config_cpi()
755 else if (cfg->cpi_alg == CPI_ALG_VLAN16) in nic_config_cpi()
756 rssi = ((cpi - cpi_base) & 0xe) >> 1; in nic_config_cpi()
757 else if (cfg->cpi_alg == CPI_ALG_DIFF) in nic_config_cpi()
758 rssi = ((cpi - cpi_base) & 0x38) >> 3; in nic_config_cpi()
760 nic->cpi_base[cfg->vf_id] = cpi_base; in nic_config_cpi()
761 nic->rssi_base[cfg->vf_id] = rssi_base; in nic_config_cpi()
771 mbx.rss_size.ind_tbl_size = nic->rss_ind_tbl_size; in nic_send_rss_size()
778 * - RSS index
779 * - indir table i.e hash::RQ mapping
780 * - no of hash bits to consider
790 rssi_base = nic->rssi_base[cfg->vf_id] + cfg->tbl_offset; in nic_config_rss()
793 qset = cfg->vf_id; in nic_config_rss()
795 for (; rssi < (rssi_base + cfg->tbl_len); rssi++) { in nic_config_rss()
797 (qset << 3) | (cfg->ind_tbl[idx] & 0x7)); in nic_config_rss()
801 cpi_base = nic->cpi_base[cfg->vf_id]; in nic_config_rss()
802 if (pass1_silicon(nic->dev)) in nic_config_rss()
808 cpi_cfg |= (cfg->hash_bits << 20); in nic_config_rss()
817 * VNIC0-SQ0 -> TL4(0) -> TL3[0] -> TL2[0] -> TL1[0] -> BGX0
818 * VNIC1-SQ0 -> TL4(8) -> TL3[2] -> TL2[0] -> TL1[0] -> BGX0
819 * VNIC2-SQ0 -> TL4(16) -> TL3[4] -> TL2[1] -> TL1[0] -> BGX0
820 * VNIC3-SQ0 -> TL4(24) -> TL3[6] -> TL2[1] -> TL1[0] -> BGX0
821 * VNIC4-SQ0 -> TL4(512) -> TL3[128] -> TL2[32] -> TL1[1] -> BGX1
822 * VNIC5-SQ0 -> TL4(520) -> TL3[130] -> TL2[32] -> TL1[1] -> BGX1
823 * VNIC6-SQ0 -> TL4(528) -> TL3[132] -> TL2[33] -> TL1[1] -> BGX1
824 * VNIC7-SQ0 -> TL4(536) -> TL3[134] -> TL2[33] -> TL1[1] -> BGX1
832 uint8_t sq_idx = sq->sq_num; in nic_tx_channel_cfg()
837 bgx = NIC_GET_BGX_FROM_VF_LMAC_MAP(nic->vf_lmac_map[pqs_vnic]); in nic_tx_channel_cfg()
838 lmac = NIC_GET_LMAC_FROM_VF_LMAC_MAP(nic->vf_lmac_map[pqs_vnic]); in nic_tx_channel_cfg()
871 if (lbk->vf_id > MAX_LMAC) in nic_config_loopback()
874 bgx_idx = NIC_GET_BGX_FROM_VF_LMAC_MAP(nic->vf_lmac_map[lbk->vf_id]); in nic_config_loopback()
875 lmac_idx = NIC_GET_LMAC_FROM_VF_LMAC_MAP(nic->vf_lmac_map[lbk->vf_id]); in nic_config_loopback()
877 bgx_lmac_internal_loopback(nic->node, bgx_idx, lmac_idx, lbk->enable); in nic_config_loopback()
895 nic->mbx_lock[vf] = TRUE; in nic_handle_mbx_intr()
910 nic->link[vf] = 0; in nic_handle_mbx_intr()
911 nic->duplex[vf] = 0; in nic_handle_mbx_intr()
912 nic->speed[vf] = 0; in nic_handle_mbx_intr()
918 (mbx.qs.num << NIC_QS_ID_SHIFT); in nic_handle_mbx_intr()
948 nic_tx_channel_cfg(nic, mbx.qs.num, &mbx.sq); in nic_handle_mbx_intr()
952 bgx = NIC_GET_BGX_FROM_VF_LMAC_MAP(nic->vf_lmac_map[lmac]); in nic_handle_mbx_intr()
953 lmac = NIC_GET_LMAC_FROM_VF_LMAC_MAP(nic->vf_lmac_map[lmac]); in nic_handle_mbx_intr()
954 bgx_set_lmac_mac(nic->node, bgx, lmac, mbx.mac.mac_addr); in nic_handle_mbx_intr()
971 nic->vf_info[vf].vf_enabled = TRUE; in nic_handle_mbx_intr()
975 nic->vf_info[vf].vf_enabled = FALSE; in nic_handle_mbx_intr()
984 device_printf(nic->dev, in nic_handle_mbx_intr()
994 nic->mbx_lock[vf] = FALSE; in nic_handle_mbx_intr()
1035 dinfo = device_get_ivars(nic->dev); in nic_enable_msix()
1036 rid = dinfo->cfg.msix.msix_table_bar; in nic_enable_msix()
1037 nic->msix_table_res = in nic_enable_msix()
1038 bus_alloc_resource_any(nic->dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); in nic_enable_msix()
1039 if (nic->msix_table_res == NULL) { in nic_enable_msix()
1040 device_printf(nic->dev, in nic_enable_msix()
1041 "Could not allocate memory for MSI-X table\n"); in nic_enable_msix()
1045 count = nic->num_vec = NIC_PF_MSIX_VECTORS; in nic_enable_msix()
1047 ret = pci_alloc_msix(nic->dev, &count); in nic_enable_msix()
1048 if ((ret != 0) || (count != nic->num_vec)) { in nic_enable_msix()
1049 device_printf(nic->dev, in nic_enable_msix()
1051 nic->num_vec, ret); in nic_enable_msix()
1055 nic->msix_enabled = 1; in nic_enable_msix()
1062 if (nic->msix_enabled) { in nic_disable_msix()
1063 pci_release_msi(nic->dev); in nic_disable_msix()
1064 nic->msix_enabled = 0; in nic_disable_msix()
1065 nic->num_vec = 0; in nic_disable_msix()
1068 bus_release_resource(nic->dev, SYS_RES_MEMORY, in nic_disable_msix()
1069 rman_get_rid(nic->msix_table_res), nic->msix_table_res); in nic_disable_msix()
1077 for (irq = 0; irq < nic->num_vec; irq++) { in nic_free_all_interrupts()
1078 if (nic->msix_entries[irq].irq_res == NULL) in nic_free_all_interrupts()
1080 if (nic->msix_entries[irq].handle != NULL) { in nic_free_all_interrupts()
1081 bus_teardown_intr(nic->dev, in nic_free_all_interrupts()
1082 nic->msix_entries[irq].irq_res, in nic_free_all_interrupts()
1083 nic->msix_entries[irq].handle); in nic_free_all_interrupts()
1086 bus_release_resource(nic->dev, SYS_RES_IRQ, irq + 1, in nic_free_all_interrupts()
1087 nic->msix_entries[irq].irq_res); in nic_free_all_interrupts()
1097 /* Enable MSI-X */ in nic_register_interrupts()
1105 nic->msix_entries[irq].irq_res = bus_alloc_resource_any(nic->dev, in nic_register_interrupts()
1107 if (nic->msix_entries[irq].irq_res == NULL) { in nic_register_interrupts()
1111 ret = bus_setup_intr(nic->dev, nic->msix_entries[irq].irq_res, in nic_register_interrupts()
1113 &nic->msix_entries[irq].handle); in nic_register_interrupts()
1119 nic->msix_entries[irq].irq_res = bus_alloc_resource_any(nic->dev, in nic_register_interrupts()
1121 if (nic->msix_entries[irq].irq_res == NULL) { in nic_register_interrupts()
1125 ret = bus_setup_intr(nic->dev, nic->msix_entries[irq].irq_res, in nic_register_interrupts()
1127 &nic->msix_entries[irq].handle); in nic_register_interrupts()
1159 "SR-IOV capability is not found in PCIe config space\n"); in nic_sriov_init()
1162 /* Fix-up the number of enabled VFs */ in nic_sriov_init()
1167 /* Attach SR-IOV */ in nic_sriov_init()
1170 pci_iov_schema_add_unicast_mac(vf_schema, "mac-addr", 0, NULL); in nic_sriov_init()
1172 * All VFs can change their MACs. in nic_sriov_init()
1175 pci_iov_schema_add_bool(vf_schema, "allow-set-mac", in nic_sriov_init()
1181 "Failed to initialize SR-IOV (error=%d)\n", in nic_sriov_init()
1206 for (vf = 0; vf < nic->num_vf_en; vf++) { in nic_poll_for_link()
1208 if (!nic->vf_info[vf].vf_enabled) in nic_poll_for_link()
1212 bgx = NIC_GET_BGX_FROM_VF_LMAC_MAP(nic->vf_lmac_map[vf]); in nic_poll_for_link()
1213 lmac = NIC_GET_LMAC_FROM_VF_LMAC_MAP(nic->vf_lmac_map[vf]); in nic_poll_for_link()
1215 bgx_get_lmac_link_state(nic->node, bgx, lmac, &link); in nic_poll_for_link()
1218 if (nic->link[vf] == link.link_up) in nic_poll_for_link()
1221 if (!nic->mbx_lock[vf]) { in nic_poll_for_link()
1222 nic->link[vf] = link.link_up; in nic_poll_for_link()
1223 nic->duplex[vf] = link.duplex; in nic_poll_for_link()
1224 nic->speed[vf] = link.speed; in nic_poll_for_link()
1233 callout_reset(&nic->check_link, hz * 2, nic_poll_for_link, nic); in nic_poll_for_link()