diff options
author | David S. Miller <davem@davemloft.net> | 2014-01-05 20:23:12 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-05 20:23:12 -0500 |
commit | 723a6c7a297b509d6d779aba3be3a0fb8c374d99 (patch) | |
tree | aca413a0f47936317aa1dffd0bf054e429546398 | |
parent | a02bdd423d844f5beb3196922f07c85c2f7691b8 (diff) | |
parent | e8379c79542c95b25890ed49be652b1634deca17 (diff) |
Merge branch 'bnx2x'
Yuval Mintz says:
====================
bnx2x: Bug fixes patch series
Most of what this parch series contains is SR-IOV related bug fixes.
Additionally, it contains some small fixes for legacy devices/modes.
Please consider applying these patches to `net'.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | 7 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 6 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c | 15 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h | 7 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | 254 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c | 26 |
7 files changed, 196 insertions, 120 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h index a1f66e2c9a86..2d5fce4c9751 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | |||
@@ -1250,7 +1250,10 @@ struct bnx2x_slowpath { | |||
1250 | * Therefore, if they would have been defined in the same union, | 1250 | * Therefore, if they would have been defined in the same union, |
1251 | * data can get corrupted. | 1251 | * data can get corrupted. |
1252 | */ | 1252 | */ |
1253 | struct afex_vif_list_ramrod_data func_afex_rdata; | 1253 | union { |
1254 | struct afex_vif_list_ramrod_data viflist_data; | ||
1255 | struct function_update_data func_update; | ||
1256 | } func_afex_rdata; | ||
1254 | 1257 | ||
1255 | /* used by dmae command executer */ | 1258 | /* used by dmae command executer */ |
1256 | struct dmae_command dmae[MAX_DMAE_C]; | 1259 | struct dmae_command dmae[MAX_DMAE_C]; |
@@ -2499,4 +2502,6 @@ void bnx2x_set_local_cmng(struct bnx2x *bp); | |||
2499 | #define MCPR_SCRATCH_BASE(bp) \ | 2502 | #define MCPR_SCRATCH_BASE(bp) \ |
2500 | (CHIP_IS_E1x(bp) ? MCP_REG_MCPR_SCRATCH : MCP_A_REG_MCPR_SCRATCH) | 2503 | (CHIP_IS_E1x(bp) ? MCP_REG_MCPR_SCRATCH : MCP_A_REG_MCPR_SCRATCH) |
2501 | 2504 | ||
2505 | #define E1H_MAX_MF_SB_COUNT (HC_SB_MAX_SB_E1X/(E1HVN_MAX * PORT_MAX)) | ||
2506 | |||
2502 | #endif /* bnx2x.h */ | 2507 | #endif /* bnx2x.h */ |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 814d0eca9b33..8b3107b2fcc1 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -11447,9 +11447,9 @@ static int bnx2x_get_hwinfo(struct bnx2x *bp) | |||
11447 | } | 11447 | } |
11448 | } | 11448 | } |
11449 | 11449 | ||
11450 | /* adjust igu_sb_cnt to MF for E1x */ | 11450 | /* adjust igu_sb_cnt to MF for E1H */ |
11451 | if (CHIP_IS_E1x(bp) && IS_MF(bp)) | 11451 | if (CHIP_IS_E1H(bp) && IS_MF(bp)) |
11452 | bp->igu_sb_cnt /= E1HVN_MAX; | 11452 | bp->igu_sb_cnt = min_t(u8, bp->igu_sb_cnt, E1H_MAX_MF_SB_COUNT); |
11453 | 11453 | ||
11454 | /* port info */ | 11454 | /* port info */ |
11455 | bnx2x_get_port_hwinfo(bp); | 11455 | bnx2x_get_port_hwinfo(bp); |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c index 32c92abf5094..18438a504d57 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c | |||
@@ -2038,6 +2038,7 @@ static int bnx2x_vlan_mac_del_all(struct bnx2x *bp, | |||
2038 | struct bnx2x_vlan_mac_ramrod_params p; | 2038 | struct bnx2x_vlan_mac_ramrod_params p; |
2039 | struct bnx2x_exe_queue_obj *exeq = &o->exe_queue; | 2039 | struct bnx2x_exe_queue_obj *exeq = &o->exe_queue; |
2040 | struct bnx2x_exeq_elem *exeq_pos, *exeq_pos_n; | 2040 | struct bnx2x_exeq_elem *exeq_pos, *exeq_pos_n; |
2041 | unsigned long flags; | ||
2041 | int read_lock; | 2042 | int read_lock; |
2042 | int rc = 0; | 2043 | int rc = 0; |
2043 | 2044 | ||
@@ -2046,8 +2047,9 @@ static int bnx2x_vlan_mac_del_all(struct bnx2x *bp, | |||
2046 | spin_lock_bh(&exeq->lock); | 2047 | spin_lock_bh(&exeq->lock); |
2047 | 2048 | ||
2048 | list_for_each_entry_safe(exeq_pos, exeq_pos_n, &exeq->exe_queue, link) { | 2049 | list_for_each_entry_safe(exeq_pos, exeq_pos_n, &exeq->exe_queue, link) { |
2049 | if (exeq_pos->cmd_data.vlan_mac.vlan_mac_flags == | 2050 | flags = exeq_pos->cmd_data.vlan_mac.vlan_mac_flags; |
2050 | *vlan_mac_flags) { | 2051 | if (BNX2X_VLAN_MAC_CMP_FLAGS(flags) == |
2052 | BNX2X_VLAN_MAC_CMP_FLAGS(*vlan_mac_flags)) { | ||
2051 | rc = exeq->remove(bp, exeq->owner, exeq_pos); | 2053 | rc = exeq->remove(bp, exeq->owner, exeq_pos); |
2052 | if (rc) { | 2054 | if (rc) { |
2053 | BNX2X_ERR("Failed to remove command\n"); | 2055 | BNX2X_ERR("Failed to remove command\n"); |
@@ -2080,7 +2082,9 @@ static int bnx2x_vlan_mac_del_all(struct bnx2x *bp, | |||
2080 | return read_lock; | 2082 | return read_lock; |
2081 | 2083 | ||
2082 | list_for_each_entry(pos, &o->head, link) { | 2084 | list_for_each_entry(pos, &o->head, link) { |
2083 | if (pos->vlan_mac_flags == *vlan_mac_flags) { | 2085 | flags = pos->vlan_mac_flags; |
2086 | if (BNX2X_VLAN_MAC_CMP_FLAGS(flags) == | ||
2087 | BNX2X_VLAN_MAC_CMP_FLAGS(*vlan_mac_flags)) { | ||
2084 | p.user_req.vlan_mac_flags = pos->vlan_mac_flags; | 2088 | p.user_req.vlan_mac_flags = pos->vlan_mac_flags; |
2085 | memcpy(&p.user_req.u, &pos->u, sizeof(pos->u)); | 2089 | memcpy(&p.user_req.u, &pos->u, sizeof(pos->u)); |
2086 | rc = bnx2x_config_vlan_mac(bp, &p); | 2090 | rc = bnx2x_config_vlan_mac(bp, &p); |
@@ -4382,8 +4386,11 @@ int bnx2x_config_rss(struct bnx2x *bp, | |||
4382 | struct bnx2x_raw_obj *r = &o->raw; | 4386 | struct bnx2x_raw_obj *r = &o->raw; |
4383 | 4387 | ||
4384 | /* Do nothing if only driver cleanup was requested */ | 4388 | /* Do nothing if only driver cleanup was requested */ |
4385 | if (test_bit(RAMROD_DRV_CLR_ONLY, &p->ramrod_flags)) | 4389 | if (test_bit(RAMROD_DRV_CLR_ONLY, &p->ramrod_flags)) { |
4390 | DP(BNX2X_MSG_SP, "Not configuring RSS ramrod_flags=%lx\n", | ||
4391 | p->ramrod_flags); | ||
4386 | return 0; | 4392 | return 0; |
4393 | } | ||
4387 | 4394 | ||
4388 | r->set_pending(r); | 4395 | r->set_pending(r); |
4389 | 4396 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h index 658f4e33abf9..6a53c15c85a3 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h | |||
@@ -266,6 +266,13 @@ enum { | |||
266 | BNX2X_DONT_CONSUME_CAM_CREDIT, | 266 | BNX2X_DONT_CONSUME_CAM_CREDIT, |
267 | BNX2X_DONT_CONSUME_CAM_CREDIT_DEST, | 267 | BNX2X_DONT_CONSUME_CAM_CREDIT_DEST, |
268 | }; | 268 | }; |
269 | /* When looking for matching filters, some flags are not interesting */ | ||
270 | #define BNX2X_VLAN_MAC_CMP_MASK (1 << BNX2X_UC_LIST_MAC | \ | ||
271 | 1 << BNX2X_ETH_MAC | \ | ||
272 | 1 << BNX2X_ISCSI_ETH_MAC | \ | ||
273 | 1 << BNX2X_NETQ_ETH_MAC) | ||
274 | #define BNX2X_VLAN_MAC_CMP_FLAGS(flags) \ | ||
275 | ((flags) & BNX2X_VLAN_MAC_CMP_MASK) | ||
269 | 276 | ||
270 | struct bnx2x_vlan_mac_ramrod_params { | 277 | struct bnx2x_vlan_mac_ramrod_params { |
271 | /* Object to run the command from */ | 278 | /* Object to run the command from */ |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c index 2e46c28fc601..e7845e5be1c7 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | |||
@@ -1209,6 +1209,11 @@ static void bnx2x_vfop_rxmode(struct bnx2x *bp, struct bnx2x_virtf *vf) | |||
1209 | /* next state */ | 1209 | /* next state */ |
1210 | vfop->state = BNX2X_VFOP_RXMODE_DONE; | 1210 | vfop->state = BNX2X_VFOP_RXMODE_DONE; |
1211 | 1211 | ||
1212 | /* record the accept flags in vfdb so hypervisor can modify them | ||
1213 | * if necessary | ||
1214 | */ | ||
1215 | bnx2x_vfq(vf, ramrod->cl_id - vf->igu_base_id, accept_flags) = | ||
1216 | ramrod->rx_accept_flags; | ||
1212 | vfop->rc = bnx2x_config_rx_mode(bp, ramrod); | 1217 | vfop->rc = bnx2x_config_rx_mode(bp, ramrod); |
1213 | bnx2x_vfop_finalize(vf, vfop->rc, VFOP_DONE); | 1218 | bnx2x_vfop_finalize(vf, vfop->rc, VFOP_DONE); |
1214 | op_err: | 1219 | op_err: |
@@ -1224,39 +1229,43 @@ op_pending: | |||
1224 | return; | 1229 | return; |
1225 | } | 1230 | } |
1226 | 1231 | ||
1232 | static void bnx2x_vf_prep_rx_mode(struct bnx2x *bp, u8 qid, | ||
1233 | struct bnx2x_rx_mode_ramrod_params *ramrod, | ||
1234 | struct bnx2x_virtf *vf, | ||
1235 | unsigned long accept_flags) | ||
1236 | { | ||
1237 | struct bnx2x_vf_queue *vfq = vfq_get(vf, qid); | ||
1238 | |||
1239 | memset(ramrod, 0, sizeof(*ramrod)); | ||
1240 | ramrod->cid = vfq->cid; | ||
1241 | ramrod->cl_id = vfq_cl_id(vf, vfq); | ||
1242 | ramrod->rx_mode_obj = &bp->rx_mode_obj; | ||
1243 | ramrod->func_id = FW_VF_HANDLE(vf->abs_vfid); | ||
1244 | ramrod->rx_accept_flags = accept_flags; | ||
1245 | ramrod->tx_accept_flags = accept_flags; | ||
1246 | ramrod->pstate = &vf->filter_state; | ||
1247 | ramrod->state = BNX2X_FILTER_RX_MODE_PENDING; | ||
1248 | |||
1249 | set_bit(BNX2X_FILTER_RX_MODE_PENDING, &vf->filter_state); | ||
1250 | set_bit(RAMROD_RX, &ramrod->ramrod_flags); | ||
1251 | set_bit(RAMROD_TX, &ramrod->ramrod_flags); | ||
1252 | |||
1253 | ramrod->rdata = bnx2x_vf_sp(bp, vf, rx_mode_rdata.e2); | ||
1254 | ramrod->rdata_mapping = bnx2x_vf_sp_map(bp, vf, rx_mode_rdata.e2); | ||
1255 | } | ||
1256 | |||
1227 | int bnx2x_vfop_rxmode_cmd(struct bnx2x *bp, | 1257 | int bnx2x_vfop_rxmode_cmd(struct bnx2x *bp, |
1228 | struct bnx2x_virtf *vf, | 1258 | struct bnx2x_virtf *vf, |
1229 | struct bnx2x_vfop_cmd *cmd, | 1259 | struct bnx2x_vfop_cmd *cmd, |
1230 | int qid, unsigned long accept_flags) | 1260 | int qid, unsigned long accept_flags) |
1231 | { | 1261 | { |
1232 | struct bnx2x_vf_queue *vfq = vfq_get(vf, qid); | ||
1233 | struct bnx2x_vfop *vfop = bnx2x_vfop_add(bp, vf); | 1262 | struct bnx2x_vfop *vfop = bnx2x_vfop_add(bp, vf); |
1234 | 1263 | ||
1235 | if (vfop) { | 1264 | if (vfop) { |
1236 | struct bnx2x_rx_mode_ramrod_params *ramrod = | 1265 | struct bnx2x_rx_mode_ramrod_params *ramrod = |
1237 | &vf->op_params.rx_mode; | 1266 | &vf->op_params.rx_mode; |
1238 | 1267 | ||
1239 | memset(ramrod, 0, sizeof(*ramrod)); | 1268 | bnx2x_vf_prep_rx_mode(bp, qid, ramrod, vf, accept_flags); |
1240 | |||
1241 | /* Prepare ramrod parameters */ | ||
1242 | ramrod->cid = vfq->cid; | ||
1243 | ramrod->cl_id = vfq_cl_id(vf, vfq); | ||
1244 | ramrod->rx_mode_obj = &bp->rx_mode_obj; | ||
1245 | ramrod->func_id = FW_VF_HANDLE(vf->abs_vfid); | ||
1246 | |||
1247 | ramrod->rx_accept_flags = accept_flags; | ||
1248 | ramrod->tx_accept_flags = accept_flags; | ||
1249 | ramrod->pstate = &vf->filter_state; | ||
1250 | ramrod->state = BNX2X_FILTER_RX_MODE_PENDING; | ||
1251 | |||
1252 | set_bit(BNX2X_FILTER_RX_MODE_PENDING, &vf->filter_state); | ||
1253 | set_bit(RAMROD_RX, &ramrod->ramrod_flags); | ||
1254 | set_bit(RAMROD_TX, &ramrod->ramrod_flags); | ||
1255 | |||
1256 | ramrod->rdata = | ||
1257 | bnx2x_vf_sp(bp, vf, rx_mode_rdata.e2); | ||
1258 | ramrod->rdata_mapping = | ||
1259 | bnx2x_vf_sp_map(bp, vf, rx_mode_rdata.e2); | ||
1260 | 1269 | ||
1261 | bnx2x_vfop_opset(BNX2X_VFOP_RXMODE_CONFIG, | 1270 | bnx2x_vfop_opset(BNX2X_VFOP_RXMODE_CONFIG, |
1262 | bnx2x_vfop_rxmode, cmd->done); | 1271 | bnx2x_vfop_rxmode, cmd->done); |
@@ -3202,13 +3211,16 @@ int bnx2x_enable_sriov(struct bnx2x *bp) | |||
3202 | bnx2x_iov_static_resc(bp, vf); | 3211 | bnx2x_iov_static_resc(bp, vf); |
3203 | } | 3212 | } |
3204 | 3213 | ||
3205 | /* prepare msix vectors in VF configuration space */ | 3214 | /* prepare msix vectors in VF configuration space - the value in the |
3215 | * PCI configuration space should be the index of the last entry, | ||
3216 | * namely one less than the actual size of the table | ||
3217 | */ | ||
3206 | for (vf_idx = first_vf; vf_idx < first_vf + req_vfs; vf_idx++) { | 3218 | for (vf_idx = first_vf; vf_idx < first_vf + req_vfs; vf_idx++) { |
3207 | bnx2x_pretend_func(bp, HW_VF_HANDLE(bp, vf_idx)); | 3219 | bnx2x_pretend_func(bp, HW_VF_HANDLE(bp, vf_idx)); |
3208 | REG_WR(bp, PCICFG_OFFSET + GRC_CONFIG_REG_VF_MSIX_CONTROL, | 3220 | REG_WR(bp, PCICFG_OFFSET + GRC_CONFIG_REG_VF_MSIX_CONTROL, |
3209 | num_vf_queues); | 3221 | num_vf_queues - 1); |
3210 | DP(BNX2X_MSG_IOV, "set msix vec num in VF %d cfg space to %d\n", | 3222 | DP(BNX2X_MSG_IOV, "set msix vec num in VF %d cfg space to %d\n", |
3211 | vf_idx, num_vf_queues); | 3223 | vf_idx, num_vf_queues - 1); |
3212 | } | 3224 | } |
3213 | bnx2x_pretend_func(bp, BP_ABS_FUNC(bp)); | 3225 | bnx2x_pretend_func(bp, BP_ABS_FUNC(bp)); |
3214 | 3226 | ||
@@ -3436,10 +3448,18 @@ out: | |||
3436 | 3448 | ||
3437 | int bnx2x_set_vf_vlan(struct net_device *dev, int vfidx, u16 vlan, u8 qos) | 3449 | int bnx2x_set_vf_vlan(struct net_device *dev, int vfidx, u16 vlan, u8 qos) |
3438 | { | 3450 | { |
3451 | struct bnx2x_queue_state_params q_params = {NULL}; | ||
3452 | struct bnx2x_vlan_mac_ramrod_params ramrod_param; | ||
3453 | struct bnx2x_queue_update_params *update_params; | ||
3454 | struct pf_vf_bulletin_content *bulletin = NULL; | ||
3455 | struct bnx2x_rx_mode_ramrod_params rx_ramrod; | ||
3439 | struct bnx2x *bp = netdev_priv(dev); | 3456 | struct bnx2x *bp = netdev_priv(dev); |
3440 | int rc, q_logical_state; | 3457 | struct bnx2x_vlan_mac_obj *vlan_obj; |
3458 | unsigned long vlan_mac_flags = 0; | ||
3459 | unsigned long ramrod_flags = 0; | ||
3441 | struct bnx2x_virtf *vf = NULL; | 3460 | struct bnx2x_virtf *vf = NULL; |
3442 | struct pf_vf_bulletin_content *bulletin = NULL; | 3461 | unsigned long accept_flags; |
3462 | int rc; | ||
3443 | 3463 | ||
3444 | /* sanity and init */ | 3464 | /* sanity and init */ |
3445 | rc = bnx2x_vf_ndo_prep(bp, vfidx, &vf, &bulletin); | 3465 | rc = bnx2x_vf_ndo_prep(bp, vfidx, &vf, &bulletin); |
@@ -3457,104 +3477,118 @@ int bnx2x_set_vf_vlan(struct net_device *dev, int vfidx, u16 vlan, u8 qos) | |||
3457 | /* update PF's copy of the VF's bulletin. No point in posting the vlan | 3477 | /* update PF's copy of the VF's bulletin. No point in posting the vlan |
3458 | * to the VF since it doesn't have anything to do with it. But it useful | 3478 | * to the VF since it doesn't have anything to do with it. But it useful |
3459 | * to store it here in case the VF is not up yet and we can only | 3479 | * to store it here in case the VF is not up yet and we can only |
3460 | * configure the vlan later when it does. | 3480 | * configure the vlan later when it does. Treat vlan id 0 as remove the |
3481 | * Host tag. | ||
3461 | */ | 3482 | */ |
3462 | bulletin->valid_bitmap |= 1 << VLAN_VALID; | 3483 | if (vlan > 0) |
3484 | bulletin->valid_bitmap |= 1 << VLAN_VALID; | ||
3485 | else | ||
3486 | bulletin->valid_bitmap &= ~(1 << VLAN_VALID); | ||
3463 | bulletin->vlan = vlan; | 3487 | bulletin->vlan = vlan; |
3464 | 3488 | ||
3465 | /* is vf initialized and queue set up? */ | 3489 | /* is vf initialized and queue set up? */ |
3466 | q_logical_state = | 3490 | if (vf->state != VF_ENABLED || |
3467 | bnx2x_get_q_logical_state(bp, &bnx2x_leading_vfq(vf, sp_obj)); | 3491 | bnx2x_get_q_logical_state(bp, &bnx2x_leading_vfq(vf, sp_obj)) != |
3468 | if (vf->state == VF_ENABLED && | 3492 | BNX2X_Q_LOGICAL_STATE_ACTIVE) |
3469 | q_logical_state == BNX2X_Q_LOGICAL_STATE_ACTIVE) { | 3493 | return rc; |
3470 | /* configure the vlan in device on this vf's queue */ | ||
3471 | unsigned long ramrod_flags = 0; | ||
3472 | unsigned long vlan_mac_flags = 0; | ||
3473 | struct bnx2x_vlan_mac_obj *vlan_obj = | ||
3474 | &bnx2x_leading_vfq(vf, vlan_obj); | ||
3475 | struct bnx2x_vlan_mac_ramrod_params ramrod_param; | ||
3476 | struct bnx2x_queue_state_params q_params = {NULL}; | ||
3477 | struct bnx2x_queue_update_params *update_params; | ||
3478 | 3494 | ||
3479 | rc = validate_vlan_mac(bp, &bnx2x_leading_vfq(vf, mac_obj)); | 3495 | /* configure the vlan in device on this vf's queue */ |
3480 | if (rc) | 3496 | vlan_obj = &bnx2x_leading_vfq(vf, vlan_obj); |
3481 | return rc; | 3497 | rc = validate_vlan_mac(bp, &bnx2x_leading_vfq(vf, mac_obj)); |
3482 | memset(&ramrod_param, 0, sizeof(ramrod_param)); | 3498 | if (rc) |
3499 | return rc; | ||
3483 | 3500 | ||
3484 | /* must lock vfpf channel to protect against vf flows */ | 3501 | /* must lock vfpf channel to protect against vf flows */ |
3485 | bnx2x_lock_vf_pf_channel(bp, vf, CHANNEL_TLV_PF_SET_VLAN); | 3502 | bnx2x_lock_vf_pf_channel(bp, vf, CHANNEL_TLV_PF_SET_VLAN); |
3486 | 3503 | ||
3487 | /* remove existing vlans */ | 3504 | /* remove existing vlans */ |
3488 | __set_bit(RAMROD_COMP_WAIT, &ramrod_flags); | 3505 | __set_bit(RAMROD_COMP_WAIT, &ramrod_flags); |
3489 | rc = vlan_obj->delete_all(bp, vlan_obj, &vlan_mac_flags, | 3506 | rc = vlan_obj->delete_all(bp, vlan_obj, &vlan_mac_flags, |
3490 | &ramrod_flags); | 3507 | &ramrod_flags); |
3491 | if (rc) { | 3508 | if (rc) { |
3492 | BNX2X_ERR("failed to delete vlans\n"); | 3509 | BNX2X_ERR("failed to delete vlans\n"); |
3493 | rc = -EINVAL; | 3510 | rc = -EINVAL; |
3494 | goto out; | 3511 | goto out; |
3495 | } | 3512 | } |
3513 | |||
3514 | /* need to remove/add the VF's accept_any_vlan bit */ | ||
3515 | accept_flags = bnx2x_leading_vfq(vf, accept_flags); | ||
3516 | if (vlan) | ||
3517 | clear_bit(BNX2X_ACCEPT_ANY_VLAN, &accept_flags); | ||
3518 | else | ||
3519 | set_bit(BNX2X_ACCEPT_ANY_VLAN, &accept_flags); | ||
3520 | |||
3521 | bnx2x_vf_prep_rx_mode(bp, LEADING_IDX, &rx_ramrod, vf, | ||
3522 | accept_flags); | ||
3523 | bnx2x_leading_vfq(vf, accept_flags) = accept_flags; | ||
3524 | bnx2x_config_rx_mode(bp, &rx_ramrod); | ||
3525 | |||
3526 | /* configure the new vlan to device */ | ||
3527 | memset(&ramrod_param, 0, sizeof(ramrod_param)); | ||
3528 | __set_bit(RAMROD_COMP_WAIT, &ramrod_flags); | ||
3529 | ramrod_param.vlan_mac_obj = vlan_obj; | ||
3530 | ramrod_param.ramrod_flags = ramrod_flags; | ||
3531 | set_bit(BNX2X_DONT_CONSUME_CAM_CREDIT, | ||
3532 | &ramrod_param.user_req.vlan_mac_flags); | ||
3533 | ramrod_param.user_req.u.vlan.vlan = vlan; | ||
3534 | ramrod_param.user_req.cmd = BNX2X_VLAN_MAC_ADD; | ||
3535 | rc = bnx2x_config_vlan_mac(bp, &ramrod_param); | ||
3536 | if (rc) { | ||
3537 | BNX2X_ERR("failed to configure vlan\n"); | ||
3538 | rc = -EINVAL; | ||
3539 | goto out; | ||
3540 | } | ||
3496 | 3541 | ||
3497 | /* send queue update ramrod to configure default vlan and silent | 3542 | /* send queue update ramrod to configure default vlan and silent |
3498 | * vlan removal | 3543 | * vlan removal |
3544 | */ | ||
3545 | __set_bit(RAMROD_COMP_WAIT, &q_params.ramrod_flags); | ||
3546 | q_params.cmd = BNX2X_Q_CMD_UPDATE; | ||
3547 | q_params.q_obj = &bnx2x_leading_vfq(vf, sp_obj); | ||
3548 | update_params = &q_params.params.update; | ||
3549 | __set_bit(BNX2X_Q_UPDATE_DEF_VLAN_EN_CHNG, | ||
3550 | &update_params->update_flags); | ||
3551 | __set_bit(BNX2X_Q_UPDATE_SILENT_VLAN_REM_CHNG, | ||
3552 | &update_params->update_flags); | ||
3553 | if (vlan == 0) { | ||
3554 | /* if vlan is 0 then we want to leave the VF traffic | ||
3555 | * untagged, and leave the incoming traffic untouched | ||
3556 | * (i.e. do not remove any vlan tags). | ||
3499 | */ | 3557 | */ |
3500 | __set_bit(RAMROD_COMP_WAIT, &q_params.ramrod_flags); | 3558 | __clear_bit(BNX2X_Q_UPDATE_DEF_VLAN_EN, |
3501 | q_params.cmd = BNX2X_Q_CMD_UPDATE; | 3559 | &update_params->update_flags); |
3502 | q_params.q_obj = &bnx2x_leading_vfq(vf, sp_obj); | 3560 | __clear_bit(BNX2X_Q_UPDATE_SILENT_VLAN_REM, |
3503 | update_params = &q_params.params.update; | 3561 | &update_params->update_flags); |
3504 | __set_bit(BNX2X_Q_UPDATE_DEF_VLAN_EN_CHNG, | 3562 | } else { |
3563 | /* configure default vlan to vf queue and set silent | ||
3564 | * vlan removal (the vf remains unaware of this vlan). | ||
3565 | */ | ||
3566 | __set_bit(BNX2X_Q_UPDATE_DEF_VLAN_EN, | ||
3505 | &update_params->update_flags); | 3567 | &update_params->update_flags); |
3506 | __set_bit(BNX2X_Q_UPDATE_SILENT_VLAN_REM_CHNG, | 3568 | __set_bit(BNX2X_Q_UPDATE_SILENT_VLAN_REM, |
3507 | &update_params->update_flags); | 3569 | &update_params->update_flags); |
3570 | update_params->def_vlan = vlan; | ||
3571 | update_params->silent_removal_value = | ||
3572 | vlan & VLAN_VID_MASK; | ||
3573 | update_params->silent_removal_mask = VLAN_VID_MASK; | ||
3574 | } | ||
3508 | 3575 | ||
3509 | if (vlan == 0) { | 3576 | /* Update the Queue state */ |
3510 | /* if vlan is 0 then we want to leave the VF traffic | 3577 | rc = bnx2x_queue_state_change(bp, &q_params); |
3511 | * untagged, and leave the incoming traffic untouched | 3578 | if (rc) { |
3512 | * (i.e. do not remove any vlan tags). | 3579 | BNX2X_ERR("Failed to configure default VLAN\n"); |
3513 | */ | 3580 | goto out; |
3514 | __clear_bit(BNX2X_Q_UPDATE_DEF_VLAN_EN, | 3581 | } |
3515 | &update_params->update_flags); | ||
3516 | __clear_bit(BNX2X_Q_UPDATE_SILENT_VLAN_REM, | ||
3517 | &update_params->update_flags); | ||
3518 | } else { | ||
3519 | /* configure the new vlan to device */ | ||
3520 | __set_bit(RAMROD_COMP_WAIT, &ramrod_flags); | ||
3521 | ramrod_param.vlan_mac_obj = vlan_obj; | ||
3522 | ramrod_param.ramrod_flags = ramrod_flags; | ||
3523 | ramrod_param.user_req.u.vlan.vlan = vlan; | ||
3524 | ramrod_param.user_req.cmd = BNX2X_VLAN_MAC_ADD; | ||
3525 | rc = bnx2x_config_vlan_mac(bp, &ramrod_param); | ||
3526 | if (rc) { | ||
3527 | BNX2X_ERR("failed to configure vlan\n"); | ||
3528 | rc = -EINVAL; | ||
3529 | goto out; | ||
3530 | } | ||
3531 | |||
3532 | /* configure default vlan to vf queue and set silent | ||
3533 | * vlan removal (the vf remains unaware of this vlan). | ||
3534 | */ | ||
3535 | update_params = &q_params.params.update; | ||
3536 | __set_bit(BNX2X_Q_UPDATE_DEF_VLAN_EN, | ||
3537 | &update_params->update_flags); | ||
3538 | __set_bit(BNX2X_Q_UPDATE_SILENT_VLAN_REM, | ||
3539 | &update_params->update_flags); | ||
3540 | update_params->def_vlan = vlan; | ||
3541 | } | ||
3542 | 3582 | ||
3543 | /* Update the Queue state */ | ||
3544 | rc = bnx2x_queue_state_change(bp, &q_params); | ||
3545 | if (rc) { | ||
3546 | BNX2X_ERR("Failed to configure default VLAN\n"); | ||
3547 | goto out; | ||
3548 | } | ||
3549 | 3583 | ||
3550 | /* clear the flag indicating that this VF needs its vlan | 3584 | /* clear the flag indicating that this VF needs its vlan |
3551 | * (will only be set if the HV configured the Vlan before vf was | 3585 | * (will only be set if the HV configured the Vlan before vf was |
3552 | * up and we were called because the VF came up later | 3586 | * up and we were called because the VF came up later |
3553 | */ | 3587 | */ |
3554 | out: | 3588 | out: |
3555 | vf->cfg_flags &= ~VF_CFG_VLAN; | 3589 | vf->cfg_flags &= ~VF_CFG_VLAN; |
3556 | bnx2x_unlock_vf_pf_channel(bp, vf, CHANNEL_TLV_PF_SET_VLAN); | 3590 | bnx2x_unlock_vf_pf_channel(bp, vf, CHANNEL_TLV_PF_SET_VLAN); |
3557 | } | 3591 | |
3558 | return rc; | 3592 | return rc; |
3559 | } | 3593 | } |
3560 | 3594 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h index 1ff6a9366629..8c213fa52174 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h | |||
@@ -74,6 +74,7 @@ struct bnx2x_vf_queue { | |||
74 | /* VLANs object */ | 74 | /* VLANs object */ |
75 | struct bnx2x_vlan_mac_obj vlan_obj; | 75 | struct bnx2x_vlan_mac_obj vlan_obj; |
76 | atomic_t vlan_count; /* 0 means vlan-0 is set ~ untagged */ | 76 | atomic_t vlan_count; /* 0 means vlan-0 is set ~ untagged */ |
77 | unsigned long accept_flags; /* last accept flags configured */ | ||
77 | 78 | ||
78 | /* Queue Slow-path State object */ | 79 | /* Queue Slow-path State object */ |
79 | struct bnx2x_queue_sp_obj sp_obj; | 80 | struct bnx2x_queue_sp_obj sp_obj; |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c index 3dc2537fe91b..0756d7dabdd5 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c | |||
@@ -1598,6 +1598,8 @@ static void bnx2x_vfop_mbx_qfilters(struct bnx2x *bp, struct bnx2x_virtf *vf) | |||
1598 | 1598 | ||
1599 | if (msg->flags & VFPF_SET_Q_FILTERS_RX_MASK_CHANGED) { | 1599 | if (msg->flags & VFPF_SET_Q_FILTERS_RX_MASK_CHANGED) { |
1600 | unsigned long accept = 0; | 1600 | unsigned long accept = 0; |
1601 | struct pf_vf_bulletin_content *bulletin = | ||
1602 | BP_VF_BULLETIN(bp, vf->index); | ||
1601 | 1603 | ||
1602 | /* covert VF-PF if mask to bnx2x accept flags */ | 1604 | /* covert VF-PF if mask to bnx2x accept flags */ |
1603 | if (msg->rx_mask & VFPF_RX_MASK_ACCEPT_MATCHED_UNICAST) | 1605 | if (msg->rx_mask & VFPF_RX_MASK_ACCEPT_MATCHED_UNICAST) |
@@ -1617,9 +1619,11 @@ static void bnx2x_vfop_mbx_qfilters(struct bnx2x *bp, struct bnx2x_virtf *vf) | |||
1617 | __set_bit(BNX2X_ACCEPT_BROADCAST, &accept); | 1619 | __set_bit(BNX2X_ACCEPT_BROADCAST, &accept); |
1618 | 1620 | ||
1619 | /* A packet arriving the vf's mac should be accepted | 1621 | /* A packet arriving the vf's mac should be accepted |
1620 | * with any vlan | 1622 | * with any vlan, unless a vlan has already been |
1623 | * configured. | ||
1621 | */ | 1624 | */ |
1622 | __set_bit(BNX2X_ACCEPT_ANY_VLAN, &accept); | 1625 | if (!(bulletin->valid_bitmap & (1 << VLAN_VALID))) |
1626 | __set_bit(BNX2X_ACCEPT_ANY_VLAN, &accept); | ||
1623 | 1627 | ||
1624 | /* set rx-mode */ | 1628 | /* set rx-mode */ |
1625 | rc = bnx2x_vfop_rxmode_cmd(bp, vf, &cmd, | 1629 | rc = bnx2x_vfop_rxmode_cmd(bp, vf, &cmd, |
@@ -1710,6 +1714,21 @@ static void bnx2x_vf_mbx_set_q_filters(struct bnx2x *bp, | |||
1710 | goto response; | 1714 | goto response; |
1711 | } | 1715 | } |
1712 | } | 1716 | } |
1717 | /* if vlan was set by hypervisor we don't allow guest to config vlan */ | ||
1718 | if (bulletin->valid_bitmap & 1 << VLAN_VALID) { | ||
1719 | int i; | ||
1720 | |||
1721 | /* search for vlan filters */ | ||
1722 | for (i = 0; i < filters->n_mac_vlan_filters; i++) { | ||
1723 | if (filters->filters[i].flags & | ||
1724 | VFPF_Q_FILTER_VLAN_TAG_VALID) { | ||
1725 | BNX2X_ERR("VF[%d] attempted to configure vlan but one was already set by Hypervisor. Aborting request\n", | ||
1726 | vf->abs_vfid); | ||
1727 | vf->op_rc = -EPERM; | ||
1728 | goto response; | ||
1729 | } | ||
1730 | } | ||
1731 | } | ||
1713 | 1732 | ||
1714 | /* verify vf_qid */ | 1733 | /* verify vf_qid */ |
1715 | if (filters->vf_qid > vf_rxq_count(vf)) | 1734 | if (filters->vf_qid > vf_rxq_count(vf)) |
@@ -1805,6 +1824,9 @@ static void bnx2x_vf_mbx_update_rss(struct bnx2x *bp, struct bnx2x_virtf *vf, | |||
1805 | vf_op_params->rss_result_mask = rss_tlv->rss_result_mask; | 1824 | vf_op_params->rss_result_mask = rss_tlv->rss_result_mask; |
1806 | 1825 | ||
1807 | /* flags handled individually for backward/forward compatability */ | 1826 | /* flags handled individually for backward/forward compatability */ |
1827 | vf_op_params->rss_flags = 0; | ||
1828 | vf_op_params->ramrod_flags = 0; | ||
1829 | |||
1808 | if (rss_tlv->rss_flags & VFPF_RSS_MODE_DISABLED) | 1830 | if (rss_tlv->rss_flags & VFPF_RSS_MODE_DISABLED) |
1809 | __set_bit(BNX2X_RSS_MODE_DISABLED, &vf_op_params->rss_flags); | 1831 | __set_bit(BNX2X_RSS_MODE_DISABLED, &vf_op_params->rss_flags); |
1810 | if (rss_tlv->rss_flags & VFPF_RSS_MODE_REGULAR) | 1832 | if (rss_tlv->rss_flags & VFPF_RSS_MODE_REGULAR) |