Lines Matching defs:fbd
53 void fbnic_rss_disable_hw(struct fbnic_dev *fbd)
56 if (!fbnic_bmc_present(fbd))
57 wr32(fbd, FBNIC_RPC_RMI_CONFIG,
78 void fbnic_rss_reinit_hw(struct fbnic_dev *fbd, struct fbnic_net *fbn)
83 wr32(fbd, FBNIC_RPC_RSS_TBL(0, i), fbn->indir_tbl[0][i]);
84 wr32(fbd, FBNIC_RPC_RSS_TBL(1, i), fbn->indir_tbl[1][i]);
88 wr32(fbd, FBNIC_RPC_RSS_KEY(i), fbn->rss_key[i]);
91 wr32(fbd, FBNIC_RPC_ACT_TBL0_DEFAULT, FBNIC_RPC_ACT_TBL0_DROP);
92 wrfl(fbd);
94 wr32(fbd, FBNIC_RPC_ACT_TBL1_DEFAULT, 0);
97 wr32(fbd, FBNIC_RPC_RMI_CONFIG,
103 void fbnic_bmc_rpc_all_multi_config(struct fbnic_dev *fbd,
116 mac_addr = &fbd->mac_addr[fbd->mac_addr_boundary - 1];
117 if (fbnic_bmc_present(fbd) && fbd->fw_cap.all_multi) {
146 act_tcam = &fbd->act_tcam[FBNIC_RPC_ACT_TBL_BMC_ALL_MULTI_OFFSET];
151 if (!fbnic_bmc_present(fbd) || !fbd->fw_cap.all_multi || enable_host) {
165 fbd->mac_addr_boundary - 1) |
177 void fbnic_bmc_rpc_init(struct fbnic_dev *fbd)
185 if (!fbnic_bmc_present(fbd))
190 u8 *bmc_mac = fbd->fw_cap.bmc_mac_addr[j];
197 mac_addr = __fbnic_mc_sync(fbd, bmc_mac);
199 mac_addr = &fbd->mac_addr[i++];
202 netdev_err(fbd->netdev,
215 mac_addr = &fbd->mac_addr[FBNIC_RPC_TCAM_MACDA_BROADCAST_IDX];
221 act_tcam = &fbd->act_tcam[FBNIC_RPC_ACT_TBL_BMC_OFFSET];
240 fbnic_bmc_rpc_all_multi_config(fbd, false);
255 void fbnic_rss_reinit(struct fbnic_dev *fbd, struct fbnic_net *fbn)
299 for (i = fbnic_bmc_present(fbd) ? 0 : FBNIC_RSS_EN_NUM_UNICAST;
302 struct fbnic_act_tcam *act_tcam = &fbd->act_tcam[idx];
315 if (i >= FBNIC_RSS_EN_NUM_UNICAST && fbnic_bmc_present(fbd))
343 fbd->mac_addr_boundary);
359 struct fbnic_mac_addr *__fbnic_uc_sync(struct fbnic_dev *fbd,
369 for (i = fbd->mac_addr_boundary - 1;
371 struct fbnic_mac_addr *mac_addr = &fbd->mac_addr[i];
390 struct fbnic_mac_addr *__fbnic_mc_sync(struct fbnic_dev *fbd,
400 for (i = fbd->mac_addr_boundary;
402 struct fbnic_mac_addr *mac_addr = &fbd->mac_addr[i];
416 struct fbnic_mac_addr *mac_addr = &fbd->mac_addr[i];
455 void fbnic_sift_macda(struct fbnic_dev *fbd)
463 src < fbd->mac_addr_boundary;) {
464 struct fbnic_mac_addr *dest_addr = &fbd->mac_addr[dest];
469 while (src < fbd->mac_addr_boundary) {
470 struct fbnic_mac_addr *src_addr = &fbd->mac_addr[src++];
497 static void fbnic_clear_macda_entry(struct fbnic_dev *fbd, unsigned int idx)
503 wr32(fbd, FBNIC_RPC_TCAM_MACDA(idx, i), 0);
506 static void fbnic_clear_macda(struct fbnic_dev *fbd)
510 for (idx = ARRAY_SIZE(fbd->mac_addr); idx--;) {
511 struct fbnic_mac_addr *mac_addr = &fbd->mac_addr[idx];
517 if (fbnic_bmc_present(fbd))
519 dev_warn_once(fbd->dev,
523 fbnic_clear_macda_entry(fbd, idx);
538 static void fbnic_write_macda_entry(struct fbnic_dev *fbd, unsigned int idx,
548 wr32(fbd, FBNIC_RPC_TCAM_MACDA(idx, i),
552 wrfl(fbd);
554 wr32(fbd, FBNIC_RPC_TCAM_MACDA(idx, i), FBNIC_RPC_TCAM_VALIDATE);
557 void fbnic_write_macda(struct fbnic_dev *fbd)
561 for (idx = ARRAY_SIZE(fbd->mac_addr); idx--;) {
562 struct fbnic_mac_addr *mac_addr = &fbd->mac_addr[idx];
571 fbnic_clear_macda_entry(fbd, idx);
577 fbnic_write_macda_entry(fbd, idx, mac_addr);
583 static void fbnic_clear_act_tcam(struct fbnic_dev *fbd, unsigned int idx)
589 wr32(fbd, FBNIC_RPC_TCAM_ACT(idx, i), 0);
592 static void fbnic_clear_tce_tcam_entry(struct fbnic_dev *fbd, unsigned int idx)
598 wr32(fbd, FBNIC_TCE_RAM_TCAM(idx, i), 0);
601 static void fbnic_write_tce_tcam_dest(struct fbnic_dev *fbd, unsigned int idx,
610 idx2dest_map = rd32(fbd, FBNIC_TCE_TCAM_IDX2DEST_MAP);
614 wr32(fbd, FBNIC_TCE_TCAM_IDX2DEST_MAP, idx2dest_map);
617 static void fbnic_write_tce_tcam_entry(struct fbnic_dev *fbd, unsigned int idx,
627 wr32(fbd, FBNIC_TCE_RAM_TCAM(idx, i),
631 wrfl(fbd);
633 wr32(fbd, FBNIC_TCE_RAM_TCAM3(idx), FBNIC_TCE_RAM_TCAM3_MCQ_MASK |
638 static void __fbnic_write_tce_tcam_rev(struct fbnic_dev *fbd)
643 for (mac_idx = ARRAY_SIZE(fbd->mac_addr); mac_idx--;) {
644 struct fbnic_mac_addr *mac_addr = &fbd->mac_addr[mac_idx];
651 dev_err(fbd->dev, "TCE TCAM overflow\n");
656 fbnic_write_tce_tcam_dest(fbd, tcam_idx, mac_addr);
657 fbnic_write_tce_tcam_entry(fbd, tcam_idx, mac_addr);
661 fbnic_clear_tce_tcam_entry(fbd, --tcam_idx);
663 fbd->tce_tcam_last = tcam_idx;
666 static void __fbnic_write_tce_tcam(struct fbnic_dev *fbd)
671 for (mac_idx = 0; mac_idx < ARRAY_SIZE(fbd->mac_addr); mac_idx++) {
672 struct fbnic_mac_addr *mac_addr = &fbd->mac_addr[mac_idx];
679 dev_err(fbd->dev, "TCE TCAM overflow\n");
683 fbnic_write_tce_tcam_dest(fbd, tcam_idx, mac_addr);
684 fbnic_write_tce_tcam_entry(fbd, tcam_idx, mac_addr);
689 fbnic_clear_tce_tcam_entry(fbd, tcam_idx++);
691 fbd->tce_tcam_last = tcam_idx;
694 void fbnic_write_tce_tcam(struct fbnic_dev *fbd)
696 if (fbd->tce_tcam_last)
697 __fbnic_write_tce_tcam_rev(fbd);
699 __fbnic_write_tce_tcam(fbd);
702 struct fbnic_ip_addr *__fbnic_ip4_sync(struct fbnic_dev *fbd,
769 struct fbnic_ip_addr *__fbnic_ip6_sync(struct fbnic_dev *fbd,
858 static void fbnic_clear_ip_src_entry(struct fbnic_dev *fbd, unsigned int idx)
864 wr32(fbd, FBNIC_RPC_TCAM_IPSRC(idx, i), 0);
867 static void fbnic_clear_ip_dst_entry(struct fbnic_dev *fbd, unsigned int idx)
873 wr32(fbd, FBNIC_RPC_TCAM_IPDST(idx, i), 0);
876 static void fbnic_clear_ip_outer_src_entry(struct fbnic_dev *fbd,
883 wr32(fbd, FBNIC_RPC_TCAM_OUTER_IPSRC(idx, i), 0);
886 static void fbnic_clear_ip_outer_dst_entry(struct fbnic_dev *fbd,
893 wr32(fbd, FBNIC_RPC_TCAM_OUTER_IPDST(idx, i), 0);
896 static void fbnic_write_ip_src_entry(struct fbnic_dev *fbd, unsigned int idx,
906 wr32(fbd, FBNIC_RPC_TCAM_IPSRC(idx, i),
909 wrfl(fbd);
912 wr32(fbd, FBNIC_RPC_TCAM_IPSRC(idx, i),
916 static void fbnic_write_ip_dst_entry(struct fbnic_dev *fbd, unsigned int idx,
926 wr32(fbd, FBNIC_RPC_TCAM_IPDST(idx, i),
929 wrfl(fbd);
932 wr32(fbd, FBNIC_RPC_TCAM_IPDST(idx, i),
936 static void fbnic_write_ip_outer_src_entry(struct fbnic_dev *fbd,
947 wr32(fbd, FBNIC_RPC_TCAM_OUTER_IPSRC(idx, i),
950 wrfl(fbd);
952 wr32(fbd, FBNIC_RPC_TCAM_OUTER_IPSRC(idx, i), FBNIC_RPC_TCAM_VALIDATE);
955 static void fbnic_write_ip_outer_dst_entry(struct fbnic_dev *fbd,
966 wr32(fbd, FBNIC_RPC_TCAM_OUTER_IPDST(idx, i),
969 wrfl(fbd);
971 wr32(fbd, FBNIC_RPC_TCAM_OUTER_IPDST(idx, i), FBNIC_RPC_TCAM_VALIDATE);
974 void fbnic_write_ip_addr(struct fbnic_dev *fbd)
978 for (idx = ARRAY_SIZE(fbd->ip_src); idx--;) {
979 struct fbnic_ip_addr *ip_addr = &fbd->ip_src[idx];
988 fbnic_clear_ip_src_entry(fbd, idx);
994 fbnic_write_ip_src_entry(fbd, idx, ip_addr);
1000 for (idx = ARRAY_SIZE(fbd->ip_dst); idx--;) {
1001 struct fbnic_ip_addr *ip_addr = &fbd->ip_dst[idx];
1007 fbnic_clear_ip_dst_entry(fbd, idx);
1013 fbnic_write_ip_dst_entry(fbd, idx, ip_addr);
1018 for (idx = ARRAY_SIZE(fbd->ipo_src); idx--;) {
1019 struct fbnic_ip_addr *ip_addr = &fbd->ipo_src[idx];
1025 fbnic_clear_ip_outer_src_entry(fbd, idx);
1031 fbnic_write_ip_outer_src_entry(fbd, idx, ip_addr);
1036 for (idx = ARRAY_SIZE(fbd->ipo_dst); idx--;) {
1037 struct fbnic_ip_addr *ip_addr = &fbd->ipo_dst[idx];
1043 fbnic_clear_ip_outer_dst_entry(fbd, idx);
1049 fbnic_write_ip_outer_dst_entry(fbd, idx, ip_addr);
1055 void fbnic_clear_rules(struct fbnic_dev *fbd)
1063 fbnic_clear_macda(fbd);
1075 if (fbnic_bmc_present(fbd)) {
1076 act_tcam = &fbd->act_tcam[i];
1080 wr32(fbd, FBNIC_RPC_ACT_TBL0(i), dest);
1081 wr32(fbd, FBNIC_RPC_ACT_TBL1(i), 0);
1091 act_tcam = &fbd->act_tcam[i];
1096 fbnic_clear_act_tcam(fbd, i);
1101 static void fbnic_delete_act_tcam(struct fbnic_dev *fbd, unsigned int idx)
1103 fbnic_clear_act_tcam(fbd, idx);
1104 memset(&fbd->act_tcam[idx], 0, sizeof(struct fbnic_act_tcam));
1107 static void fbnic_update_act_tcam(struct fbnic_dev *fbd, unsigned int idx)
1109 struct fbnic_act_tcam *act_tcam = &fbd->act_tcam[idx];
1113 wr32(fbd, FBNIC_RPC_ACT_TBL0(idx), act_tcam->dest);
1114 wr32(fbd, FBNIC_RPC_ACT_TBL1(idx), act_tcam->rss_en_mask);
1118 wr32(fbd, FBNIC_RPC_TCAM_ACT(idx, i),
1124 wrfl(fbd);
1126 wr32(fbd, FBNIC_RPC_TCAM_ACT(idx, i), FBNIC_RPC_TCAM_VALIDATE);
1130 void fbnic_write_rules(struct fbnic_dev *fbd)
1136 struct fbnic_act_tcam *act_tcam = &fbd->act_tcam[i];
1143 fbnic_delete_act_tcam(fbd, i);
1145 fbnic_update_act_tcam(fbd, i);