| 3482 | } |
| 3483 | |
| 3484 | static void |
| 3485 | vxlan_sysctl_setup(struct vxlan_softc *sc) |
| 3486 | { |
| 3487 | struct sysctl_ctx_list *ctx; |
| 3488 | struct sysctl_oid *node; |
| 3489 | struct vxlan_statistics *stats; |
| 3490 | char namebuf[8]; |
| 3491 | |
| 3492 | ctx = &sc->vxl_sysctl_ctx; |
| 3493 | stats = &sc->vxl_stats; |
| 3494 | snprintf(namebuf, sizeof(namebuf), "%d", sc->vxl_unit); |
| 3495 | |
| 3496 | sysctl_ctx_init(ctx); |
| 3497 | sc->vxl_sysctl_node = SYSCTL_ADD_NODE(ctx, |
| 3498 | SYSCTL_STATIC_CHILDREN(_net_link_vxlan), OID_AUTO, namebuf, |
| 3499 | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, ""); |
| 3500 | |
| 3501 | node = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(sc->vxl_sysctl_node), |
| 3502 | OID_AUTO, "ftable", CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, ""); |
| 3503 | SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(node), OID_AUTO, "count", |
| 3504 | CTLFLAG_RD, &sc->vxl_ftable_cnt, 0, |
| 3505 | "Number of entries in fowarding table"); |
| 3506 | SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(node), OID_AUTO, "max", |
| 3507 | CTLFLAG_RD, &sc->vxl_ftable_max, 0, |
| 3508 | "Maximum number of entries allowed in fowarding table"); |
| 3509 | SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(node), OID_AUTO, "timeout", |
| 3510 | CTLFLAG_RD, &sc->vxl_ftable_timeout, 0, |
| 3511 | "Number of seconds between prunes of the forwarding table"); |
| 3512 | SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(node), OID_AUTO, "dump", |
| 3513 | CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE | CTLFLAG_SKIP, |
| 3514 | sc, 0, vxlan_ftable_sysctl_dump, "A", |
| 3515 | "Dump the forwarding table entries"); |
| 3516 | |
| 3517 | node = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(sc->vxl_sysctl_node), |
| 3518 | OID_AUTO, "stats", CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, ""); |
| 3519 | SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(node), OID_AUTO, |
| 3520 | "ftable_nospace", CTLFLAG_RD, &stats->ftable_nospace, 0, |
| 3521 | "Fowarding table reached maximum entries"); |
| 3522 | SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(node), OID_AUTO, |
| 3523 | "ftable_lock_upgrade_failed", CTLFLAG_RD, |
| 3524 | &stats->ftable_lock_upgrade_failed, 0, |
| 3525 | "Forwarding table update required lock upgrade"); |
| 3526 | |
| 3527 | SYSCTL_ADD_COUNTER_U64(ctx, SYSCTL_CHILDREN(node), OID_AUTO, "txcsum", |
| 3528 | CTLFLAG_RD, &stats->txcsum, |
| 3529 | "# of times hardware assisted with tx checksum"); |
| 3530 | SYSCTL_ADD_COUNTER_U64(ctx, SYSCTL_CHILDREN(node), OID_AUTO, "tso", |
| 3531 | CTLFLAG_RD, &stats->tso, "# of times hardware assisted with TSO"); |
| 3532 | SYSCTL_ADD_COUNTER_U64(ctx, SYSCTL_CHILDREN(node), OID_AUTO, "rxcsum", |
| 3533 | CTLFLAG_RD, &stats->rxcsum, |
| 3534 | "# of times hardware assisted with rx checksum"); |
| 3535 | } |
| 3536 | |
| 3537 | static void |
| 3538 | vxlan_sysctl_destroy(struct vxlan_softc *sc) |
no test coverage detected