亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? zl5011xpkcpreclassify.c

?? Zalink50114----TDMoIP芯片驅(qū)動源碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*******************************************************************************
*
*  File name:              zl5011xPkcPreClassify.c
*
*  Version:                16
*
*  Author:                 MRC
*
*  Date created:           13/05/2002
*
*  Copyright 2002, 2003, 2004, 2005, Zarlink Semiconductor Limited.
*  All rights reserved.
*
*  Module Description:
*
*  This file contains all the functions that will control the pre-classifier
*  part of the Pkc block. The pre-classifier is used to match protocol types.
*
*  The various stages in the PKC are as follows:
*
*  pre-processor  matches ethertype / MAC addresses for directing to the host.
*  pre-classifier matches the protocol type and extracts bytes from the header
*                 for use in the classification stage
*  classifier     matches the bytes extracted by the pre-classifier, to
*                 determine the context number for data transactions. Is also
*                 used to direct control packets related to a data path to the
*                 host.
*
*  Revision History:
*
*  Rev:  Date:       Author:  Comments:
*  1     13/05/2002  MRC      Creation
*  2     21/05/2002  MRC      PKC Rams have to be written in reverse order.
*  3     13/05/2002  MRC      Updated the get free function and added delete fn
*  4     03/07/2002  MRC      Changed the protocol match structure names
*  5     12/07/2002  MRC      Rationalised the 2 enums for CPU queues
*  6     04/09/2002  MRC      Changed the name of a structure entry from
*                             protocolLength16Bits to protocolTwoByteSeq
*  7     31/10/2002  MRC      Added variants + minor fixes
*  8     30/04/2003  ARW      Temporary altered file checked in by accident
*  9     30/04/2003  ARW      Revision 7 restored as the most recent version
*  10    30/04/2003  JFE      Made change to allow for preclassify bug (errata 2.56)
*  11    30/04/2003  JFE      Added missing bracket.
*  12    28/10/2003  AMS      Added zl5011xPkcProtocolConflictCheck function (essential
*                             to new way that packet helper functions work)
*  13    04/11/2003  AMS      Added some tracing to ProtocolConflictCheck function
*  14    18/11/2003  APL      Fixed compiler warning
*  15    23/07/2004  MRC      Fixed some compiler warnings
*  16    21/07/2005  MRC      Added function to check if an entry is used
*
*******************************************************************************/

/*****************   INCLUDE FILES                *****************************/

#include "zl5011x.h"
#include "zl5011xPkc.h"
#include "zl5011xPkcMap.h"
#include "zl5011xUtilLib.h"

/*******************************************************************************

 Function:
    zl5011xPkcProtocolConfigure

 Description:
    This function controls the behaviour for packets that are not matched in
    the pre classifier. They can be discarded or forwarded to the host using a
    specified queue.

 Inputs:
   zl5011xParams   Pointer to the structure for this device instance
   discard        ZL5011X_TRUE to discard non-matching packets,
                  ZL5011X_FALSE to forward to the host
   queueNum       queue number to use for packets forwarded to host

 Outputs:
   None

 Returns:
   zlStatusE

 Remarks:
   None

*******************************************************************************/

zlStatusE zl5011xPkcProtocolConfigure(zl5011xParamsS *zl5011xParams,
      zl5011xBooleanE discard, zl5011xQueueE queueNum)
{
   zlStatusE status = ZL5011X_OK;
   Uint32T bits = 0;

   ZL5011X_TRACE(ZL5011X_PKC_FN_ID,
         "zl5011xPkcProtocolConfigure: drop %d, queue %d",
         discard, queueNum, 0, 0, 0, 0);

   status = ZL5011X_CHECK_BOOLEAN(discard);

   if (status == ZL5011X_OK)
   {
      if (discard == ZL5011X_FALSE)
      {
         status = ZL5011X_CHECK_QUEUE_NUMBER(queueNum);

         /* if the packets are being directed to the CPU, then set the
            queue ID and leave the discard bit */
         if (status == ZL5011X_OK)
            bits = queueNum << ZL5011X_PKC_PRE_NO_MATCH_QUEUE_BITS;
      }
      else
      {
         /* if discarding the packets, then set the bit to enable this */
         bits = ZL5011X_1BIT_MASK << ZL5011X_PKC_PRE_NO_MATCH_DROP_BIT;
      }
   }

   if (status == ZL5011X_OK)
   {
      status = zl5011xWrite(zl5011xParams, ZL5011X_PKC_PROTOCOL_NO_MATCH, bits);

      /* store the discard and queue settings in the device structure */
      zl5011xParams->packetIf.packetRx.pkcProtocolDiscard = discard;
      zl5011xParams->packetIf.packetRx.pkcProtocolCpuQueue = queueNum;
   }

   return(status);
}

/*******************************************************************************

 Function:
    zl5011xPkcProtocolCheckFreeEntry

 Description:
   This function is provided to allow the application to check whether a PKC
   protocol match is in use without actually reserving it for use.

 Inputs:
   zl5011xParams   Pointer to the structure for this device instance
   matchNum       the classifier match number to check

 Outputs:
   entryFree      ZL5011X_TRUE if the entry is unused

 Returns:
   zlStatusE

 Remarks:
   None

*******************************************************************************/

zlStatusE zl5011xPkcProtocolCheckFreeEntry(zl5011xParamsS *zl5011xParams,
      Uint32T matchNum, zl5011xBooleanE *entryFree)
{
   zlStatusE status = ZL5011X_OK;

   ZL5011X_TRACE(ZL5011X_PKC_FN_ID,
         "zl5011xPkcProtocolCheckFreeEntry: match %d",
         matchNum, 0, 0, 0, 0, 0);

   *entryFree = ZL5011X_FALSE;

   /* check that a valid match number was specified */
   if (matchNum >= ZL5011X_PKC_NUM_PROTOCOL_ENTRIES)
   {
      status = ZL5011X_PARAMETER_INVALID;
   }
   else
   {
      /* check whether the match is in use */
      if (zl5011xParams->packetIf.packetRx.pkcProtocol[matchNum].protocolReserved == ZL5011X_FALSE)
      {
         *entryFree = ZL5011X_TRUE;
      }
   }

   if (status == ZL5011X_OK)
   {
      ZL5011X_TRACE(ZL5011X_PKC_FN_ID,
            "zl5011xPkcProtocolCheckFreeEntry: match %d, avail %d",
            matchNum, *entryFree, 0, 0, 0, 0);
   }

   return(status);
}

/*******************************************************************************

 Function:
    zl5011xPkcProtocolGetFreeEntry

 Description:
   This function can reserve an entry in the pre-classifier if a valid match
   number is provided, or will allocate one if possible.

 Inputs:
   zl5011xParams   Pointer to the structure for this device instance
   matchNum       the number of a free entry or ZL5011X_INVALID to allocate a
                  match number

 Outputs:
   matchNum       the number of a free entry if at input it was ZL5011X_INVALID

 Returns:
   zlStatusE

 Remarks:
   None

*******************************************************************************/

zlStatusE zl5011xPkcProtocolGetFreeEntry(zl5011xParamsS *zl5011xParams,
      Uint32T *matchNum)
{
   Uint32T loop;
   zlStatusE status = ZL5011X_OK;

   ZL5011X_TRACE(ZL5011X_PKC_FN_ID,
         "zl5011xPkcProtocolGetFreeEntry: match in %d",
         *matchNum, 0, 0, 0, 0, 0);

   /* if the match number was set to a special value of invalid,
      then one will be automatically found */
   if (*matchNum == (Uint32T)ZL5011X_INVALID)
   {
      for (loop = 0; loop < ZL5011X_PKC_NUM_PROTOCOL_ENTRIES; loop++)
      {
         if (zl5011xParams->packetIf.packetRx.pkcProtocol[loop].protocolReserved == ZL5011X_FALSE)
            break;
      }

      if (loop >= ZL5011X_PKC_NUM_PROTOCOL_ENTRIES)
      {
         /* no free matches in the classifier, so return error */
         status = ZL5011X_NO_AVAIL_PROTOCOL_MATCH;
      }
      else
      {
         *matchNum = loop;
      }
   }
   else
   {
      /* if the number was specified, but was not valid, then throw an error */
      if (*matchNum >= ZL5011X_PKC_NUM_PROTOCOL_ENTRIES)
      {
         status = ZL5011X_PARAMETER_INVALID;
      }
      else
      {
         /* check that the match is not already in use */
         if (zl5011xParams->packetIf.packetRx.pkcProtocol[*matchNum].protocolReserved == ZL5011X_TRUE)
         {
            status = ZL5011X_PROTOCOL_MATCH_IN_USE;
         }
      }
   }

   /* reserve the match if there has not been an error */
   if (status == ZL5011X_OK)
   {
      zl5011xParams->packetIf.packetRx.pkcProtocol[*matchNum].protocolReserved = ZL5011X_TRUE;

      ZL5011X_TRACE(ZL5011X_PKC_FN_ID,
            "zl5011xPkcProtocolGetFreeEntry: match out %d",
            *matchNum, 0, 0, 0, 0, 0);
   }

   return(status);
}

/*******************************************************************************

 Function:
    zl5011xPkcProtocolEnableEntry

 Description:
   Enables a pre classifier entry. The entry should be configured before it is
   enabled.

 Inputs:
   zl5011xParams   Pointer to the structure for this device instance
   matchNum       the number of the entry to enable

 Outputs:
   None

 Returns:
   zlStatusE

 Remarks:
   None

*******************************************************************************/

zlStatusE zl5011xPkcProtocolEnableEntry(zl5011xParamsS *zl5011xParams,
      Uint32T matchNum)
{
   zlStatusE status = ZL5011X_OK;

   ZL5011X_TRACE(ZL5011X_PKC_FN_ID,
         "zl5011xPkcProtocolEnableEntry: match %3d",
         matchNum, 0, 0, 0, 0, 0);

   /* check pre classifier entry number is in range */
   if (matchNum >= ZL5011X_PKC_NUM_PROTOCOL_ENTRIES)
   {
      status = ZL5011X_PARAMETER_INVALID;
   }

   if (status == ZL5011X_OK)
   {
      zl5011xParams->packetIf.packetRx.pkcProtocol[matchNum].protocolInUse = ZL5011X_TRUE;
      zl5011xParams->packetIf.packetRx.pkcProtocol[matchNum].protocolReserved = ZL5011X_TRUE;

      /* set the bit to enable the pre classifier entry */
      status = zl5011xReadModWrite(zl5011xParams, ZL5011X_PKC_PROTOCOL_ENABLE,
            ZL5011X_1BIT_MASK << (matchNum*2),
            ZL5011X_1BIT_MASK << (matchNum*2));
   }

   return status;
}

/*******************************************************************************

 Function:
    zl5011xPkcProtocolDisableEntry

 Description:
   Disables a pre classifier entry. The entry is still reserved, but is disabled
   in the device.

 Inputs:
   zl5011xParams   Pointer to the structure for this device instance
   matchNum       the number of the entry to disable

 Outputs:
   None

 Returns:
   zlStatusE

 Remarks:
   None

*******************************************************************************/

zlStatusE zl5011xPkcProtocolDisableEntry(zl5011xParamsS *zl5011xParams,
      Uint32T matchNum)
{
   zlStatusE status = ZL5011X_OK;

   ZL5011X_TRACE(ZL5011X_PKC_FN_ID,
         "zl5011xPkcProtocolDisableEntry: match %3d",
         matchNum, 0, 0, 0, 0, 0);

   /* check pre classifier entry number is in range */
   if (matchNum >= ZL5011X_PKC_NUM_PROTOCOL_ENTRIES)
   {
      status = ZL5011X_PARAMETER_INVALID;
   }

   if (status == ZL5011X_OK)
   {
      zl5011xParams->packetIf.packetRx.pkcProtocol[matchNum].protocolInUse = ZL5011X_FALSE;

      /* set the bit to disable the pre classifier entry */
      status = zl5011xReadModWrite(zl5011xParams, ZL5011X_PKC_PROTOCOL_ENABLE,
            0,
            ZL5011X_1BIT_MASK << (matchNum*2));
   }

   return status;
}

/*******************************************************************************

 Function:
    zl5011xPkcProtocolDeleteEntry

 Description:
   Deletes a pre classifier entry. The entry is marked as free, to allow it to
   be allocated again.

 Inputs:
   zl5011xParams   Pointer to the structure for this device instance
   matchNum       the number of the entry to delete

 Outputs:
   None

 Returns:
   zlStatusE

 Remarks:
   None

*******************************************************************************/

zlStatusE zl5011xPkcProtocolDeleteEntry(zl5011xParamsS *zl5011xParams,
      Uint32T matchNum)
{
   zlStatusE status = ZL5011X_OK;

   ZL5011X_TRACE(ZL5011X_PKC_FN_ID,
         "zl5011xPkcProtocolDeleteEntry: match %3d",
         matchNum, 0, 0, 0, 0, 0);

   status = zl5011xPkcProtocolDisableEntry(zl5011xParams, matchNum);

   /* if the disable was okay, then free the protocol match by clearing
      the reserved flag */
   if (status == ZL5011X_OK)
   {
      zl5011xParams->packetIf.packetRx.pkcProtocol[matchNum].protocolReserved = ZL5011X_FALSE;
   }

   return status;
}

/*******************************************************************************

 Function:
    zl5011xPkcProtocolSetMatchField

 Description:
   Sets the match bytes in the pre classifier. There is also a mask field, that
   is used to control which of the bits in these mask bytes are compared.

 Inputs:
   zl5011xParams   Pointer to the structure for this device instance
   matchNum       the number of the entry to set
   matchIndex     array of bytes to be used

 Outputs:
   None

 Returns:
   zlStatusE

 Remarks:
   None

*******************************************************************************/

zlStatusE zl5011xPkcProtocolSetMatchField(zl5011xParamsS *zl5011xParams,
      Uint32T matchNum, Uint8T *matchIndex)
{
   Uint32T tempWord[(ZL5011X_PKC_PROTOCOL_MATCH_SIZE / 4) + 1];
   Uint8T tempPos = 0;
   Uint8T index = 0;
   Uint32T address;
   Uint32T loop;
   zlStatusE status = ZL5011X_OK;

   ZL5011X_TRACE(ZL5011X_PKC_FN_ID,
         "zl5011xPkcProtocolSetMatchField: match %3d",
         matchNum, 0, 0, 0, 0, 0);

   address = ZL5011X_PKC_PROTOCOL_MATCH +
         ((matchNum*2) * ZL5011X_PKC_PROTOCOL_MATCH_SIZE);

   /* assemble the classify match entries into 32 bit words and
      then write them to the device */
   for (loop = 0; loop < ZL5011X_PKC_PROTOCOL_NUM_MATCH_FIELDS; loop++)
   {
      if (status != ZL5011X_OK)
         break;

      status = zl5011xAssembleBitFields(tempWord, &index, &tempPos,
            matchIndex[loop], ZL5011X_PKC_PROTOCOL_SIZE_MATCH_FIELD);
   }

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜激情一区二区| 欧美激情一区二区在线| 99精品久久只有精品| 精品午夜久久福利影院| 免费成人av在线| 免费看欧美女人艹b| 日韩电影一二三区| 精品一二线国产| 国产剧情一区二区三区| 国产精品一区久久久久| 东方aⅴ免费观看久久av| 成人国产精品免费网站| 99久久99久久久精品齐齐| 91久久免费观看| 在线不卡欧美精品一区二区三区| 欧美一级片在线看| 精品欧美乱码久久久久久1区2区| 欧美sm美女调教| 国产精品日韩成人| 一区二区不卡在线视频 午夜欧美不卡在| 亚洲男人天堂一区| 日本aⅴ精品一区二区三区| 国产综合色精品一区二区三区| 成人午夜电影小说| 色欧美日韩亚洲| 欧美一级高清片| 中文字幕在线一区免费| 亚洲综合在线第一页| 日本免费在线视频不卡一不卡二| 国内精品伊人久久久久av影院| 成人免费毛片aaaaa**| 欧美日韩免费一区二区三区视频| 国产欧美久久久精品影院| 久久久久9999亚洲精品| 亚洲精品伦理在线| 蜜臀久久99精品久久久久宅男| 精品一区二区成人精品| 91黄视频在线观看| 26uuu另类欧美| 亚洲精品视频免费看| 麻豆高清免费国产一区| 91片在线免费观看| 欧美电视剧在线观看完整版| 亚洲精品中文在线| 一本到不卡精品视频在线观看 | 26uuu久久综合| 亚洲靠逼com| 国产精品18久久久久久久久| 欧美色精品天天在线观看视频| 久久美女高清视频| 日韩不卡一二三区| 在线观看精品一区| 中文字幕中文字幕中文字幕亚洲无线| 青青草成人在线观看| 91黄色免费网站| 久久综合网色—综合色88| 亚洲最大成人网4388xx| 成人av资源在线| 欧美大片一区二区| 日韩成人精品在线观看| 91美女片黄在线观看91美女| 久久蜜桃av一区精品变态类天堂| 亚洲综合视频网| 99国产精品久| 国产精品美女www爽爽爽| 久久国内精品自在自线400部| av日韩在线网站| 国产午夜亚洲精品午夜鲁丝片| 日本三级亚洲精品| 欧美色图在线观看| 伊人性伊人情综合网| 国产99久久久精品| 日本一区二区成人| 国产精品一区二区三区乱码| 91精品久久久久久久91蜜桃| 亚洲一级二级三级| 欧美日免费三级在线| 亚洲同性gay激情无套| 成人h精品动漫一区二区三区| 日本一区二区三区高清不卡| 国产91在线观看丝袜| 国产日产欧美精品一区二区三区| 国产乱码精品一区二区三区av | 男人的天堂久久精品| 欧美日韩国产系列| 一区二区在线电影| 日本久久电影网| 亚洲国产视频一区| 日韩视频在线永久播放| 国产精品影视在线观看| 国产精品国产三级国产aⅴ入口| 不卡的电影网站| 亚洲免费av在线| 精品婷婷伊人一区三区三| 日韩精品一二区| 久久综合成人精品亚洲另类欧美| 青青草国产精品亚洲专区无| 日韩一区二区免费视频| 国产乱子伦一区二区三区国色天香| 久久蜜桃一区二区| 色综合欧美在线| 天堂资源在线中文精品| 日韩欧美精品在线| 成人福利在线看| 午夜精品久久久久久| 久久久蜜桃精品| 色综合久久天天| 久久99精品一区二区三区| 国产精品丝袜黑色高跟| 欧美午夜在线观看| 国产一区二三区好的| 亚洲欧洲色图综合| 91麻豆精品国产无毒不卡在线观看 | 91精品国产麻豆国产自产在线| 国产乱对白刺激视频不卡| 亚洲精品免费播放| 久久亚洲综合色| 欧美性大战久久久久久久蜜臀| 国产乱码精品1区2区3区| 亚洲一级片在线观看| 欧美经典一区二区| 制服视频三区第一页精品| 国产成人av自拍| 日本不卡视频在线观看| 亚洲色图欧美在线| 久久免费午夜影院| 91精品欧美久久久久久动漫| 不卡的av网站| 狠狠色综合色综合网络| 亚洲午夜免费视频| 综合久久给合久久狠狠狠97色| 日韩精品一区二区三区在线 | 欧美写真视频网站| 岛国av在线一区| 韩国在线一区二区| 日韩国产欧美一区二区三区| 伊人开心综合网| 亚洲欧洲精品一区二区三区不卡| 精品国产乱码久久久久久夜甘婷婷 | 国产精品久久久久精k8 | 亚洲色图欧洲色图婷婷| 久久嫩草精品久久久久| 欧美大白屁股肥臀xxxxxx| 91麻豆精品国产自产在线观看一区| 色婷婷亚洲综合| 91片在线免费观看| 97久久超碰精品国产| 成人爱爱电影网址| 99精品1区2区| 91女厕偷拍女厕偷拍高清| k8久久久一区二区三区| 国产成人精品免费在线| 国产一区不卡视频| 国产成人精品免费网站| 国产不卡在线一区| 国产不卡视频一区| 99久久综合精品| 日本道精品一区二区三区| 欧洲在线/亚洲| 欧美日本一区二区三区| 欧美片在线播放| 日韩精品一区二区在线| 久久人人超碰精品| 国产精品久久久久久福利一牛影视| 国产精品美女久久久久久久 | 欧美一级欧美三级| 日韩美女在线视频| 国产亚洲一区二区在线观看| 国产精品久久久久久久久免费桃花| 中文字幕二三区不卡| 亚洲美女电影在线| 性做久久久久久免费观看欧美| 蜜臀91精品一区二区三区| 黄页视频在线91| 91免费视频网| 欧美一区二区在线看| 精品久久五月天| 综合亚洲深深色噜噜狠狠网站| 一区二区三区精密机械公司| 日本美女一区二区三区视频| 色88888久久久久久影院野外| 在线亚洲精品福利网址导航| 6080午夜不卡| 中文字幕第一区第二区| 亚洲亚洲人成综合网络| 久久se这里有精品| 91在线播放网址| 精品国产青草久久久久福利| 中文字幕在线不卡视频| 视频一区在线播放| 成人av网在线| 3d成人h动漫网站入口| 亚洲国产成人午夜在线一区| 亚洲午夜三级在线| 国产99精品国产| 欧美一二三四在线| 一区二区三区在线免费播放| 极品美女销魂一区二区三区| 色综合一区二区三区| 久久久电影一区二区三区|