Added get/set_max_xxx functions.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5024 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Waldemar Kornewald
2003-10-14 10:14:57 +00:00
parent 917d6a9d1f
commit 13b219e125
8 changed files with 76 additions and 8 deletions
+6
View File
@@ -15,6 +15,12 @@
# define start_rx_thread core->start_rx_thread
# define start_tx_thread core->start_tx_thread
# define get_max_hdr core->get_max_hdr
# define set_max_linkhdr core->set_max_linkhdr
# define get_max_linkhdr core->get_max_linkhdr
# define set_max_protohdr core->set_max_protohdr
# define get_max_protohdr core->get_max_protohdr
# define net_add_timer core->net_add_timer
# define net_remove_timer core->net_remove_timer
+7
View File
@@ -26,6 +26,13 @@ struct core_module_info {
void (*start_rx_thread)(struct ifnet *dev);
void (*start_tx_thread)(struct ifnet *dev);
// functions for the 'max_xxx' values
int (*get_max_hdr)(void);
void (*set_max_linkhdr)(int maxLinkHdr);
int (*get_max_linkhdr)(void);
void (*set_max_protohdr)(int maxProtoHdr);
int (*get_max_protohdr)(void);
/* timer functions */
net_timer_id (*net_add_timer)(net_timer_hook ,void *,
bigtime_t);
-7
View File
@@ -308,11 +308,4 @@ void dump_freelist(void);
/* XXX - add me! */
struct pool_ctl *mbpool;
struct pool_ctl *clpool;
int max_hdr; /* largest link+protocol header */
int max_linkhdr; /* largest link level header */
int max_protohdr; /* largest protocol header */
#endif /* OBOS_MBUF_H */
+40
View File
@@ -17,6 +17,7 @@
#include <driver_settings.h>
#include "core_private.h"
#include "core_module.h"
#include "sys/socket.h"
#include "sys/socketvar.h"
@@ -63,6 +64,12 @@ static int stop_stack(void);
static void add_protosw(struct protosw *[], int layer);
static struct net_module *module_list = NULL;
static int get_max_hdr(void);
static void set_max_linkhdr(int maxLinkHdr);
static int get_max_linkhdr(void);
static void set_max_protohdr(int maxProtoHdr);
static int get_max_protohdr(void);
/* Wider scoped prototypes */
int net_sysctl(int *name, uint namelen, void *oldp, size_t *oldlenp,
void *newp, size_t newlen);
@@ -87,6 +94,12 @@ struct core_module_info core_info = {
start_rx_thread,
start_tx_thread,
get_max_hdr,
set_max_linkhdr,
get_max_linkhdr,
set_max_protohdr,
get_max_protohdr,
net_add_timer,
net_remove_timer,
@@ -336,6 +349,33 @@ void start_tx_thread(struct ifnet *dev)
resume_thread(dev->tx_thread);
}
static int get_max_hdr(void)
{
return max_hdr;
}
static void set_max_linkhdr(int maxLinkHdr)
{
max_linkhdr = maxLinkHdr;
max_hdr = max_linkhdr + max_protohdr;
}
static int get_max_linkhdr(void)
{
return max_linkhdr;
}
static void set_max_protohdr(int maxProtoHdr)
{
max_protohdr = maxProtoHdr;
max_hdr = max_linkhdr + max_protohdr;
}
static int get_max_protohdr(void)
{
return max_protohdr;
}
void net_server_add_device(struct ifnet *ifn)
{
char dname[16];
@@ -0,0 +1,12 @@
#ifndef _CORE_PRIVATE__H
#define _CORE_PRIVATE__H
extern struct pool_ctl *mbpool;
extern struct pool_ctl *clpool;
extern int max_hdr; /* largest link+protocol header */
extern int max_linkhdr; /* largest link level header */
extern int max_protohdr; /* largest protocol header */
#endif
+9 -1
View File
@@ -19,6 +19,15 @@
#define MBUF_ALLOCSIZE 4096
struct pool_ctl *mbpool;
struct pool_ctl *clpool;
int max_hdr = 0; /* largest link+protocol header */
int max_linkhdr = 0; /* largest link level header */
int max_protohdr = 0; /* largest protocol header */
void dump_freelist(void)
{
pool_debug_walk(mbpool);
@@ -31,7 +40,6 @@ void mbinit(void)
pool_init(&mbpool, sizeof(struct mbuf));
if (!clpool)
pool_init(&clpool, MCLBYTES);
/* XXX - move me to the protocol init routines! */
max_linkhdr = 14;
max_protohdr = 40;
max_hdr = max_linkhdr + max_protohdr;
@@ -7,6 +7,7 @@
#include <KernelExport.h>
#endif
#include "core_private.h"
#include <sys/socket.h>
#include <net_socket.h>
#include <pools.h>
+1
View File
@@ -6,6 +6,7 @@
#include <string.h>
#include <sys/time.h>
#include "core_private.h"
#include "sys/socket.h"
#include "sys/socketvar.h"
#include "sys/sockio.h"