Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
Linux
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
E-EXK4 - Operating System Group
projects
Linux
Commits
e4dfd449
Commit
e4dfd449
authored
19 years ago
by
Arnaldo Carvalho de Melo
Browse files
Options
Downloads
Patches
Plain Diff
[DCCP] ackvec: use u8 for the buf offsets
Signed-off-by:
Arnaldo Carvalho de Melo
<
acme@mandriva.com
>
parent
6742bbcb
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
net/dccp/ackvec.c
+17
-10
17 additions, 10 deletions
net/dccp/ackvec.c
net/dccp/ackvec.h
+6
-6
6 additions, 6 deletions
net/dccp/ackvec.h
with
23 additions
and
16 deletions
net/dccp/ackvec.c
+
17
−
10
View file @
e4dfd449
...
@@ -55,8 +55,8 @@ int dccp_insert_option_ackvec(struct sock *sk, struct sk_buff *skb)
...
@@ -55,8 +55,8 @@ int dccp_insert_option_ackvec(struct sock *sk, struct sk_buff *skb)
from
=
av
->
dccpav_buf
+
av
->
dccpav_buf_head
;
from
=
av
->
dccpav_buf
+
av
->
dccpav_buf_head
;
/* Check if buf_head wraps */
/* Check if buf_head wraps */
if
(
av
->
dccpav_buf_head
+
len
>
av
->
dccpav_vec_len
)
{
if
(
(
int
)
av
->
dccpav_buf_head
+
len
>
av
->
dccpav_vec_len
)
{
const
u32
tailsize
=
(
av
->
dccpav_vec_len
-
av
->
dccpav_buf_head
)
;
const
u32
tailsize
=
av
->
dccpav_vec_len
-
av
->
dccpav_buf_head
;
memcpy
(
to
,
from
,
tailsize
);
memcpy
(
to
,
from
,
tailsize
);
to
+=
tailsize
;
to
+=
tailsize
;
...
@@ -93,8 +93,14 @@ int dccp_insert_option_ackvec(struct sock *sk, struct sk_buff *skb)
...
@@ -93,8 +93,14 @@ int dccp_insert_option_ackvec(struct sock *sk, struct sk_buff *skb)
struct
dccp_ackvec
*
dccp_ackvec_alloc
(
const
unsigned
int
len
,
struct
dccp_ackvec
*
dccp_ackvec_alloc
(
const
unsigned
int
len
,
const
gfp_t
priority
)
const
gfp_t
priority
)
{
{
struct
dccp_ackvec
*
av
=
kmalloc
(
sizeof
(
*
av
)
+
len
,
priority
)
;
struct
dccp_ackvec
*
av
;
BUG_ON
(
len
==
0
);
if
(
len
>
DCCP_MAX_ACKVEC_LEN
)
return
NULL
;
av
=
kmalloc
(
sizeof
(
*
av
)
+
len
,
priority
);
if
(
av
!=
NULL
)
{
if
(
av
!=
NULL
)
{
av
->
dccpav_buf_len
=
len
;
av
->
dccpav_buf_len
=
len
;
av
->
dccpav_buf_head
=
av
->
dccpav_buf_head
=
...
@@ -117,13 +123,13 @@ void dccp_ackvec_free(struct dccp_ackvec *av)
...
@@ -117,13 +123,13 @@ void dccp_ackvec_free(struct dccp_ackvec *av)
}
}
static
inline
u8
dccp_ackvec_state
(
const
struct
dccp_ackvec
*
av
,
static
inline
u8
dccp_ackvec_state
(
const
struct
dccp_ackvec
*
av
,
const
u
nsigned
int
index
)
const
u
8
index
)
{
{
return
av
->
dccpav_buf
[
index
]
&
DCCP_ACKVEC_STATE_MASK
;
return
av
->
dccpav_buf
[
index
]
&
DCCP_ACKVEC_STATE_MASK
;
}
}
static
inline
u8
dccp_ackvec_len
(
const
struct
dccp_ackvec
*
av
,
static
inline
u8
dccp_ackvec_len
(
const
struct
dccp_ackvec
*
av
,
const
u
nsigned
int
index
)
const
u
8
index
)
{
{
return
av
->
dccpav_buf
[
index
]
&
DCCP_ACKVEC_LEN_MASK
;
return
av
->
dccpav_buf
[
index
]
&
DCCP_ACKVEC_LEN_MASK
;
}
}
...
@@ -135,7 +141,7 @@ static inline u8 dccp_ackvec_len(const struct dccp_ackvec *av,
...
@@ -135,7 +141,7 @@ static inline u8 dccp_ackvec_len(const struct dccp_ackvec *av,
*/
*/
static
inline
int
dccp_ackvec_set_buf_head_state
(
struct
dccp_ackvec
*
av
,
static
inline
int
dccp_ackvec_set_buf_head_state
(
struct
dccp_ackvec
*
av
,
const
unsigned
int
packets
,
const
unsigned
int
packets
,
const
unsigned
char
state
)
const
unsigned
char
state
)
{
{
unsigned
int
gap
;
unsigned
int
gap
;
signed
long
new_head
;
signed
long
new_head
;
...
@@ -223,7 +229,7 @@ int dccp_ackvec_add(struct dccp_ackvec *av, const struct sock *sk,
...
@@ -223,7 +229,7 @@ int dccp_ackvec_add(struct dccp_ackvec *av, const struct sock *sk,
* could reduce the complexity of this scan.)
* could reduce the complexity of this scan.)
*/
*/
u64
delta
=
dccp_delta_seqno
(
ackno
,
av
->
dccpav_buf_ackno
);
u64
delta
=
dccp_delta_seqno
(
ackno
,
av
->
dccpav_buf_ackno
);
u
nsigned
int
index
=
av
->
dccpav_buf_head
;
u
8
index
=
av
->
dccpav_buf_head
;
while
(
1
)
{
while
(
1
)
{
const
u8
len
=
dccp_ackvec_len
(
av
,
index
);
const
u8
len
=
dccp_ackvec_len
(
av
,
index
);
...
@@ -301,9 +307,10 @@ static void dccp_ackvec_throw_away_ack_record(struct dccp_ackvec *av)
...
@@ -301,9 +307,10 @@ static void dccp_ackvec_throw_away_ack_record(struct dccp_ackvec *av)
* draft-ietf-dccp-spec-11.txt Appendix A. -acme
* draft-ietf-dccp-spec-11.txt Appendix A. -acme
*/
*/
#if 0
#if 0
av->dccpav_buf_tail = av->dccpav_ack_ptr + 1;
u32 new_buf_tail = av->dccpav_ack_ptr + 1;
if (av->dccpav_buf_tail >= av->dccpav_vec_len)
if (new_buf_tail >= av->dccpav_vec_len)
av->dccpav_buf_tail -= av->dccpav_vec_len;
new_buf_tail -= av->dccpav_vec_len;
av->dccpav_buf_tail = new_buf_tail;
#endif
#endif
av
->
dccpav_vec_len
-=
av
->
dccpav_sent_len
;
av
->
dccpav_vec_len
-=
av
->
dccpav_sent_len
;
}
}
...
...
This diff is collapsed.
Click to expand it.
net/dccp/ackvec.h
+
6
−
6
View file @
e4dfd449
...
@@ -54,16 +54,16 @@
...
@@ -54,16 +54,16 @@
* @dccpav_buf - circular buffer of acknowledgeable packets
* @dccpav_buf - circular buffer of acknowledgeable packets
*/
*/
struct
dccp_ackvec
{
struct
dccp_ackvec
{
unsigned
int
dccpav_buf_head
;
unsigned
int
dccpav_buf_tail
;
u64
dccpav_buf_ackno
;
u64
dccpav_buf_ackno
;
u64
dccpav_ack_seqno
;
u64
dccpav_ack_seqno
;
u64
dccpav_ack_ackno
;
u64
dccpav_ack_ackno
;
unsigned
int
dccpav_ack_ptr
;
unsigned
int
dccpav_sent_len
;
unsigned
int
dccpav_vec_len
;
unsigned
int
dccpav_buf_len
;
struct
timeval
dccpav_time
;
struct
timeval
dccpav_time
;
u8
dccpav_buf_head
;
u8
dccpav_buf_tail
;
u8
dccpav_ack_ptr
;
u8
dccpav_sent_len
;
u8
dccpav_vec_len
;
u8
dccpav_buf_len
;
u8
dccpav_buf_nonce
;
u8
dccpav_buf_nonce
;
u8
dccpav_ack_nonce
;
u8
dccpav_ack_nonce
;
u8
dccpav_buf
[
0
];
u8
dccpav_buf
[
0
];
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment