qed: Prevent VFs from pause flooding
authorYuval Mintz <Yuval.Mintz@qlogic.com>
Mon, 22 Aug 2016 10:25:10 +0000 (13:25 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 23 Aug 2016 01:24:52 +0000 (18:24 -0700)
Firmware would silently drop any control frame sent by VF to prevent
a malicious VF from generating pause flood in the network.

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/qed/qed_l2.c
drivers/net/ethernet/qlogic/qed/qed_l2.h
drivers/net/ethernet/qlogic/qed/qed_sriov.c

index c04162dabfea0adb5ec0c310f8dda17b2f805046..bf433016551a709115aa61f5b3e0f57f27a50394 100644 (file)
@@ -101,6 +101,9 @@ int qed_sp_eth_vport_start(struct qed_hwfn *p_hwfn,
 
        p_ramrod->tx_switching_en = p_params->tx_switching;
 
+       p_ramrod->ctl_frame_mac_check_en = !!p_params->check_mac;
+       p_ramrod->ctl_frame_ethtype_check_en = !!p_params->check_ethtype;
+
        /* Software Function ID in hwfn (PFs are 0 - 15, VFs are 16 - 135) */
        p_ramrod->sw_fid = qed_concrete_to_sw_fid(p_hwfn->cdev,
                                                  p_params->concrete_fid);
index ea93519bcb7dc80693b62456537015d60d27addb..e495d62fcc0375922a687e4913bd2ec03f677382 100644 (file)
@@ -102,6 +102,8 @@ struct qed_sp_vport_start_params {
        u16 opaque_fid;
        u8 vport_id;
        u16 mtu;
+       bool check_mac;
+       bool check_ethtype;
 };
 
 int qed_sp_eth_vport_start(struct qed_hwfn *p_hwfn,
index f1fae770e041cc4ca13e347e47c8ebfe8856fde2..cb68674640f9fdd8af135ef148f7fd65ac3e1455 100644 (file)
@@ -1680,6 +1680,7 @@ static void qed_iov_vf_mbx_start_vport(struct qed_hwfn *p_hwfn,
        params.vport_id = vf->vport_id;
        params.max_buffers_per_cqe = start->max_buffers_per_cqe;
        params.mtu = vf->mtu;
+       params.check_mac = true;
 
        rc = qed_sp_eth_vport_start(p_hwfn, &params);
        if (rc) {