コード例 #1
0
ファイル: IxEthDBAPISupport.c プロジェクト: dafyddcrosby/L4OS
/**
 * @brief sets the port maximum Tx and Rx frame sizes
 *
 * @param portID ID of the port to set the frame size on
 * @param maximumFrameSize maximum Tx and Rx frame sizes
 *
 * This function updates the internal data structures and
 * calls ixEthDBPortFrameLengthsUpdate() for NPE update.
 *
 * Note that both the maximum Tx and Rx frame size are set
 * to the same value. This function is kept for compatibility
 * reasons.
 *
 * This function is fully documented in the main header 
 * file, IxEthDB.h.
 *
 * @return IX_ETH_DB_SUCCESS if the operation was
 * successfull or an appropriate error message otherwise
 */
IX_ETH_DB_PUBLIC
IxEthDBStatus ixEthDBFilteringPortMaximumFrameSizeSet(IxEthDBPortId portID, UINT32 maximumFrameSize)
{
    IX_ETH_DB_CHECK_PORT_EXISTS(portID);

    IX_ETH_DB_CHECK_SINGLE_NPE(portID);

    if (!ixEthDBPortInfo[portID].initialized)
    {
        return IX_ETH_DB_PORT_UNINITIALIZED;
    }

    if (ixEthDBPortDefinitions[portID].type == IX_ETH_NPE)
    {
	if ((maximumFrameSize < IX_ETHDB_MIN_NPE_FRAME_SIZE) || 
	    (maximumFrameSize > IX_ETHDB_MAX_NPE_FRAME_SIZE))
	{
	    return IX_ETH_DB_INVALID_ARG;
	}
    }
    else
    {
        return IX_ETH_DB_NO_PERMISSION;
    }

    /* update internal structure */
    ixEthDBPortInfo[portID].maxRxFrameSize = maximumFrameSize;
    ixEthDBPortInfo[portID].maxTxFrameSize = maximumFrameSize;
    
    /* update the maximum frame size in the NPE */
    return ixEthDBPortFrameLengthsUpdate(portID);
}
コード例 #2
0
ファイル: IxEthDBFeatures.c プロジェクト: janfj/dd-wrt
/**
 * @brief Restore the states of EthDB Features
 *
 * @param portID ID of the port
 *
 * See IxEthDB.h for more details.
 */
IX_ETH_DB_PUBLIC 
IxEthDBStatus ixEthDBFeatureStatesRestore(IxEthDBPortId portID)
{
    PortInfo *portInfo = &ixEthDBPortInfo[portID];

    /* Check whether port if enabled */
    IX_ETH_DB_CHECK_PORT_INITIALIZED(portID);
    IX_ETH_DB_CHECK_PORT(portID);

   /* ========================  Basic ==========================
    *  Set up Port MAC Address
    */
    if (ixEthDBPortAddressSet(portID, &(portInfo->macAddr)) != IX_SUCCESS)
    {
        return IX_ETH_DB_FAIL;
    }
   
    /*
     * Set up Port Max Rx/Tx frame lengths
     */ 
    if(ixEthDBPortFrameLengthsUpdate(portID) != IX_SUCCESS)
    {
        return IX_ETH_DB_FAIL;
    }

    /* ========================  VLAN/QoS ==========================         
     * Only performs VLAN feature update if it is enabled before
     */ 
    if ((portInfo->featureStatus & IX_ETH_DB_VLAN_QOS) != 0)
    {
      /* Set VLAN Rx tag mode */
      if (ixEthDBIngressVlanModeUpdate(portID) != IX_SUCCESS)
      {
         return IX_ETH_DB_FAIL;
      }

      /* Set Default Rx VID */
      if (ixEthDBPortVlanTagSet(portID, portInfo->vlanTag) != IX_SUCCESS)
      {
         return IX_ETH_DB_FAIL;
      }
 
      /* Set PortID extraction mode */
      if (ixEthDBVlanPortExtractionEnable(portID, portInfo->portIdExtractionEnable) != IX_SUCCESS)
      {
         return IX_ETH_DB_FAIL;   
      }

      /* Set VLAN Table */
      if (ixEthDBVlanTableRangeUpdate(portID) != IX_SUCCESS)
      {
         return IX_ETH_DB_FAIL; 
      }
    } /* VLAN/QoS */

   /* ========================  Firewall ==========================         
    * Only performs Firewall feature update if it is enabled before
    */    
    if ((portInfo->featureStatus & IX_ETH_DB_FIREWALL) != 0)
    {
      if(ixEthDBFirewallTableDownload(portID) != IX_SUCCESS)
      {
	return IX_ETH_DB_FAIL;
      }  
    } /* Firewall */
  
   /* ===================== Header Conversion ==========================         
    * Only performs Header Conversion feature update if it is enabled before
    */   
    if ((portInfo->featureStatus & IX_ETH_DB_WIFI_HEADER_CONVERSION) != 0)
    {
      /* Update WiFi FC & DID */
      if (ixEthDBWiFiFrameControlDurationIDUpdate(portID) != IX_SUCCESS)
      {      
	return IX_ETH_DB_FAIL; 
      }

      /* Update BSSID */
      if (ixEthDBWiFiBSSIDSet(portID, (IxEthDBMacAddr *) portInfo->bssid) != IX_SUCCESS)
      {
	return IX_ETH_DB_FAIL;
      }

      /* Update Header Conversion Table & AP MAC Table */
      if (ixEthDBWiFiConversionTableDownload(portID) != IX_ETH_DB_SUCCESS)
      {
	return IX_ETH_DB_FAIL;
      }
    } /* Header Conversion */
  
   /* ====================== Learning & Filtering ==========================         
    * Learning & Filtering feature update is not neccessary as we can rely 
    * on EthNPE to learn the src address again. As for the entry added by client
    * earlier, it will be lost. This is the constraint as the mechanism to retrieve
    * the entry that has been added by client from NPE is not trivial.
    */

   /* ============================== STP ===================================         
    * Only performs STP feature update if it is enabled before
    */
    if ((portInfo->featureStatus & IX_ETH_DB_SPANNING_TREE_PROTOCOL) != 0)
    {    
      if (ixEthDBSpanningTreeBlockingStateSet(portID, portInfo->stpBlocked) != IX_SUCCESS)
      {
	return IX_ETH_DB_FAIL;
      }
    }

    return IX_ETH_DB_SUCCESS;
}