Administrator can configure to drop packet in transmit,
if it doesn't match interface mac address, in case of virtual function.
Signed-off-by: Sony Chacko <sony.chacko@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
 #define QLCNIC_BRIDGE_ENABLED          0X10
 #define QLCNIC_DIAG_ENABLED            0x20
 #define QLCNIC_ESWITCH_ENABLED         0x40
+#define QLCNIC_MACSPOOF                        0x200
 #define QLCNIC_IS_MSI_FAMILY(adapter) \
        ((adapter)->flags & (QLCNIC_MSI_ENABLED | QLCNIC_MSIX_ENABLED))
 
 
 qlcnic_set_eswitch_port_features(struct qlcnic_adapter *adapter,
                struct qlcnic_esw_func_cfg *esw_cfg)
 {
+       adapter->flags &= ~QLCNIC_MACSPOOF;
+       if (adapter->op_mode == QLCNIC_NON_PRIV_FUNC)
+               if (esw_cfg->mac_anti_spoof)
+                       adapter->flags |= QLCNIC_MACSPOOF;
+
        qlcnic_set_netdev_features(adapter, esw_cfg);
 }
 
                return NETDEV_TX_BUSY;
        }
 
+       if (adapter->flags & QLCNIC_MACSPOOF) {
+               if (compare_ether_addr(eth_hdr(skb)->h_source,
+                                       adapter->mac_addr))
+                       goto drop_packet;
+       }
+
        frag_count = skb_shinfo(skb)->nr_frags + 1;
 
        /* 4 fragments per cmd des */