diff options
author | Tilman Schmidt <tilman@imap.cc> | 2010-06-21 09:54:19 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-06-26 00:16:59 -0400 |
commit | e7752ee280608a24e27f163641121bdc2c68d6af (patch) | |
tree | a731b1d9b2c95732d2882a52bb20e4af7546de59 /drivers/isdn/gigaset/gigaset.h | |
parent | ed770f01360b392564650bf1553ce723fa46afec (diff) |
isdn/gigaset: honor CAPI application's buffer size request
Fix the Gigaset CAPI driver to limit the length of a connection's
payload data receive buffers to the corresponding CAPI application's
data buffer size, as some real-life CAPI applications tend to be
rather unhappy if they receive bigger data blocks than requested.
Impact: bugfix
Signed-off-by: Tilman Schmidt <tilman@imap.cc>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn/gigaset/gigaset.h')
-rw-r--r-- | drivers/isdn/gigaset/gigaset.h | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/drivers/isdn/gigaset/gigaset.h b/drivers/isdn/gigaset/gigaset.h index 05947f9c1849..f77ec54eb07d 100644 --- a/drivers/isdn/gigaset/gigaset.h +++ b/drivers/isdn/gigaset/gigaset.h | |||
@@ -45,10 +45,6 @@ | |||
45 | #define MAX_EVENTS 64 /* size of event queue */ | 45 | #define MAX_EVENTS 64 /* size of event queue */ |
46 | 46 | ||
47 | #define RBUFSIZE 8192 | 47 | #define RBUFSIZE 8192 |
48 | #define SBUFSIZE 4096 /* sk_buff payload size */ | ||
49 | |||
50 | #define TRANSBUFSIZE 768 /* bytes per skb for transparent receive */ | ||
51 | #define MAX_BUF_SIZE (SBUFSIZE - 2) /* Max. size of a data packet from LL */ | ||
52 | 48 | ||
53 | /* compile time options */ | 49 | /* compile time options */ |
54 | #define GIG_MAJOR 0 | 50 | #define GIG_MAJOR 0 |
@@ -380,8 +376,10 @@ struct bc_state { | |||
380 | 376 | ||
381 | struct at_state_t at_state; | 377 | struct at_state_t at_state; |
382 | 378 | ||
383 | __u16 fcs; | 379 | /* receive buffer */ |
384 | struct sk_buff *skb; | 380 | unsigned rx_bufsize; /* max size accepted by application */ |
381 | struct sk_buff *rx_skb; | ||
382 | __u16 rx_fcs; | ||
385 | int inputstate; /* see INS_XXXX */ | 383 | int inputstate; /* see INS_XXXX */ |
386 | 384 | ||
387 | int channel; | 385 | int channel; |
@@ -801,8 +799,23 @@ static inline void gigaset_bchannel_up(struct bc_state *bcs) | |||
801 | gigaset_schedule_event(bcs->cs); | 799 | gigaset_schedule_event(bcs->cs); |
802 | } | 800 | } |
803 | 801 | ||
804 | /* handling routines for sk_buff */ | 802 | /* set up next receive skb for data mode */ |
805 | /* ============================= */ | 803 | static inline struct sk_buff *gigaset_new_rx_skb(struct bc_state *bcs) |
804 | { | ||
805 | struct cardstate *cs = bcs->cs; | ||
806 | unsigned short hw_hdr_len = cs->hw_hdr_len; | ||
807 | |||
808 | if (bcs->ignore) { | ||
809 | bcs->rx_skb = NULL; | ||
810 | } else { | ||
811 | bcs->rx_skb = dev_alloc_skb(bcs->rx_bufsize + hw_hdr_len); | ||
812 | if (bcs->rx_skb == NULL) | ||
813 | dev_warn(cs->dev, "could not allocate skb\n"); | ||
814 | else | ||
815 | skb_reserve(bcs->rx_skb, hw_hdr_len); | ||
816 | } | ||
817 | return bcs->rx_skb; | ||
818 | } | ||
806 | 819 | ||
807 | /* append received bytes to inbuf */ | 820 | /* append received bytes to inbuf */ |
808 | int gigaset_fill_inbuf(struct inbuf_t *inbuf, const unsigned char *src, | 821 | int gigaset_fill_inbuf(struct inbuf_t *inbuf, const unsigned char *src, |