void print_arp_add(int f, unsigned char *gtw, MV_U8 *mac) { if (f == AF_INET) { printk(KERN_INFO "nfp_arp_add(IPV4, "MV_IPQUAD_FMT" , "MV_MACQUAD_FMT" )\n", MV_IPQUAD(gtw), MV_MACQUAD(mac)); } else { printk(KERN_INFO "nfp_arp_add(IPV6, "MV_IP6_FMT" , "MV_MACQUAD_FMT" )\n", MV_IP6_ARG(gtw), MV_MACQUAD(mac)); } }
static ssize_t hwf_nfp_debug_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) { unsigned int res = 0, err = 0; MV_U32 hit_cntr, val; MV_NFP_CT_KEY key; MV_NFP_CT_INFO info; MV_STATUS status; char protoStr[4]; res = sscanf(buf, "%hhu.%hhu.%hhu.%hhu %hhu.%hhu.%hhu.%hhu %hu %hu %c%c%c %d", key.src_l3, key.src_l3 + 1, key.src_l3 + 2, key.src_l3 + 3, key.dst_l3, key.dst_l3 + 1, key.dst_l3 + 2, key.dst_l3 + 3, &key.sport, &key.dport, protoStr, protoStr + 1, protoStr + 2, &val); key.family = AF_INET; key.proto = get_protocol_num(protoStr); if (!strcmp(attr->attr.name, "hwf_add")) { status = nfp_ct_hwf_set(&key); } else if (!strcmp(attr->attr.name, "hwf_del")) { status = nfp_ct_hwf_clear(&key); } else if (!strcmp(attr->attr.name, "hit_get")) { status = nfp_ct_hit_cntr_get(&key, &hit_cntr); if (status == MV_OK) printk(KERN_INFO "hit_cntr: %d\n", hit_cntr); } else if (!strcmp(attr->attr.name, "hit_set")) { status = nfp_ct_hit_cntr_set(&key, val); } else if (!strcmp(attr->attr.name, "info")) { status = nfp_ct_info_get(&key, &info); if (status != MV_OK) { printk("rule not found\n"); return len; } printk("info-flags: %d\n", info.flags); printk("info-nsip: %d %s VALID\n", info.new_sip, (info.flags & NFP_F_CT_SNAT) ? "" : "NOT"); printk("info-ndip: %d %s VALID\n", info.new_dip, (info.flags & NFP_F_CT_DNAT) ? "" : "NOT"); printk("info-nsport: %d %s VALID\n", info.new_sport, (info.flags & NFP_F_CT_SNAT) ? "" : "NOT"); printk("info-ndport: %d %s VALID\n", info.new_dport, (info.flags & NFP_F_CT_DNAT) ? "" : "NOT"); printk("info-sa: "MV_MACQUAD_FMT" %s VALID\n", MV_MACQUAD(info.sa), !(info.flags & NFP_F_CT_FIB_INV) ? "" : "NOT"); printk("info-da: "MV_MACQUAD_FMT" %s VALID\n", MV_MACQUAD(info.da), !(info.flags & NFP_F_CT_FIB_INV) ? "" : "NOT"); printk("info-out_port: %d %s VALID\n", info.out_port, !(info.flags & NFP_F_CT_FIB_INV) ? "" : "NOT"); #ifdef NFP_CLASSIFY printk("info-mh: %d %s VALID\n", info.mh, (info.flags & NFP_F_CT_SET_MH) ? "" : "NOT"); printk("info-txp: %d %s VALID\n", info.txp, (info.flags & NFP_F_CT_SET_TXP) ? "" : "NOT"); printk("info-txq: %d %s VALID\n", info.txq, (info.flags & NFP_F_CT_SET_TXQ) ? "" : "NOT"); printk("info-dscp: %d %s VALID\n", info.dscp, (info.flags & NFP_F_CT_SET_DSCP) ? "" : "NOT"); printk("info-vprio: %d %s VALID\n", info.vprio, (info.flags & NFP_F_CT_SET_VLAN_PRIO) ? "" : "NOT"); #endif /* NFP_CLASSIFY */ printk("info-processed by: %s\n\n", (info.flags & NFP_F_CT_HWF) ? "HWF" : "NFP"); } return err ? -EINVAL : len; }
static void mvNfpFibRulePrint(NFP_RULE_FIB *fib) { if (fib->family == MV_INET) { mvOsPrintf("IPv4: " MV_IPQUAD_FMT "->" MV_IPQUAD_FMT"\n", MV_IPQUAD(*((u32 *) fib->srcL3)), MV_IPQUAD(*((u32 *) fib->dstL3))); } else { mvOsPrintf("IPv6: " MV_IP6_FMT "->" MV_IP6_FMT"\n", MV_IP6_ARG(fib->srcL3), MV_IP6_ARG(fib->dstL3)); } mvOsPrintf(" mh=%2.2x:%2.2x da=" MV_MACQUAD_FMT " sa=" MV_MACQUAD_FMT "\n", ((MV_U8 *) &fib->mh)[0], ((MV_U8 *) &fib->mh)[1], MV_MACQUAD(fib->da), MV_MACQUAD(fib->sa)); mvOsPrintf(" outport=%d, outdev=%p, flags=0x%x, ref=%d, age=%x, fib=%p, pnc=%p\n", fib->outport, fib->outdev, fib->flags, fib->ref, fib->age, fib, fib->pnc); mvOsPrintf(" Flags: "); if (fib->flags & NFP_F_DYNAMIC) mvOsPrintf("NFP_F_DYNAMIC "); if (fib->flags & NFP_F_STATIC) mvOsPrintf("NFP_F_STATIC "); if (fib->flags & NFP_F_INV) mvOsPrintf("NFP_F_INV "); if (fib->flags & NFP_F_SNAT) mvOsPrintf("NFP_F_SNAT "); if (fib->flags & NFP_F_DNAT) mvOsPrintf("NFP_F_DNAT "); if (fib->flags & NFP_F_BUSY) mvOsPrintf("NFP_F_BUSY "); if (fib->flags & NFP_F_PPPOE_ADD) mvOsPrintf("NFP_F_PPPOE_ADD "); if (fib->flags & NFP_F_PPPOE_REMOVE) mvOsPrintf("NFP_F_PPPOE_REMOVE "); if (fib->flags & NFP_F_HWF) mvOsPrintf("NFP_F_HWF "); if (fib->flags & NFP_F_BRIDGE) mvOsPrintf("NFP_F_BRIDGE "); mvOsPrintf("\n"); }
static void mvNfpBridgeRulePrint(NFP_RULE_BRIDGE *rule) { if (rule->status == NFP_BRIDGE_INV) mvOsPrintf("INVALID : "); else if (rule->status == NFP_BRIDGE_LOCAL) mvOsPrintf("LOCAL : "); else mvOsPrintf("NON_LOCAL: "); mvOsPrintf(" bridgeId=%d mac=" MV_MACQUAD_FMT " mh_out=%02x:%02x outport=%d, outdev=%p, age=%u\n", rule->bridgeId, MV_MACQUAD(rule->mac), ((MV_U8 *)&rule->mh_out)[0], ((MV_U8 *)&rule->mh_out)[1], rule->outport, rule->outdev, rule->age); }