diff --git a/iscsi-scst/Makefile b/iscsi-scst/Makefile index b9f16e358..2291e6269 100644 --- a/iscsi-scst/Makefile +++ b/iscsi-scst/Makefile @@ -48,6 +48,7 @@ ifeq ($(INSTALL_MOD_PATH),) endif INSTALL_DIR := $(INSTALL_MOD_PATH)/lib/modules/$(KVER)/extra +INFINIBAND_ENABLED := $(shell if grep -q '^CONFIG_INFINIBAND=[my]$$' $(KDIR)/.config; then echo true; else echo false; fi) all: include/iscsi_scst_itf_ver.h progs mods @@ -102,7 +103,11 @@ endif mods: Modules.symvers Module.symvers echo " Building against $(OFED_FLAVOR) InfiniBand kernel headers." $(MAKE) -C $(KDIR) SCST_INC_DIR=$(SCST_INC_DIR) SUBDIRS=$(KMOD) modules - $(MAKE) -C $(KDIR) SCST_INC_DIR=$(SCST_INC_DIR) SUBDIRS=$(ISERTMOD) PRE_CFLAGS="$(OFED_CFLAGS) -DOFED_FLAVOR=$(OFED_FLAVOR)" KBUILD_EXTRA_SYMBOLS=$(ISER_SYMVERS) modules + if $(INFINIBAND_ENABLED); then \ + $(MAKE) -C $(KDIR) SCST_INC_DIR=$(SCST_INC_DIR) SUBDIRS=$(ISERTMOD) \ + PRE_CFLAGS="$(OFED_CFLAGS) -DOFED_FLAVOR=$(OFED_FLAVOR)" \ + KBUILD_EXTRA_SYMBOLS=$(ISER_SYMVERS) modules; \ + fi progs: $(MAKE) -C usr SCST_INC_DIR=$(SCST_INC_DIR) @@ -123,9 +128,11 @@ install: all $(MAKE) -C $(KDIR) SCST_INC_DIR=$(SCST_INC_DIR) SUBDIRS=$(KMOD) \ $$([ -n "$(DESTDIR)$(INSTALL_MOD_PATH)" ] && echo DEPMOD=true) \ modules_install - $(MAKE) -C $(KDIR) SCST_INC_DIR=$(SCST_INC_DIR) SUBDIRS=$(ISERTMOD) \ - $$([ -n "$(DESTDIR)$(INSTALL_MOD_PATH)" ] && echo DEPMOD=true) \ - modules_install + if $(INFINIBAND_ENABLED); then \ + $(MAKE) -C $(KDIR) SCST_INC_DIR=$(SCST_INC_DIR) SUBDIRS=$(ISERTMOD) \ + $$([ -n "$(DESTDIR)$(INSTALL_MOD_PATH)" ] && echo DEPMOD=true) \ + modules_install + fi uninstall: rm -f $(DESTDIR)$(SBINDIR)/iscsi-scstd \ @@ -142,7 +149,9 @@ ifneq ($(SCST_MOD_VERS),) Modules.symvers: $(SCST_DIR)/Modules.symvers echo $(SCST_MOD_VERS) cp $(SCST_DIR)/Modules.symvers kernel/ - cp $(SCST_DIR)/Modules.symvers kernel/isert-scst + if $(INFINIBAND_ENABLED); then \ + cp $(SCST_DIR)/Modules.symvers kernel/isert-scst; \ + fi else .PHONY: Modules.symvers endif @@ -152,7 +161,9 @@ SCST_MOD_VERS := $(shell ls $(SCST_DIR)/Module.symvers 2>/dev/null) ifneq ($(SCST_MOD_VERS),) Module.symvers: $(SCST_DIR)/Module.symvers cp $(SCST_DIR)/Module.symvers kernel/ - cp $(SCST_DIR)/Module.symvers kernel/isert-scst + if $(INFINIBAND_ENABLED); then \ + cp $(SCST_DIR)/Module.symvers kernel/isert-scst; \ + fi else .PHONY: Module.symvers endif diff --git a/iscsi-scst/kernel/digest.c b/iscsi-scst/kernel/digest.c index 1da1a04d0..29f9e645d 100644 --- a/iscsi-scst/kernel/digest.c +++ b/iscsi-scst/kernel/digest.c @@ -61,7 +61,6 @@ static __be32 evaluate_crc32_from_sg(struct scatterlist *sg, int nbytes, uint32_t padding) { u32 crc = ~0; - int pad_bytes = ((nbytes + 3) & -4) - nbytes; #ifdef CONFIG_SCST_ISCSI_DEBUG_DIGEST_FAILURES if (((scst_random() % 100000) == 752)) { @@ -71,15 +70,19 @@ static __be32 evaluate_crc32_from_sg(struct scatterlist *sg, int nbytes, #endif #if defined(CONFIG_LIBCRC32C_MODULE) || defined(CONFIG_LIBCRC32C) - while (nbytes > 0) { - int d = min(nbytes, (int)(sg->length)); - crc = crc32c(crc, sg_virt(sg), d); - nbytes -= d; - sg++; - } + { + int pad_bytes = ((nbytes + 3) & -4) - nbytes; - if (pad_bytes) - crc = crc32c(crc, (u8 *)&padding, pad_bytes); + while (nbytes > 0) { + int d = min(nbytes, (int)(sg->length)); + crc = crc32c(crc, sg_virt(sg), d); + nbytes -= d; + sg++; + } + + if (pad_bytes) + crc = crc32c(crc, (u8 *)&padding, pad_bytes); + } #endif return (__force __be32)~cpu_to_le32(crc);