bnx2x: add VF Multicast filters support
authorYuval Mintz <yuvalmin@broadcom.com>
Thu, 26 Dec 2013 07:57:12 +0000 (09:57 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 26 Dec 2013 18:38:21 +0000 (13:38 -0500)
This patch adds the necessary support for configuring (and removing) multicast
filters to VFs.

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h
drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c

index 2e46c28fc6019a892f7792c6017effe3f7db7063..25182765e4be5d3a2c556f9212e2fde5c79b9693 100644 (file)
@@ -166,6 +166,7 @@ enum bnx2x_vfop_qteardown_state {
           BNX2X_VFOP_QTEARDOWN_RXMODE,
           BNX2X_VFOP_QTEARDOWN_CLR_VLAN,
           BNX2X_VFOP_QTEARDOWN_CLR_MAC,
+          BNX2X_VFOP_QTEARDOWN_CLR_MCAST,
           BNX2X_VFOP_QTEARDOWN_QDTOR,
           BNX2X_VFOP_QTEARDOWN_DONE
 };
@@ -1112,7 +1113,10 @@ static void bnx2x_vfop_mcast(struct bnx2x *bp, struct bnx2x_virtf *vf)
        switch (state) {
        case BNX2X_VFOP_MCAST_DEL:
                /* clear existing mcasts */
-               vfop->state = BNX2X_VFOP_MCAST_ADD;
+               vfop->state = (args->mc_num) ? BNX2X_VFOP_MCAST_ADD
+                                            : BNX2X_VFOP_MCAST_CHK_DONE;
+               mcast->mcast_list_len = vf->mcast_list_len;
+               vf->mcast_list_len = args->mc_num;
                vfop->rc = bnx2x_config_mcast(bp, mcast, BNX2X_MCAST_CMD_DEL);
                bnx2x_vfop_finalize(vf, vfop->rc, VFOP_CONT);
 
@@ -1120,17 +1124,17 @@ static void bnx2x_vfop_mcast(struct bnx2x *bp, struct bnx2x_virtf *vf)
                if (raw->check_pending(raw))
                        goto op_pending;
 
-               if (args->mc_num) {
-                       /* update mcast list on the ramrod params */
-                       INIT_LIST_HEAD(&mcast->mcast_list);
-                       for (i = 0; i < args->mc_num; i++)
-                               list_add_tail(&(args->mc[i].link),
-                                             &mcast->mcast_list);
-                       /* add new mcasts */
-                       vfop->state = BNX2X_VFOP_MCAST_CHK_DONE;
-                       vfop->rc = bnx2x_config_mcast(bp, mcast,
-                                                     BNX2X_MCAST_CMD_ADD);
-               }
+               /* update mcast list on the ramrod params */
+               INIT_LIST_HEAD(&mcast->mcast_list);
+               for (i = 0; i < args->mc_num; i++)
+                       list_add_tail(&(args->mc[i].link),
+                                     &mcast->mcast_list);
+               mcast->mcast_list_len = args->mc_num;
+
+               /* add new mcasts */
+               vfop->state = BNX2X_VFOP_MCAST_CHK_DONE;
+               vfop->rc = bnx2x_config_mcast(bp, mcast,
+                                             BNX2X_MCAST_CMD_ADD);
                bnx2x_vfop_finalize(vf, vfop->rc, VFOP_DONE);
 
        case BNX2X_VFOP_MCAST_CHK_DONE:
@@ -1303,12 +1307,19 @@ static void bnx2x_vfop_qdown(struct bnx2x *bp, struct bnx2x_virtf *vf)
 
        case BNX2X_VFOP_QTEARDOWN_CLR_MAC:
                /* mac-clear-all: consume credit */
-               vfop->state = BNX2X_VFOP_QTEARDOWN_QDTOR;
+               vfop->state = BNX2X_VFOP_QTEARDOWN_CLR_MCAST;
                vfop->rc = bnx2x_vfop_mac_delall_cmd(bp, vf, &cmd, qid, false);
                if (vfop->rc)
                        goto op_err;
                return;
 
+       case BNX2X_VFOP_QTEARDOWN_CLR_MCAST:
+               vfop->state = BNX2X_VFOP_QTEARDOWN_QDTOR;
+               vfop->rc = bnx2x_vfop_mcast_cmd(bp, vf, &cmd, NULL, 0, false);
+               if (vfop->rc)
+                       goto op_err;
+               return;
+
        case BNX2X_VFOP_QTEARDOWN_QDTOR:
                /* run the queue destruction flow */
                DP(BNX2X_MSG_IOV, "case: BNX2X_VFOP_QTEARDOWN_QDTOR\n");
@@ -2188,6 +2199,7 @@ int bnx2x_iov_nic_init(struct bnx2x *bp)
                 *  It needs to be initialized here so that it can be safely
                 *  handled by a subsequent FLR flow.
                 */
+               vf->mcast_list_len = 0;
                bnx2x_init_mcast_obj(bp, &vf->mcast_obj, 0xFF,
                                     0xFF, 0xFF, 0xFF,
                                     bnx2x_vf_sp(bp, vf, mcast_rdata),
@@ -2848,13 +2860,9 @@ static void bnx2x_vfop_close(struct bnx2x *bp, struct bnx2x_virtf *vf)
                                goto op_err;
                        return;
                }
-
-               /* remove multicasts */
                vfop->state = BNX2X_VFOP_CLOSE_HW;
-               vfop->rc = bnx2x_vfop_mcast_cmd(bp, vf, &cmd, NULL, 0, false);
-               if (vfop->rc)
-                       goto op_err;
-               return;
+               vfop->rc = 0;
+               bnx2x_vfop_finalize(vf, vfop->rc, VFOP_CONT);
 
        case BNX2X_VFOP_CLOSE_HW:
 
@@ -2888,6 +2896,9 @@ op_done:
 
        DP(BNX2X_MSG_IOV, "set state to acquired\n");
        bnx2x_vfop_end(bp, vf, vfop);
+op_pending:
+       /* Not supported at the moment; Exists for macros only */
+       return;
 }
 
 int bnx2x_vfop_close_cmd(struct bnx2x *bp,
index 1ff6a9366629ed88fe79a079391c92e95d1e9baf..a5c84a7d454c47171132b4a7f99f2dcfaea0fcde 100644 (file)
@@ -268,6 +268,7 @@ struct bnx2x_virtf {
        int leading_rss;
 
        /* MCAST object */
+       int mcast_list_len;
        struct bnx2x_mcast_obj          mcast_obj;
 
        /* RSS configuration object */
index 82a6b6b2406dc103345050080d8366dc0fd5f2d2..30c7f249203cce4cd69bf2078624f431318dc40f 100644 (file)
@@ -1420,6 +1420,14 @@ static void bnx2x_vf_mbx_setup_q(struct bnx2x *bp, struct bnx2x_virtf *vf,
                                setup_q->rxq.cache_line_log;
                        rxq_params->sb_cq_index = setup_q->rxq.sb_index;
 
+                       /* rx setup - multicast engine */
+                       if (bnx2x_vfq_is_leading(q)) {
+                               u8 mcast_id = FW_VF_HANDLE(vf->abs_vfid);
+
+                               rxq_params->mcast_engine_id = mcast_id;
+                               __set_bit(BNX2X_Q_FLG_MCAST, &setup_p->flags);
+                       }
+
                        bnx2x_vfop_qctor_dump_rx(bp, vf, init_p, setup_p,
                                                 q->index, q->sb_idx);
                }