cxgb4: impose mandatory VLAN usage when non-zero TAG ID
authorCasey Leedom <leedom@chelsio.com>
Fri, 7 Sep 2018 10:29:33 +0000 (15:59 +0530)
committerDavid S. Miller <davem@davemloft.net>
Sat, 8 Sep 2018 06:06:07 +0000 (23:06 -0700)
When a non-zero VLAN Tag ID is passed to t4_set_vlan_acl()
then impose mandatory VLAN Usage with that VLAN ID.
I.e any other VLAN ID should result in packets getting
dropped.

Signed-off-by: Casey Leedom <leedom@chelsio.com>
Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h

index 5fe5d16..6f1bd7b 100644 (file)
@@ -10210,6 +10210,9 @@ int t4_set_vlan_acl(struct adapter *adap, unsigned int mbox, unsigned int vf,
        vlan_cmd.en_to_len16 = cpu_to_be32(enable | FW_LEN16(vlan_cmd));
        /* Drop all packets that donot match vlan id */
        vlan_cmd.dropnovlan_fm = FW_ACL_VLAN_CMD_FM_F;
+       vlan_cmd.dropnovlan_fm = (enable
+                                 ? (FW_ACL_VLAN_CMD_DROPNOVLAN_F |
+                                    FW_ACL_VLAN_CMD_FM_F) : 0);
        if (enable != 0) {
                vlan_cmd.nvlan = 1;
                vlan_cmd.vlanid[0] = cpu_to_be16(vlan);
index 5dc6c41..6d2bc87 100644 (file)
@@ -2464,6 +2464,7 @@ struct fw_acl_vlan_cmd {
 
 #define FW_ACL_VLAN_CMD_DROPNOVLAN_S   7
 #define FW_ACL_VLAN_CMD_DROPNOVLAN_V(x)        ((x) << FW_ACL_VLAN_CMD_DROPNOVLAN_S)
+#define FW_ACL_VLAN_CMD_DROPNOVLAN_F    FW_ACL_VLAN_CMD_DROPNOVLAN_V(1U)
 
 #define FW_ACL_VLAN_CMD_FM_S           6
 #define FW_ACL_VLAN_CMD_FM_M           0x1