F r e e R T O S a n d T C P / I P c o mmu n i c - - PowerPoint PPT Presentation

f r e e r t o s a n d t c p i p c o mmu n i c a t i o n t
SMART_READER_LITE
LIVE PREVIEW

F r e e R T O S a n d T C P / I P c o mmu n i c - - PowerPoint PPT Presentation

A d v a n c e d Wo r k s h o p o n mo d e r n F P G A - b a s e d t e c h n o l o g y f o r S c i e n t i f i c C o mp u t i n g F r e e R T O S a n d T C P / I P c o


slide-1
SLIDE 1

A d v a n c e d Wo r k s h

  • p
  • n

mo d e r n F P G A

  • b

a s e d t e c h n

  • l
  • g

y f

  • r

S c i e n t i f i c C

  • mp

u t i n g

S m r 3 2 8 9 – I C T P ( M a y 2 1 9 )

F r e e R T O S a n d T C P / I P c

  • mmu

n i c a t i

  • n

: t h e l w I P l i b r a r y

F e r n a n d

  • R

i n c ó n

f e r n a n d

  • .

r i n c

  • n

@u c l m . e s

slide-2
SLIDE 2

F r e e R T O S + l w I P S m r 3 2 8 9 – I C T P ( M a y 2 1 9 ) 2

C

  • n

t e n t s

  • T

h e l w I P T C P / I P s t a c k

– T

h e n e t w

  • r

k s t a c k

– T

h e s

  • c

k e t c

  • n

c e p t

  • A

T y p i c a l N e t w

  • r

k A p p l i c a t i

  • n
  • U

D P v s T C P

  • U

s e f u l n e t w

  • r

k t

  • l

s

  • h

t t p s : / / w w w . x i l i n x . c

  • m

/ v i d e

  • /

s

  • c

/ n e t w

  • r

k i n g

  • w

i t h

  • l

w i p

  • f
  • c

u s e d

  • f

r e e

  • r

t

  • s

. h t m l

slide-3
SLIDE 3

F r e e R T O S + l w I P S m r 3 2 8 9 – I C T P ( M a y 2 1 9 ) 3

l w I P T C P / I P s t a c k

  • l

w I P s t a n d s f

  • r

L i g h t w e i g h t I P :

– S

m a l l f

  • t

p r i n t i m p l e m e n t a t i

  • n

– S

p e c i a l l y w e l l s u i t e d f

  • r

e m b e d d e d s y s t e m s

  • S

u p p

  • r

t s a l a r g e n u m b e r

  • f

n e t w

  • r

k p r

  • t
  • c
  • l

s

– U

D P , T C P , I C M P , A R P , . . .

  • A

P I s :

– B

e r k e l e y s

  • c

k e t s :

  • r

e q u i r e s a n O . S .

– R

a w A P I

  • Wi

t h

  • r

w i t h

  • u

t O S

  • M
  • r

e c

  • n

t r

  • l

, b u t m

  • r

e c

  • m

p l e x t

  • u

s e

  • I

n c l u d e d i n x i l i n x S D K

– A

l s

  • i

n c l u d e s d r i v e r f

  • r

X i l i n x E t h e r n e t d r i v e r

– X

A P P 1 2 6 i s t h e r e f e r e n c e a p p l i c a t i

  • n

n

  • t

e

slide-4
SLIDE 4

F r e e R T O S + l w I P S m r 3 2 8 9 – I C T P ( M a y 2 1 9 ) 4

T h e n e t w

  • r

k s t a c k

  • T

h e n e t w

  • r

k d e s i g n i s

  • r

g a n i z e d a s a l a y e r s t a c k .

  • E

a c h l a y e r p r

  • v

i d e s a s e t

  • f

s e r v i c e s t

  • t

h e u p p e r l a y e r a n d r e q u i r e s s e r v i c e s f r

  • m

t h e l

  • w

e r l a y e r .

  • T

h e l a y e r ' n '

  • f

a n

  • d

e m a i n t a i n s a v i r t u a l c

  • n

v e r s a t i

  • n

w i t h t h e s a m e l a y e r t h e d e s t i n a t i

  • n

n

  • d

e . T h a t c

  • n

v e r s a t i

  • n

m u s t m e e t a s p e c i fi c p r

  • t
  • c
  • l

.

slide-5
SLIDE 5

F r e e R T O S + l w I P S m r 3 2 8 9 – I C T P ( M a y 2 1 9 ) 5

N e t w

  • r

k s

  • c

k e t s

  • S
  • c

k e t :

– B

a s i c a b s t r a c t i

  • n

f

  • r

n e t w

  • r

k p r

  • g

r a m m i n g

– C

  • m

b i n a t i

  • n
  • f

I P + p

  • r

t

– I

n t e r

  • p

r

  • c

e s s c

  • m

m u n i c a t i

  • n
slide-6
SLIDE 6

F r e e R T O S + l w I P S m r 3 2 8 9 – I C T P ( M a y 2 1 9 ) 6

N e t w

  • r

k s

  • c

k e t s

  • F

r

  • m

t h e p r

  • g

r a m m i n g p

  • i

n t

  • f

v i e w

– C

h a n n e l a b s t r a c t i

  • n
  • B

e r k e l e y s

  • c

k e t s ( B S D s

  • c

k e t s | P O S I X s

  • c

k e t s )

– D

e f a c t

  • s

t a n d a r d A P I

  • L

w I P S

  • c

k e t A P I

– ‘

l i t e ’ v e r s i

  • n
  • f

B S D s

  • c

k e t s s

p r

  • c

e s s c l i e n t

socket B y t e s → write read

p r

  • c

e s s s e r v e r

socket write read ← B y t e s lwip_socket(AF_INET, SOCK_STREAM, 0)

slide-7
SLIDE 7

F r e e R T O S + l w I P S m r 3 2 8 9 – I C T P ( M a y 2 1 9 ) 7

F r e e R T O S n e t w

  • r

k a p p l i c a t i

  • n
  • B

a s i c t e m p l a t e f

  • r

s

  • c

k e t

  • r

i e n t e d p r

  • g

r a m m i n g :

– F

i r s t s e t u p a n e t w

  • r

k t h r e a d a n d s t a r t F r e e R T O S t a s k s c h e d u l e r

– T

h e n t h e n e t w

  • r

k t h r e a d :

  • I

n i t i a l i z e s l w i p

  • C
  • n

fi g u r e s a n e t w

  • r

k i n t e r f a c e

  • R

i s e s t h e i n t e r f a c e

  • S

t a r t s a n

  • t

h e r t h r e a d f

  • r

t h e r e c e p t i

  • n
  • I

n s t a l l s a n y

  • t

h e r n e t w

  • r

k t a s k s ( n e w t h r e a d s ) r e q u i r e d b y t h e a p p l i c a t i

  • n

– We

’ l l s u p p

  • s

e a n e c h

  • s

e r v e r

  • F

i n a l l y i t d e l e t e s i t s e l f

– T

h e r e f

  • r

e a f t e r i n i t i a l i z a t i

  • n

s e v e r a l t h r e a d s a r e a c t i v e :

  • R

e c e p t i

  • n
  • E

c h

  • s

e r v e r

slide-8
SLIDE 8

F r e e R T O S + l w I P S m r 3 2 8 9 – I C T P ( M a y 2 1 9 ) 8

F r e e R T O S n e t w

  • r

k a p p l i c a t i

  • n
  • I

n i t i a l i z a t i

  • n

:

E q u i v a l e n t t

  • a

F r e e R T O S t a s k We n e e d F r e e R T O S t

  • s

t a r t t a s k e x e c u t i

  • n

f

  • r

t h e r e s t

  • f

t h e p r

  • c

e d u r e

slide-9
SLIDE 9

F r e e R T O S + l w I P S m r 3 2 8 9 – I C T P ( M a y 2 1 9 ) 9

F r e e R T O S n e t w

  • r

k a p p l i c a t i

  • n
  • N

e t w

  • r

k c

  • n

fi g u r a t i

  • n

t h r e a d

S t a t i c I P c

  • n

fi g u r a t i

  • n

… ( c

  • n

t i n u e s i n t h e n e x t s l i d e )

slide-10
SLIDE 10

F r e e R T O S + l w I P S m r 3 2 8 9 – I C T P ( M a y 2 1 9 ) 10

F r e e R T O S n e t w

  • r

k a p p l i c a t i

  • n
  • N

e t w

  • r

k c

  • n

fi g u r a t i

  • n

t h r e a d

T h i s t a s k i s j u s t f

  • r

c

  • n

fi g u r a t i

  • n

p u r p

  • s

e s T a s k s t h a t w i l l r e m a i n a c t i v e :

  • N

e t w

  • r

k d a t a r e c e p t i

  • n
  • E

c h

  • s

e r v e r ( t h a t p r

  • c

e s s e s d a t a r e c e i v e d )

slide-11
SLIDE 11

F r e e R T O S + l w I P S m r 3 2 8 9 – I C T P ( M a y 2 1 9 ) 11

N e t w

  • r

k p r

  • g

r a m m i n g c

  • n

c e p t s : E r r

  • r

c

  • n

t r

  • l
  • N

e t w

  • r

k c

  • m

m u n i c a t i

  • n

a t t h e I P l e v e l i s u n r e l i a b l e

  • I

f r e l i a b i l i t y i s r e q u i r e d a t t h e t r a n s p

  • r

t l a y e r . E r r

  • r

c

  • n

t r

  • l

i s r e s p

  • n

s i b l e f

  • r

:

– D

e t e c t a n d d i s c a r d c

  • r

r u p t p a c k e t s

– K

e e p t r a c k

  • f

l

  • s

t a n d d i s c a r d e d p a c k e t s ( r e s e n d )

– D

i s c a r d d u p l i c a t e s

– B

u ff e r

  • u

t

  • f
  • r

d e r p a c k e t s

  • I

m p l e m e n t e d t h r

  • u

g h :

– S

e q u e n c e n u m b e r s ( i n p a c k e t s )

– A

c k n

  • w

l e d g e m e n t a n d t i m e r s

slide-12
SLIDE 12

F r e e R T O S + l w I P S m r 3 2 8 9 – I C T P ( M a y 2 1 9 ) 12

N e t w

  • r

k p r

  • g

r a m m i n g c

  • n

c e p t s : F l

  • w

c

  • n

t r

  • l
  • B
  • t

h t h e s e n d e r a n d r e c e i v e r a d j u s t t h e t r a n s m i s s i

  • n

s p e e d

  • s

l i d i n g w i n d

  • w

:

– B

u ff e r u s e d t

  • m

a k e t h e t r a n s m i s s i

  • n

m

  • r

e e ffi c i e n t

  • S

e e v i d e

  • s

– a

s w e l l a s t

  • c
  • n

t r

  • l

t h e fl

  • w
  • f

d a t a s

  • t

h a t t h e d e s t i n a t i

  • n

d

  • e

s n

  • t

b e c

  • m

e

  • v

e r w h e l m e d w i t h d a t a

  • T

h e d e s t i n a t i

  • n

c a n r e d u c e t h e s i z e

  • f

t h e w i n d

  • w
slide-13
SLIDE 13

F r e e R T O S + l w I P S m r 3 2 8 9 – I C T P ( M a y 2 1 9 ) 13

U D P

  • U

n r e l i a b l e p r

  • t
  • c
  • l

– N

  • e

r r

  • r

c

  • n

t r

  • l
  • T

h e c l i e n t i g n

  • r

e s i f t h e p a c k e t a r r i v e d c

  • r

r e c t l y t

  • t

h e s e r v e r

– N

  • fl
  • w

c

  • n

t r

  • l
  • N
  • w

a y t

  • a

d j u s t t h e s p e e d

  • f

b

  • t

h t h e s e n d e r a n d r e c e i v e r

  • B

u t t h e n w h y u s i n g U D P ?

– E

x t r e m e l y s i m p l e ( m i n i m u m

  • v

e r h e a d ) → T h e f a s t e s t w a y ( l

  • w

e s t l a t e n c y )

– C

  • n

t r

  • l

c a n b e p r

  • v

i d e d b y d e A p l i c a t i

  • n

L a y e r

  • B

u t t h a t ’ s

  • n

y

  • u

a s a p r

  • g

r a m m e r

  • N
  • h

e l p f r

  • m

t h e n e t w

  • r

k s t a c k

– T

h e r e a r e m a y a p p l i c a t i

  • n

s w h e r e l

  • s

i n g p a r t

  • f

t h e i n f

  • r

m a t i

  • n

c a n b e t

  • l

e r a t e d :

  • E

x . V i d e

  • c
  • n

f e r e n c e

slide-14
SLIDE 14

F r e e R T O S + l w I P S m r 3 2 8 9 – I C T P ( M a y 2 1 9 ) 14

U D P

  • U

D P t i m i n g d i a g r a m

T h i s p a c k e t w i l l b e d i s c a r d e d

slide-15
SLIDE 15

F r e e R T O S + l w I P S m r 3 2 8 9 – I C T P ( M a y 2 1 9 ) 15

U D P

  • U

D P s

  • c

k e t P r

  • g

r a m m i n g fl

  • w
slide-16
SLIDE 16

F r e e R T O S + l w I P S m r 3 2 8 9 – I C T P ( M a y 2 1 9 ) 16

T C P

  • C
  • n

n e c t i

  • n
  • r

i e n t e d p r

  • t
  • c
  • l
  • R

e l i a b l e

– R

e t r a n s m i s s i

  • n
  • f

l

  • s

t

  • r

c

  • r

r u p t e d p a c k e t s

– C

u m u l a t i v e a n d s e l e c t i v e A C K s

  • C
  • m

p l e x p r

  • t
  • c
  • l

w i t h m u l t i p l e p h a s e s ( h i g h e r l a t e n c y , l

  • w

e r t h r

  • u

g h p u t )

– C

  • n

n e c t i

  • n

e s t a b l i s h m e n t

– D

a t a t r a n s f e r

– C

  • n

n e c t i

  • n

t e a r d

  • w

n

  • U

s e d w h e n l

  • s

i n g i n f

  • r

m a t i

  • n

c a n ’ t b e t

  • l

e r a t e d

– H

T T P / H T T P S

– E

  • m

a i l , t e x t m e s s a g i n g

slide-17
SLIDE 17

F r e e R T O S + l w I P S m r 3 2 8 9 – I C T P ( M a y 2 1 9 ) 17

T C P

  • T

C P c

  • m

m u n i c a t i

  • n

fl

  • w

– D

a t a t r a n s f e r s m u s t b e a c k n

  • w

l e d g e s

– B

u t a c k n

  • w

l e d g e s a r e p a c k e d . N

  • t
  • n

e p e r p a c k e t r e c e i v e d

slide-18
SLIDE 18

F r e e R T O S + l w I P S m r 3 2 8 9 – I C T P ( M a y 2 1 9 ) 18

T C P

  • T

C P s

  • c

k e t P r

  • g

r a m m i n g fl

  • w
slide-19
SLIDE 19

F r e e R T O S + l w I P S m r 3 2 8 9 – I C T P ( M a y 2 1 9 ) 19

T C P

slide-20
SLIDE 20

F r e e R T O S + l w I P S m r 3 2 8 9 – I C T P ( M a y 2 1 9 ) 20

T C P

slide-21
SLIDE 21

F r e e R T O S + l w I P S m r 3 2 8 9 – I C T P ( M a y 2 1 9 ) 21

l w I P p e r f

  • r

m a n c e

  • D

e p e n d s

  • n

– t

h e c

  • n

c r e t e h a r d w a r e ( a l s

  • t

h e C P U n

  • t

j u s t t h e n e t w

  • r

k i n t e r f a c e )

– a

n d A P I u s e d ( R A W

  • r

s

  • c

k e t )

slide-22
SLIDE 22

F r e e R T O S + l w I P S m r 3 2 8 9 – I C T P ( M a y 2 1 9 ) 22

N e t w

  • r

k t

  • l

s : n e t c a t

  • T

h e s w i s s a r m y k n i f e f

  • r

n e t w

  • r

k

  • p

e r a t i

  • n

s

  • C

a n b e c

  • n

fi g u r e d t

  • b

e a c l i e n t

  • r

a s e r v e r :

– U

D P e x a m p l e :

  • S

e r v e r : n c

  • l

u

  • p

< p

  • r

t > [ < h

  • s

t n a m e > ]

  • C

l i e n t : n c

  • u

< h

  • s

t n a m e > < p

  • r

t >

– T

C P e x a m p l e :

  • S

e r v e r : n c

  • l
  • p

< p

  • r

t > [ < h

  • s

t n a m e > ]

  • C

l i e n t : n c < h

  • s

t n a m e > < p

  • r

t >

slide-23
SLIDE 23

F r e e R T O S + l w I P S m r 3 2 8 9 – I C T P ( M a y 2 1 9 ) 23

N e t w

  • r

k t

  • l

s : Wi r e s h a r k

  • M
  • s

t p

  • p

u l a r n e t w

  • r

k t r a ffi c s n i ff e r

  • C

a p t u r e s a n d a n a l y z e s a n y k i n d

  • f

n e t w

  • r

k t r a ffi c

– Wi

l l h e l p y

  • u

t

  • u

n d e r s t a n d t h e n e t w

  • r

k s t a c k

– P

r

  • t
  • c
  • l

d i s s e c t

  • r
  • M

u l t i

  • p

l a t f

  • r

m ( e v e n m

  • b

i l e p h

  • n

e s )

– F

r e e s

  • f

t w a r e

slide-24
SLIDE 24

F r e e R T O S + l w I P S m r 3 2 8 9 – I C T P ( M a y 2 1 9 ) 24

N e t w

  • r

k t

  • l

s : Wi r e s h a r k

C a p t u r e d p a c k e t s P a c k e t e n c a p s u l a t i

  • n

P a c k e t c

  • n

t e n t s