Commit 4259cb25 authored by Linus Torvalds's avatar Linus Torvalds

Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (32 commits)
  [NETPOLL]: Fix local_bh_enable() warning.
  [IPVS]: Make ip_vs_sync.c <= 80col wide.
  [IPVS]: Use msleep_interruptable() instead of ssleep() aka msleep()
  [HAMRADIO]: Fix baycom_epp.c compile failure.
  [DCCP]: Whitespace cleanups
  [DCCP] ccid3: Fixup some type conversions related to rtts
  [DCCP] ccid3: BUG-FIX - conversion errors
  [DCCP] ccid3: Reorder packet history source file
  [DCCP] ccid3: Reorder packet history header file
  [DCCP] ccid3: Make debug output consistent
  [DCCP] ccid3: Perform history operations only after packet has been sent
  [DCCP] ccid3: TX history - remove unused field
  [DCCP] ccid3: Shift window counter computation
  [DCCP] ccid3: Sanity-check RTT samples
  [DCCP] ccid3: Initialise RTT values
  [DCCP] ccid: Deprecate ccid_hc_tx_insert_options
  [DCCP]: Warn when discarding packet due to internal errors
  [DCCP]: Only deliver to the CCID rx side in charge
  [DCCP]: Simplify TFRC calculation
  [DCCP]: Debug timeval operations
  ...
parents cd39301a a49f99ff
......@@ -19,7 +19,8 @@ for real time and multimedia traffic.
It has a base protocol and pluggable congestion control IDs (CCIDs).
It is at experimental RFC status and the homepage for DCCP as a protocol is at:
It is at proposed standard RFC status and the homepage for DCCP as a protocol
is at:
http://www.read.cs.ucla.edu/dccp/
Missing features
......@@ -34,9 +35,6 @@ The known bugs are at:
Socket options
==============
DCCP_SOCKOPT_PACKET_SIZE is used for CCID3 to set default packet size for
calculations.
DCCP_SOCKOPT_SERVICE sets the service. The specification mandates use of
service codes (RFC 4340, sec. 8.1.2); if this socket option is not set,
the socket will fall back to 0 (which means that no meaningful service code
......
......@@ -24,7 +24,7 @@
#define SHA384_DIGEST_SIZE 48
#define SHA512_DIGEST_SIZE 64
#define SHA384_HMAC_BLOCK_SIZE 96
#define SHA384_HMAC_BLOCK_SIZE 128
#define SHA512_HMAC_BLOCK_SIZE 128
struct sha512_ctx {
......
......@@ -2,4 +2,4 @@
fore200e_mkfirm
fore200e_pca_fw.c
pca200e.bin
pca200e_ecd.bin2
......@@ -1177,7 +1177,7 @@ static void baycom_probe(struct net_device *dev)
dev->mtu = AX25_DEF_PACLEN; /* eth_mtu is the default */
dev->addr_len = AX25_ADDR_LEN; /* sizeof an ax.25 address */
memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN);
memcpy(dev->dev_addr, &ax25_nocall, AX25_ADDR_LEN);
memcpy(dev->dev_addr, &null_ax25_address, AX25_ADDR_LEN);
dev->tx_queue_len = 16;
/* New style flags */
......
......@@ -382,7 +382,7 @@ config SDLA
# Wan router core.
config WAN_ROUTER_DRIVERS
bool "WAN router drivers"
tristate "WAN router drivers"
depends on WAN && WAN_ROUTER
---help---
Connect LAN to WAN via Linux box.
......@@ -393,7 +393,8 @@ config WAN_ROUTER_DRIVERS
<file:Documentation/networking/wan-router.txt>.
Note that the answer to this question won't directly affect the
kernel: saying N will just cause the configurator to skip all
kernel except for how subordinate drivers may be built:
saying N will just cause the configurator to skip all
the questions about WAN router drivers.
If unsure, say N.
......
......@@ -176,7 +176,7 @@ enum {
};
/* DCCP features (RFC 4340 section 6.4) */
enum {
enum {
DCCPF_RESERVED = 0,
DCCPF_CCID = 1,
DCCPF_SHORT_SEQNOS = 2, /* XXX: not yet implemented */
......
......@@ -37,10 +37,14 @@ struct tfrc_rx_info {
* @tfrctx_p: current loss event rate (5.4)
* @tfrctx_rto: estimate of RTO, equals 4*RTT (4.3)
* @tfrctx_ipi: inter-packet interval (4.6)
*
* Note: X and X_recv are both maintained in units of 64 * bytes/second. This
* enables a finer resolution of sending rates and avoids problems with
* integer arithmetic; u32 is not sufficient as scaling consumes 6 bits.
*/
struct tfrc_tx_info {
__u32 tfrctx_x;
__u32 tfrctx_x_recv;
__u64 tfrctx_x;
__u64 tfrctx_x_recv;
__u32 tfrctx_x_calc;
__u32 tfrctx_rtt;
__u32 tfrctx_p;
......
......@@ -285,6 +285,8 @@ extern struct sock *ax25_make_new(struct sock *, struct ax25_dev *);
extern const ax25_address ax25_bcast;
extern const ax25_address ax25_defaddr;
extern const ax25_address null_ax25_address;
extern char *ax2asc(char *buf, const ax25_address *);
extern void asc2ax(ax25_address *addr, const char *callsign);
extern int ax25cmp(const ax25_address *, const ax25_address *);
extern int ax25digicmp(const ax25_digi *, const ax25_digi *);
extern const unsigned char *ax25_addr_parse(const unsigned char *, int,
......
......@@ -83,7 +83,7 @@ EXPORT_SYMBOL(ax2asc);
*/
void asc2ax(ax25_address *addr, const char *callsign)
{
char *s;
const char *s;
int n;
for (s = callsign, n = 0; n < 6; n++) {
......
......@@ -242,10 +242,14 @@ static void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
/* don't get messages out of order, and no recursion */
if (skb_queue_len(&npinfo->txq) == 0 &&
npinfo->poll_owner != smp_processor_id() &&
netif_tx_trylock(dev)) {
npinfo->poll_owner != smp_processor_id()) {
unsigned long flags;
local_irq_save(flags);
if (netif_tx_trylock(dev)) {
/* try until next clock tick */
for (tries = jiffies_to_usecs(1)/USEC_PER_POLL; tries > 0; --tries) {
for (tries = jiffies_to_usecs(1)/USEC_PER_POLL;
tries > 0; --tries) {
if (!netif_queue_stopped(dev))
status = dev->hard_start_xmit(skb, dev);
......@@ -259,6 +263,8 @@ static void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
}
netif_tx_unlock(dev);
}
local_irq_restore(flags);
}
if (status != NETDEV_TX_OK) {
skb_queue_tail(&npinfo->txq, skb);
......
......@@ -43,8 +43,6 @@ struct ccid_operations {
unsigned char* value);
int (*ccid_hc_rx_insert_options)(struct sock *sk,
struct sk_buff *skb);
int (*ccid_hc_tx_insert_options)(struct sock *sk,
struct sk_buff *skb);
void (*ccid_hc_tx_packet_recv)(struct sock *sk,
struct sk_buff *skb);
int (*ccid_hc_tx_parse_options)(struct sock *sk,
......@@ -146,14 +144,6 @@ static inline int ccid_hc_rx_parse_options(struct ccid *ccid, struct sock *sk,
return rc;
}
static inline int ccid_hc_tx_insert_options(struct ccid *ccid, struct sock *sk,
struct sk_buff *skb)
{
if (ccid->ccid_ops->ccid_hc_tx_insert_options != NULL)
return ccid->ccid_ops->ccid_hc_tx_insert_options(sk, skb);
return 0;
}
static inline int ccid_hc_rx_insert_options(struct ccid *ccid, struct sock *sk,
struct sk_buff *skb)
{
......
This diff is collapsed.
......@@ -51,6 +51,16 @@
/* Parameter t_mbi from [RFC 3448, 4.3]: backoff interval in seconds */
#define TFRC_T_MBI 64
/* What we think is a reasonable upper limit on RTT values */
#define CCID3_SANE_RTT_MAX ((suseconds_t)(4 * USEC_PER_SEC))
#define CCID3_RTT_SANITY_CHECK(rtt) do { \
if (rtt > CCID3_SANE_RTT_MAX) { \
DCCP_CRIT("RTT (%d) too large, substituting %d", \
(int)rtt, (int)CCID3_SANE_RTT_MAX); \
rtt = CCID3_SANE_RTT_MAX; \
} } while (0)
enum ccid3_options {
TFRC_OPT_LOSS_EVENT_RATE = 192,
TFRC_OPT_LOSS_INTERVALS = 193,
......@@ -75,14 +85,14 @@ enum ccid3_hc_tx_states {
/** struct ccid3_hc_tx_sock - CCID3 sender half-connection socket
*
* @ccid3hctx_x - Current sending rate
* @ccid3hctx_x_recv - Receive rate
* @ccid3hctx_x_calc - Calculated send rate (RFC 3448, 3.1)
* @ccid3hctx_x - Current sending rate in 64 * bytes per second
* @ccid3hctx_x_recv - Receive rate in 64 * bytes per second
* @ccid3hctx_x_calc - Calculated rate in bytes per second
* @ccid3hctx_rtt - Estimate of current round trip time in usecs
* @ccid3hctx_p - Current loss event rate (0-1) scaled by 1000000
* @ccid3hctx_s - Packet size
* @ccid3hctx_t_rto - Retransmission Timeout (RFC 3448, 3.1)
* @ccid3hctx_t_ipi - Interpacket (send) interval (RFC 3448, 4.6)
* @ccid3hctx_s - Packet size in bytes
* @ccid3hctx_t_rto - Nofeedback Timer setting in usecs
* @ccid3hctx_t_ipi - Interpacket (send) interval (RFC 3448, 4.6) in usecs
* @ccid3hctx_state - Sender state, one of %ccid3_hc_tx_states
* @ccid3hctx_last_win_count - Last window counter sent
* @ccid3hctx_t_last_win_count - Timestamp of earliest packet
......@@ -91,7 +101,7 @@ enum ccid3_hc_tx_states {
* @ccid3hctx_idle - Flag indicating that sender is idling
* @ccid3hctx_t_ld - Time last doubled during slow start
* @ccid3hctx_t_nom - Nominal send time of next packet
* @ccid3hctx_delta - Send timer delta
* @ccid3hctx_delta - Send timer delta (RFC 3448, 4.6) in usecs
* @ccid3hctx_hist - Packet history
* @ccid3hctx_options_received - Parsed set of retrieved options
*/
......
......@@ -36,9 +36,100 @@
#include <linux/module.h>
#include <linux/string.h>
#include "packet_history.h"
/*
* Transmitter History Routines
*/
struct dccp_tx_hist *dccp_tx_hist_new(const char *name)
{
struct dccp_tx_hist *hist = kmalloc(sizeof(*hist), GFP_ATOMIC);
static const char dccp_tx_hist_mask[] = "tx_hist_%s";
char *slab_name;
if (hist == NULL)
goto out;
slab_name = kmalloc(strlen(name) + sizeof(dccp_tx_hist_mask) - 1,
GFP_ATOMIC);
if (slab_name == NULL)
goto out_free_hist;
sprintf(slab_name, dccp_tx_hist_mask, name);
hist->dccptxh_slab = kmem_cache_create(slab_name,
sizeof(struct dccp_tx_hist_entry),
0, SLAB_HWCACHE_ALIGN,
NULL, NULL);
if (hist->dccptxh_slab == NULL)
goto out_free_slab_name;
out:
return hist;
out_free_slab_name:
kfree(slab_name);
out_free_hist:
kfree(hist);
hist = NULL;
goto out;
}
EXPORT_SYMBOL_GPL(dccp_tx_hist_new);
void dccp_tx_hist_delete(struct dccp_tx_hist *hist)
{
const char* name = kmem_cache_name(hist->dccptxh_slab);
kmem_cache_destroy(hist->dccptxh_slab);
kfree(name);
kfree(hist);
}
EXPORT_SYMBOL_GPL(dccp_tx_hist_delete);
struct dccp_tx_hist_entry *
dccp_tx_hist_find_entry(const struct list_head *list, const u64 seq)
{
struct dccp_tx_hist_entry *packet = NULL, *entry;
list_for_each_entry(entry, list, dccphtx_node)
if (entry->dccphtx_seqno == seq) {
packet = entry;
break;
}
return packet;
}
EXPORT_SYMBOL_GPL(dccp_tx_hist_find_entry);
void dccp_tx_hist_purge(struct dccp_tx_hist *hist, struct list_head *list)
{
struct dccp_tx_hist_entry *entry, *next;
list_for_each_entry_safe(entry, next, list, dccphtx_node) {
list_del_init(&entry->dccphtx_node);
dccp_tx_hist_entry_delete(hist, entry);
}
}
EXPORT_SYMBOL_GPL(dccp_tx_hist_purge);
void dccp_tx_hist_purge_older(struct dccp_tx_hist *hist,
struct list_head *list,
struct dccp_tx_hist_entry *packet)
{
struct dccp_tx_hist_entry *next;
list_for_each_entry_safe_continue(packet, next, list, dccphtx_node) {
list_del_init(&packet->dccphtx_node);
dccp_tx_hist_entry_delete(hist, packet);
}
}
EXPORT_SYMBOL_GPL(dccp_tx_hist_purge_older);
/*
* Receiver History Routines
*/
struct dccp_rx_hist *dccp_rx_hist_new(const char *name)
{
struct dccp_rx_hist *hist = kmalloc(sizeof(*hist), GFP_ATOMIC);
......@@ -83,18 +174,24 @@ void dccp_rx_hist_delete(struct dccp_rx_hist *hist)
EXPORT_SYMBOL_GPL(dccp_rx_hist_delete);
void dccp_rx_hist_purge(struct dccp_rx_hist *hist, struct list_head *list)
int dccp_rx_hist_find_entry(const struct list_head *list, const u64 seq,
u8 *ccval)
{
struct dccp_rx_hist_entry *entry, *next;
struct dccp_rx_hist_entry *packet = NULL, *entry;
list_for_each_entry_safe(entry, next, list, dccphrx_node) {
list_del_init(&entry->dccphrx_node);
kmem_cache_free(hist->dccprxh_slab, entry);
list_for_each_entry(entry, list, dccphrx_node)
if (entry->dccphrx_seqno == seq) {
packet = entry;
break;
}
}
EXPORT_SYMBOL_GPL(dccp_rx_hist_purge);
if (packet)
*ccval = packet->dccphrx_ccval;
return packet != NULL;
}
EXPORT_SYMBOL_GPL(dccp_rx_hist_find_entry);
struct dccp_rx_hist_entry *
dccp_rx_hist_find_data_packet(const struct list_head *list)
{
......@@ -184,110 +281,18 @@ void dccp_rx_hist_add_packet(struct dccp_rx_hist *hist,
EXPORT_SYMBOL_GPL(dccp_rx_hist_add_packet);
struct dccp_tx_hist *dccp_tx_hist_new(const char *name)
{
struct dccp_tx_hist *hist = kmalloc(sizeof(*hist), GFP_ATOMIC);
static const char dccp_tx_hist_mask[] = "tx_hist_%s";
char *slab_name;
if (hist == NULL)
goto out;
slab_name = kmalloc(strlen(name) + sizeof(dccp_tx_hist_mask) - 1,
GFP_ATOMIC);
if (slab_name == NULL)
goto out_free_hist;
sprintf(slab_name, dccp_tx_hist_mask, name);
hist->dccptxh_slab = kmem_cache_create(slab_name,
sizeof(struct dccp_tx_hist_entry),
0, SLAB_HWCACHE_ALIGN,
NULL, NULL);
if (hist->dccptxh_slab == NULL)
goto out_free_slab_name;
out:
return hist;
out_free_slab_name:
kfree(slab_name);
out_free_hist:
kfree(hist);
hist = NULL;
goto out;
}
EXPORT_SYMBOL_GPL(dccp_tx_hist_new);
void dccp_tx_hist_delete(struct dccp_tx_hist *hist)
{
const char* name = kmem_cache_name(hist->dccptxh_slab);
kmem_cache_destroy(hist->dccptxh_slab);
kfree(name);
kfree(hist);
}
EXPORT_SYMBOL_GPL(dccp_tx_hist_delete);
struct dccp_tx_hist_entry *
dccp_tx_hist_find_entry(const struct list_head *list, const u64 seq)
{
struct dccp_tx_hist_entry *packet = NULL, *entry;
list_for_each_entry(entry, list, dccphtx_node)
if (entry->dccphtx_seqno == seq) {
packet = entry;
break;
}
return packet;
}
EXPORT_SYMBOL_GPL(dccp_tx_hist_find_entry);
int dccp_rx_hist_find_entry(const struct list_head *list, const u64 seq,
u8 *ccval)
{
struct dccp_rx_hist_entry *packet = NULL, *entry;
list_for_each_entry(entry, list, dccphrx_node)
if (entry->dccphrx_seqno == seq) {
packet = entry;
break;
}
if (packet)
*ccval = packet->dccphrx_ccval;
return packet != NULL;
}
EXPORT_SYMBOL_GPL(dccp_rx_hist_find_entry);
void dccp_tx_hist_purge_older(struct dccp_tx_hist *hist,
struct list_head *list,
struct dccp_tx_hist_entry *packet)
void dccp_rx_hist_purge(struct dccp_rx_hist *hist, struct list_head *list)
{
struct dccp_tx_hist_entry *next;
struct dccp_rx_hist_entry *entry, *next;
list_for_each_entry_safe_continue(packet, next, list, dccphtx_node) {
list_del_init(&packet->dccphtx_node);
dccp_tx_hist_entry_delete(hist, packet);
list_for_each_entry_safe(entry, next, list, dccphrx_node) {
list_del_init(&entry->dccphrx_node);
kmem_cache_free(hist->dccprxh_slab, entry);
}
}
EXPORT_SYMBOL_GPL(dccp_tx_hist_purge_older);
void dccp_tx_hist_purge(struct dccp_tx_hist *hist, struct list_head *list)
{
struct dccp_tx_hist_entry *entry, *next;
list_for_each_entry_safe(entry, next, list, dccphtx_node) {
list_del_init(&entry->dccphtx_node);
dccp_tx_hist_entry_delete(hist, entry);
}
}
EXPORT_SYMBOL_GPL(dccp_rx_hist_purge);
EXPORT_SYMBOL_GPL(dccp_tx_hist_purge);
MODULE_AUTHOR("Ian McDonald <ian.mcdonald@jandi.co.nz>, "
"Arnaldo Carvalho de Melo <acme@ghostprotocols.net>");
......
......@@ -49,24 +49,17 @@
#define TFRC_WIN_COUNT_PER_RTT 4
#define TFRC_WIN_COUNT_LIMIT 16
/*
* Transmitter History data structures and declarations
*/
struct dccp_tx_hist_entry {
struct list_head dccphtx_node;
u64 dccphtx_seqno:48,
dccphtx_ccval:4,
dccphtx_sent:1;
u32 dccphtx_rtt;
struct timeval dccphtx_tstamp;
};
struct dccp_rx_hist_entry {
struct list_head dccphrx_node;
u64 dccphrx_seqno:48,
dccphrx_ccval:4,
dccphrx_type:4;
u32 dccphrx_ndp; /* In fact it is from 8 to 24 bits */
struct timeval dccphrx_tstamp;
};
struct dccp_tx_hist {
struct kmem_cache *dccptxh_slab;
};
......@@ -74,15 +67,6 @@ struct dccp_tx_hist {
extern struct dccp_tx_hist *dccp_tx_hist_new(const char *name);
extern void dccp_tx_hist_delete(struct dccp_tx_hist *hist);
struct dccp_rx_hist {
struct kmem_cache *dccprxh_slab;
};
extern struct dccp_rx_hist *dccp_rx_hist_new(const char *name);
extern void dccp_rx_hist_delete(struct dccp_rx_hist *hist);
extern struct dccp_rx_hist_entry *
dccp_rx_hist_find_data_packet(const struct list_head *list);
static inline struct dccp_tx_hist_entry *
dccp_tx_hist_entry_new(struct dccp_tx_hist *hist,
const gfp_t prio)
......@@ -96,18 +80,20 @@ static inline struct dccp_tx_hist_entry *
return entry;
}
static inline void dccp_tx_hist_entry_delete(struct dccp_tx_hist *hist,
struct dccp_tx_hist_entry *entry)
static inline struct dccp_tx_hist_entry *
dccp_tx_hist_head(struct list_head *list)
{
if (entry != NULL)
kmem_cache_free(hist->dccptxh_slab, entry);
struct dccp_tx_hist_entry *head = NULL;
if (!list_empty(list))
head = list_entry(list->next, struct dccp_tx_hist_entry,
dccphtx_node);
return head;
}
extern struct dccp_tx_hist_entry *
dccp_tx_hist_find_entry(const struct list_head *list,
const u64 seq);
extern int dccp_rx_hist_find_entry(const struct list_head *list, const u64 seq,
u8 *ccval);
static inline void dccp_tx_hist_add_entry(struct list_head *list,
struct dccp_tx_hist_entry *entry)
......@@ -115,23 +101,38 @@ static inline void dccp_tx_hist_add_entry(struct list_head *list,
list_add(&entry->dccphtx_node, list);
}
static inline void dccp_tx_hist_entry_delete(struct dccp_tx_hist *hist,
struct dccp_tx_hist_entry *entry)
{
if (entry != NULL)
kmem_cache_free(hist->dccptxh_slab, entry);
}
extern void dccp_tx_hist_purge(struct dccp_tx_hist *hist,
struct list_head *list);
extern void dccp_tx_hist_purge_older(struct dccp_tx_hist *hist,
struct list_head *list,
struct dccp_tx_hist_entry *next);
extern void dccp_tx_hist_purge(struct dccp_tx_hist *hist,
struct list_head *list);
/*
* Receiver History data structures and declarations
*/
struct dccp_rx_hist_entry {
struct list_head dccphrx_node;
u64 dccphrx_seqno:48,
dccphrx_ccval:4,
dccphrx_type:4;
u32 dccphrx_ndp; /* In fact it is from 8 to 24 bits */
struct timeval dccphrx_tstamp;
};
static inline struct dccp_tx_hist_entry *
dccp_tx_hist_head(struct list_head *list)
{
struct dccp_tx_hist_entry *head = NULL;
struct dccp_rx_hist {
struct kmem_cache *dccprxh_slab;
};
if (!list_empty(list))
head = list_entry(list->next, struct dccp_tx_hist_entry,
dccphtx_node);
return head;
}
extern struct dccp_rx_hist *dccp_rx_hist_new(const char *name);
extern void dccp_rx_hist_delete(struct dccp_rx_hist *hist);
static inline struct dccp_rx_hist_entry *
dccp_rx_hist_entry_new(struct dccp_rx_hist *hist,
......@@ -156,16 +157,6 @@ static inline struct dccp_rx_hist_entry *
return entry;
}
static inline void dccp_rx_hist_entry_delete(struct dccp_rx_hist *hist,
struct dccp_rx_hist_entry *entry)
{
if (entry != NULL)
kmem_cache_free(hist->dccprxh_slab, entry);
}
extern void dccp_rx_hist_purge(struct dccp_rx_hist *hist,
struct list_head *list);
static inline struct dccp_rx_hist_entry *
dccp_rx_hist_head(struct list_head *list)
{
......@@ -177,12 +168,10 @@ static inline struct dccp_rx_hist_entry *
return head;
}
static inline int
dccp_rx_hist_entry_data_packet(const struct dccp_rx_hist_entry *entry)
{
return entry->dccphrx_type == DCCP_PKT_DATA ||
entry->dccphrx_type == DCCP_PKT_DATAACK;
}
extern int dccp_rx_hist_find_entry(const struct list_head *list, const u64 seq,
u8 *ccval);
extern struct dccp_rx_hist_entry *
dccp_rx_hist_find_data_packet(const struct list_head *list);
extern void dccp_rx_hist_add_packet(struct dccp_rx_hist *hist,
struct list_head *rx_list,
......@@ -190,6 +179,23 @@ extern void dccp_rx_hist_add_packet(struct dccp_rx_hist *hist,
struct dccp_rx_hist_entry *packet,
u64 nonloss_seqno);
static inline void dccp_rx_hist_entry_delete(struct dccp_rx_hist *hist,
struct dccp_rx_hist_entry *entry)
{
if (entry != NULL)
kmem_cache_free(hist->dccprxh_slab, entry);
}
extern void dccp_rx_hist_purge(struct dccp_rx_hist *hist,
struct list_head *list);
static inline int
dccp_rx_hist_entry_data_packet(const struct dccp_rx_hist_entry *entry)
{
return entry->dccphrx_type == DCCP_PKT_DATA ||
entry->dccphrx_type == DCCP_PKT_DATAACK;
}
extern u64 dccp_rx_hist_detect_loss(struct list_head *rx_list,
struct list_head *li_list, u8 *win_loss);
......
......@@ -13,8 +13,29 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <linux/types.h>
#include <asm/div64.h>
/* integer-arithmetic divisions of type (a * 1000000)/b */
static inline u64 scaled_div(u64 a, u32 b)
{
BUG_ON(b==0);
a *= 1000000;
do_div(a, b);
return a;
}
static inline u32 scaled_div32(u64 a, u32 b)
{
u64 result = scaled_div(a, b);
if (result > UINT_MAX) {
DCCP_CRIT("Overflow: a(%llu)/b(%u) > ~0U",
(unsigned long long)a, b);
return UINT_MAX;
}
return result;
}
extern u32 tfrc_calc_x(u16 s, u32 R, u32 p);
extern u32 tfrc_calc_x_reverse_lookup(u32 fvalue);
......
......@@ -13,7 +13,6 @@
*/
#include <linux/module.h>
#include <asm/div64.h>
#include "../../dccp.h"
#include "tfrc.h"
......@@ -616,15 +615,12 @@ static inline u32 tfrc_binsearch(u32 fval, u8 small)
* @R: RTT scaled by 1000000 (i.e., microseconds)
* @p: loss ratio estimate scaled by 1000000
* Returns X_calc in bytes per second (not scaled).
*
* Note: DO NOT alter this code unless you run test cases against it,
* as the code has been optimized to stop underflow/overflow.
*/
u32 tfrc_calc_x(u16 s, u32 R, u32 p)
{
int index;
u16 index;
u32 f;
u64 tmp1, tmp2;
u64 result;
/* check against invalid parameters and divide-by-zero */
BUG_ON(p > 1000000); /* p must not exceed 100% */
......@@ -650,15 +646,17 @@ u32 tfrc_calc_x(u16 s, u32 R, u32 p)
f = tfrc_calc_x_lookup[index][0];
}
/* The following computes X = s/(R*f(p)) in bytes per second. Since f(p)
* and R are both scaled by 1000000, we need to multiply by 1000000^2.
* ==> DO NOT alter this unless you test against overflow on 32 bit */
tmp1 = ((u64)s * 100000000);
tmp2 = ((u64)R * (u64)f);
do_div(tmp2, 10000);
do_div(tmp1, tmp2);
return (u32)tmp1;
/*
* Compute X = s/(R*f(p)) in bytes per second.
* Since f(p) and R are both scaled by 1000000, we need to multiply by
* 1000000^2. To avoid overflow, the result is computed in two stages.
* This works under almost all reasonable operational conditions, for a
* wide range of parameters. Yet, should some strange combination of
* parameters result in overflow, the use of scaled_div32 will catch
* this and return UINT_MAX - which is a logically adequate consequence.
*/
result = scaled_div(s, R);
return scaled_div32(result, f);
}
EXPORT_SYMBOL_GPL(tfrc_calc_x);
......
......@@ -80,8 +80,6 @@ extern void dccp_time_wait(struct sock *sk, int state, int timeo);
#define DCCP_RTO_MAX ((unsigned)(120 * HZ)) /* FIXME: using TCP value */
#define DCCP_XMIT_TIMEO 30000 /* Time/msecs for blocking transmit per packet */
/* sysctl variables for DCCP */
extern int sysctl_dccp_request_retries;
extern int sysctl_dccp_retries1;
......@@ -434,6 +432,7 @@ static inline void timeval_sub_usecs(struct timeval *tv,
tv->tv_sec--;
tv->tv_usec += USEC_PER_SEC;
}
DCCP_BUG_ON(tv->tv_sec < 0);
}
#ifdef CONFIG_SYSCTL
......
......@@ -248,7 +248,17 @@ int dccp_rcv_established(struct sock *sk, struct sk_buff *skb,
DCCP_ACKVEC_STATE_RECEIVED))
goto discard;
/*
* Deliver to the CCID module in charge.
* FIXME: Currently DCCP operates one-directional only, i.e. a listening
* server is not at the same time a connecting client. There is
* not much sense in delivering to both rx/tx sides at the moment
* (only one is active at a time); when moving to bidirectional
* service, this needs to be revised.
*/
if (dccp_sk(sk)->dccps_role == DCCP_ROLE_SERVER)
ccid_hc_rx_packet_recv(dp->dccps_hc_rx_ccid, sk, skb);
else
ccid_hc_tx_packet_recv(dp->dccps_hc_tx_ccid, sk, skb);
return __dccp_rcv_established(sk, skb, dh, len);
......@@ -484,7 +494,10 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
DCCP_ACKVEC_STATE_RECEIVED))
goto discard;
/* XXX see the comments in dccp_rcv_established about this */
if (dccp_sk(sk)->dccps_role == DCCP_ROLE_SERVER)
ccid_hc_rx_packet_recv(dp->dccps_hc_rx_ccid, sk, skb);
else
ccid_hc_tx_packet_recv(dp->dccps_hc_tx_ccid, sk, skb);
}
......
......@@ -557,11 +557,6 @@ int dccp_insert_options(struct sock *sk, struct sk_buff *skb)
return -1;
dp->dccps_hc_rx_insert_options = 0;
}
if (dp->dccps_hc_tx_insert_options) {
if (ccid_hc_tx_insert_options(dp->dccps_hc_tx_ccid, sk, skb))
return -1;
dp->dccps_hc_tx_insert_options = 0;
}
/* Feature negotiation */
/* Data packets can't do feat negotiation */
......
......@@ -175,14 +175,12 @@ void dccp_write_space(struct sock *sk)
/**
* dccp_wait_for_ccid - Wait for ccid to tell us we can send a packet
* @sk: socket to wait for
* @timeo: for how long
*/
static int dccp_wait_for_ccid(struct sock *sk, struct sk_buff *skb,
long *timeo)
static int dccp_wait_for_ccid(struct sock *sk, struct sk_buff *skb)
{
struct dccp_sock *dp = dccp_sk(sk);
DEFINE_WAIT(wait);
long delay;
unsigned long delay;
int rc;
while (1) {
......@@ -190,8 +188,6 @@ static int dccp_wait_for_ccid(struct sock *sk, struct sk_buff *skb,
if (sk->sk_err)
goto do_error;
if (!*timeo)
goto do_nonblock;
if (signal_pending(current))
goto do_interrupted;
......@@ -199,12 +195,9 @@ static int dccp_wait_for_ccid(struct sock *sk, struct sk_buff *skb,
if (rc <= 0)
break;
delay = msecs_to_jiffies(rc);
if (delay > *timeo || delay < 0)
goto do_nonblock;
sk->sk_write_pending++;
release_sock(sk);
*timeo -= schedule_timeout(delay);
schedule_timeout(delay);
lock_sock(sk);
sk->sk_write_pending--;
}
......@@ -215,11 +208,8 @@ static int dccp_wait_for_ccid(struct sock *sk, struct sk_buff *skb,
do_error:
rc = -EPIPE;
goto out;
do_nonblock:
rc = -EAGAIN;
goto out;
do_interrupted:
rc = sock_intr_errno(*timeo);
rc = -EINTR;
goto out;
}
......@@ -240,8 +230,6 @@ void dccp_write_xmit(struct sock *sk, int block)
{
struct dccp_sock *dp = dccp_sk(sk);
struct sk_buff *skb;
long timeo = DCCP_XMIT_TIMEO; /* If a packet is taking longer than
this we have other issues */
while ((skb = skb_peek(&sk->sk_write_queue))) {
int err = ccid_hc_tx_send_packet(dp->dccps_hc_tx_ccid, sk, skb);
......@@ -251,11 +239,9 @@ void dccp_write_xmit(struct sock *sk, int block)
sk_reset_timer(sk, &dp->dccps_xmit_timer,
msecs_to_jiffies(err)+jiffies);
break;
} else {
err = dccp_wait_for_ccid(sk, skb, &timeo);
timeo = DCCP_XMIT_TIMEO;
}
if (err)
} else
err = dccp_wait_for_ccid(sk, skb);
if (err && err != -EINTR)
DCCP_BUG("err=%d after dccp_wait_for_ccid", err);
}
......@@ -281,9 +267,11 @@ void dccp_write_xmit(struct sock *sk, int block)
if (err)
DCCP_BUG("err=%d after ccid_hc_tx_packet_sent",
err);
} else
} else {
dccp_pr_debug("packet discarded\n");
kfree(skb);
}
}
}
int dccp_retransmit_skb(struct sock *sk, struct sk_buff *skb)
......@@ -350,7 +338,6 @@ EXPORT_SYMBOL_GPL(dccp_make_response);
static struct sk_buff *dccp_make_reset(struct sock *sk, struct dst_entry *dst,
const enum dccp_reset_codes code)
{
struct dccp_hdr *dh;
struct dccp_sock *dp = dccp_sk(sk);
......
......@@ -657,7 +657,7 @@ static void sync_master_loop(void)
if (stop_master_sync)
break;
ssleep(1);
msleep_interruptible(1000);
}
/* clean up the sync_buff queue */
......@@ -714,7 +714,7 @@ static void sync_backup_loop(void)
if (stop_backup_sync)
break;
ssleep(1);
msleep_interruptible(1000);
}
/* release the sending multicast socket */
......@@ -826,7 +826,7 @@ static int fork_sync_thread(void *startup)
if ((pid = kernel_thread(sync_thread, startup, 0)) < 0) {
IP_VS_ERR("could not create sync_thread due to %d... "
"retrying.\n", pid);
ssleep(1);
msleep_interruptible(1000);
goto repeat;
}
......@@ -849,10 +849,12 @@ int start_sync_thread(int state, char *mcast_ifn, __u8 syncid)
ip_vs_sync_state |= state;
if (state == IP_VS_STATE_MASTER) {
strlcpy(ip_vs_master_mcast_ifn, mcast_ifn, sizeof(ip_vs_master_mcast_ifn));
strlcpy(ip_vs_master_mcast_ifn, mcast_ifn,
sizeof(ip_vs_master_mcast_ifn));
ip_vs_master_syncid = syncid;
} else {
strlcpy(ip_vs_backup_mcast_ifn, mcast_ifn, sizeof(ip_vs_backup_mcast_ifn));
strlcpy(ip_vs_backup_mcast_ifn, mcast_ifn,
sizeof(ip_vs_backup_mcast_ifn));
ip_vs_backup_syncid = syncid;
}
......@@ -860,7 +862,7 @@ int start_sync_thread(int state, char *mcast_ifn, __u8 syncid)
if ((pid = kernel_thread(fork_sync_thread, &startup, 0)) < 0) {
IP_VS_ERR("could not create fork_sync_thread due to %d... "
"retrying.\n", pid);
ssleep(1);
msleep_interruptible(1000);
goto repeat;
}
......@@ -880,7 +882,8 @@ int stop_sync_thread(int state)
IP_VS_DBG(7, "%s: pid %d\n", __FUNCTION__, current->pid);
IP_VS_INFO("stopping sync thread %d ...\n",
(state == IP_VS_STATE_MASTER) ? sync_master_pid : sync_backup_pid);
(state == IP_VS_STATE_MASTER) ?
sync_master_pid : sync_backup_pid);
__set_current_state(TASK_UNINTERRUPTIBLE);
add_wait_queue(&stop_sync_wait, &wait);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment