Skip to content
Snippets Groups Projects
  • Nadav Har'El's avatar
    fe9e6a82
    Add copyright statements in bsd/ · fe9e6a82
    Nadav Har'El authored
    Added our copyright statements to some of the files in the top bsd/
    directory, and in bsd/porting.
    
    I only added our copyright to files which were completely by us - I did
    not attempt to hunt which bsd or solaris files we modified to add our
    copyright to them, I don't think this is important (or, we can do this
    later).
    
    I also found one header file (uma_stub.h) that had large chunks copied from
    freebsd, so I added both the freebsd copyright and ours.
    fe9e6a82
    History
    Add copyright statements in bsd/
    Nadav Har'El authored
    Added our copyright statements to some of the files in the top bsd/
    directory, and in bsd/porting.
    
    I only added our copyright to files which were completely by us - I did
    not attempt to hunt which bsd or solaris files we modified to add our
    copyright to them, I don't think this is important (or, we can do this
    later).
    
    I also found one header file (uma_stub.h) that had large chunks copied from
    freebsd, so I added both the freebsd copyright and ours.
net.cc 2.38 KiB
/*
 * Copyright (C) 2013 Cloudius Systems, Ltd.
 *
 * This work is open source software, licensed under the terms of the
 * BSD license as described in the LICENSE file in the top-level directory.
 */

#include "debug.hh"
#include <sys/time.h>

#include <bsd/porting/callout.h>
#include <bsd/porting/netport.h>
#include <bsd/porting/networking.h>
#include <bsd/porting/route.h>

#include <bsd/sys/sys/libkern.h>
#include <bsd/sys/sys/eventhandler.h>
#include <bsd/sys/sys/mbuf.h>
#include <bsd/sys/sys/domain.h>
#include <bsd/sys/net/netisr.h>
#include <bsd/sys/net/if.h>
#include <bsd/sys/net/if_llatbl.h>
#include <bsd/sys/net/pfil.h>
#include <bsd/sys/netinet/igmp.h>
#include <bsd/sys/netinet/if_ether.h>
#include <bsd/sys/netinet/in_pcb.h>
#include <bsd/sys/netinet/cc.h>
#include <bsd/sys/net/ethernet.h>
#include <bsd/sys/net/route.h>
#include <bsd/machine/param.h>

extern "C" {

    /* Generation of ip ids */
    void ip_initid(void);

    /* AF_INET */
    extern  struct domain inetdomain;
    /* AF_ROUTE */
    extern  struct domain routedomain;

    extern void system_taskq_init(void *arg);
    extern void opensolaris_load(void *arg);
    extern void callb_init(void *arg);

    extern void zfs_init(void *arg);

    // taskqueue
    #include <bsd/sys/sys/taskqueue.h>
    #include <bsd/sys/sys/priority.h>
    TASKQUEUE_DEFINE_THREAD(thread);
}

void net_init(void)
{
    debug("Initializing network stack...\n");

    // main taskqueue
    taskqueue_define_thread(NULL);

    // Initialize callouts
    init_callouts();

    /* Random */
    struct timeval tv;
    bsd_srandom(tv.tv_sec ^ tv.tv_usec);
    ip_initid();

    tunable_mbinit(NULL);
    init_maxsockets(NULL);
    arc4_init();
    eventhandler_init(NULL);
    opensolaris_load(NULL);
    mbuf_init(NULL);
    netisr_init(NULL);
    if_init(NULL);
    vnet_if_init(NULL);
    ether_init(NULL);
    callb_init(NULL);
    system_taskq_init(NULL);
    vnet_lltable_init();
    igmp_init();
    vnet_igmp_init();
    vnet_pfil_init();
    domaininit(NULL);
    OSV_DOMAIN_SET(inet);
    OSV_DOMAIN_SET(route);
    rts_init();
    route_init();
    vnet_route_init();
    ipport_tick_init(NULL);
    arp_init();
    domainfinalize(NULL);
    cc_init();
    if_attachdomain(NULL);
    vnet_loif_init();

    /* Start the loopback device */
    osv_start_if("lo0", "127.0.0.1", "255.0.0.0");
    osv_ifup("lo0");
    zfs_init(NULL);

    debug("Done!\n");
}