dect
/
libnl
Archived
13
0
Fork 0

Update include/linux header copies

Adapts ratespec code taking into account that the kernel now takes
care of overhead calculations.
This commit is contained in:
Thomas Graf 2010-10-21 19:47:14 +02:00
parent 3a96527f24
commit b9d965b01b
18 changed files with 452 additions and 279 deletions

View File

@ -1,6 +1,8 @@
#ifndef __LINUX_GEN_STATS_H #ifndef __LINUX_GEN_STATS_H
#define __LINUX_GEN_STATS_H #define __LINUX_GEN_STATS_H
#include <linux/types.h>
enum { enum {
TCA_STATS_UNSPEC, TCA_STATS_UNSPEC,
TCA_STATS_BASIC, TCA_STATS_BASIC,
@ -12,33 +14,38 @@ enum {
#define TCA_STATS_MAX (__TCA_STATS_MAX - 1) #define TCA_STATS_MAX (__TCA_STATS_MAX - 1)
/** /**
* struct gnet_stats_basic - byte/packet throughput statistics
* @bytes: number of seen bytes * @bytes: number of seen bytes
* @packets: number of seen packets * @packets: number of seen packets
*/ */
struct gnet_stats_basic struct gnet_stats_basic {
{
__u64 bytes; __u64 bytes;
__u32 packets; __u32 packets;
}; };
struct gnet_stats_basic_packed {
__u64 bytes;
__u32 packets;
} __attribute__ ((packed));
/** /**
* struct gnet_stats_rate_est - rate estimator
* @bps: current byte rate * @bps: current byte rate
* @pps: current packet rate * @pps: current packet rate
*/ */
struct gnet_stats_rate_est struct gnet_stats_rate_est {
{
__u32 bps; __u32 bps;
__u32 pps; __u32 pps;
}; };
/** /**
* struct gnet_stats_queue - queuing statistics
* @qlen: queue length * @qlen: queue length
* @backlog: backlog size of queue * @backlog: backlog size of queue
* @drops: number of dropped packets * @drops: number of dropped packets
* @requeues: number of requeues * @requeues: number of requeues
* @overlimits: number of enqueues over the limit
*/ */
struct gnet_stats_queue struct gnet_stats_queue {
{
__u32 qlen; __u32 qlen;
__u32 backlog; __u32 backlog;
__u32 drops; __u32 drops;
@ -47,11 +54,11 @@ struct gnet_stats_queue
}; };
/** /**
* struct gnet_estimator - rate estimator configuration
* @interval: sampling period * @interval: sampling period
* @ewma_log: the log of measurement window weight * @ewma_log: the log of measurement window weight
*/ */
struct gnet_estimator struct gnet_estimator {
{
signed char interval; signed char interval;
unsigned char ewma_log; unsigned char ewma_log;
}; };

View File

@ -1,10 +1,10 @@
#ifndef __LINUX_IF_ADDR_H #ifndef __LINUX_IF_ADDR_H
#define __LINUX_IF_ADDR_H #define __LINUX_IF_ADDR_H
#include <linux/types.h>
#include <linux/netlink.h> #include <linux/netlink.h>
struct ifaddrmsg struct ifaddrmsg {
{
__u8 ifa_family; __u8 ifa_family;
__u8 ifa_prefixlen; /* The prefix length */ __u8 ifa_prefixlen; /* The prefix length */
__u8 ifa_flags; /* Flags */ __u8 ifa_flags; /* Flags */
@ -19,8 +19,7 @@ struct ifaddrmsg
* but for point-to-point IFA_ADDRESS is DESTINATION address, * but for point-to-point IFA_ADDRESS is DESTINATION address,
* local address is supplied in IFA_LOCAL attribute. * local address is supplied in IFA_LOCAL attribute.
*/ */
enum enum {
{
IFA_UNSPEC, IFA_UNSPEC,
IFA_ADDRESS, IFA_ADDRESS,
IFA_LOCAL, IFA_LOCAL,
@ -40,13 +39,13 @@ enum
#define IFA_F_NODAD 0x02 #define IFA_F_NODAD 0x02
#define IFA_F_OPTIMISTIC 0x04 #define IFA_F_OPTIMISTIC 0x04
#define IFA_F_DADFAILED 0x08
#define IFA_F_HOMEADDRESS 0x10 #define IFA_F_HOMEADDRESS 0x10
#define IFA_F_DEPRECATED 0x20 #define IFA_F_DEPRECATED 0x20
#define IFA_F_TENTATIVE 0x40 #define IFA_F_TENTATIVE 0x40
#define IFA_F_PERMANENT 0x80 #define IFA_F_PERMANENT 0x80
struct ifa_cacheinfo struct ifa_cacheinfo {
{
__u32 ifa_prefered; __u32 ifa_prefered;
__u32 ifa_valid; __u32 ifa_valid;
__u32 cstamp; /* created timestamp, hundredths of seconds */ __u32 cstamp; /* created timestamp, hundredths of seconds */

View File

@ -23,6 +23,8 @@
#ifndef _LINUX_IF_ARP_H #ifndef _LINUX_IF_ARP_H
#define _LINUX_IF_ARP_H #define _LINUX_IF_ARP_H
#include <linux/netdevice.h>
/* ARP protocol HARDWARE identifiers. */ /* ARP protocol HARDWARE identifiers. */
#define ARPHRD_NETROM 0 /* from KA9Q: NET/ROM pseudo */ #define ARPHRD_NETROM 0 /* from KA9Q: NET/ROM pseudo */
#define ARPHRD_ETHER 1 /* Ethernet 10Mbps */ #define ARPHRD_ETHER 1 /* Ethernet 10Mbps */
@ -50,6 +52,7 @@
#define ARPHRD_ROSE 270 #define ARPHRD_ROSE 270
#define ARPHRD_X25 271 /* CCITT X.25 */ #define ARPHRD_X25 271 /* CCITT X.25 */
#define ARPHRD_HWX25 272 /* Boards with X.25 in firmware */ #define ARPHRD_HWX25 272 /* Boards with X.25 in firmware */
#define ARPHRD_CAN 280 /* Controller Area Network */
#define ARPHRD_PPP 512 #define ARPHRD_PPP 512
#define ARPHRD_CISCO 513 /* Cisco HDLC */ #define ARPHRD_CISCO 513 /* Cisco HDLC */
#define ARPHRD_HDLC ARPHRD_CISCO #define ARPHRD_HDLC ARPHRD_CISCO
@ -83,6 +86,11 @@
#define ARPHRD_IEEE80211 801 /* IEEE 802.11 */ #define ARPHRD_IEEE80211 801 /* IEEE 802.11 */
#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */ #define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */
#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */ #define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */
#define ARPHRD_IEEE802154 804
#define ARPHRD_PHONET 820 /* PhoNet media type */
#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */
#define ARPHRD_CAIF 822 /* CAIF media type */
#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */ #define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */
#define ARPHRD_NONE 0xFFFE /* zero header length */ #define ARPHRD_NONE 0xFFFE /* zero header length */
@ -126,13 +134,12 @@ struct arpreq_old {
* This structure defines an ethernet arp header. * This structure defines an ethernet arp header.
*/ */
struct arphdr struct arphdr {
{ __be16 ar_hrd; /* format of hardware address */
unsigned short ar_hrd; /* format of hardware address */ __be16 ar_pro; /* format of protocol address */
unsigned short ar_pro; /* format of protocol address */
unsigned char ar_hln; /* length of hardware address */ unsigned char ar_hln; /* length of hardware address */
unsigned char ar_pln; /* length of protocol address */ unsigned char ar_pln; /* length of protocol address */
unsigned short ar_op; /* ARP opcode (command) */ __be16 ar_op; /* ARP opcode (command) */
#if 0 #if 0
/* /*

View File

@ -9,7 +9,7 @@
* *
* Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
* Donald Becker, <becker@super.org> * Donald Becker, <becker@super.org>
* Alan Cox, <alan@redhat.com> * Alan Cox, <alan@lxorguk.ukuu.org.uk>
* Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -17,13 +17,15 @@
* as published by the Free Software Foundation; either version * as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#ifndef _LINUX_IF_ETHER_H #ifndef _LINUX_IF_ETHER_H
#define _LINUX_IF_ETHER_H #define _LINUX_IF_ETHER_H
#include <linux/types.h>
/* /*
* IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble
* and FCS/CRC (frame check sequence). * and FCS/CRC (frame check sequence).
*/ */
#define ETH_ALEN 6 /* Octets in one ethernet addr */ #define ETH_ALEN 6 /* Octets in one ethernet addr */
@ -31,6 +33,7 @@
#define ETH_ZLEN 60 /* Min. octets in frame sans FCS */ #define ETH_ZLEN 60 /* Min. octets in frame sans FCS */
#define ETH_DATA_LEN 1500 /* Max. octets in payload */ #define ETH_DATA_LEN 1500 /* Max. octets in payload */
#define ETH_FRAME_LEN 1514 /* Max. octets in frame sans FCS */ #define ETH_FRAME_LEN 1514 /* Max. octets in frame sans FCS */
#define ETH_FCS_LEN 4 /* Octets in the FCS */
/* /*
* These are the defined Ethernet Protocol ID's. * These are the defined Ethernet Protocol ID's.
@ -53,12 +56,15 @@
#define ETH_P_DIAG 0x6005 /* DEC Diagnostics */ #define ETH_P_DIAG 0x6005 /* DEC Diagnostics */
#define ETH_P_CUST 0x6006 /* DEC Customer use */ #define ETH_P_CUST 0x6006 /* DEC Customer use */
#define ETH_P_SCA 0x6007 /* DEC Systems Comms Arch */ #define ETH_P_SCA 0x6007 /* DEC Systems Comms Arch */
#define ETH_P_TEB 0x6558 /* Trans Ether Bridging */
#define ETH_P_RARP 0x8035 /* Reverse Addr Res packet */ #define ETH_P_RARP 0x8035 /* Reverse Addr Res packet */
#define ETH_P_ATALK 0x809B /* Appletalk DDP */ #define ETH_P_ATALK 0x809B /* Appletalk DDP */
#define ETH_P_AARP 0x80F3 /* Appletalk AARP */ #define ETH_P_AARP 0x80F3 /* Appletalk AARP */
#define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */ #define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */
#define ETH_P_IPX 0x8137 /* IPX over DIX */ #define ETH_P_IPX 0x8137 /* IPX over DIX */
#define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */ #define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */
#define ETH_P_PAUSE 0x8808 /* IEEE Pause frames. See 802.3 31B */
#define ETH_P_SLOW 0x8809 /* Slow Protocol. See 802.3ad 43B */
#define ETH_P_WCCP 0x883E /* Web-cache coordination protocol #define ETH_P_WCCP 0x883E /* Web-cache coordination protocol
* defined in draft-wilson-wrec-wccp-v2-00.txt */ * defined in draft-wilson-wrec-wccp-v2-00.txt */
#define ETH_P_PPP_DISC 0x8863 /* PPPoE discovery messages */ #define ETH_P_PPP_DISC 0x8863 /* PPPoE discovery messages */
@ -69,12 +75,18 @@
#define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport #define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport
* over Ethernet * over Ethernet
*/ */
#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */ #define ETH_P_AOE 0x88A2 /* ATA over Ethernet */
#define ETH_P_TIPC 0x88CA /* TIPC */
#define ETH_P_1588 0x88F7 /* IEEE 1588 Timesync */
#define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */
#define ETH_P_FIP 0x8914 /* FCoE Initialization Protocol */
#define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */
/* /*
* Non DIX types. Won't clash for 1500 types. * Non DIX types. Won't clash for 1500 types.
*/ */
#define ETH_P_802_3 0x0001 /* Dummy type for 802.3 frames */ #define ETH_P_802_3 0x0001 /* Dummy type for 802.3 frames */
#define ETH_P_AX25 0x0002 /* Dummy protocol id for AX.25 */ #define ETH_P_AX25 0x0002 /* Dummy protocol id for AX.25 */
#define ETH_P_ALL 0x0003 /* Every packet (be careful!!!) */ #define ETH_P_ALL 0x0003 /* Every packet (be careful!!!) */
@ -84,6 +96,7 @@
#define ETH_P_WAN_PPP 0x0007 /* Dummy type for WAN PPP frames*/ #define ETH_P_WAN_PPP 0x0007 /* Dummy type for WAN PPP frames*/
#define ETH_P_PPP_MP 0x0008 /* Dummy type for PPP MP frames */ #define ETH_P_PPP_MP 0x0008 /* Dummy type for PPP MP frames */
#define ETH_P_LOCALTALK 0x0009 /* Localtalk pseudo type */ #define ETH_P_LOCALTALK 0x0009 /* Localtalk pseudo type */
#define ETH_P_CAN 0x000C /* Controller Area Network */
#define ETH_P_PPPTALK 0x0010 /* Dummy type for Atalk over PPP*/ #define ETH_P_PPPTALK 0x0010 /* Dummy type for Atalk over PPP*/
#define ETH_P_TR_802_2 0x0011 /* 802.2 frames */ #define ETH_P_TR_802_2 0x0011 /* 802.2 frames */
#define ETH_P_MOBITEX 0x0015 /* Mobitex (kaz@cafe.net) */ #define ETH_P_MOBITEX 0x0015 /* Mobitex (kaz@cafe.net) */
@ -92,15 +105,20 @@
#define ETH_P_ECONET 0x0018 /* Acorn Econet */ #define ETH_P_ECONET 0x0018 /* Acorn Econet */
#define ETH_P_HDLC 0x0019 /* HDLC frames */ #define ETH_P_HDLC 0x0019 /* HDLC frames */
#define ETH_P_ARCNET 0x001A /* 1A for ArcNet :-) */ #define ETH_P_ARCNET 0x001A /* 1A for ArcNet :-) */
#define ETH_P_DSA 0x001B /* Distributed Switch Arch. */
#define ETH_P_TRAILER 0x001C /* Trailer switch tagging */
#define ETH_P_PHONET 0x00F5 /* Nokia Phonet frames */
#define ETH_P_IEEE802154 0x00F6 /* IEEE802.15.4 frame */
#define ETH_P_CAIF 0x00F7 /* ST-Ericsson CAIF protocol */
/* /*
* This is an Ethernet frame header. * This is an Ethernet frame header.
*/ */
struct ethhdr { struct ethhdr {
unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
unsigned char h_source[ETH_ALEN]; /* source ether addr */ unsigned char h_source[ETH_ALEN]; /* source ether addr */
unsigned short h_proto; /* packet type ID field */ __be16 h_proto; /* packet type ID field */
} __attribute__((packed)); } __attribute__((packed));
#endif /* _LINUX_IF_ETHER_H */ #endif /* _LINUX_IF_ETHER_H */

View File

@ -1,11 +1,11 @@
#ifndef _LINUX_IF_LINK_H #ifndef _LINUX_IF_LINK_H
#define _LINUX_IF_LINK_H #define _LINUX_IF_LINK_H
#include <linux/types.h>
#include <linux/netlink.h> #include <linux/netlink.h>
/* The struct should be in sync with struct net_device_stats */ /* This struct should be in sync with struct rtnl_link_stats64 */
struct rtnl_link_stats struct rtnl_link_stats {
{
__u32 rx_packets; /* total packets received */ __u32 rx_packets; /* total packets received */
__u32 tx_packets; /* total packets transmitted */ __u32 tx_packets; /* total packets transmitted */
__u32 rx_bytes; /* total bytes received */ __u32 rx_bytes; /* total bytes received */
@ -37,9 +37,41 @@ struct rtnl_link_stats
__u32 tx_compressed; __u32 tx_compressed;
}; };
/* The main device statistics structure */
struct rtnl_link_stats64 {
__u64 rx_packets; /* total packets received */
__u64 tx_packets; /* total packets transmitted */
__u64 rx_bytes; /* total bytes received */
__u64 tx_bytes; /* total bytes transmitted */
__u64 rx_errors; /* bad packets received */
__u64 tx_errors; /* packet transmit problems */
__u64 rx_dropped; /* no space in linux buffers */
__u64 tx_dropped; /* no space available in linux */
__u64 multicast; /* multicast packets received */
__u64 collisions;
/* detailed rx_errors: */
__u64 rx_length_errors;
__u64 rx_over_errors; /* receiver ring buff overflow */
__u64 rx_crc_errors; /* recved pkt with crc error */
__u64 rx_frame_errors; /* recv'd frame alignment error */
__u64 rx_fifo_errors; /* recv'r fifo overrun */
__u64 rx_missed_errors; /* receiver missed packet */
/* detailed tx_errors */
__u64 tx_aborted_errors;
__u64 tx_carrier_errors;
__u64 tx_fifo_errors;
__u64 tx_heartbeat_errors;
__u64 tx_window_errors;
/* for cslip etc */
__u64 rx_compressed;
__u64 tx_compressed;
};
/* The struct should be in sync with struct ifmap */ /* The struct should be in sync with struct ifmap */
struct rtnl_link_ifmap struct rtnl_link_ifmap {
{
__u64 mem_start; __u64 mem_start;
__u64 mem_end; __u64 mem_end;
__u64 base_addr; __u64 base_addr;
@ -48,8 +80,7 @@ struct rtnl_link_ifmap
__u8 port; __u8 port;
}; };
enum enum {
{
IFLA_UNSPEC, IFLA_UNSPEC,
IFLA_ADDRESS, IFLA_ADDRESS,
IFLA_BROADCAST, IFLA_BROADCAST,
@ -79,6 +110,12 @@ enum
IFLA_LINKINFO, IFLA_LINKINFO,
#define IFLA_LINKINFO IFLA_LINKINFO #define IFLA_LINKINFO IFLA_LINKINFO
IFLA_NET_NS_PID, IFLA_NET_NS_PID,
IFLA_IFALIAS,
IFLA_NUM_VF, /* Number of VFs if device is SR-IOV PF */
IFLA_VFINFO_LIST,
IFLA_STATS64,
IFLA_VF_PORTS,
IFLA_PORT_SELF,
__IFLA_MAX __IFLA_MAX
}; };
@ -121,8 +158,7 @@ enum
*/ */
/* Subtype attributes for IFLA_PROTINFO */ /* Subtype attributes for IFLA_PROTINFO */
enum enum {
{
IFLA_INET6_UNSPEC, IFLA_INET6_UNSPEC,
IFLA_INET6_FLAGS, /* link flags */ IFLA_INET6_FLAGS, /* link flags */
IFLA_INET6_CONF, /* sysctl parameters */ IFLA_INET6_CONF, /* sysctl parameters */
@ -135,16 +171,14 @@ enum
#define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1) #define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1)
struct ifla_cacheinfo struct ifla_cacheinfo {
{
__u32 max_reasm_len; __u32 max_reasm_len;
__u32 tstamp; /* ipv6InterfaceTable updated timestamp */ __u32 tstamp; /* ipv6InterfaceTable updated timestamp */
__u32 reachable_time; __u32 reachable_time;
__u32 retrans_time; __u32 retrans_time;
}; };
enum enum {
{
IFLA_INFO_UNSPEC, IFLA_INFO_UNSPEC,
IFLA_INFO_KIND, IFLA_INFO_KIND,
IFLA_INFO_DATA, IFLA_INFO_DATA,
@ -156,8 +190,7 @@ enum
/* VLAN section */ /* VLAN section */
enum enum {
{
IFLA_VLAN_UNSPEC, IFLA_VLAN_UNSPEC,
IFLA_VLAN_ID, IFLA_VLAN_ID,
IFLA_VLAN_FLAGS, IFLA_VLAN_FLAGS,
@ -173,8 +206,7 @@ struct ifla_vlan_flags {
__u32 mask; __u32 mask;
}; };
enum enum {
{
IFLA_VLAN_QOS_UNSPEC, IFLA_VLAN_QOS_UNSPEC,
IFLA_VLAN_QOS_MAPPING, IFLA_VLAN_QOS_MAPPING,
__IFLA_VLAN_QOS_MAX __IFLA_VLAN_QOS_MAX
@ -182,10 +214,140 @@ enum
#define IFLA_VLAN_QOS_MAX (__IFLA_VLAN_QOS_MAX - 1) #define IFLA_VLAN_QOS_MAX (__IFLA_VLAN_QOS_MAX - 1)
struct ifla_vlan_qos_mapping struct ifla_vlan_qos_mapping {
{
__u32 from; __u32 from;
__u32 to; __u32 to;
}; };
/* MACVLAN section */
enum {
IFLA_MACVLAN_UNSPEC,
IFLA_MACVLAN_MODE,
__IFLA_MACVLAN_MAX,
};
#define IFLA_MACVLAN_MAX (__IFLA_MACVLAN_MAX - 1)
enum macvlan_mode {
MACVLAN_MODE_PRIVATE = 1, /* don't talk to other macvlans */
MACVLAN_MODE_VEPA = 2, /* talk to other ports through ext bridge */
MACVLAN_MODE_BRIDGE = 4, /* talk to bridge ports directly */
};
/* SR-IOV virtual function management section */
enum {
IFLA_VF_INFO_UNSPEC,
IFLA_VF_INFO,
__IFLA_VF_INFO_MAX,
};
#define IFLA_VF_INFO_MAX (__IFLA_VF_INFO_MAX - 1)
enum {
IFLA_VF_UNSPEC,
IFLA_VF_MAC, /* Hardware queue specific attributes */
IFLA_VF_VLAN,
IFLA_VF_TX_RATE, /* TX Bandwidth Allocation */
__IFLA_VF_MAX,
};
#define IFLA_VF_MAX (__IFLA_VF_MAX - 1)
struct ifla_vf_mac {
__u32 vf;
__u8 mac[32]; /* MAX_ADDR_LEN */
};
struct ifla_vf_vlan {
__u32 vf;
__u32 vlan; /* 0 - 4095, 0 disables VLAN filter */
__u32 qos;
};
struct ifla_vf_tx_rate {
__u32 vf;
__u32 rate; /* Max TX bandwidth in Mbps, 0 disables throttling */
};
struct ifla_vf_info {
__u32 vf;
__u8 mac[32];
__u32 vlan;
__u32 qos;
__u32 tx_rate;
};
/* VF ports management section
*
* Nested layout of set/get msg is:
*
* [IFLA_NUM_VF]
* [IFLA_VF_PORTS]
* [IFLA_VF_PORT]
* [IFLA_PORT_*], ...
* [IFLA_VF_PORT]
* [IFLA_PORT_*], ...
* ...
* [IFLA_PORT_SELF]
* [IFLA_PORT_*], ...
*/
enum {
IFLA_VF_PORT_UNSPEC,
IFLA_VF_PORT, /* nest */
__IFLA_VF_PORT_MAX,
};
#define IFLA_VF_PORT_MAX (__IFLA_VF_PORT_MAX - 1)
enum {
IFLA_PORT_UNSPEC,
IFLA_PORT_VF, /* __u32 */
IFLA_PORT_PROFILE, /* string */
IFLA_PORT_VSI_TYPE, /* 802.1Qbg (pre-)standard VDP */
IFLA_PORT_INSTANCE_UUID, /* binary UUID */
IFLA_PORT_HOST_UUID, /* binary UUID */
IFLA_PORT_REQUEST, /* __u8 */
IFLA_PORT_RESPONSE, /* __u16, output only */
__IFLA_PORT_MAX,
};
#define IFLA_PORT_MAX (__IFLA_PORT_MAX - 1)
#define PORT_PROFILE_MAX 40
#define PORT_UUID_MAX 16
#define PORT_SELF_VF -1
enum {
PORT_REQUEST_PREASSOCIATE = 0,
PORT_REQUEST_PREASSOCIATE_RR,
PORT_REQUEST_ASSOCIATE,
PORT_REQUEST_DISASSOCIATE,
};
enum {
PORT_VDP_RESPONSE_SUCCESS = 0,
PORT_VDP_RESPONSE_INVALID_FORMAT,
PORT_VDP_RESPONSE_INSUFFICIENT_RESOURCES,
PORT_VDP_RESPONSE_UNUSED_VTID,
PORT_VDP_RESPONSE_VTID_VIOLATION,
PORT_VDP_RESPONSE_VTID_VERSION_VIOALTION,
PORT_VDP_RESPONSE_OUT_OF_SYNC,
/* 0x08-0xFF reserved for future VDP use */
PORT_PROFILE_RESPONSE_SUCCESS = 0x100,
PORT_PROFILE_RESPONSE_INPROGRESS,
PORT_PROFILE_RESPONSE_INVALID,
PORT_PROFILE_RESPONSE_BADSTATE,
PORT_PROFILE_RESPONSE_INSUFFICIENT_RESOURCES,
PORT_PROFILE_RESPONSE_ERROR,
};
struct ifla_port_vsi {
__u8 vsi_mgr_id;
__u8 vsi_type_id[3];
__u8 vsi_type_version;
__u8 pad[3];
};
#endif /* _LINUX_IF_LINK_H */ #endif /* _LINUX_IF_LINK_H */

View File

@ -13,7 +13,6 @@
#ifndef _LINUX_IF_VLAN_H_ #ifndef _LINUX_IF_VLAN_H_
#define _LINUX_IF_VLAN_H_ #define _LINUX_IF_VLAN_H_
/* VLAN IOCTLs are found in sockios.h */ /* VLAN IOCTLs are found in sockios.h */
/* Passed in vlan_ioctl_args structure to determine behaviour. */ /* Passed in vlan_ioctl_args structure to determine behaviour. */
@ -32,6 +31,8 @@ enum vlan_ioctl_cmds {
enum vlan_flags { enum vlan_flags {
VLAN_FLAG_REORDER_HDR = 0x1, VLAN_FLAG_REORDER_HDR = 0x1,
VLAN_FLAG_GVRP = 0x2,
VLAN_FLAG_LOOSE_BINDING = 0x4,
}; };
enum vlan_name_types { enum vlan_name_types {
@ -55,7 +56,7 @@ struct vlan_ioctl_args {
unsigned int flag; /* Matches vlan_dev_info flags */ unsigned int flag; /* Matches vlan_dev_info flags */
} u; } u;
short vlan_qos; short vlan_qos;
}; };
#endif /* !(_LINUX_IF_VLAN_H_) */ #endif /* !(_LINUX_IF_VLAN_H_) */

View File

@ -1,10 +1,10 @@
#ifndef __LINUX_NEIGHBOUR_H #ifndef __LINUX_NEIGHBOUR_H
#define __LINUX_NEIGHBOUR_H #define __LINUX_NEIGHBOUR_H
#include <linux/types.h>
#include <linux/netlink.h> #include <linux/netlink.h>
struct ndmsg struct ndmsg {
{
__u8 ndm_family; __u8 ndm_family;
__u8 ndm_pad1; __u8 ndm_pad1;
__u16 ndm_pad2; __u16 ndm_pad2;
@ -14,8 +14,7 @@ struct ndmsg
__u8 ndm_type; __u8 ndm_type;
}; };
enum enum {
{
NDA_UNSPEC, NDA_UNSPEC,
NDA_DST, NDA_DST,
NDA_LLADDR, NDA_LLADDR,
@ -30,6 +29,7 @@ enum
* Neighbor Cache Entry Flags * Neighbor Cache Entry Flags
*/ */
#define NTF_USE 0x01
#define NTF_PROXY 0x08 /* == ATF_PUBL */ #define NTF_PROXY 0x08 /* == ATF_PUBL */
#define NTF_ROUTER 0x80 #define NTF_ROUTER 0x80
@ -54,8 +54,7 @@ enum
NUD_PERMANENT is also cannot be deleted by garbage collectors. NUD_PERMANENT is also cannot be deleted by garbage collectors.
*/ */
struct nda_cacheinfo struct nda_cacheinfo {
{
__u32 ndm_confirmed; __u32 ndm_confirmed;
__u32 ndm_used; __u32 ndm_used;
__u32 ndm_updated; __u32 ndm_updated;
@ -87,8 +86,7 @@ struct nda_cacheinfo
* device. * device.
****/ ****/
struct ndt_stats struct ndt_stats {
{
__u64 ndts_allocs; __u64 ndts_allocs;
__u64 ndts_destroys; __u64 ndts_destroys;
__u64 ndts_hash_grows; __u64 ndts_hash_grows;
@ -122,15 +120,13 @@ enum {
}; };
#define NDTPA_MAX (__NDTPA_MAX - 1) #define NDTPA_MAX (__NDTPA_MAX - 1)
struct ndtmsg struct ndtmsg {
{
__u8 ndtm_family; __u8 ndtm_family;
__u8 ndtm_pad1; __u8 ndtm_pad1;
__u16 ndtm_pad2; __u16 ndtm_pad2;
}; };
struct ndt_config struct ndt_config {
{
__u16 ndtc_key_len; __u16 ndtc_key_len;
__u16 ndtc_entry_size; __u16 ndtc_entry_size;
__u32 ndtc_entries; __u32 ndtc_entries;

View File

@ -1,6 +1,7 @@
#ifndef __LINUX_NETFILTER_H #ifndef __LINUX_NETFILTER_H
#define __LINUX_NETFILTER_H #define __LINUX_NETFILTER_H
#include <linux/types.h>
/* Responses from hook functions. */ /* Responses from hook functions. */
#define NF_DROP 0 #define NF_DROP 0
@ -19,9 +20,8 @@
#define NF_VERDICT_QMASK 0xffff0000 #define NF_VERDICT_QMASK 0xffff0000
#define NF_VERDICT_QBITS 16 #define NF_VERDICT_QBITS 16
#define NF_QUEUE_NR(x) (((x << NF_VERDICT_QBITS) & NF_VERDICT_QMASK) | NF_QUEUE) #define NF_QUEUE_NR(x) ((((x) << NF_VERDICT_BITS) & NF_VERDICT_QMASK) | NF_QUEUE)
/* only for userspace compatibility */
/* Generic cache responses from hook functions. /* Generic cache responses from hook functions.
<= 0x2000 is used for protocol-flags. */ <= 0x2000 is used for protocol-flags. */
#define NFC_UNKNOWN 0x4000 #define NFC_UNKNOWN 0x4000
@ -33,7 +33,25 @@ enum nf_inet_hooks {
NF_INET_FORWARD, NF_INET_FORWARD,
NF_INET_LOCAL_OUT, NF_INET_LOCAL_OUT,
NF_INET_POST_ROUTING, NF_INET_POST_ROUTING,
NF_INET_NUMHOOKS, NF_INET_NUMHOOKS
};
enum {
NFPROTO_UNSPEC = 0,
NFPROTO_IPV4 = 2,
NFPROTO_ARP = 3,
NFPROTO_BRIDGE = 7,
NFPROTO_IPV6 = 10,
NFPROTO_DECNET = 12,
NFPROTO_NUMPROTO,
};
union nf_inet_addr {
__u32 all[4];
__be32 ip;
__be32 ip6[4];
struct in_addr in;
struct in6_addr in6;
}; };
#endif /*__LINUX_NETFILTER_H*/ #endif /*__LINUX_NETFILTER_H*/

View File

@ -27,16 +27,16 @@
#define MAX_LINKS 32 #define MAX_LINKS 32
struct sockaddr_nl struct net;
{
struct sockaddr_nl {
sa_family_t nl_family; /* AF_NETLINK */ sa_family_t nl_family; /* AF_NETLINK */
unsigned short nl_pad; /* zero */ unsigned short nl_pad; /* zero */
__u32 nl_pid; /* port ID */ __u32 nl_pid; /* port ID */
__u32 nl_groups; /* multicast groups mask */ __u32 nl_groups; /* multicast groups mask */
}; };
struct nlmsghdr struct nlmsghdr {
{
__u32 nlmsg_len; /* Length of message including header */ __u32 nlmsg_len; /* Length of message including header */
__u16 nlmsg_type; /* Message content */ __u16 nlmsg_type; /* Message content */
__u16 nlmsg_flags; /* Additional flags */ __u16 nlmsg_flags; /* Additional flags */
@ -92,8 +92,7 @@ struct nlmsghdr
#define NLMSG_MIN_TYPE 0x10 /* < 0x10: reserved control messages */ #define NLMSG_MIN_TYPE 0x10 /* < 0x10: reserved control messages */
struct nlmsgerr struct nlmsgerr {
{
int error; int error;
struct nlmsghdr msg; struct nlmsghdr msg;
}; };
@ -101,9 +100,10 @@ struct nlmsgerr
#define NETLINK_ADD_MEMBERSHIP 1 #define NETLINK_ADD_MEMBERSHIP 1
#define NETLINK_DROP_MEMBERSHIP 2 #define NETLINK_DROP_MEMBERSHIP 2
#define NETLINK_PKTINFO 3 #define NETLINK_PKTINFO 3
#define NETLINK_BROADCAST_ERROR 4
#define NETLINK_NO_ENOBUFS 5
struct nl_pktinfo struct nl_pktinfo {
{
__u32 group; __u32 group;
}; };
@ -123,8 +123,7 @@ enum {
* <-------------- nlattr->nla_len --------------> * <-------------- nlattr->nla_len -------------->
*/ */
struct nlattr struct nlattr {
{
__u16 nla_len; __u16 nla_len;
__u16 nla_type; __u16 nla_type;
}; };

View File

@ -75,8 +75,7 @@ bits 9,10,11: redirect counter - redirect TTL. Loop avoidance
#define SET_TC_AT(v,n) ((V_TC_AT(n)) | (v & ~M_TC_AT)) #define SET_TC_AT(v,n) ((V_TC_AT(n)) | (v & ~M_TC_AT))
/* Action attributes */ /* Action attributes */
enum enum {
{
TCA_ACT_UNSPEC, TCA_ACT_UNSPEC,
TCA_ACT_KIND, TCA_ACT_KIND,
TCA_ACT_OPTIONS, TCA_ACT_OPTIONS,
@ -108,8 +107,7 @@ enum
#define TC_ACT_JUMP 0x10000000 #define TC_ACT_JUMP 0x10000000
/* Action type identifiers*/ /* Action type identifiers*/
enum enum {
{
TCA_ID_UNSPEC=0, TCA_ID_UNSPEC=0,
TCA_ID_POLICE=1, TCA_ID_POLICE=1,
/* other actions go here */ /* other actions go here */
@ -118,8 +116,7 @@ enum
#define TCA_ID_MAX __TCA_ID_MAX #define TCA_ID_MAX __TCA_ID_MAX
struct tc_police struct tc_police {
{
__u32 index; __u32 index;
int action; int action;
#define TC_POLICE_UNSPEC TC_ACT_UNSPEC #define TC_POLICE_UNSPEC TC_ACT_UNSPEC
@ -138,15 +135,13 @@ struct tc_police
__u32 capab; __u32 capab;
}; };
struct tcf_t struct tcf_t {
{
__u64 install; __u64 install;
__u64 lastuse; __u64 lastuse;
__u64 expires; __u64 expires;
}; };
struct tc_cnt struct tc_cnt {
{
int refcnt; int refcnt;
int bindcnt; int bindcnt;
}; };
@ -158,8 +153,7 @@ struct tc_cnt
int refcnt; \ int refcnt; \
int bindcnt int bindcnt
enum enum {
{
TCA_POLICE_UNSPEC, TCA_POLICE_UNSPEC,
TCA_POLICE_TBF, TCA_POLICE_TBF,
TCA_POLICE_RATE, TCA_POLICE_RATE,
@ -182,8 +176,7 @@ enum
#define TC_U32_UNSPEC 0 #define TC_U32_UNSPEC 0
#define TC_U32_ROOT (0xFFF00000) #define TC_U32_ROOT (0xFFF00000)
enum enum {
{
TCA_U32_UNSPEC, TCA_U32_UNSPEC,
TCA_U32_CLASSID, TCA_U32_CLASSID,
TCA_U32_HASH, TCA_U32_HASH,
@ -200,16 +193,14 @@ enum
#define TCA_U32_MAX (__TCA_U32_MAX - 1) #define TCA_U32_MAX (__TCA_U32_MAX - 1)
struct tc_u32_key struct tc_u32_key {
{
__be32 mask; __be32 mask;
__be32 val; __be32 val;
int off; int off;
int offmask; int offmask;
}; };
struct tc_u32_sel struct tc_u32_sel {
{
unsigned char flags; unsigned char flags;
unsigned char offshift; unsigned char offshift;
unsigned char nkeys; unsigned char nkeys;
@ -223,15 +214,13 @@ struct tc_u32_sel
struct tc_u32_key keys[0]; struct tc_u32_key keys[0];
}; };
struct tc_u32_mark struct tc_u32_mark {
{
__u32 val; __u32 val;
__u32 mask; __u32 mask;
__u32 success; __u32 success;
}; };
struct tc_u32_pcnt struct tc_u32_pcnt {
{
__u64 rcnt; __u64 rcnt;
__u64 rhit; __u64 rhit;
__u64 kcnts[0]; __u64 kcnts[0];
@ -249,8 +238,7 @@ struct tc_u32_pcnt
/* RSVP filter */ /* RSVP filter */
enum enum {
{
TCA_RSVP_UNSPEC, TCA_RSVP_UNSPEC,
TCA_RSVP_CLASSID, TCA_RSVP_CLASSID,
TCA_RSVP_DST, TCA_RSVP_DST,
@ -263,15 +251,13 @@ enum
#define TCA_RSVP_MAX (__TCA_RSVP_MAX - 1 ) #define TCA_RSVP_MAX (__TCA_RSVP_MAX - 1 )
struct tc_rsvp_gpi struct tc_rsvp_gpi {
{
__u32 key; __u32 key;
__u32 mask; __u32 mask;
int offset; int offset;
}; };
struct tc_rsvp_pinfo struct tc_rsvp_pinfo {
{
struct tc_rsvp_gpi dpi; struct tc_rsvp_gpi dpi;
struct tc_rsvp_gpi spi; struct tc_rsvp_gpi spi;
__u8 protocol; __u8 protocol;
@ -282,8 +268,7 @@ struct tc_rsvp_pinfo
/* ROUTE filter */ /* ROUTE filter */
enum enum {
{
TCA_ROUTE4_UNSPEC, TCA_ROUTE4_UNSPEC,
TCA_ROUTE4_CLASSID, TCA_ROUTE4_CLASSID,
TCA_ROUTE4_TO, TCA_ROUTE4_TO,
@ -299,8 +284,7 @@ enum
/* FW filter */ /* FW filter */
enum enum {
{
TCA_FW_UNSPEC, TCA_FW_UNSPEC,
TCA_FW_CLASSID, TCA_FW_CLASSID,
TCA_FW_POLICE, TCA_FW_POLICE,
@ -314,8 +298,7 @@ enum
/* TC index filter */ /* TC index filter */
enum enum {
{
TCA_TCINDEX_UNSPEC, TCA_TCINDEX_UNSPEC,
TCA_TCINDEX_HASH, TCA_TCINDEX_HASH,
TCA_TCINDEX_MASK, TCA_TCINDEX_MASK,
@ -331,8 +314,7 @@ enum
/* Flow filter */ /* Flow filter */
enum enum {
{
FLOW_KEY_SRC, FLOW_KEY_SRC,
FLOW_KEY_DST, FLOW_KEY_DST,
FLOW_KEY_PROTO, FLOW_KEY_PROTO,
@ -355,14 +337,12 @@ enum
#define FLOW_KEY_MAX (__FLOW_KEY_MAX - 1) #define FLOW_KEY_MAX (__FLOW_KEY_MAX - 1)
enum enum {
{
FLOW_MODE_MAP, FLOW_MODE_MAP,
FLOW_MODE_HASH, FLOW_MODE_HASH,
}; };
enum enum {
{
TCA_FLOW_UNSPEC, TCA_FLOW_UNSPEC,
TCA_FLOW_KEYS, TCA_FLOW_KEYS,
TCA_FLOW_MODE, TCA_FLOW_MODE,
@ -383,8 +363,7 @@ enum
/* Basic filter */ /* Basic filter */
enum enum {
{
TCA_BASIC_UNSPEC, TCA_BASIC_UNSPEC,
TCA_BASIC_CLASSID, TCA_BASIC_CLASSID,
TCA_BASIC_EMATCHES, TCA_BASIC_EMATCHES,
@ -398,8 +377,7 @@ enum
/* Cgroup classifier */ /* Cgroup classifier */
enum enum {
{
TCA_CGROUP_UNSPEC, TCA_CGROUP_UNSPEC,
TCA_CGROUP_ACT, TCA_CGROUP_ACT,
TCA_CGROUP_POLICE, TCA_CGROUP_POLICE,
@ -411,14 +389,12 @@ enum
/* Extended Matches */ /* Extended Matches */
struct tcf_ematch_tree_hdr struct tcf_ematch_tree_hdr {
{
__u16 nmatches; __u16 nmatches;
__u16 progid; __u16 progid;
}; };
enum enum {
{
TCA_EMATCH_TREE_UNSPEC, TCA_EMATCH_TREE_UNSPEC,
TCA_EMATCH_TREE_HDR, TCA_EMATCH_TREE_HDR,
TCA_EMATCH_TREE_LIST, TCA_EMATCH_TREE_LIST,
@ -426,8 +402,7 @@ enum
}; };
#define TCA_EMATCH_TREE_MAX (__TCA_EMATCH_TREE_MAX - 1) #define TCA_EMATCH_TREE_MAX (__TCA_EMATCH_TREE_MAX - 1)
struct tcf_ematch_hdr struct tcf_ematch_hdr {
{
__u16 matchid; __u16 matchid;
__u16 kind; __u16 kind;
__u16 flags; __u16 flags;
@ -457,8 +432,7 @@ struct tcf_ematch_hdr
#define TCF_EM_REL_MASK 3 #define TCF_EM_REL_MASK 3
#define TCF_EM_REL_VALID(v) (((v) & TCF_EM_REL_MASK) != TCF_EM_REL_MASK) #define TCF_EM_REL_VALID(v) (((v) & TCF_EM_REL_MASK) != TCF_EM_REL_MASK)
enum enum {
{
TCF_LAYER_LINK, TCF_LAYER_LINK,
TCF_LAYER_NETWORK, TCF_LAYER_NETWORK,
TCF_LAYER_TRANSPORT, TCF_LAYER_TRANSPORT,
@ -479,13 +453,11 @@ enum
#define TCF_EM_VLAN 6 #define TCF_EM_VLAN 6
#define TCF_EM_MAX 6 #define TCF_EM_MAX 6
enum enum {
{
TCF_EM_PROG_TC TCF_EM_PROG_TC
}; };
enum enum {
{
TCF_EM_OPND_EQ, TCF_EM_OPND_EQ,
TCF_EM_OPND_GT, TCF_EM_OPND_GT,
TCF_EM_OPND_LT TCF_EM_OPND_LT

View File

@ -1,6 +1,8 @@
#ifndef __LINUX_PKT_SCHED_H #ifndef __LINUX_PKT_SCHED_H
#define __LINUX_PKT_SCHED_H #define __LINUX_PKT_SCHED_H
#include <linux/types.h>
/* Logical priority bands not depending on specific packet scheduler. /* Logical priority bands not depending on specific packet scheduler.
Every scheduler will map them to real traffic classes, if it has Every scheduler will map them to real traffic classes, if it has
no more precise mechanism to classify packets. no more precise mechanism to classify packets.
@ -27,8 +29,7 @@
Particular schedulers may have also their private records. Particular schedulers may have also their private records.
*/ */
struct tc_stats struct tc_stats {
{
__u64 bytes; /* NUmber of enqueues bytes */ __u64 bytes; /* NUmber of enqueues bytes */
__u32 packets; /* Number of enqueued packets */ __u32 packets; /* Number of enqueued packets */
__u32 drops; /* Packets dropped because of lack of resources */ __u32 drops; /* Packets dropped because of lack of resources */
@ -40,8 +41,7 @@ struct tc_stats
__u32 backlog; __u32 backlog;
}; };
struct tc_estimator struct tc_estimator {
{
signed char interval; signed char interval;
unsigned char ewma_log; unsigned char ewma_log;
}; };
@ -73,20 +73,40 @@ struct tc_estimator
#define TC_H_ROOT (0xFFFFFFFFU) #define TC_H_ROOT (0xFFFFFFFFU)
#define TC_H_INGRESS (0xFFFFFFF1U) #define TC_H_INGRESS (0xFFFFFFF1U)
struct tc_ratespec struct tc_ratespec {
{
unsigned char cell_log; unsigned char cell_log;
unsigned char __reserved; unsigned char __reserved;
unsigned short feature; unsigned short overhead;
short addend; short cell_align;
unsigned short mpu; unsigned short mpu;
__u32 rate; __u32 rate;
}; };
#define TC_RTAB_SIZE 1024
struct tc_sizespec {
unsigned char cell_log;
unsigned char size_log;
short cell_align;
int overhead;
unsigned int linklayer;
unsigned int mpu;
unsigned int mtu;
unsigned int tsize;
};
enum {
TCA_STAB_UNSPEC,
TCA_STAB_BASE,
TCA_STAB_DATA,
__TCA_STAB_MAX
};
#define TCA_STAB_MAX (__TCA_STAB_MAX - 1)
/* FIFO section */ /* FIFO section */
struct tc_fifo_qopt struct tc_fifo_qopt {
{
__u32 limit; /* Queue length: bytes for bfifo, packets for pfifo */ __u32 limit; /* Queue length: bytes for bfifo, packets for pfifo */
}; };
@ -95,25 +115,21 @@ struct tc_fifo_qopt
#define TCQ_PRIO_BANDS 16 #define TCQ_PRIO_BANDS 16
#define TCQ_MIN_PRIO_BANDS 2 #define TCQ_MIN_PRIO_BANDS 2
struct tc_prio_qopt struct tc_prio_qopt {
{
int bands; /* Number of bands */ int bands; /* Number of bands */
__u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */ __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */
}; };
enum /* MULTIQ section */
{
TCA_PRIO_UNSPEC,
TCA_PRIO_MQ,
__TCA_PRIO_MAX
};
#define TCA_PRIO_MAX (__TCA_PRIO_MAX - 1) struct tc_multiq_qopt {
__u16 bands; /* Number of bands */
__u16 max_bands; /* Maximum number of queues */
};
/* TBF section */ /* TBF section */
struct tc_tbf_qopt struct tc_tbf_qopt {
{
struct tc_ratespec rate; struct tc_ratespec rate;
struct tc_ratespec peakrate; struct tc_ratespec peakrate;
__u32 limit; __u32 limit;
@ -121,8 +137,7 @@ struct tc_tbf_qopt
__u32 mtu; __u32 mtu;
}; };
enum enum {
{
TCA_TBF_UNSPEC, TCA_TBF_UNSPEC,
TCA_TBF_PARMS, TCA_TBF_PARMS,
TCA_TBF_RTAB, TCA_TBF_RTAB,
@ -139,8 +154,7 @@ enum
/* SFQ section */ /* SFQ section */
struct tc_sfq_qopt struct tc_sfq_qopt {
{
unsigned quantum; /* Bytes per round allocated to flow */ unsigned quantum; /* Bytes per round allocated to flow */
int perturb_period; /* Period of hash perturbation */ int perturb_period; /* Period of hash perturbation */
__u32 limit; /* Maximal packets in queue */ __u32 limit; /* Maximal packets in queue */
@ -148,6 +162,10 @@ struct tc_sfq_qopt
unsigned flows; /* Maximal number of flows */ unsigned flows; /* Maximal number of flows */
}; };
struct tc_sfq_xstats {
__s32 allot;
};
/* /*
* NOTE: limit, divisor and flows are hardwired to code at the moment. * NOTE: limit, divisor and flows are hardwired to code at the moment.
* *
@ -159,8 +177,7 @@ struct tc_sfq_qopt
/* RED section */ /* RED section */
enum enum {
{
TCA_RED_UNSPEC, TCA_RED_UNSPEC,
TCA_RED_PARMS, TCA_RED_PARMS,
TCA_RED_STAB, TCA_RED_STAB,
@ -169,8 +186,7 @@ enum
#define TCA_RED_MAX (__TCA_RED_MAX - 1) #define TCA_RED_MAX (__TCA_RED_MAX - 1)
struct tc_red_qopt struct tc_red_qopt {
{
__u32 limit; /* HARD maximal queue length (bytes) */ __u32 limit; /* HARD maximal queue length (bytes) */
__u32 qth_min; /* Min average length threshold (bytes) */ __u32 qth_min; /* Min average length threshold (bytes) */
__u32 qth_max; /* Max average length threshold (bytes) */ __u32 qth_max; /* Max average length threshold (bytes) */
@ -182,8 +198,7 @@ struct tc_red_qopt
#define TC_RED_HARDDROP 2 #define TC_RED_HARDDROP 2
}; };
struct tc_red_xstats struct tc_red_xstats {
{
__u32 early; /* Early drops */ __u32 early; /* Early drops */
__u32 pdrop; /* Drops due to queue limits */ __u32 pdrop; /* Drops due to queue limits */
__u32 other; /* Drops due to drop() calls */ __u32 other; /* Drops due to drop() calls */
@ -194,8 +209,7 @@ struct tc_red_xstats
#define MAX_DPs 16 #define MAX_DPs 16
enum enum {
{
TCA_GRED_UNSPEC, TCA_GRED_UNSPEC,
TCA_GRED_PARMS, TCA_GRED_PARMS,
TCA_GRED_STAB, TCA_GRED_STAB,
@ -205,8 +219,7 @@ enum
#define TCA_GRED_MAX (__TCA_GRED_MAX - 1) #define TCA_GRED_MAX (__TCA_GRED_MAX - 1)
struct tc_gred_qopt struct tc_gred_qopt {
{
__u32 limit; /* HARD maximal queue length (bytes) */ __u32 limit; /* HARD maximal queue length (bytes) */
__u32 qth_min; /* Min average length threshold (bytes) */ __u32 qth_min; /* Min average length threshold (bytes) */
__u32 qth_max; /* Max average length threshold (bytes) */ __u32 qth_max; /* Max average length threshold (bytes) */
@ -226,8 +239,7 @@ struct tc_gred_qopt
}; };
/* gred setup */ /* gred setup */
struct tc_gred_sopt struct tc_gred_sopt {
{
__u32 DPs; __u32 DPs;
__u32 def_DP; __u32 def_DP;
__u8 grio; __u8 grio;
@ -240,8 +252,7 @@ struct tc_gred_sopt
#define TC_HTB_MAXDEPTH 8 #define TC_HTB_MAXDEPTH 8
#define TC_HTB_PROTOVER 3 /* the same as HTB and TC's major */ #define TC_HTB_PROTOVER 3 /* the same as HTB and TC's major */
struct tc_htb_opt struct tc_htb_opt {
{
struct tc_ratespec rate; struct tc_ratespec rate;
struct tc_ratespec ceil; struct tc_ratespec ceil;
__u32 buffer; __u32 buffer;
@ -250,8 +261,7 @@ struct tc_htb_opt
__u32 level; /* out only */ __u32 level; /* out only */
__u32 prio; __u32 prio;
}; };
struct tc_htb_glob struct tc_htb_glob {
{
__u32 version; /* to match HTB/TC */ __u32 version; /* to match HTB/TC */
__u32 rate2quantum; /* bps->quantum divisor */ __u32 rate2quantum; /* bps->quantum divisor */
__u32 defcls; /* default class number */ __u32 defcls; /* default class number */
@ -260,8 +270,7 @@ struct tc_htb_glob
/* stats */ /* stats */
__u32 direct_pkts; /* count of non shapped packets */ __u32 direct_pkts; /* count of non shapped packets */
}; };
enum enum {
{
TCA_HTB_UNSPEC, TCA_HTB_UNSPEC,
TCA_HTB_PARMS, TCA_HTB_PARMS,
TCA_HTB_INIT, TCA_HTB_INIT,
@ -272,8 +281,7 @@ enum
#define TCA_HTB_MAX (__TCA_HTB_MAX - 1) #define TCA_HTB_MAX (__TCA_HTB_MAX - 1)
struct tc_htb_xstats struct tc_htb_xstats {
{
__u32 lends; __u32 lends;
__u32 borrows; __u32 borrows;
__u32 giants; /* too big packets (rate will not be accurate) */ __u32 giants; /* too big packets (rate will not be accurate) */
@ -283,28 +291,24 @@ struct tc_htb_xstats
/* HFSC section */ /* HFSC section */
struct tc_hfsc_qopt struct tc_hfsc_qopt {
{
__u16 defcls; /* default class */ __u16 defcls; /* default class */
}; };
struct tc_service_curve struct tc_service_curve {
{
__u32 m1; /* slope of the first segment in bps */ __u32 m1; /* slope of the first segment in bps */
__u32 d; /* x-projection of the first segment in us */ __u32 d; /* x-projection of the first segment in us */
__u32 m2; /* slope of the second segment in bps */ __u32 m2; /* slope of the second segment in bps */
}; };
struct tc_hfsc_stats struct tc_hfsc_stats {
{
__u64 work; /* total work done */ __u64 work; /* total work done */
__u64 rtwork; /* work done by real-time criteria */ __u64 rtwork; /* work done by real-time criteria */
__u32 period; /* current period */ __u32 period; /* current period */
__u32 level; /* class level in hierarchy */ __u32 level; /* class level in hierarchy */
}; };
enum enum {
{
TCA_HFSC_UNSPEC, TCA_HFSC_UNSPEC,
TCA_HFSC_RSC, TCA_HFSC_RSC,
TCA_HFSC_FSC, TCA_HFSC_FSC,
@ -321,8 +325,7 @@ enum
#define TC_CBQ_MAXLEVEL 8 #define TC_CBQ_MAXLEVEL 8
#define TC_CBQ_DEF_EWMA 5 #define TC_CBQ_DEF_EWMA 5
struct tc_cbq_lssopt struct tc_cbq_lssopt {
{
unsigned char change; unsigned char change;
unsigned char flags; unsigned char flags;
#define TCF_CBQ_LSS_BOUNDED 1 #define TCF_CBQ_LSS_BOUNDED 1
@ -341,8 +344,7 @@ struct tc_cbq_lssopt
__u32 avpkt; __u32 avpkt;
}; };
struct tc_cbq_wrropt struct tc_cbq_wrropt {
{
unsigned char flags; unsigned char flags;
unsigned char priority; unsigned char priority;
unsigned char cpriority; unsigned char cpriority;
@ -351,8 +353,7 @@ struct tc_cbq_wrropt
__u32 weight; __u32 weight;
}; };
struct tc_cbq_ovl struct tc_cbq_ovl {
{
unsigned char strategy; unsigned char strategy;
#define TC_CBQ_OVL_CLASSIC 0 #define TC_CBQ_OVL_CLASSIC 0
#define TC_CBQ_OVL_DELAY 1 #define TC_CBQ_OVL_DELAY 1
@ -364,30 +365,26 @@ struct tc_cbq_ovl
__u32 penalty; __u32 penalty;
}; };
struct tc_cbq_police struct tc_cbq_police {
{
unsigned char police; unsigned char police;
unsigned char __res1; unsigned char __res1;
unsigned short __res2; unsigned short __res2;
}; };
struct tc_cbq_fopt struct tc_cbq_fopt {
{
__u32 split; __u32 split;
__u32 defmap; __u32 defmap;
__u32 defchange; __u32 defchange;
}; };
struct tc_cbq_xstats struct tc_cbq_xstats {
{
__u32 borrows; __u32 borrows;
__u32 overactions; __u32 overactions;
__s32 avgidle; __s32 avgidle;
__s32 undertime; __s32 undertime;
}; };
enum enum {
{
TCA_CBQ_UNSPEC, TCA_CBQ_UNSPEC,
TCA_CBQ_LSSOPT, TCA_CBQ_LSSOPT,
TCA_CBQ_WRROPT, TCA_CBQ_WRROPT,
@ -432,8 +429,7 @@ enum {
/* Network emulator */ /* Network emulator */
enum enum {
{
TCA_NETEM_UNSPEC, TCA_NETEM_UNSPEC,
TCA_NETEM_CORR, TCA_NETEM_CORR,
TCA_NETEM_DELAY_DIST, TCA_NETEM_DELAY_DIST,
@ -444,8 +440,7 @@ enum
#define TCA_NETEM_MAX (__TCA_NETEM_MAX - 1) #define TCA_NETEM_MAX (__TCA_NETEM_MAX - 1)
struct tc_netem_qopt struct tc_netem_qopt {
{
__u32 latency; /* added delay (us) */ __u32 latency; /* added delay (us) */
__u32 limit; /* fifo limit (packets) */ __u32 limit; /* fifo limit (packets) */
__u32 loss; /* random packet loss (0=none ~0=100%) */ __u32 loss; /* random packet loss (0=none ~0=100%) */
@ -454,25 +449,36 @@ struct tc_netem_qopt
__u32 jitter; /* random jitter in latency (us) */ __u32 jitter; /* random jitter in latency (us) */
}; };
struct tc_netem_corr struct tc_netem_corr {
{
__u32 delay_corr; /* delay correlation */ __u32 delay_corr; /* delay correlation */
__u32 loss_corr; /* packet loss correlation */ __u32 loss_corr; /* packet loss correlation */
__u32 dup_corr; /* duplicate correlation */ __u32 dup_corr; /* duplicate correlation */
}; };
struct tc_netem_reorder struct tc_netem_reorder {
{
__u32 probability; __u32 probability;
__u32 correlation; __u32 correlation;
}; };
struct tc_netem_corrupt struct tc_netem_corrupt {
{
__u32 probability; __u32 probability;
__u32 correlation; __u32 correlation;
}; };
#define NETEM_DIST_SCALE 8192 #define NETEM_DIST_SCALE 8192
/* DRR */
enum {
TCA_DRR_UNSPEC,
TCA_DRR_QUANTUM,
__TCA_DRR_MAX
};
#define TCA_DRR_MAX (__TCA_DRR_MAX - 1)
struct tc_drr_stats {
__u32 deficit;
};
#endif #endif

View File

@ -1,11 +1,19 @@
#ifndef __LINUX_RTNETLINK_H #ifndef __LINUX_RTNETLINK_H
#define __LINUX_RTNETLINK_H #define __LINUX_RTNETLINK_H
#include <linux/types.h>
#include <linux/netlink.h> #include <linux/netlink.h>
#include <linux/if_link.h> #include <linux/if_link.h>
#include <linux/if_addr.h> #include <linux/if_addr.h>
#include <linux/neighbour.h> #include <linux/neighbour.h>
/* rtnetlink families. Values up to 127 are reserved for real address
* families, values above 128 may be used arbitrarily.
*/
#define RTNL_FAMILY_IPMR 128
#define RTNL_FAMILY_IP6MR 129
#define RTNL_FAMILY_MAX 129
/**** /****
* Routing/neighbour discovery messages. * Routing/neighbour discovery messages.
****/ ****/
@ -103,10 +111,15 @@ enum {
RTM_NEWADDRLABEL = 72, RTM_NEWADDRLABEL = 72,
#define RTM_NEWADDRLABEL RTM_NEWADDRLABEL #define RTM_NEWADDRLABEL RTM_NEWADDRLABEL
RTM_DELADDRLABEL, RTM_DELADDRLABEL,
#define RTM_NEWADDRLABEL RTM_NEWADDRLABEL #define RTM_DELADDRLABEL RTM_DELADDRLABEL
RTM_GETADDRLABEL, RTM_GETADDRLABEL,
#define RTM_GETADDRLABEL RTM_GETADDRLABEL #define RTM_GETADDRLABEL RTM_GETADDRLABEL
RTM_GETDCB = 78,
#define RTM_GETDCB RTM_GETDCB
RTM_SETDCB,
#define RTM_SETDCB RTM_SETDCB
__RTM_MAX, __RTM_MAX,
#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) #define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1)
}; };
@ -121,8 +134,7 @@ enum {
with attribute type. with attribute type.
*/ */
struct rtattr struct rtattr {
{
unsigned short rta_len; unsigned short rta_len;
unsigned short rta_type; unsigned short rta_type;
}; };
@ -148,8 +160,7 @@ struct rtattr
* Definitions used in routing table administration. * Definitions used in routing table administration.
****/ ****/
struct rtmsg struct rtmsg {
{
unsigned char rtm_family; unsigned char rtm_family;
unsigned char rtm_dst_len; unsigned char rtm_dst_len;
unsigned char rtm_src_len; unsigned char rtm_src_len;
@ -165,8 +176,7 @@ struct rtmsg
/* rtm_type */ /* rtm_type */
enum enum {
{
RTN_UNSPEC, RTN_UNSPEC,
RTN_UNICAST, /* Gateway or direct route */ RTN_UNICAST, /* Gateway or direct route */
RTN_LOCAL, /* Accept locally */ RTN_LOCAL, /* Accept locally */
@ -211,6 +221,7 @@ enum
#define RTPROT_DNROUTED 13 /* DECnet routing daemon */ #define RTPROT_DNROUTED 13 /* DECnet routing daemon */
#define RTPROT_XORP 14 /* XORP */ #define RTPROT_XORP 14 /* XORP */
#define RTPROT_NTK 15 /* Netsukuku */ #define RTPROT_NTK 15 /* Netsukuku */
#define RTPROT_DHCP 16 /* DHCP client */
/* rtm_scope /* rtm_scope
@ -223,8 +234,7 @@ enum
could be assigned a value between UNIVERSE and LINK. could be assigned a value between UNIVERSE and LINK.
*/ */
enum rt_scope_t enum rt_scope_t {
{
RT_SCOPE_UNIVERSE=0, RT_SCOPE_UNIVERSE=0,
/* User defined values */ /* User defined values */
RT_SCOPE_SITE=200, RT_SCOPE_SITE=200,
@ -242,10 +252,10 @@ enum rt_scope_t
/* Reserved table identifiers */ /* Reserved table identifiers */
enum rt_class_t enum rt_class_t {
{
RT_TABLE_UNSPEC=0, RT_TABLE_UNSPEC=0,
/* User defined values */ /* User defined values */
RT_TABLE_COMPAT=252,
RT_TABLE_DEFAULT=253, RT_TABLE_DEFAULT=253,
RT_TABLE_MAIN=254, RT_TABLE_MAIN=254,
RT_TABLE_LOCAL=255, RT_TABLE_LOCAL=255,
@ -255,8 +265,7 @@ enum rt_class_t
/* Routing message attributes */ /* Routing message attributes */
enum rtattr_type_t enum rtattr_type_t {
{
RTA_UNSPEC, RTA_UNSPEC,
RTA_DST, RTA_DST,
RTA_SRC, RTA_SRC,
@ -273,7 +282,7 @@ enum rtattr_type_t
RTA_SESSION, /* no longer used */ RTA_SESSION, /* no longer used */
RTA_MP_ALGO, /* no longer used */ RTA_MP_ALGO, /* no longer used */
RTA_TABLE, RTA_TABLE,
RTA_GENERATION, RTA_MARK,
__RTA_MAX __RTA_MAX
}; };
@ -291,8 +300,7 @@ enum rtattr_type_t
* and rtt for different paths from multipath. * and rtt for different paths from multipath.
*/ */
struct rtnexthop struct rtnexthop {
{
unsigned short rtnh_len; unsigned short rtnh_len;
unsigned char rtnh_flags; unsigned char rtnh_flags;
unsigned char rtnh_hops; unsigned char rtnh_hops;
@ -318,8 +326,7 @@ struct rtnexthop
/* RTM_CACHEINFO */ /* RTM_CACHEINFO */
struct rta_cacheinfo struct rta_cacheinfo {
{
__u32 rta_clntref; __u32 rta_clntref;
__u32 rta_lastuse; __u32 rta_lastuse;
__s32 rta_expires; __s32 rta_expires;
@ -334,8 +341,7 @@ struct rta_cacheinfo
/* RTM_METRICS --- array of struct rtattr with types of RTAX_* */ /* RTM_METRICS --- array of struct rtattr with types of RTAX_* */
enum enum {
{
RTAX_UNSPEC, RTAX_UNSPEC,
#define RTAX_UNSPEC RTAX_UNSPEC #define RTAX_UNSPEC RTAX_UNSPEC
RTAX_LOCK, RTAX_LOCK,
@ -364,6 +370,8 @@ enum
#define RTAX_FEATURES RTAX_FEATURES #define RTAX_FEATURES RTAX_FEATURES
RTAX_RTO_MIN, RTAX_RTO_MIN,
#define RTAX_RTO_MIN RTAX_RTO_MIN #define RTAX_RTO_MIN RTAX_RTO_MIN
RTAX_INITRWND,
#define RTAX_INITRWND RTAX_INITRWND
__RTAX_MAX __RTAX_MAX
}; };
@ -374,8 +382,7 @@ enum
#define RTAX_FEATURE_TIMESTAMP 0x00000004 #define RTAX_FEATURE_TIMESTAMP 0x00000004
#define RTAX_FEATURE_ALLFRAG 0x00000008 #define RTAX_FEATURE_ALLFRAG 0x00000008
struct rta_session struct rta_session {
{
__u8 proto; __u8 proto;
__u8 pad1; __u8 pad1;
__u16 pad2; __u16 pad2;
@ -400,8 +407,7 @@ struct rta_session
* General form of address family dependent message. * General form of address family dependent message.
****/ ****/
struct rtgenmsg struct rtgenmsg {
{
unsigned char rtgen_family; unsigned char rtgen_family;
}; };
@ -414,8 +420,7 @@ struct rtgenmsg
* on network protocol. * on network protocol.
*/ */
struct ifinfomsg struct ifinfomsg {
{
unsigned char ifi_family; unsigned char ifi_family;
unsigned char __ifi_pad; unsigned char __ifi_pad;
unsigned short ifi_type; /* ARPHRD_* */ unsigned short ifi_type; /* ARPHRD_* */
@ -428,8 +433,7 @@ struct ifinfomsg
* prefix information * prefix information
****/ ****/
struct prefixmsg struct prefixmsg {
{
unsigned char prefix_family; unsigned char prefix_family;
unsigned char prefix_pad1; unsigned char prefix_pad1;
unsigned short prefix_pad2; unsigned short prefix_pad2;
@ -450,8 +454,7 @@ enum
#define PREFIX_MAX (__PREFIX_MAX - 1) #define PREFIX_MAX (__PREFIX_MAX - 1)
struct prefix_cacheinfo struct prefix_cacheinfo {
{
__u32 preferred_time; __u32 preferred_time;
__u32 valid_time; __u32 valid_time;
}; };
@ -461,8 +464,7 @@ struct prefix_cacheinfo
* Traffic control messages. * Traffic control messages.
****/ ****/
struct tcmsg struct tcmsg {
{
unsigned char tcm_family; unsigned char tcm_family;
unsigned char tcm__pad1; unsigned char tcm__pad1;
unsigned short tcm__pad2; unsigned short tcm__pad2;
@ -472,8 +474,7 @@ struct tcmsg
__u32 tcm_info; __u32 tcm_info;
}; };
enum enum {
{
TCA_UNSPEC, TCA_UNSPEC,
TCA_KIND, TCA_KIND,
TCA_OPTIONS, TCA_OPTIONS,
@ -482,6 +483,7 @@ enum
TCA_RATE, TCA_RATE,
TCA_FCNT, TCA_FCNT,
TCA_STATS2, TCA_STATS2,
TCA_STAB,
__TCA_MAX __TCA_MAX
}; };
@ -494,8 +496,7 @@ enum
* Neighbor Discovery userland options * Neighbor Discovery userland options
****/ ****/
struct nduseroptmsg struct nduseroptmsg {
{
unsigned char nduseropt_family; unsigned char nduseropt_family;
unsigned char nduseropt_pad1; unsigned char nduseropt_pad1;
unsigned short nduseropt_opts_len; /* Total length of options */ unsigned short nduseropt_opts_len; /* Total length of options */
@ -507,8 +508,7 @@ struct nduseroptmsg
/* Followed by one or more ND options */ /* Followed by one or more ND options */
}; };
enum enum {
{
NDUSEROPT_UNSPEC, NDUSEROPT_UNSPEC,
NDUSEROPT_SRCADDR, NDUSEROPT_SRCADDR,
__NDUSEROPT_MAX __NDUSEROPT_MAX
@ -581,13 +581,16 @@ enum rtnetlink_groups {
#define RTNLGRP_IPV6_RULE RTNLGRP_IPV6_RULE #define RTNLGRP_IPV6_RULE RTNLGRP_IPV6_RULE
RTNLGRP_ND_USEROPT, RTNLGRP_ND_USEROPT,
#define RTNLGRP_ND_USEROPT RTNLGRP_ND_USEROPT #define RTNLGRP_ND_USEROPT RTNLGRP_ND_USEROPT
RTNLGRP_PHONET_IFADDR,
#define RTNLGRP_PHONET_IFADDR RTNLGRP_PHONET_IFADDR
RTNLGRP_PHONET_ROUTE,
#define RTNLGRP_PHONET_ROUTE RTNLGRP_PHONET_ROUTE
__RTNLGRP_MAX __RTNLGRP_MAX
}; };
#define RTNLGRP_MAX (__RTNLGRP_MAX - 1) #define RTNLGRP_MAX (__RTNLGRP_MAX - 1)
/* TC action piece */ /* TC action piece */
struct tcamsg struct tcamsg {
{
unsigned char tca_family; unsigned char tca_family;
unsigned char tca__pad1; unsigned char tca__pad1;
unsigned short tca__pad2; unsigned short tca__pad2;

View File

@ -147,8 +147,8 @@ static inline void rtnl_copy_ratespec(struct rtnl_ratespec *dst,
struct tc_ratespec *src) struct tc_ratespec *src)
{ {
dst->rs_cell_log = src->cell_log; dst->rs_cell_log = src->cell_log;
dst->rs_feature = src->feature; dst->rs_overhead = src->overhead;
dst->rs_addend = src->addend; dst->rs_cell_align = src->cell_align;
dst->rs_mpu = src->mpu; dst->rs_mpu = src->mpu;
dst->rs_rate = src->rate; dst->rs_rate = src->rate;
} }
@ -157,8 +157,8 @@ static inline void rtnl_rcopy_ratespec(struct tc_ratespec *dst,
struct rtnl_ratespec *src) struct rtnl_ratespec *src)
{ {
dst->cell_log = src->rs_cell_log; dst->cell_log = src->rs_cell_log;
dst->feature = src->rs_feature; dst->overhead = src->rs_overhead;
dst->addend = src->rs_addend; dst->cell_align = src->rs_cell_align;
dst->mpu = src->rs_mpu; dst->mpu = src->rs_mpu;
dst->rate = src->rs_rate; dst->rate = src->rs_rate;
} }

View File

@ -414,8 +414,8 @@ struct rtnl_neightbl
struct rtnl_ratespec struct rtnl_ratespec
{ {
uint8_t rs_cell_log; uint8_t rs_cell_log;
uint16_t rs_feature; uint16_t rs_overhead;
uint16_t rs_addend; int16_t rs_cell_align;
uint16_t rs_mpu; uint16_t rs_mpu;
uint32_t rs_rate; uint32_t rs_rate;
}; };
@ -638,8 +638,6 @@ struct rtnl_htb_class
uint32_t ch_rbuffer; uint32_t ch_rbuffer;
uint32_t ch_cbuffer; uint32_t ch_cbuffer;
uint32_t ch_quantum; uint32_t ch_quantum;
uint8_t ch_overhead;
uint8_t ch_mpu;
uint32_t ch_mask; uint32_t ch_mask;
}; };

View File

@ -49,7 +49,7 @@ extern int rtnl_tc_calc_cell_log(int);
*/ */
#define RTNL_TC_RTABLE_SIZE 256 #define RTNL_TC_RTABLE_SIZE 256
extern int rtnl_tc_build_rate_table(uint32_t *, uint8_t, uint8_t, int, int); extern int rtnl_tc_build_rate_table(uint32_t *, uint8_t, int, int);
/* TC Handle Translations */ /* TC Handle Translations */

View File

@ -119,8 +119,6 @@ static int htb_class_msg_parser(struct rtnl_class *class)
d->ch_rbuffer = rtnl_tc_calc_bufsize(opts.buffer, opts.rate.rate); d->ch_rbuffer = rtnl_tc_calc_bufsize(opts.buffer, opts.rate.rate);
d->ch_cbuffer = rtnl_tc_calc_bufsize(opts.cbuffer, opts.ceil.rate); d->ch_cbuffer = rtnl_tc_calc_bufsize(opts.cbuffer, opts.ceil.rate);
d->ch_quantum = opts.quantum; d->ch_quantum = opts.quantum;
d->ch_overhead = (opts.rate.mpu >> 8) & 0xff;
d->ch_mpu = opts.rate.mpu & 0xff;
d->ch_mask = (SCH_HTB_HAS_PRIO | SCH_HTB_HAS_RATE | d->ch_mask = (SCH_HTB_HAS_PRIO | SCH_HTB_HAS_RATE |
SCH_HTB_HAS_CEIL | SCH_HTB_HAS_RBUFFER | SCH_HTB_HAS_CEIL | SCH_HTB_HAS_RBUFFER |
@ -220,10 +218,10 @@ static void htb_class_dump_details(struct rtnl_class *class,
nl_dump(p, " quantum %u", d->ch_quantum); nl_dump(p, " quantum %u", d->ch_quantum);
if (d->ch_mask & SCH_HTB_HAS_OVERHEAD) if (d->ch_mask & SCH_HTB_HAS_OVERHEAD)
nl_dump(p, " overhead %u", d->ch_overhead); nl_dump(p, " overhead %u", d->ch_rate.rs_overhead);
if (d->ch_mask & SCH_HTB_HAS_MPU) if (d->ch_mask & SCH_HTB_HAS_MPU)
nl_dump(p, " mpu %u", d->ch_mpu); nl_dump(p, " mpu %u", d->ch_rate.rs_mpu);
} }
static struct nl_msg *htb_qdisc_get_opts(struct rtnl_qdisc *qdisc) static struct nl_msg *htb_qdisc_get_opts(struct rtnl_qdisc *qdisc)
@ -270,7 +268,6 @@ static struct nl_msg *htb_class_get_opts(struct rtnl_class *class)
struct tc_htb_opt opts; struct tc_htb_opt opts;
struct nl_msg *msg; struct nl_msg *msg;
int buffer, cbuffer; int buffer, cbuffer;
uint8_t overhead = 0, mpu = 0;
if (d == NULL) if (d == NULL)
return NULL; return NULL;
@ -321,23 +318,14 @@ static struct nl_msg *htb_class_get_opts(struct rtnl_class *class)
if (d->ch_mask & SCH_HTB_HAS_QUANTUM) if (d->ch_mask & SCH_HTB_HAS_QUANTUM)
opts.quantum = d->ch_quantum; opts.quantum = d->ch_quantum;
if (d->ch_mask & SCH_HTB_HAS_OVERHEAD)
overhead = d->ch_overhead;
if (d->ch_mask & SCH_HTB_HAS_MPU)
mpu = d->ch_mpu;
opts.rate.mpu = mpu | (overhead << 8);
opts.ceil.mpu = mpu | (overhead << 8);
nla_put(msg, TCA_HTB_PARMS, sizeof(opts), &opts); nla_put(msg, TCA_HTB_PARMS, sizeof(opts), &opts);
rtnl_tc_build_rate_table(rtable, mpu, overhead, rtnl_tc_build_rate_table(rtable, d->ch_rate.rs_mpu,
1 << opts.rate.cell_log, 1 << opts.rate.cell_log,
opts.rate.rate); opts.rate.rate);
nla_put(msg, TCA_HTB_RTAB, sizeof(rtable), &rtable); nla_put(msg, TCA_HTB_RTAB, sizeof(rtable), &rtable);
rtnl_tc_build_rate_table(ctable, mpu, overhead, rtnl_tc_build_rate_table(ctable, d->ch_ceil.rs_mpu,
1 << opts.ceil.cell_log, 1 << opts.ceil.cell_log,
opts.ceil.rate); opts.ceil.rate);
nla_put(msg, TCA_HTB_CTAB, sizeof(ctable), &ctable); nla_put(msg, TCA_HTB_CTAB, sizeof(ctable), &ctable);
@ -491,7 +479,8 @@ void rtnl_htb_set_overhead(struct rtnl_class *class, uint8_t overhead)
if (d == NULL) if (d == NULL)
return; return;
d->ch_overhead = overhead; d->ch_rate.rs_overhead = overhead;
d->ch_ceil.rs_overhead = overhead;
d->ch_mask |= SCH_HTB_HAS_OVERHEAD; d->ch_mask |= SCH_HTB_HAS_OVERHEAD;
} }
@ -506,7 +495,8 @@ void rtnl_htb_set_mpu(struct rtnl_class *class, uint8_t mpu)
if (d == NULL) if (d == NULL)
return; return;
d->ch_mpu = mpu; d->ch_rate.rs_mpu = mpu;
d->ch_ceil.rs_mpu = mpu;
d->ch_mask |= SCH_HTB_HAS_MPU; d->ch_mask |= SCH_HTB_HAS_MPU;
} }

View File

@ -174,7 +174,7 @@ static struct nl_msg *tbf_get_opts(struct rtnl_qdisc *qdisc)
tbf->qt_rate.rs_mpu = tbf->qt_mpu; tbf->qt_rate.rs_mpu = tbf->qt_mpu;
rtnl_rcopy_ratespec(&opts.rate, &tbf->qt_rate); rtnl_rcopy_ratespec(&opts.rate, &tbf->qt_rate);
rtnl_tc_build_rate_table(rtab, tbf->qt_mpu & 0xff, tbf->qt_mpu >> 8, rtnl_tc_build_rate_table(rtab, tbf->qt_mpu & 0xff,
1 << tbf->qt_rate.rs_cell_log, 1 << tbf->qt_rate.rs_cell_log,
tbf->qt_rate.rs_rate); tbf->qt_rate.rs_rate);
@ -184,7 +184,6 @@ static struct nl_msg *tbf_get_opts(struct rtnl_qdisc *qdisc)
rtnl_rcopy_ratespec(&opts.peakrate, &tbf->qt_peakrate); rtnl_rcopy_ratespec(&opts.peakrate, &tbf->qt_peakrate);
rtnl_tc_build_rate_table(ptab, tbf->qt_mpu & 0xff, rtnl_tc_build_rate_table(ptab, tbf->qt_mpu & 0xff,
tbf->qt_mpu >> 8,
1 << tbf->qt_peakrate.rs_cell_log, 1 << tbf->qt_peakrate.rs_cell_log,
tbf->qt_peakrate.rs_rate); tbf->qt_peakrate.rs_rate);
} }

View File

@ -191,7 +191,7 @@ void tca_dump_line(struct rtnl_tca *g, const char *type,
link_cache = nl_cache_mngt_require("route/link"); link_cache = nl_cache_mngt_require("route/link");
nl_dump_line(p, "%s %s ", g->tc_kind, type); nl_dump_line(p, "%s %s ", type, g->tc_kind);
if (link_cache) { if (link_cache) {
char buf[32]; char buf[32];
@ -201,7 +201,7 @@ void tca_dump_line(struct rtnl_tca *g, const char *type,
} else } else
nl_dump(p, "dev %u ", g->tc_ifindex); nl_dump(p, "dev %u ", g->tc_ifindex);
nl_dump(p, "handle %s parent %s", nl_dump(p, "id %s parent %s",
rtnl_tc_handle2str(g->tc_handle, handle, sizeof(handle)), rtnl_tc_handle2str(g->tc_handle, handle, sizeof(handle)),
rtnl_tc_handle2str(g->tc_parent, parent, sizeof(parent))); rtnl_tc_handle2str(g->tc_parent, parent, sizeof(parent)));
} }
@ -432,7 +432,6 @@ int rtnl_tc_calc_cell_log(int cell_size)
* Compute a transmission time lookup table * Compute a transmission time lookup table
* @arg dst Destination buffer of RTNL_TC_RTABLE_SIZE uint32_t[]. * @arg dst Destination buffer of RTNL_TC_RTABLE_SIZE uint32_t[].
* @arg mpu Minimal size of a packet at all times. * @arg mpu Minimal size of a packet at all times.
* @arg overhead Overhead to be added to each packet.
* @arg cell Size of cell, i.e. size of step between entries in bytes. * @arg cell Size of cell, i.e. size of step between entries in bytes.
* @arg rate Rate in bytes per second. * @arg rate Rate in bytes per second.
* *
@ -443,8 +442,7 @@ int rtnl_tc_calc_cell_log(int cell_size)
* txtime = table[pktsize >> log2(cell)]; * txtime = table[pktsize >> log2(cell)];
* @endcode * @endcode
*/ */
int rtnl_tc_build_rate_table(uint32_t *dst, uint8_t mpu, uint8_t overhead, int rtnl_tc_build_rate_table(uint32_t *dst, uint8_t mpu, int cell, int rate)
int cell, int rate)
{ {
int i, size, cell_log; int i, size, cell_log;
@ -453,7 +451,7 @@ int rtnl_tc_build_rate_table(uint32_t *dst, uint8_t mpu, uint8_t overhead,
return cell_log; return cell_log;
for (i = 0; i < RTNL_TC_RTABLE_SIZE; i++) { for (i = 0; i < RTNL_TC_RTABLE_SIZE; i++) {
size = (i << cell_log) + overhead; size = (i << cell_log);
if (size < mpu) if (size < mpu)
size = mpu; size = mpu;