mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-27 11:55:53 +00:00
b53f35a809
A bunch of MTU-related cleanups in the network code. First, there is the addition of the notion of a maximally-sized packet, which is the MTU plus headers. This is used to size the skb that will receive a packet. This allows ether_adjust_skb to go away, as it was used to resize the skb after it was allocated. Since the skb passed into the low-level read routine is no longer resized, and possibly reallocated, there, they (and the write routines) don't need to get an sk_buff **. They just need the sk_buff * now. The callers of ether_adjust_skb still need to do the skb_put, so that's now inlined. The MAX_PACKET definitions in most of the drivers are gone. The set_mtu methods were all the same and did nothing, so they can be removed. The ethertap driver had a typo which doubled the size of the packet rather than adding two bytes to it. It also wasn't defining its setup_size, causing a zero-byte kmalloc and crash when the invalid pointer returned from kmalloc was dereferenced. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
71 lines
1.9 KiB
C
71 lines
1.9 KiB
C
/*
|
|
* Copyright (C) 2002 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
|
|
* Licensed under the GPL
|
|
*/
|
|
|
|
#ifndef __UM_NET_KERN_H
|
|
#define __UM_NET_KERN_H
|
|
|
|
#include <linux/netdevice.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/skbuff.h>
|
|
#include <linux/socket.h>
|
|
#include <linux/list.h>
|
|
#include <linux/workqueue.h>
|
|
|
|
struct uml_net {
|
|
struct list_head list;
|
|
struct net_device *dev;
|
|
struct platform_device pdev;
|
|
int index;
|
|
unsigned char mac[ETH_ALEN];
|
|
};
|
|
|
|
struct uml_net_private {
|
|
struct list_head list;
|
|
spinlock_t lock;
|
|
struct net_device *dev;
|
|
struct timer_list tl;
|
|
struct net_device_stats stats;
|
|
struct work_struct work;
|
|
int fd;
|
|
unsigned char mac[ETH_ALEN];
|
|
int max_packet;
|
|
unsigned short (*protocol)(struct sk_buff *);
|
|
int (*open)(void *);
|
|
void (*close)(int, void *);
|
|
void (*remove)(void *);
|
|
int (*read)(int, struct sk_buff *skb, struct uml_net_private *);
|
|
int (*write)(int, struct sk_buff *skb, struct uml_net_private *);
|
|
|
|
void (*add_address)(unsigned char *, unsigned char *, void *);
|
|
void (*delete_address)(unsigned char *, unsigned char *, void *);
|
|
char user[0];
|
|
};
|
|
|
|
struct net_kern_info {
|
|
void (*init)(struct net_device *, void *);
|
|
unsigned short (*protocol)(struct sk_buff *);
|
|
int (*read)(int, struct sk_buff *skb, struct uml_net_private *);
|
|
int (*write)(int, struct sk_buff *skb, struct uml_net_private *);
|
|
};
|
|
|
|
struct transport {
|
|
struct list_head list;
|
|
const char *name;
|
|
int (* const setup)(char *, char **, void *);
|
|
const struct net_user_info *user;
|
|
const struct net_kern_info *kern;
|
|
const int private_size;
|
|
const int setup_size;
|
|
};
|
|
|
|
extern struct net_device *ether_init(int);
|
|
extern unsigned short ether_protocol(struct sk_buff *);
|
|
extern int tap_setup_common(char *str, char *type, char **dev_name,
|
|
char **mac_out, char **gate_addr);
|
|
extern void register_transport(struct transport *new);
|
|
extern unsigned short eth_protocol(struct sk_buff *skb);
|
|
|
|
#endif
|