wiki:Proto/cModules/f0Computing/b0MFclick
close Warning: Can't synchronize with repository "(default)" ("(default)" is not readable or not a Git repository.). Look in the Trac log for more information.

How to host the computing layer in the MF click router

This page describes how to integrate the computing services in the click MF router (based on the May 23, 2014 version): To trigger a transparent services, there are three steps:

  • intercept a complete chunk from the router (from mf_segmentor)
  • update the chunk payload, note that the chunk size might be changed (e.g., compression services)
  • ship back the processed chunk for further delivery

When need to change the mf_segmentor.cc accordingly:

add a computing parameter, to specify the service number (0 - doing nothing, 1 - a simple encryption service)

int MF_Segmentor::configure(Vector<String> &conf, ErrorHandler *errh){
  if(cp_va_kparse(conf, this, errh,
                  "ROUTER_STATS", cpkP+cpkM, cpElement, &_routerStats,
                  "CHUNK_MANAGER", cpkP+cpkM, cpElement, &_chunkManager,
                  "WINDOW_SIZE", cpkP, cpUnsigned, &_window_size,
                  "COMPUTING", cpkP, cpUnsigned, &_computing_service, // 0 - no service, 1 - simple encryption
                  cpEnd) < 0) {
    return -1;
  }
  return 0;
}

also

we need to put

#include "Core_Computing_Func.hh"

in the beginning also we need to add

while ((!isSendingPoolFull()) && (_readyCache->size() > 0)) {
      uint32_t hop_ID = findMinReadyHopID();
      logger.log(MF_DEBUG,
                 "seg: starting trxfr hop ID: %d; ready chks: %d",
                 hop_ID, _readyCache->size());

      Chunk *chunk = _readyCache->find(hop_ID).value(); 
      Computing_Core_Func(chunk);

      //find ready chunks, erase from readyQ
      ReadyChunkMap::iterator it = _readyCache->find(hop_ID); 
      Chunk *readyChunk = it.value();
      _readyCache->erase(it);

accordingly, we need some updates in the mf_segmentor.hh

 private:
   void Computing_Core_Func(Chunk *chunk);
   void Computing_parse_chunk_info(Chunk *chunk);
   void Computing_chunk_processing(uint32_t _service_type, Chunk *chunk, uint32_t ori_chunk_size);
   void Computing_updated_chunk(Chunk *chunk, uint32_t new_chunk_size, uint32_t hop_id_log, uint32_t _pkt_size);
   uint32_t _computing_service;
  • Computing_Core_Function is the main interface for the router to trigger the computing service
  • Computing_parse_chunk_info is used for parsing the basic information of a received chunk
  • Computing_chunk_processing is the main part of the computing function, you can add as many services as you wish here
  • Computing_updated_chunk is used for clearing the old chunk payload, and adding the new chunk payload
Last modified 9 years ago Last modified on Nov 29, 2014, 2:08:37 AM
Note: See TracWiki for help on using the wiki.