diff --git a/src/include/gpxe/netdevice.h b/src/include/gpxe/netdevice.h index 60ce886d..b7ec83d9 100644 --- a/src/include/gpxe/netdevice.h +++ b/src/include/gpxe/netdevice.h @@ -176,21 +176,11 @@ struct net_device { void *priv; }; -/** - * Register a link-layer protocol - * - * @v protocol Link-layer protocol - */ -#define LL_PROTOCOL( protocol ) \ - struct ll_protocol protocol __table ( ll_protocols, 01 ) +/** Declare a link-layer protocol */ +#define __ll_protocol __table ( ll_protocols, 01 ) -/** - * Register a network-layer protocol - * - * @v protocol Network-layer protocol - */ -#define NET_PROTOCOL( protocol ) \ - struct net_protocol protocol __table ( net_protocols, 01 ) +/** Declare a network-layer protocol */ +#define __net_protocol __table ( net_protocols, 01 ) /** * Get network device name diff --git a/src/include/gpxe/tcpip.h b/src/include/gpxe/tcpip.h index daed7da5..6ab2f195 100644 --- a/src/include/gpxe/tcpip.h +++ b/src/include/gpxe/tcpip.h @@ -94,21 +94,11 @@ struct tcpip_net_protocol { struct sockaddr_tcpip *st_dest ); }; -/** - * Register a TCP/IP transport-layer protocol - * - * @v protocol Transport-layer protocol - */ -#define TCPIP_PROTOCOL( protocol ) \ - struct tcpip_protocol protocol __table ( tcpip_protocols, 01 ) +/** Declare a TCP/IP transport-layer protocol */ +#define __tcpip_protocol __table ( tcpip_protocols, 01 ) -/** - * Register a TCP/IP network-layer protocol - * - * @v protocol Network-layer protocol - */ -#define TCPIP_NET_PROTOCOL( protocol ) \ - struct tcpip_net_protocol protocol __table ( tcpip_net_protocols, 01 ) +/** Declare a TCP/IP network-layer protocol */ +#define __tcpip_net_protocol __table ( tcpip_net_protocols, 01 ) extern int tcpip_rx ( struct pk_buff *pkb, uint8_t tcpip_proto, struct sockaddr_tcpip *st_src, diff --git a/src/net/aoe.c b/src/net/aoe.c index e0954fa5..199cabf7 100644 --- a/src/net/aoe.c +++ b/src/net/aoe.c @@ -253,14 +253,12 @@ static int aoe_rx ( struct pk_buff *pkb, struct net_device *netdev __unused, } /** AoE protocol */ -struct net_protocol aoe_protocol = { +struct net_protocol aoe_protocol __net_protocol = { .name = "AoE", .net_proto = htons ( ETH_P_AOE ), .rx = aoe_rx, }; -NET_PROTOCOL ( aoe_protocol ); - /** * Open AoE session * diff --git a/src/net/arp.c b/src/net/arp.c index 6293bf95..fea81d71 100644 --- a/src/net/arp.c +++ b/src/net/arp.c @@ -287,11 +287,9 @@ arp_ntoa ( const void *net_addr __attribute__ (( unused )) ) { } /** ARP protocol */ -struct net_protocol arp_protocol = { +struct net_protocol arp_protocol __net_protocol = { .name = "ARP", .net_proto = htons ( ETH_P_ARP ), .rx = arp_rx, .ntoa = arp_ntoa, }; - -NET_PROTOCOL ( arp_protocol ); diff --git a/src/net/ethernet.c b/src/net/ethernet.c index c4b526f5..4cdf571c 100644 --- a/src/net/ethernet.c +++ b/src/net/ethernet.c @@ -104,7 +104,7 @@ static const char * eth_ntoa ( const void *ll_addr ) { } /** Ethernet protocol */ -struct ll_protocol ethernet_protocol = { +struct ll_protocol ethernet_protocol __ll_protocol = { .name = "Ethernet", .ll_proto = htons ( ARPHRD_ETHER ), .ll_addr_len = ETH_ALEN, @@ -113,5 +113,3 @@ struct ll_protocol ethernet_protocol = { .rx = eth_rx, .ntoa = eth_ntoa, }; - -LL_PROTOCOL ( ethernet_protocol ); diff --git a/src/net/ipv4.c b/src/net/ipv4.c index da16452f..5f10d684 100644 --- a/src/net/ipv4.c +++ b/src/net/ipv4.c @@ -499,7 +499,7 @@ static const char * ipv4_ntoa ( const void *net_addr ) { } /** IPv4 protocol */ -struct net_protocol ipv4_protocol = { +struct net_protocol ipv4_protocol __net_protocol = { .name = "IP", .net_proto = htons ( ETH_P_IP ), .net_addr_len = sizeof ( struct in_addr ), @@ -507,17 +507,13 @@ struct net_protocol ipv4_protocol = { .ntoa = ipv4_ntoa, }; -NET_PROTOCOL ( ipv4_protocol ); - /** IPv4 TCPIP net protocol */ -struct tcpip_net_protocol ipv4_tcpip_protocol = { +struct tcpip_net_protocol ipv4_tcpip_protocol __tcpip_net_protocol = { .name = "IPv4", .sa_family = AF_INET, .tx = ipv4_tx, }; -TCPIP_NET_PROTOCOL ( ipv4_tcpip_protocol ); - /** IPv4 ARP protocol */ struct arp_net_protocol ipv4_arp_protocol __arp_net_protocol = { .net_protocol = &ipv4_protocol, diff --git a/src/net/ipv6.c b/src/net/ipv6.c index a38ec211..38705aa0 100644 --- a/src/net/ipv6.c +++ b/src/net/ipv6.c @@ -35,7 +35,7 @@ static const char * ipv6_ntoa ( const void *net_addr ) { } /** IPv6 protocol */ -struct net_protocol ipv6_protocol = { +struct net_protocol ipv6_protocol __net_protocol = { .name = "IP6", .net_proto = htons ( ETH_P_IPV6 ), .net_addr_len = sizeof ( struct in6_addr ), @@ -43,13 +43,9 @@ struct net_protocol ipv6_protocol = { .ntoa = ipv6_ntoa, }; -NET_PROTOCOL ( ipv6_protocol ); - /** IPv6 TCPIP net protocol */ -struct tcpip_net_protocol ipv6_tcpip_protocol = { +struct tcpip_net_protocol ipv6_tcpip_protocol __tcpip_net_protocol = { .name = "IPv6", .sa_family = AF_INET6, .tx = ipv6_tx, }; - -TCPIP_NET_PROTOCOL ( ipv6_tcpip_protocol ); diff --git a/src/net/tcp.c b/src/net/tcp.c index 94e9c2a5..e1588999 100644 --- a/src/net/tcp.c +++ b/src/net/tcp.c @@ -922,13 +922,11 @@ static int tcp_rx ( struct pk_buff *pkb, } /** TCP protocol */ -struct tcpip_protocol tcp_protocol = { +struct tcpip_protocol tcp_protocol __tcpip_protocol = { .name = "TCP", .rx = tcp_rx, .tcpip_proto = IP_TCP, .csum_offset = 16, }; -TCPIP_PROTOCOL ( tcp_protocol ); - #endif /* USE_UIP */ diff --git a/src/net/udp.c b/src/net/udp.c index 41847932..21bfebcd 100644 --- a/src/net/udp.c +++ b/src/net/udp.c @@ -267,11 +267,9 @@ static int udp_rx ( struct pk_buff *pkb, struct sockaddr_tcpip *st_src, return rc; } -struct tcpip_protocol udp_protocol = { +struct tcpip_protocol udp_protocol __tcpip_protocol = { .name = "UDP", .rx = udp_rx, .tcpip_proto = IP_UDP, .csum_offset = 6, }; - -TCPIP_PROTOCOL ( udp_protocol );