1 / 17

Sharing Memory

INF5060: Multimedia data communication using network processors. Sharing Memory. 1/10 - 2004. Resource Manager. Task Used by StrongARM code For microACEs and microACE applications to interface with microengines API Initialize and configure IXP1200

awen
Download Presentation

Sharing Memory

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. 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. 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. 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. Using Exceptions Using Shared Memory wwbump

  6. #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 */ wwbump_import.h

  7. #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 <ix/microace/rm.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 unsigned int Webcnt; #endif /* __CC_H */ wwbcc.h

  8. #include <stdio.h> #include <stdlib.h> #include <string.h> #include <wwbump.h> #include <wwbcc.h> #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; #include <stdlib.h> #include <string.h> #include <wwbump.h> #include <wwbcc.h> #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; wwbcc.c

  9. /* 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 << i) & wwb->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 ) … } } wwbcc.c

  10. 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; } wwbcc.c

  11. 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; } wwbcc.c

  12. #define IX_EXCEPTION 0 #define SA_CONSUME_NUM 31 #define SEQNUM_IGNORE 31 .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_EXCEPTION 0 #define SA_CONSUME_NUM 31 #define SEQNUM_IGNORE 31 .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#] WWB_dl.uc

  13. 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 nop 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 nop nop .endlocal WWB_dl.uc

  14. #define ETH_IP 0x800 #define IPT_TCP 6 #define TCP_WWW 80 #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_IP 0x800 #define IPT_TCP 6 #define TCP_WWW 80 #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 WWBump.uc

  15. .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 WWBump.uc

  16. 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 .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 .endlocal WWBump.uc

  17. 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 WWBump.uc

More Related