diff options
author | Sucheta Chakraborty <sucheta.chakraborty@qlogic.com> | 2014-04-25 17:43:58 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-04-27 23:20:53 -0400 |
commit | 868e9144314a00f04ee30ab1288338e510b4cf3a (patch) | |
tree | 362424f41ba6415d79c5348139b1c1c744f9652e /drivers/net | |
parent | 1f0f467b670eec101419a2a1235e315e4324ea07 (diff) |
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: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 13 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c | 35 |
2 files changed, 42 insertions, 6 deletions
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index 19878fb393d0..5ceff4796df6 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | |||
@@ -2052,6 +2052,7 @@ out: | |||
2052 | 2052 | ||
2053 | static int qlcnic_alloc_adapter_resources(struct qlcnic_adapter *adapter) | 2053 | static int qlcnic_alloc_adapter_resources(struct qlcnic_adapter *adapter) |
2054 | { | 2054 | { |
2055 | struct qlcnic_hardware_context *ahw = adapter->ahw; | ||
2055 | int err = 0; | 2056 | int err = 0; |
2056 | 2057 | ||
2057 | adapter->recv_ctx = kzalloc(sizeof(struct qlcnic_recv_context), | 2058 | adapter->recv_ctx = kzalloc(sizeof(struct qlcnic_recv_context), |
@@ -2061,6 +2062,18 @@ static int qlcnic_alloc_adapter_resources(struct qlcnic_adapter *adapter) | |||
2061 | goto err_out; | 2062 | goto err_out; |
2062 | } | 2063 | } |
2063 | 2064 | ||
2065 | if (qlcnic_83xx_check(adapter)) { | ||
2066 | ahw->coal.type = QLCNIC_INTR_COAL_TYPE_RX_TX; | ||
2067 | ahw->coal.tx_time_us = QLCNIC_DEF_INTR_COALESCE_TX_TIME_US; | ||
2068 | ahw->coal.tx_packets = QLCNIC_DEF_INTR_COALESCE_TX_PACKETS; | ||
2069 | ahw->coal.rx_time_us = QLCNIC_DEF_INTR_COALESCE_RX_TIME_US; | ||
2070 | ahw->coal.rx_packets = QLCNIC_DEF_INTR_COALESCE_RX_PACKETS; | ||
2071 | } else { | ||
2072 | ahw->coal.type = QLCNIC_INTR_COAL_TYPE_RX; | ||
2073 | ahw->coal.rx_time_us = QLCNIC_DEF_INTR_COALESCE_RX_TIME_US; | ||
2074 | ahw->coal.rx_packets = QLCNIC_DEF_INTR_COALESCE_RX_PACKETS; | ||
2075 | } | ||
2076 | |||
2064 | /* clear stats */ | 2077 | /* clear stats */ |
2065 | memset(&adapter->stats, 0, sizeof(adapter->stats)); | 2078 | memset(&adapter->stats, 0, sizeof(adapter->stats)); |
2066 | err_out: | 2079 | err_out: |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c index 280137991544..c7926ce85fec 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #define QLC_VF_FLOOD_BIT BIT_16 | 16 | #define QLC_VF_FLOOD_BIT BIT_16 |
17 | #define QLC_FLOOD_MODE 0x5 | 17 | #define QLC_FLOOD_MODE 0x5 |
18 | #define QLC_SRIOV_ALLOW_VLAN0 BIT_19 | 18 | #define QLC_SRIOV_ALLOW_VLAN0 BIT_19 |
19 | #define QLC_INTR_COAL_TYPE_MASK 0x7 | ||
19 | 20 | ||
20 | static int qlcnic_sriov_pf_get_vport_handle(struct qlcnic_adapter *, u8); | 21 | static int qlcnic_sriov_pf_get_vport_handle(struct qlcnic_adapter *, u8); |
21 | 22 | ||
@@ -1178,19 +1179,41 @@ static int qlcnic_sriov_validate_cfg_intrcoal(struct qlcnic_adapter *adapter, | |||
1178 | { | 1179 | { |
1179 | struct qlcnic_nic_intr_coalesce *coal = &adapter->ahw->coal; | 1180 | struct qlcnic_nic_intr_coalesce *coal = &adapter->ahw->coal; |
1180 | u16 ctx_id, pkts, time; | 1181 | u16 ctx_id, pkts, time; |
1182 | int err = -EINVAL; | ||
1183 | u8 type; | ||
1181 | 1184 | ||
1185 | type = cmd->req.arg[1] & QLC_INTR_COAL_TYPE_MASK; | ||
1182 | ctx_id = cmd->req.arg[1] >> 16; | 1186 | ctx_id = cmd->req.arg[1] >> 16; |
1183 | pkts = cmd->req.arg[2] & 0xffff; | 1187 | pkts = cmd->req.arg[2] & 0xffff; |
1184 | time = cmd->req.arg[2] >> 16; | 1188 | time = cmd->req.arg[2] >> 16; |
1185 | 1189 | ||
1186 | if (ctx_id != vf->rx_ctx_id) | 1190 | switch (type) { |
1187 | return -EINVAL; | 1191 | case QLCNIC_INTR_COAL_TYPE_RX: |
1188 | if (pkts > coal->rx_packets) | 1192 | if (ctx_id != vf->rx_ctx_id || pkts > coal->rx_packets || |
1189 | return -EINVAL; | 1193 | time < coal->rx_time_us) |
1190 | if (time < coal->rx_time_us) | 1194 | goto err_label; |
1191 | return -EINVAL; | 1195 | break; |
1196 | case QLCNIC_INTR_COAL_TYPE_TX: | ||
1197 | if (ctx_id != vf->tx_ctx_id || pkts > coal->tx_packets || | ||
1198 | time < coal->tx_time_us) | ||
1199 | goto err_label; | ||
1200 | break; | ||
1201 | default: | ||
1202 | netdev_err(adapter->netdev, "Invalid coalescing type 0x%x received\n", | ||
1203 | type); | ||
1204 | return err; | ||
1205 | } | ||
1192 | 1206 | ||
1193 | return 0; | 1207 | return 0; |
1208 | |||
1209 | err_label: | ||
1210 | 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", | ||
1211 | vf->rx_ctx_id, coal->rx_packets, coal->rx_time_us, | ||
1212 | vf->tx_ctx_id, coal->tx_packets, coal->tx_time_us); | ||
1213 | netdev_err(adapter->netdev, "Received: ctx_id 0x%x packets 0x%x time_us 0x%x type 0x%x\n", | ||
1214 | ctx_id, pkts, time, type); | ||
1215 | |||
1216 | return err; | ||
1194 | } | 1217 | } |
1195 | 1218 | ||
1196 | static int qlcnic_sriov_pf_cfg_intrcoal_cmd(struct qlcnic_bc_trans *tran, | 1219 | static int qlcnic_sriov_pf_cfg_intrcoal_cmd(struct qlcnic_bc_trans *tran, |