Commit 868e9144 authored by Sucheta Chakraborty's avatar Sucheta Chakraborty Committed by David S. Miller

qlcnic: Allow setting TX interrupt coalescing parameters from VF.

o Tx interrupt coalescing parameters can now be set from VF.
o Added validation code in PF to validate the parameters.
Signed-off-by: default avatarSucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1f0f467b
...@@ -2052,6 +2052,7 @@ void qlcnic_diag_free_res(struct net_device *netdev, int drv_sds_rings) ...@@ -2052,6 +2052,7 @@ void qlcnic_diag_free_res(struct net_device *netdev, int drv_sds_rings)
static int qlcnic_alloc_adapter_resources(struct qlcnic_adapter *adapter) static int qlcnic_alloc_adapter_resources(struct qlcnic_adapter *adapter)
{ {
struct qlcnic_hardware_context *ahw = adapter->ahw;
int err = 0; int err = 0;
adapter->recv_ctx = kzalloc(sizeof(struct qlcnic_recv_context), adapter->recv_ctx = kzalloc(sizeof(struct qlcnic_recv_context),
...@@ -2061,6 +2062,18 @@ static int qlcnic_alloc_adapter_resources(struct qlcnic_adapter *adapter) ...@@ -2061,6 +2062,18 @@ static int qlcnic_alloc_adapter_resources(struct qlcnic_adapter *adapter)
goto err_out; goto err_out;
} }
if (qlcnic_83xx_check(adapter)) {
ahw->coal.type = QLCNIC_INTR_COAL_TYPE_RX_TX;
ahw->coal.tx_time_us = QLCNIC_DEF_INTR_COALESCE_TX_TIME_US;
ahw->coal.tx_packets = QLCNIC_DEF_INTR_COALESCE_TX_PACKETS;
ahw->coal.rx_time_us = QLCNIC_DEF_INTR_COALESCE_RX_TIME_US;
ahw->coal.rx_packets = QLCNIC_DEF_INTR_COALESCE_RX_PACKETS;
} else {
ahw->coal.type = QLCNIC_INTR_COAL_TYPE_RX;
ahw->coal.rx_time_us = QLCNIC_DEF_INTR_COALESCE_RX_TIME_US;
ahw->coal.rx_packets = QLCNIC_DEF_INTR_COALESCE_RX_PACKETS;
}
/* clear stats */ /* clear stats */
memset(&adapter->stats, 0, sizeof(adapter->stats)); memset(&adapter->stats, 0, sizeof(adapter->stats));
err_out: err_out:
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#define QLC_VF_FLOOD_BIT BIT_16 #define QLC_VF_FLOOD_BIT BIT_16
#define QLC_FLOOD_MODE 0x5 #define QLC_FLOOD_MODE 0x5
#define QLC_SRIOV_ALLOW_VLAN0 BIT_19 #define QLC_SRIOV_ALLOW_VLAN0 BIT_19
#define QLC_INTR_COAL_TYPE_MASK 0x7
static int qlcnic_sriov_pf_get_vport_handle(struct qlcnic_adapter *, u8); static int qlcnic_sriov_pf_get_vport_handle(struct qlcnic_adapter *, u8);
...@@ -1178,19 +1179,41 @@ static int qlcnic_sriov_validate_cfg_intrcoal(struct qlcnic_adapter *adapter, ...@@ -1178,19 +1179,41 @@ static int qlcnic_sriov_validate_cfg_intrcoal(struct qlcnic_adapter *adapter,
{ {
struct qlcnic_nic_intr_coalesce *coal = &adapter->ahw->coal; struct qlcnic_nic_intr_coalesce *coal = &adapter->ahw->coal;
u16 ctx_id, pkts, time; u16 ctx_id, pkts, time;
int err = -EINVAL;
u8 type;
type = cmd->req.arg[1] & QLC_INTR_COAL_TYPE_MASK;
ctx_id = cmd->req.arg[1] >> 16; ctx_id = cmd->req.arg[1] >> 16;
pkts = cmd->req.arg[2] & 0xffff; pkts = cmd->req.arg[2] & 0xffff;
time = cmd->req.arg[2] >> 16; time = cmd->req.arg[2] >> 16;
if (ctx_id != vf->rx_ctx_id) switch (type) {
return -EINVAL; case QLCNIC_INTR_COAL_TYPE_RX:
if (pkts > coal->rx_packets) if (ctx_id != vf->rx_ctx_id || pkts > coal->rx_packets ||
return -EINVAL; time < coal->rx_time_us)
if (time < coal->rx_time_us) goto err_label;
return -EINVAL; break;
case QLCNIC_INTR_COAL_TYPE_TX:
if (ctx_id != vf->tx_ctx_id || pkts > coal->tx_packets ||
time < coal->tx_time_us)
goto err_label;
break;
default:
netdev_err(adapter->netdev, "Invalid coalescing type 0x%x received\n",
type);
return err;
}
return 0; return 0;
err_label:
netdev_err(adapter->netdev, "Expected: rx_ctx_id 0x%x rx_packets 0x%x rx_time_us 0x%x tx_ctx_id 0x%x tx_packets 0x%x tx_time_us 0x%x\n",
vf->rx_ctx_id, coal->rx_packets, coal->rx_time_us,
vf->tx_ctx_id, coal->tx_packets, coal->tx_time_us);
netdev_err(adapter->netdev, "Received: ctx_id 0x%x packets 0x%x time_us 0x%x type 0x%x\n",
ctx_id, pkts, time, type);
return err;
} }
static int qlcnic_sriov_pf_cfg_intrcoal_cmd(struct qlcnic_bc_trans *tran, static int qlcnic_sriov_pf_cfg_intrcoal_cmd(struct qlcnic_bc_trans *tran,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment