Presentation is loading. Please wait.

Presentation is loading. Please wait.

Sharing Memory Sharing Memory 1/10 - 2004 INF5060: Multimedia data communication using network processors.

Similar presentations


Presentation on theme: "Sharing Memory Sharing Memory 1/10 - 2004 INF5060: Multimedia data communication using network processors."— Presentation transcript:

1 Sharing Memory Sharing Memory 1/ INF5060: Multimedia data communication using network processors

2 2004 Carsten Griwodz & Pål HalvorsenINF5060 – multimedia communication using network processors Resource Manager  Task  Used by StrongARM code  For microACEs and microACE applications to interface with microengines  API  Initialize and configure IXP1200  Send and receive packets to and from microcode blocks  Load code into microengines  Get/set microengine configuration and resource assignment  Enable/disable microengines  Allocate and access uncached SRAM, SDRAM and Scratch memory  Create and statically bind microACEs

3 2004 Carsten Griwodz & Pål HalvorsenINF5060 – multimedia communication using network processors Resource Manager  Data structures  RmMemoryHandle  Opaque handle identifying memory allocated by the resource manager  typedef int RmMemoryHandle  RmImportedSymbol  Structured used to patch microcode symbols  typedef struct { int meNumber; char name[MAX_SIZE_OF_IMPORTED_SYMBOL]; int value; } RmImportedSymbol;

4 2004 Carsten Griwodz & Pål HalvorsenINF5060 – multimedia communication using network processors Resource Manager  RmUengPatchSymbols  A function call that patches an array of variables to the StrongARM side into the microcode running on one microengine.  ix_error RmUengPatchSymbols( int uengNumber, RmImportedSymbol symbols[], int numberOfSymbols );

5 2004 Carsten Griwodz & Pål HalvorsenINF5060 – multimedia communication using network processors wwbump Using ExceptionsUsing Shared Memory

6 2004 Carsten Griwodz & Pål HalvorsenINF5060 – multimedia communication using network processors wwbump_import.h #ifndef _WWBUMP_IMPORT_H #define _WWBUMP_IMPORT_H #ifdef MICROCODE.import_var WWBUMP_TAG #else #define WWBUMP_TAG_STR "WWBUMP_TAG" #endif #endif /* _WWBUMP_IMPORT_H */ #ifndef _WWBUMP_IMPORT_H #define _WWBUMP_IMPORT_H #ifdef MICROCODE.import_var WWBUMP_TAG.import_var PKTCNT_ADDR #else #define WWBUMP_TAG_STR "WWBUMP_TAG" #define PCADDR_STR "PKTCNT_ADDR" #endif #endif /* _WWBUMP_IMPORT_H */

7 2004 Carsten Griwodz & Pål HalvorsenINF5060 – multimedia communication using network processors wwbcc.h #ifndef __CC_H #define __CC_H #include "wwbump_sk_c.h" #include "wwbump_cc_c.h" ix_error getcnt(ix_base_t* bp,long* rv); ix_error cc_init(struct wwbump *wwb); ix_error cc_fini(struct wwbump *wwb); extern long Webcnt; #endif /* __CC_H */ #ifndef __CC_H #define __CC_H #include #include "wwbump_sk_c.h" #include "wwbump_cc_c.h" ix_error getcnt(ix_base_t* bp,long* rv); ix_error cc_init(struct wwbump *wwb); ix_error cc_fini(struct wwbump *wwb); extern unsigned int Webcnt; #endif /* __CC_H */

8 2004 Carsten Griwodz & Pål HalvorsenINF5060 – multimedia communication using network processors #include #include "wwbump_sk_c.h" #include "wwbump_cc_c.h" unsigned int Webcnt; unsigned char *Sptr; ix_error cc_init(struct wwbump *wwb) { CC_VMT_wwbump *vmt = 0; ix_cap *capp; ix_error e; RmImportedSymbol sym; int i; wwbcc.c #include #include "wwbump_sk_c.h" #include "wwbump_cc_c.h" long Webcnt; ix_error cc_init(struct wwbump *wwb) { CC_VMT_wwbump *vmt = 0; ix_cap *capp; ix_error e;

9 2004 Carsten Griwodz & Pål HalvorsenINF5060 – multimedia communication using network processors wwbcc.c /* nothing here */ e = RmMalloc(RM_SCRATCH, &Sptr, 1); if ( e ) … e = RmGetPhysOffset(RM_SCRATCH, Sptr, &Webcnt); if ( e ) … e = RmWrite(RM_SCRATCH, Webcnt, 0, 0); if ( e ) … for ( i = 0 ; i < 5 ; ++i ) { if ( (1 ue ) { sym.meNumber = i; strncpy(sym.name, PCADDR_STR, MAX_SIZE_OF_IMPORTED_SYMBOL); sym.name[MAX_SIZE_OF_IMPORTED_SYMBOL - 1] = '\0'; sym.value = Webcnt; e = RmUengPatchSymbols(i, &sym, 1); if ( e ) … }

10 2004 Carsten Griwodz & Pål HalvorsenINF5060 – multimedia communication using network processors wwbcc.c memset(&wwb->ccbase, 0, sizeof(wwb->ccbase)); ix_ace_to_cap(&wwb->ace, &capp); e = sk_wwbump_init(&wwb->ccbase, capp); if (e) … e = getCCVMT_wwbump(&wwb->ccbase, &vmt); if (e) … vmt->_pCC_wwbump_getcnt = getcnt; Webcnt = 0; return 0; } memset(&wwb->ccbase, 0, sizeof(wwb->ccbase)); ix_ace_to_cap(&wwb->ace, &capp); e = sk_wwbump_init(&wwb->ccbase, capp); if (e) … e = getCCVMT_wwbump(&wwb->ccbase, &vmt); if (e) … vmt->_pCC_wwbump_getcnt = getcnt; return 0; }

11 2004 Carsten Griwodz & Pål HalvorsenINF5060 – multimedia communication using network processors wwbcc.c ix_error cc_fini(struct wwbump *wwb) { ix_error e; e = sk_wwbump_fini(&wwb->ccbase); if ( e ) … return 0; } ix_error getcnt(ix_base_t* bp, long* rv) { (void)bp; *rv = Webcnt; return 0; } ix_error cc_fini(struct wwbump *wwb) { ix_error e; e = sk_wwbump_fini(&wwb->ccbase); if ( e ) … e = RmFree(Sptr); if ( e ) … return 0; } ix_error getcnt(ix_base_t* bp, long* rv) { unsigned int val, dummy; ix_error e; (void)bp; e = RmRead(RM_SCRATCH, Webcnt, &val, &dummy); if ( e ) … *rv = val; return 0; }

12 2004 Carsten Griwodz & Pål HalvorsenINF5060 – multimedia communication using network processors WWB_dl.uc #define IX_EXCEPTION0 #define SA_CONSUME_NUM31 #define SEQNUM_IGNORE31.local dl_reg1 dl_reg2 dl_reg3 dl_reg4 dl_buffer_handle dl_next_block #include "DispatchLoop_h.uc" #include "DispatchLoopImportVars.h" #include "EthernetIngress.uc" #include "wwbump_import.h" #include "WWBump.uc" DL_Init[] EthernetIngress_Init[] WWBumpInit[].while(1) Top_Of_Loop#: DL_SASource[ ] alu[--, dl_buffer_handle, -, IX_BUFFER_NULL] br=0[Main_Dispatch#], guess_branch br[Send_MB#] #define IX_EXCEPTION0 #define SA_CONSUME_NUM31 #define SEQNUM_IGNORE31.local dl_reg1 dl_reg2 dl_reg3 dl_reg4 dl_buffer_handle dl_next_block #include "DispatchLoop_h.uc" #include "DispatchLoopImportVars.h" #include "EthernetIngress.uc" #include "wwbump_import.h" #include "WWBump.uc" DL_Init[] EthernetIngress_Init[] WWBumpInit[].local fixme immed32[fixme, WWBUMP_TAG].endlocal.while(1) Top_Of_Loop#: DL_SASource[ ] alu[--, dl_buffer_handle, -, IX_BUFFER_NULL] br=0[Main_Dispatch#], guess_branch br[Send_MB#]

13 2004 Carsten Griwodz & Pål HalvorsenINF5060 – multimedia communication using network processors WWB_dl.uc Main_Dispatch#: EthernetIngress[ ] alu[--, dl_buffer_handle, -, IX_BUFFER_NULL] br=0[Top_Of_Loop#] br!=byte[dl_next_block, 0, 1, Drop_Packet#] WWBump[] alu[ --, dl_next_block, -, IX_EXCEPTION] br=0[Send_SA#] br[Send_MB#] Send_SA#: DL_SASink[ ].continue Send_MB#: DL_MESink[ ] nop.continue Drop_Packet#: DL_Drop[ ].endw nop.endlocal Main_Dispatch#: EthernetIngress[ ] alu[--, dl_buffer_handle, -, IX_BUFFER_NULL] br=0[Top_Of_Loop#] br!=byte[dl_next_block, 0, 1, Drop_Packet#] WWBump[] alu[ --, dl_next_block, -, IX_EXCEPTION] br=0[Send_SA#] br[Send_MB#] Send_SA#: DL_SASink[ ].continue Send_MB#: DL_MESink[ ] nop.continue Drop_Packet#: DL_Drop[ ].endw nop.endlocal

14 2004 Carsten Griwodz & Pål HalvorsenINF5060 – multimedia communication using network processors WWBump.uc #define ETH_IP0x800 #define IPT_TCP6 #define TCP_WWW80 #macro WWBumpInit[] #endm #macro WWBump[] xbuf_alloc[$$hdr,6].local ifn DL_GetInputPort[ifn] alu [ ifn, ifn, XOR, 1 ] DL_SetOutputPort[ifn].endlocal.local base off Buf_GetData[base, dl_buffer_handle] DL_GetBufferOffset[off] alu_shf[off, --, B, off, >>3] sdram[read, $$hdr0, base, off, 3], ctx_swap.endlocal #define ETH_IP0x800 #define IPT_TCP6 #define TCP_WWW80 #macro WWBumpInit[] #endm #macro WWBump[] xbuf_alloc[$$hdr,6].local ifn DL_GetInputPort[ifn] alu [ ifn, ifn, XOR, 1 ] DL_SetOutputPort[ifn].endlocal.local base off Buf_GetData[base, dl_buffer_handle] DL_GetBufferOffset[off] alu_shf[off, --, B, off, >>3] sdram[read, $$hdr0, base, off, 3], ctx_swap.endlocal

15 2004 Carsten Griwodz & Pål HalvorsenINF5060 – multimedia communication using network processors WWBump.uc.local etype immed[etype, ETH_IP] alu_shf[ --, etype, -, $$hdr3, >>16] br!=0[NotWeb#].endlocal br!=byte[$$hdr5, 0, IPT_TCP, NotWeb#].local base boff dpoff dport ld_field_w_clr[dpoff, 0001, $$hdr3, >>6].local mask immed[mask, 0x3c] alu [dpoff, dpoff,AND,mask ].endlocal alu[dpoff, dpoff, +, 16] Buf_GetData[base, dl_buffer_handle] DL_GetBufferOffset[boff] alu[boff, boff, +, dpoff] alu_shf[boff, --, B, boff, >>3] sdram[read, $$hdr0, base, boff, 1], ctx_swap.local etype immed[etype, ETH_IP] alu_shf[ --, etype, -, $$hdr3, >>16] br!=0[NotWeb#].endlocal br!=byte[$$hdr5, 0, IPT_TCP, NotWeb#].local base boff dpoff dport ld_field_w_clr[dpoff, 0001, $$hdr3, >>6].local mask immed[mask, 0x3c] alu [ dpoff, dpoff,AND,mask ].endlocal alu[dpoff, dpoff, +, 16] Buf_GetData[base, dl_buffer_handle] DL_GetBufferOffset[boff] alu[boff, boff, +, dpoff] alu_shf[boff, --, B, boff, >>3] sdram[read, $$hdr0, base, boff, 1], ctx_swap

16 2004 Carsten Griwodz & Pål HalvorsenINF5060 – multimedia communication using network processors WWBump.uc alu[ dpoff, dpoff, AND, 0x7 ] alu[ --, dpoff, -, 4] br>=0[SecondWord#] FirstWord#: ld_field_w_clr[dport, 0011, $$hdr0, >>16] br[GotDstPort#] SecondWord#: ld_field_w_clr[dport, 0011, $$hdr1, >>16] GotDstPort#:.local wprt immed[wprt, TCP_WWW] alu[--, dport, -, wprt] br!=0[NotWeb#].endlocal alu[ dpoff, dpoff, AND, 0x7 ] alu[ --, dpoff, -, 4] br>=0[SecondWord#] FirstWord#: ld_field_w_clr[dport, 0011, $$hdr0, >>16] br[GotDstPort#] SecondWord#: ld_field_w_clr[dport, 0011, $$hdr1, >>16] GotDstPort#:.local wprt immed[wprt, TCP_WWW] alu[--, dport, -, wprt] br!=0[NotWeb#].endlocal

17 2004 Carsten Griwodz & Pål HalvorsenINF5060 – multimedia communication using network processors WWBump.uc IsWeb#:.local exc immed[exc, 0] DL_SetExceptionCode[exc].endlocal.local ace_tag immed32[ace_tag, WWBUMP_TAG] DL_SetAceTag[ace_tag].endlocal immed[dl_next_block,IX_EXCEPTION] br[Finish#] NotWeb#: immed32[dl_next_block, 1] Finish#: xbuf_free[$$hdr] #endm IsWeb#:.local saddr immed32[saddr, PKTCNT_ADDR] scratch[incr, --, saddr, 0, 1].endlocal NotWeb#: immed32[dl_next_block, 1] Finish#: xbuf_free[$$hdr] #endm


Download ppt "Sharing Memory Sharing Memory 1/10 - 2004 INF5060: Multimedia data communication using network processors."

Similar presentations


Ads by Google