Minor refactoring for fabric.p4

Change-Id: I736b20fc95b4a03afa1074eb777a23507530b44f
diff --git a/pipelines/fabric/src/main/resources/include/checksum.p4 b/pipelines/fabric/src/main/resources/include/checksum.p4
index 00b4e70..dfcadb6 100644
--- a/pipelines/fabric/src/main/resources/include/checksum.p4
+++ b/pipelines/fabric/src/main/resources/include/checksum.p4
@@ -21,6 +21,7 @@
                               inout fabric_metadata_t meta)
 {
     apply {
+#ifdef TARGET_BMV2
         update_checksum(hdr.ipv4.isValid(),
             {
                 hdr.ipv4.version,
@@ -38,6 +39,7 @@
             hdr.ipv4.hdr_checksum,
             HashAlgorithm.csum16
         );
+#endif
     }
 }
 
@@ -45,6 +47,7 @@
                              inout fabric_metadata_t meta)
 {
     apply {
+#ifdef TARGET_BMV2
         verify_checksum(hdr.ipv4.isValid(),
             {
                 hdr.ipv4.version,
@@ -62,6 +65,7 @@
             hdr.ipv4.hdr_checksum,
             HashAlgorithm.csum16
         );
+#endif
     }
 }