Ejemplo n.º 1
0
/******************************************************************************
* mv_eth_tool_set_coalesce
* Description:
*	ethtool set RX/TX coalesce parameters
* INPUT:
*	netdev		Network device structure pointer
*	cmd		Coalesce parameters
* OUTPUT
*	None
* RETURN:
*	0 on success
*
*******************************************************************************/
int mv_eth_tool_set_coalesce(struct net_device *netdev,
			     struct ethtool_coalesce *cmd)
{
	mv_eth_priv 	*priv = MV_ETH_PRIV(netdev);

	if ((cmd->rx_coalesce_usecs == 0) ||
		(cmd->tx_coalesce_usecs == 0)) {
		/* coalesce usec=0 means that coalesce frames should be used,
		 * which is not permitted (unsupported) */
		return -EPERM;
	}

	if ((cmd->rx_coalesce_usecs * 166 / 64 > 0x3FFF) ||
		(cmd->tx_coalesce_usecs * 166 / 64 > 0x3FFF))
		return -EINVAL;
	
	/* Save values for mv_eth_start_internals() */
	priv->rx_coal_usec = cmd->rx_coalesce_usecs;
	priv->tx_coal_usec = cmd->tx_coalesce_usecs;
	
	mvEthRxCoalSet (priv->hal_priv, cmd->rx_coalesce_usecs);
	mvEthTxCoalSet (priv->hal_priv, cmd->tx_coalesce_usecs);

	return 0;
}
Ejemplo n.º 2
0
void    ethTxCoal(int port, int usec)
{
    void*   pHndl;

    pHndl = mvEthPortHndlGet(port);
    if(pHndl != NULL)
    {
        mvEthTxCoalSet(pHndl, usec);
    }
}
Ejemplo n.º 3
0
/* Giga Port commands */
int run_port_com(const char *buffer) {

	int scan_count;
    void*   port_hndl;

	scan_count = sscanf(buffer, PORT_CMD_STRING, PORT_SCANF_LIST);
    
	if( scan_count != PORT_LIST_LEN) {
		printk("eth port command bad format %x != %x\n", scan_count, PORT_LIST_LEN );
		return 1;
	}
    port_hndl = mvEthPortHndlGet(port);
    if(port_hndl == NULL)
        return 1;

    	switch(command) {
        	case COM_RX_COAL:
            	mvEthRxCoalSet(mvEthPortHndlGet(port), value);
            	break;

        	case COM_TX_COAL:
            	mvEthTxCoalSet(mvEthPortHndlGet(port), value);
        	break;

#ifdef ETH_MV_TX_EN
            case COM_TX_EN:
                if(value > CONFIG_MV_ETH_NUM_OF_RX_DESCR)
            {
                    printk("Eth TX_EN command bad param: value=%d\n", value);
                return 1;
            }

                eth_tx_en_config(port, value);
            break;
#endif /* ETH_MV_TX_EN */

#if (MV_ETH_VERSION >= 4)
        	case COM_EJP_MODE:
            		mvEthEjpModeSet(mvEthPortHndlGet(port), value);
            	break;
#endif /* (MV_ETH_VERSION >= 4) */

			case COM_TX_NOQUEUE:
				mv_eth_set_noqueue(port, value);
			break;

  		default:
			printk(" Unknown port command \n");
    	}
   	return 0;
}