⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ans.c

📁 COPE the first practical network coding scheme which is developped on click
💻 C
📖 第 1 页 / 共 4 页
字号:
**  Arguments:  BOARD_PRIVATE_STRUCT *bps - a pointer to the adapters hw **                                          specific data structure.**              iANSsupport_t *iANSdata   - pointer to the iANS required**                                          support structure**              IANS_BD_PARAM_HEADER *header - a pointer to the start of the**                                             ans command.****  Returns:    BD_ANS_STATUS -  SUCCESS if command was processed **                               successfully, FAILURE otherwise.*/BD_ANS_STATUS bd_ans_ExtendedSetMode(BOARD_PRIVATE_STRUCT *bps,    iANSsupport_t *iANSdata,                                         IANS_BD_PARAM_HEADER *header){    BD_ANS_STATUS status;    IANS_BD_PARAM_EXT_SET_MODE *request = (IANS_BD_PARAM_EXT_SET_MODE *)header;        /* this function call will enable/disable fast polling mode     * if it was requested here      */    status = bd_ans_SetReportingMode(bps, iANSdata, header);    /* see if we are being configured to tx/rx tlv */    if (request->BDIansAttributedMode == IANS_REQUEST_SUPPORT)        iANSdata->attributed_mode = (UINT32) BD_ANS_TRUE;    else        iANSdata->attributed_mode = (UINT32) BD_ANS_FALSE;    /* see if we are being requested to send packets to the     * ANS protocol     */        if (request->BDIansRoutingMode & IANS_ROUTING_RX_PROTOCOL)        iANSdata->routing_mode = IANS_ROUTING_ON;    else        iANSdata->routing_mode = IANS_ROUTING_OFF;    return (status);}                                      /* bd_ans_ExtendedStopPromiscuousMode()****  This function will make the driver stop sending in promiscuous mode**  if it is requested by ANS.  It is only required for OSs which don't**  provide a native mechanism to do this (UnixWare).  ****  Arguments:  BOARD_PRIVATE_STRUCT *bps - a pointer to the adapters hw **                                          specific data structure.**              iANSsupport_t *iANSdata   - pointer to the iANS required**                                          support structure****  Returns:    BD_ANS_STATUS -  SUCCESS if command was processed **                               successfully, FAILURE otherwise.*/BD_ANS_STATUS bd_ans_ExtendedStopPromiscuousMode(BOARD_PRIVATE_STRUCT *bps,    iANSsupport_t *iANSdata){    /* if we don't support this, then just leave now. */    if (iANSdata->supports_stop_promiscuous == BD_ANS_FALSE)        return BD_ANS_FAILURE;            if (bd_ans_drv_StopPromiscuousMode(bps))        return (BD_ANS_FAILURE);    return (BD_ANS_SUCCESS);}                                                  /* bd_ans_ExtendedGetStatus()****  This function is called as part of an IOCTL request by ANS to get the **  current status of the driver.  ****  Arguments:  BOARD_PRIVATE_STRUCT *bps - a pointer to the adapters hw **                                          specific data structure.**              iANSsupport_t *iANSdata   - pointer to the iANS required**                                          support structure**              IANS_BD_PARAM_HEADER *header - a pointer to the start of the**                                             ans command.****  Returns:    BD_ANS_STATUS -  SUCCESS if command was processed **                               successfully, FAILURE otherwise.*/BD_ANS_STATUS bd_ans_ExtendedGetStatus(BOARD_PRIVATE_STRUCT *bps,    iANSsupport_t *iANSdata,    IANS_BD_PARAM_HEADER *header){    //DEBUGLOG("bd_ans_ExtendedGetStatus: enter\n");    /* make sure the driver's status fields are current */    bd_ans_drv_UpdateStatus(bps);            /* fill out the required status structure with the updated status */    return bd_ans_FillStatus(bps,	iANSdata,	(void *)&(((IANS_BD_IOC_PARAM_STATUS *)header)->Status));}                                       #ifdef IANS_BASE_VLAN_TAGGING                                       /* bd_ans_TagGetCapability()****  This function is called as part of an IOCTL request by ANS to get the**  tagging capabilities of the driver.  ****  Arguments:  BOARD_PRIVATE_STRUCT *bps - a pointer to the adapters hw **                                          specific data structure.**              iANSsupport_t *iANSdata   - pointer to the iANS required**                                          support structure**              IANS_BD_PARAM_HEADER *header - a pointer to the start of the**                                             ans command.****  Returns:    BD_ANS_STATUS -  SUCCESS if command was processed **                               successfully, FAILURE otherwise.*/BD_ANS_STATUS bd_ans_TagGetCapability(BOARD_PRIVATE_STRUCT *bps,    iANSsupport_t *iANSdata,    IANS_BD_PARAM_HEADER *header){    /* these fields in the iANSdata structure have all been     * initialized by GetAllCapabilities during the Identify      * request.     */    ((IANS_BD_PARAM_ITAG_CAP *)header)->ISLTagMode =         ANS_BD_SUPPORTS(iANSdata->ISL_tag_support);    ((IANS_BD_PARAM_ITAG_CAP *)header)->IEEE802_3acTagMode =         ANS_BD_SUPPORTS(iANSdata->IEEE_tag_support);        return (BD_ANS_SUCCESS);}/* bd_ans_TagSetMode()****  This function is called as part of an IOCTL request by ANS to **  enable/disable tagging on the adapter.****  Arguments:  BOARD_PRIVATE_STRUCT *bps - a pointer to the adapters hw**                                          specific data structure.**              iANSsupport_t *iANSdata   - pointer to the iANS required**                                          support structure**              IANS_BD_PARAM_HEADER *header - a pointer to the start of the**                                             ans command.****  Returns:    BD_ANS_STATUS -  SUCCESS if command was processed**                               successfully, FAILURE otherwise.*/BD_ANS_STATUS bd_ans_TagSetMode(BOARD_PRIVATE_STRUCT *bps,    iANSsupport_t *iANSdata,    IANS_BD_PARAM_HEADER *header){    /* for each mode that can be requested, first check the      * support flaggs to make sure that the driver supports     * this mode before calling the driver to configure tagging     */    DEBUGLOG("bd_ans_TagSetMode: enter\n");        switch(((IANS_BD_PARAM_ITAG_SET_MODE *)header)->SetTagMode){    case IANS_BD_TAGGING_ISL:	DEBUGLOG("bd_ans_TagSetMode: ISL support requested\n");	if (iANSdata->ISL_tag_support == BD_ANS_FALSE)	    return BD_ANS_FAILURE;	break;	    case IANS_BD_TAGGING_802_3AC:	DEBUGLOG("bd_ans_TagSetMode: IEEE support requested\n");	if (iANSdata->IEEE_tag_support == BD_ANS_FALSE)	    return BD_ANS_FAILURE;	break;	    case IANS_BD_TAGGING_NONE:	DEBUGLOG("bd_ans_TagSetMode: UNTAGGED mode requested\n");	/* it's ok to break here and not just return, because	 * if we were previously in tagging mode, this is	 * essentially telling the driver that we no longer	 * want to be in tagging mode.  In this case, we do need	 * to call the ConfigureTagging function to make sure	 * that the driver disables tagging on the adapter.	 */	break;	    default:	return BD_ANS_FAILURE;	break;    }    iANSdata->tag_mode = ((IANS_BD_PARAM_ITAG_SET_MODE *)header)->SetTagMode;        /* if we have enabled tagging, we may need to re-configure the adapter */    return (bd_ans_drv_ConfigureTagging(bps));}#endif                                      #ifdef IANS_BASE_VLAN_ID/* bd_ans_VlanGetCapability()****  This function gets the VLAN capabilities of the driver and is called**  as part of an IOCTL query by ANS.  ****  Arguments:  BOARD_PRIVATE_STRUCT *bps - a pointer to the adapters hw **                                          specific data structure.**              iANSsupport_t *iANSdata   - pointer to the iANS required**                                          support structure**              IANS_BD_PARAM_HEADER *header - a pointer to the start of the**                                             ans command.****  Returns:    BD_ANS_STATUS -  SUCCESS if command was processed **                               successfully, FAILURE otherwise.*/BD_ANS_STATUS bd_ans_VlanGetCapability(BOARD_PRIVATE_STRUCT *bps,    iANSsupport_t *iANSdata,    IANS_BD_PARAM_HEADER *header){    /* these support fields in the iANSdata were all initialized     * in GetAllCapabilities during the Identify query     */    ((IANS_BD_PARAM_IVLAN_CAP *)header)->VlanIDCapable =         ANS_BD_SUPPORTS(iANSdata->vlan_support);    ((IANS_BD_PARAM_IVLAN_CAP *)header)->VlanIDFilteringAble =         ANS_BD_SUPPORTS(iANSdata->vlan_filtering_support);    ((IANS_BD_PARAM_IVLAN_CAP *)header)->MaxVlanIDSupported =        iANSdata->max_vlan_ID_supported;    ((IANS_BD_PARAM_IVLAN_CAP *)header)->MaxVlanTableSize =        iANSdata->vlan_table_size;        return (BD_ANS_SUCCESS);}/* bd_ans_VlanSetMode()****  This function is called as part of an ANS ioctl to request that **  the driver configure itself to run in vlan mode.  ****  Arguments:  BOARD_PRIVATE_STRUCT *bps - a pointer to the adapters hw **                                          specific data structure.**              iANSsupport_t *iANSdata   - pointer to the iANS required**                                          support structure**              IANS_BD_PARAM_HEADER *header - a pointer to the start of the**                                             ans command.****  Returns:    BD_ANS_STATUS -  SUCCESS if command was processed **                               successfully, FAILURE otherwise.*/BD_ANS_STATUS bd_ans_VlanSetMode(BOARD_PRIVATE_STRUCT *bps,    iANSsupport_t *iANSdata,    IANS_BD_PARAM_HEADER *header){    int i;    IANS_BD_PARAM_IVLAN_SET_MODE *request = 	(IANS_BD_PARAM_IVLAN_SET_MODE *)header;    DEBUGLOG("bd_ans_VlanSetMode: enter\n");    /* all the support flags were initialized in GetAllCapabilities      * as part of the Identify call     */         /* check to see if we are requested to enable/disable vlan mode */    if (iANSdata->vlan_support == BD_ANS_FALSE) {	DEBUGLOG("bd_ans_VlanSetMode: driver does NOT support vlan\n");        return BD_ANS_FAILURE;    }    if (request->VlanIDRequest == IANS_REQUEST_SUPPORT)	iANSdata->vlan_mode = IANS_VLAN_MODE_ON;    else if (request->VlanIDRequest == IANS_DONT_SUPPORT)	iANSdata->vlan_mode = IANS_VLAN_MODE_OFF;        /* check to see if we are being requested to do some hw filtering     * of vlan ids.     */    if(request->VlanIDFilteringRequest == IANS_REQUEST_SUPPORT) {        if (iANSdata->vlan_filtering_support == BD_ANS_FALSE) {	    DEBUGLOG("bd_ans_VlanSetMode: driver does NOT support vlan filter\n");            return BD_ANS_FAILURE;	} else {            iANSdata->vlan_filtering_mode = IANS_VLAN_FILTERING_ON; 	    /* initialize the vlan table structures */	    iANSdata->num_vlan_filter = 0;	    for (i = 0; i < MAX_NUM_VLAN; i++) 		iANSdata->VlanID[i] = 0;	}    }        else 	iANSdata->vlan_filtering_mode = IANS_VLAN_FILTERING_OFF;	    /* don't assume that we don't need to reconfigure the adapter here.     * we also don't want to assume that the driver configures itself     * for vlan mode the same way it configures itself for tagging mode.     * (although chances are it does).     */    return (bd_ans_drv_ConfigureVlan(bps));}                                 /* bd_ans_VlanSetTable()****  This function is called as part of an ANS ioctl request to add some**  vlan id's to the hardware vlan filter table.  ****  Arguments:  BOARD_PRIVATE_STRUCT *bps - a pointer to the adapters hw **                                          specific data structure.**              iANSsupport_t *iANSdata   - pointer to the iANS required**                                          support structure**              IANS_BD_PARAM_HEADER *header - a pointer to the start of the**                                             ans command.****  Returns:    BD_ANS_STATUS -  SUCCESS if command was processed **                               successfully, FAILURE otherwise.*/BD_ANS_STATUS bd_ans_VlanSetTable(BOARD_PRIVATE_STRUCT *bps,    iANSsupport_t *iANSdata,    IANS_BD_PARAM_HEADER *header){    IANS_BD_PARAM_IVLAN_TABLE *request = (IANS_BD_PARAM_IVLAN_TABLE *)header;    int i;    /* filtering mode cannot be ON unless the adapter supports      * vlan filtering.  This was set in VlanSetMode.     */    if (iANSdata->vlan_filtering_mode == IANS_VLAN_FILTERING_ON) {        /* this function assumes that ANS sends us a complete          * table - so we blow away the old one         */	iANSdata->num_vlan_filter = request->VLanIDNum;	for (i = 0; i < iANSdata->num_vlan_filter; i++) {	    iANSdata->VlanID[i] = request->VLanIDTable[i];	}        /* let the driver call the hardware routine to configure         * the vlan table.         */        bd_ans_drv_ConfigureVlanTable(bps); 	return BD_ANS_SUCCESS;    }    return (BD_ANS_FAILURE);}                                                                   #endif/* bd_ans_ActivateFastPolling()****  This function is called as part of an IOCTL sent by ANS to tell the 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -