static int rtnet_read_proc_devices(char *buf, char **start, off_t offset,
                                   int count, int *eof, void *data)
{
    int i;
    int res;
    struct rtnet_device *rtdev;
    RTNET_PROC_PRINT_VARS(80);


    if (!RTNET_PROC_PRINT("Name\t\tFlags\n"))
        goto done;

    for (i = 1; i <= MAX_RT_DEVICES; i++) {
        rtdev = rtdev_get_by_index(i);
        if (rtdev != NULL) {
            res = RTNET_PROC_PRINT("%-15s %s%s%s%s\n",
                            rtdev->name,
                            (rtdev->flags & IFF_UP) ? "UP" : "DOWN",
                            (rtdev->flags & IFF_BROADCAST) ? " BROADCAST" : "",
                            (rtdev->flags & IFF_LOOPBACK) ? " LOOPBACK" : "",
                            (rtdev->flags & IFF_PROMISC) ? " PROMISC" : "");
            rtdev_dereference(rtdev);
            if (!res)
                break;
        }
    }

  done:
    RTNET_PROC_PRINT_DONE;
}
static int rtnet_read_proc_version(char *buf, char **start, off_t offset,
                                   int count, int *eof, void *data)
{
    const char verstr[] =
        "RTnet " RTNET_PACKAGE_VERSION " - built on " __DATE__ " " __TIME__ "\n"
        "RTcap:      "
#ifdef CONFIG_RTNET_ADDON_RTCAP
            "yes\n"
#else
            "no\n"
#endif
        "rtnetproxy: "
#ifdef CONFIG_RTNET_ADDON_PROXY
            "yes\n"
#else
            "no\n"
#endif
        "bug checks: "
#ifdef CONFIG_RTNET_CHECKED
            "yes\n";
#else
            "no\n";
#endif
    RTNET_PROC_PRINT_VARS(256);


    RTNET_PROC_PRINT(verstr);

    RTNET_PROC_PRINT_DONE;
}
static int rtnet_read_proc_rtskb(char *buf, char **start, off_t offset, int count,
                                 int *eof, void *data)
{
    unsigned int rtskb_len;
    RTNET_PROC_PRINT_VARS(256);


    rtskb_len = ALIGN_RTSKB_STRUCT_LEN + SKB_DATA_ALIGN(RTSKB_SIZE);
    RTNET_PROC_PRINT("Statistics\t\tCurrent\tMaximum\n"
                     "rtskb pools\t\t%d\t%d\n"
                     "rtskbs\t\t\t%d\t%d\n"
                     "rtskb memory need\t%d\t%d\n",
                     rtskb_pools, rtskb_pools_max,
                     rtskb_amount, rtskb_amount_max,
                     rtskb_amount * rtskb_len, rtskb_amount_max * rtskb_len);

    RTNET_PROC_PRINT_DONE;
}
Exemple #4
0
static int rt_route_read_proc(char *buf, char **start, off_t offset, int count,
                              int *eof, void *data)
{
#ifdef CONFIG_RTNET_RTIPV4_NETROUTING
    u32 mask;
#endif /* CONFIG_RTNET_RTIPV4_NETROUTING */
    RTNET_PROC_PRINT_VARS(256);


    if (!RTNET_PROC_PRINT("Host routes allocated/total:\t%d/%d\n"
                          "Host hash table size:\t\t%d\n",
                          allocated_host_routes,
                          CONFIG_RTNET_RTIPV4_HOST_ROUTES,
                          HOST_HASH_TBL_SIZE))
        goto done;

#ifdef CONFIG_RTNET_RTIPV4_NETROUTING
    mask = NET_HASH_KEY_MASK << net_hash_key_shift;
    if (!RTNET_PROC_PRINT("Network routes allocated/total:\t%d/%d\n"
                          "Network hash table size:\t%d\n"
                          "Network hash key shift/mask:\t%d/%08X\n",
                          allocated_net_routes,
                          CONFIG_RTNET_RTIPV4_NET_ROUTES, NET_HASH_TBL_SIZE,
                          net_hash_key_shift, mask))
        goto done;
#endif /* CONFIG_RTNET_RTIPV4_NETROUTING */

#ifdef CONFIG_RTNET_RTIPV4_ROUTER
    RTNET_PROC_PRINT("IP Router:\t\t\tyes\n");
#else
    RTNET_PROC_PRINT("IP Router:\t\t\tno\n");
#endif

  done:
    RTNET_PROC_PRINT_DONE;
}