#include "inet.h"#include "buf.h"#include "clock.h"#include "event.h"#include "osdep_eth.h"#include "type.h"#include "assert.h"#include "eth.h"#include "eth_int.h"#include "io.h"#include "sr.h"Include dependency graph for eth.c:

Go to the source code of this file.
Data Structures | |
| struct | eth_fd |
| struct | vlan_hdr_t |
Defines | |
| #define | ETH_FD_NR (4*IP_PORT_MAX) |
| #define | EXPIRE_TIME 60*HZ |
| #define | EFF_FLAGS 0xf |
| #define | EFF_EMPTY 0x0 |
| #define | EFF_INUSE 0x1 |
| #define | EFF_BUSY 0xE |
| #define | EFF_READ_IP 0x2 |
| #define | EFF_WRITE_IP 0x4 |
| #define | EFF_IOCTL_IP 0x8 |
| #define | EFF_OPTSET 0x10 |
Typedefs | |
| typedef eth_fd | eth_fd_t |
Functions | |
| FORWARD int eth_checkopt | ARGS ((eth_fd_t *eth_fd)) |
| FORWARD void eth_buffree | ARGS ((int priority)) |
| FORWARD void packet2user | ARGS ((eth_fd_t *fd, acc_t *pack, time_t exp_time)) |
| FORWARD void reply_thr_get | ARGS ((eth_fd_t *eth_fd, size_t result, int for_ioctl)) |
| FORWARD void do_rec_conf | ARGS ((eth_port_t *eth_port)) |
| FORWARD acc_t *insert_vlan_hdr | ARGS ((eth_port_t *eth_port, acc_t *pack)) |
| PUBLIC void | eth_prep () |
| PUBLIC void | eth_init () |
| PUBLIC int | eth_open (int port, int srfd, get_userdata_t get_userdata, put_userdata_t put_userdata, put_pkt_t put_pkt, select_res_t select_res) |
| PUBLIC int | eth_ioctl (int fd, ioreq_t req) |
| PUBLIC int | eth_write (int fd, size_t count) |
| PUBLIC int | eth_send (int fd, acc_t *data, size_t data_len) |
| PUBLIC int | eth_read (int fd, size_t count) |
| PUBLIC int | eth_cancel (int fd, int which_operation) |
| PUBLIC int | eth_select (int fd, unsigned operations) |
| PUBLIC void | eth_close (int fd) |
| PUBLIC void | eth_loop_ev (event_t *ev, ev_arg_t ev_arg) |
| PRIVATE int | eth_checkopt (eth_fd_t *eth_fd) |
| PRIVATE void | hash_fd (eth_fd_t *eth_fd) |
| PRIVATE void | unhash_fd (eth_fd_t *eth_fd) |
| PUBLIC void | eth_restart_write (eth_port_t *eth_port) |
| PUBLIC void | eth_arrive (eth_port_t *eth_port, acc_t *pack, size_t pack_size) |
| PUBLIC void | eth_reg_vlan (eth_port_t *eth_port, eth_port_t *vlan_port) |
| PUBLIC void | eth_restart_ioctl (eth_port_t *eth_port) |
| PRIVATE void | packet2user (eth_fd_t *eth_fd, acc_t *pack, time_t exp_time) |
| PRIVATE void | eth_buffree (int priority) |
| PRIVATE void | do_rec_conf (eth_port_t *eth_port) |
| PRIVATE u32_t | compute_rec_conf (eth_port_t *eth_port) |
| PRIVATE void | reply_thr_get (eth_fd_t *eth_fd, size_t result, int for_ioctl) |
| PRIVATE void | reply_thr_put (eth_fd_t *eth_fd, size_t result, int for_ioctl) |
| PRIVATE acc_t * | insert_vlan_hdr (eth_port_t *eth_port, acc_t *pack) |
Variables | |
| PUBLIC eth_port_t * | eth_port_table |
| PUBLIC int | no_ethWritePort = 0 |
| PRIVATE eth_fd_t | eth_fd_table [ETH_FD_NR] |
| PRIVATE ether_addr_t | broadcast = { { 255, 255, 255, 255, 255, 255 } } |
|
|
Definition at line 47 of file eth.c. Referenced by eth_close(). |
|
|
Definition at line 45 of file eth.c. Referenced by eth_close(), and eth_init(). |
|
|
|
|
|
Definition at line 46 of file eth.c. Referenced by compute_rec_conf(), eth_close(), eth_ioctl(), eth_open(), eth_restart_ioctl(), and packet2user(). |
|
|
Definition at line 50 of file eth.c. Referenced by eth_cancel(), eth_ioctl(), and eth_restart_ioctl(). |
|
|
Definition at line 51 of file eth.c. Referenced by compute_rec_conf(), eth_checkopt(), eth_close(), eth_ioctl(), eth_read(), eth_send(), and eth_write(). |
|
|
Definition at line 48 of file eth.c. Referenced by eth_cancel(), eth_read(), and packet2user(). |
|
|
Definition at line 49 of file eth.c. Referenced by eth_cancel(), eth_restart_write(), and eth_write(). |
|
|
Definition at line 23 of file eth.c. Referenced by compute_rec_conf(), eth_buffree(), eth_init(), eth_open(), and eth_restart_ioctl(). |
|
|
Definition at line 24 of file eth.c. Referenced by eth_arrive(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 1144 of file eth.c. References eth_fd::ef_flags, EFF_INUSE, EFF_OPTSET, ETH_FD_NR, eth_fd_table, flags, and NWEO_NOFLAGS. Referenced by do_rec_conf(). |
|
|
Definition at line 1123 of file eth.c. References compute_rec_conf(), ETH_VLAN_HASH_NR, eth_port::etp_vlan_next, eth_port::etp_vlan_tab, and flags. Referenced by eth_close(), and eth_ioctl(). |
|
||||||||||||||||
|
Definition at line 794 of file eth.c. References acc::acc_linkC, assert, bf_afree(), bf_append(), bf_bufsize(), bf_cut(), bf_delhead(), bf_memreq(), bf_packIffLess(), broadcast, DIFBLOCK, ether_addr::ea_addr, eth_fd::ef_ethopt, eth_fd::ef_type_next, eth_hdr::eh_dst, eth_hdr::eh_proto, eth_hdr::eh_src, EPF_GOT_ADDR, eth_addrcmp, ETH_HDR_SIZE, ETH_MIN_PACK_SIZE, ETH_TCI_CFI, ETH_TCI_VLAN_MASK, ETH_TYPE_HASH_NR, ETH_VLAN_PROTO, EXPIRE_TIME, get_time(), hash(), HTONS, i, if(), ntohs, NULL, NWEO_EN_BROAD, NWEO_EN_LOC, NWEO_EN_MULTI, NWEO_EN_PROMISC, nwio_ethopt::nweo_flags, nwio_ethopt::nweo_rem, NWEO_REMSPEC, nwio_ethopt::nweo_type, p, printf, ptr2acc_data, time_t, and type. Referenced by eth_loop_ev(), read_int(), and write_int(). |
|
|
Definition at line 1066 of file eth.c. References acc::acc_ext_link, bf_afree(), eth_fd::ef_rdbuf_head, ETH_FD_NR, eth_fd_table, ETH_PRI_FDBUFS_EXTRA, and i. |
|
||||||||||||
|
Definition at line 572 of file eth.c. References assert, DBLOCK, eth_fd::ef_flags, eth_fd::ef_port, eth_fd::ef_send_next, EFF_IOCTL_IP, EFF_READ_IP, EFF_WRITE_IP, EINTR, eth_fd_table, eth_port::etp_sendq_head, eth_port::etp_sendq_tail, eth_port::etp_vlan_port, FALSE, ip_panic, NULL, NW_OK, printf, reply_thr_get(), reply_thr_put(), SR_CANCEL_IOCTL, SR_CANCEL_READ, SR_CANCEL_WRITE, and TRUE. Referenced by osdep_eth_init(). |
|
|
Definition at line 680 of file eth.c. References acc::acc_ext_link, bf_afree(), EFF_OPTSET, flags, NULL, NW_OK, NWEO_ACC_MASK, NWEO_BROAD_MASK, NWEO_LOC_MASK, NWEO_MULTI_MASK, NWEO_PROMISC_MASK, NWEO_REM_MASK, NWEO_RW_MASK, and NWEO_TYPE_MASK. Referenced by eth_ioctl(). |
|
|
Definition at line 632 of file eth.c. References acc::acc_ext_link, assert, bf_afree(), do_rec_conf(), eth_fd::ef_flags, EFF_BUSY, EFF_EMPTY, EFF_INUSE, EFF_OPTSET, eth_fd_table, NULL, and unhash_fd(). Referenced by osdep_eth_init(). |
|
|
Definition at line 89 of file eth.c. References assert, BUF_S, EFF_EMPTY, eth_conf_nr, ETH_FD_NR, ETH_HDR_SIZE, ETH_TYPE_HASH_NR, ETH_VLAN_HASH_NR, ev_init(), i, j, and NULL. Referenced by nw_init(). |
|
||||||||||||
|
||||||||||||
|
Definition at line 658 of file eth.c. References assert, bf_bufsize(), eth_arrive(), eth_restart_write(), eth_port::etp_sendev, eth_port::etp_wr_pack, ev_arg::ev_ptr, no_ethWritePort, and NULL. Referenced by eth_send(). |
|
||||||||||||||||||||||||||||
|
Definition at line 123 of file eth.c. References DBLOCK, EAGAIN, eth_fd::ef_flags, EFF_INUSE, EGENERIC, EPF_ENABLED, ETH_FD_NR, eth_fd_table, eth_port_table, eth_port::etp_flags, i, and printf. Referenced by arp_main(), ipeth_init(), and osdep_eth_init(). |
|
|
Definition at line 84 of file eth.c. References alloc(), and eth_conf_nr. Referenced by nw_conf(). |
|
||||||||||||
|
Definition at line 534 of file eth.c. References acc::acc_ext_link, assert, bf_afree(), EBADMODE, eth_fd::ef_exp_time, eth_fd::ef_flags, eth_fd::ef_rdbuf_head, EFF_OPTSET, EFF_READ_IP, EPACKSIZE, eth_fd_table, ETH_MAX_PACK_SIZE, FALSE, get_time(), NW_OK, NW_SUSPEND, packet2user(), and reply_thr_put(). Referenced by do_eth_read(), osdep_eth_init(), and setup_read(). |
|
||||||||||||
|
Definition at line 980 of file eth.c. References ETH_HASH_VLAN, eth_port::etp_vlan, eth_port::etp_vlan_next, eth_port::etp_vlan_tab, and t. |
|
|
Definition at line 993 of file eth.c. References eth_fd::ef_flags, eth_fd::ef_ioctl_req, eth_fd::ef_port, EFF_INUSE, EFF_IOCTL_IP, ETH_FD_NR, eth_fd_table, eth_ioctl(), i, if(), and NWIOGETHSTAT. Referenced by eth_restart(). |
|
|
Definition at line 774 of file eth.c. References assert, eth_fd::ef_flags, eth_fd::ef_send_next, eth_fd::ef_write_count, EFF_WRITE_IP, eth_fd_table, eth_write(), NULL, NW_OK, and r. Referenced by eth_loop_ev(), and write_int(). |
|
||||||||||||
|
Definition at line 624 of file eth.c. References printf. Referenced by osdep_eth_init(). |
|
||||||||||||||||
|
||||||||||||
|
Definition at line 386 of file eth.c. References assert, DBLOCK, EBADMODE, eth_fd::ef_ethopt, eth_fd::ef_flags, eth_fd::ef_get_userdata, eth_fd::ef_port, eth_fd::ef_send_next, eth_fd::ef_srfd, eth_fd::ef_write_count, EFAULT, EFF_OPTSET, EFF_WRITE_IP, EPACKSIZE, eth_fd_table, ETH_HDR_SIZE, ETH_MAX_PACK_SIZE, eth_send(), eth_port::etp_sendq_head, eth_port::etp_sendq_tail, eth_port::etp_vlan_port, eth_port::etp_wr_pack, FALSE, NULL, NW_OK, NW_SUSPEND, nwio_ethopt::nweo_flags, NWEO_RWDATONLY, printf, r, and reply_thr_get(). Referenced by eth_restart_write(), ipeth_restart_send(), and osdep_eth_init(). |
|
|
Definition at line 718 of file eth.c. References eth_fd::ef_ethopt, ETH_TYPE_HASH_NR, eth_port::etp_type, eth_port::etp_type_any, hash(), nwio_ethopt::nweo_type, and NWEO_TYPEANY. Referenced by eth_ioctl(). |
|
||||||||||||
|
Definition at line 1189 of file eth.c. References bf_afree(), bf_append(), bf_cut(), bf_delhead(), bf_memreq(), bf_packIffLess(), ETH_VLAN_PROTO, htons, HTONS, NULL, printf, ptr2acc_data, type, vlan_hdr_t::vh_type, and vlan_hdr_t::vh_vlan. Referenced by eth_send(). |
|
||||||||||||||||
|
Definition at line 1015 of file eth.c. References acc::acc_ext_link, acc::acc_linkC, assert, bf_afree(), bf_bufsize(), bf_delhead(), bf_dupacc(), EFF_INUSE, EFF_READ_IP, ETH_HDR_SIZE, FALSE, NULL, NWEO_RWDATONLY, reply_thr_put(), result, and size. Referenced by eth_read(). |
|
||||||||||||||||
|
Definition at line 1166 of file eth.c. Referenced by eth_cancel(), eth_ioctl(), eth_write(), ip_ioctl(), psip_ioctl(), restart_write_fd(), tcp_cancel(), tcp_ioctl(), tcp_listen(), tcp_reply_ioctl(), tcp_reply_write(), tcp_setconf(), tcp_setopt(), tcp_write(), udp_cancel(), udp_get_data(), udp_ioctl(), udp_setopt(), and udp_write(). |
|
||||||||||||||||
|
Definition at line 1177 of file eth.c. References assert, error, and NW_OK. Referenced by eth_cancel(), eth_ioctl(), eth_read(), packet2user(), psip_ioctl(), tcp_cancel(), tcp_ioctl(), tcp_read(), tcp_reply_read(), udp_cancel(), udp_ioctl(), udp_peek(), and udp_read(). |
|
|
Definition at line 741 of file eth.c. References eth_fd::ef_ethopt, eth_fd::ef_type_next, ETH_TYPE_HASH_NR, eth_port::etp_type, eth_port::etp_type_any, hash(), NULL, nwio_ethopt::nweo_type, and NWEO_TYPEANY. Referenced by eth_close(), eth_ioctl(), and udp_close(). |
|
|
Definition at line 82 of file eth.c. Referenced by eth_arrive(), and ip_eth_arrived(). |
|
|
Definition at line 81 of file eth.c. Referenced by compute_rec_conf(), eth_buffree(), eth_cancel(), eth_close(), eth_ioctl(), eth_open(), eth_read(), eth_restart_ioctl(), eth_restart_write(), eth_send(), and eth_write(). |
|
|
Definition at line 78 of file eth.c. Referenced by eth_check_drivers(), eth_open(), eth_rec(), eth_restart(), find_port(), and osdep_eth_init(). |
|
|
Definition at line 79 of file eth.c. Referenced by eth_loop_ev(), eth_write_port(), read_int(), and write_int(). |
1.4.6