[PATCH 1/3] cxgb4: add cxgb4_fcoe.h and macro definitions for FCoE
This patch adds new header file cxgb4_fcoe.h and defines new macros for FCoE support in cxgb4 driver. Signed-off-by: Varun Prakash va...@chelsio.com --- drivers/net/ethernet/chelsio/cxgb4/cxgb4.h |7 +++ drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.h | 57 +++ drivers/net/ethernet/chelsio/cxgb4/t4_msg.h | 25 ++ 3 files changed, 89 insertions(+), 0 deletions(-) create mode 100644 drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.h diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h index 4555634..bf46ca9 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h @@ -387,6 +387,10 @@ struct sge_rspq; #include cxgb4_dcb.h +#ifdef CONFIG_CHELSIO_T4_FCOE +#include cxgb4_fcoe.h +#endif /* CONFIG_CHELSIO_T4_FCOE */ + struct port_info { struct adapter *adapter; u16viid; @@ -406,6 +410,9 @@ struct port_info { #ifdef CONFIG_CHELSIO_T4_DCB struct port_dcb_info dcb; /* Data Center Bridging support */ #endif +#ifdef CONFIG_CHELSIO_T4_FCOE + struct cxgb_fcoe fcoe; +#endif /* CONFIG_CHELSIO_T4_FCOE */ }; struct dentry; diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.h new file mode 100644 index 000..bf9258a --- /dev/null +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.h @@ -0,0 +1,57 @@ +/* + * This file is part of the Chelsio T4 Ethernet driver for Linux. + * + * Copyright (c) 2015 Chelsio Communications, Inc. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + *copyright notice, this list of conditions and the following + *disclaimer. + * + * - Redistributions in binary form must reproduce the above + *copyright notice, this list of conditions and the following + *disclaimer in the documentation and/or other materials + *provided with the distribution. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef __CXGB4_FCOE_H__ +#define __CXGB4_FCOE_H__ + +#ifdef CONFIG_CHELSIO_T4_FCOE + +#define CXGB_FCOE_TXPKT_CSUM_START 28 +#define CXGB_FCOE_TXPKT_CSUM_END 8 + +/* fcoe flags */ +enum { + CXGB_FCOE_ENABLED = (1 0), +}; + +struct cxgb_fcoe { + u8 flags; +}; + +int cxgb_fcoe_enable(struct net_device *); +int cxgb_fcoe_disable(struct net_device *); +bool cxgb_fcoe_sof_eof_supported(struct adapter *, struct sk_buff *); + +#endif /* CONFIG_CHELSIO_T4_FCOE */ +#endif /* __CXGB4_FCOE_H__ */ diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h b/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h index 0fb975e..30a2f56 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_msg.h @@ -794,6 +794,14 @@ struct cpl_rx_pkt { __be16 err_vec; }; +#define RXF_PSH_S20 +#define RXF_PSH_V(x) ((x) RXF_PSH_S) +#define RXF_PSH_FRXF_PSH_V(1U) + +#define RXF_SYN_S21 +#define RXF_SYN_V(x) ((x) RXF_SYN_S) +#define RXF_SYN_FRXF_SYN_V(1U) + #define RXF_UDP_S22 #define RXF_UDP_V(x) ((x) RXF_UDP_S) #define RXF_UDP_FRXF_UDP_V(1U) @@ -810,6 +818,18 @@ struct cpl_rx_pkt { #define RXF_IP6_V(x) ((x) RXF_IP6_S) #define RXF_IP6_FRXF_IP6_V(1U) +#define RXF_SYN_COOKIE_S26 +#define RXF_SYN_COOKIE_V(x) ((x) RXF_SYN_COOKIE_S) +#define RXF_SYN_COOKIE_FRXF_SYN_COOKIE_V(1U) + +#define RXF_FCOE_S26 +#define RXF_FCOE_V(x) ((x) RXF_FCOE_S) +#define RXF_FCOE_FRXF_FCOE_V(1U) + +#define RXF_LRO_S27 +#define RXF_LRO_V(x) ((x) RXF_LRO_S) +#define RXF_LRO_FRXF_LRO_V(1U) + /* rx_pkt.l2info fields */ #define RX_ETHHDR_LEN_S0 #define RX_ETHHDR_LEN_M0x1F @@ -846,6 +866,11 @@ struct cpl_rx_pkt { #define RX_IPHDR_LEN_V(x) ((x) RX_IPHDR_LEN_S) #define RX_IPHDR_LEN_G(x) (((x) RX_IPHDR_LEN_S) RX_IPHDR_LEN_M) +/* rx_pkt.err_vec fields */ +#define RXERR_CSUM_S13 +#define RXERR_CSUM_V(x) ((x) RXERR_CSUM_S) +#define RXERR_CSUM_FRXERR_CSUM_V(1U) + struct
[PATCH 0/3] FCoE support in cxgb4 driver
This patch series enables FCoE support in cxgb4 driver, it enables FCOE_CRC and FCOE_MTU net device features. This series is created against net-next tree. Thanks Varun Prakash (3): cxgb4: add cxgb4_fcoe.h and macro definitions for FCoE cxgb4: add cxgb4_fcoe.c for FCoE cxgb4: update Kconfig and Makefile for FCoE support drivers/net/ethernet/chelsio/Kconfig| 11 ++ drivers/net/ethernet/chelsio/cxgb4/Makefile |1 + drivers/net/ethernet/chelsio/cxgb4/cxgb4.h |7 ++ drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.c | 122 +++ drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.h | 57 +++ drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |8 ++ drivers/net/ethernet/chelsio/cxgb4/sge.c| 74 +- drivers/net/ethernet/chelsio/cxgb4/t4_msg.h | 25 + 8 files changed, 302 insertions(+), 3 deletions(-) create mode 100644 drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.c create mode 100644 drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.h -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/3] cxgb4: add cxgb4_fcoe.c for FCoE
This patch adds cxgb4_fcoe.c and enables FCOE_CRC, FCOE_MTU net device features. Signed-off-by: Varun Prakash va...@chelsio.com --- drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.c | 122 +++ drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |8 ++ drivers/net/ethernet/chelsio/cxgb4/sge.c| 74 +- 3 files changed, 201 insertions(+), 3 deletions(-) create mode 100644 drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.c diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.c new file mode 100644 index 000..062d3c0 --- /dev/null +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.c @@ -0,0 +1,122 @@ +/* + * This file is part of the Chelsio T4 Ethernet driver for Linux. + * + * Copyright (c) 2015 Chelsio Communications, Inc. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + *copyright notice, this list of conditions and the following + *disclaimer. + * + * - Redistributions in binary form must reproduce the above + *copyright notice, this list of conditions and the following + *disclaimer in the documentation and/or other materials + *provided with the distribution. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifdef CONFIG_CHELSIO_T4_FCOE + +#include scsi/fc/fc_fs.h +#include scsi/libfcoe.h +#include cxgb4.h + +bool cxgb_fcoe_sof_eof_supported(struct adapter *adap, struct sk_buff *skb) +{ + struct fcoe_hdr *fcoeh = (struct fcoe_hdr *)skb_network_header(skb); + u8 sof = fcoeh-fcoe_sof; + u8 eof = 0; + + if ((sof != FC_SOF_I3) (sof != FC_SOF_N3)) { + dev_err(adap-pdev_dev, Unsupported SOF 0x%x\n, sof); + return 0; + } + + skb_copy_bits(skb, skb-len - 4, eof, 1); + + if ((eof != FC_EOF_N) (eof != FC_EOF_T)) { + dev_err(adap-pdev_dev, Unsupported EOF 0x%x\n, eof); + return 0; + } + + return 1; +} + +/** + * cxgb_fcoe_enable - enable FCoE offload features + * @netdev: net device + * + * Returns 0 on success or -EINVAL on failure. + */ +int cxgb_fcoe_enable(struct net_device *netdev) +{ + struct port_info *pi = netdev_priv(netdev); + struct adapter *adap = pi-adapter; + struct cxgb_fcoe *fcoe = pi-fcoe; + + if (is_t4(adap-params.chip)) + return -EINVAL; + + if (!(adap-flags FULL_INIT_DONE)) + return -EINVAL; + + dev_info(adap-pdev_dev, Enabling FCoE offload features\n); + + netdev-features |= NETIF_F_FCOE_CRC; + netdev-vlan_features |= NETIF_F_FCOE_CRC; + netdev-features |= NETIF_F_FCOE_MTU; + netdev-vlan_features |= NETIF_F_FCOE_MTU; + + netdev_features_change(netdev); + + fcoe-flags |= CXGB_FCOE_ENABLED; + + return 0; +} + +/** + * cxgb_fcoe_disable - disable FCoE offload + * @netdev: net device + * + * Returns 0 on success or -EINVAL on failure. + */ +int cxgb_fcoe_disable(struct net_device *netdev) +{ + struct port_info *pi = netdev_priv(netdev); + struct adapter *adap = pi-adapter; + struct cxgb_fcoe *fcoe = pi-fcoe; + + if (!(fcoe-flags CXGB_FCOE_ENABLED)) + return -EINVAL; + + dev_info(adap-pdev_dev, Disabling FCoE offload features\n); + + fcoe-flags = ~CXGB_FCOE_ENABLED; + + netdev-features = ~NETIF_F_FCOE_CRC; + netdev-vlan_features = ~NETIF_F_FCOE_CRC; + netdev-features = ~NETIF_F_FCOE_MTU; + netdev-vlan_features = ~NETIF_F_FCOE_MTU; + + netdev_features_change(netdev); + + return 0; +} +#endif /* CONFIG_CHELSIO_T4_FCOE */ diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index dd4b2da..e40e283 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c @@ -1271,6 +1271,10 @@ static u16 cxgb_select_queue(struct net_device *dev, struct sk_buff *skb, txq = 0;
[PATCH 3/3] cxgb4: update Kconfig and Makefile for FCoE support
Signed-off-by: Varun Prakash va...@chelsio.com --- drivers/net/ethernet/chelsio/Kconfig| 11 +++ drivers/net/ethernet/chelsio/cxgb4/Makefile |1 + 2 files changed, 12 insertions(+), 0 deletions(-) diff --git a/drivers/net/ethernet/chelsio/Kconfig b/drivers/net/ethernet/chelsio/Kconfig index ac6473f..7daa088 100644 --- a/drivers/net/ethernet/chelsio/Kconfig +++ b/drivers/net/ethernet/chelsio/Kconfig @@ -97,6 +97,17 @@ config CHELSIO_T4_DCB If unsure, say N. +config CHELSIO_T4_FCOE + bool Fibre Channel over Ethernet (FCoE) Support for Chelsio T5 cards + default n + depends on CHELSIO_T4 CHELSIO_T4_DCB FCOE + ---help--- + Enable FCoE offload features. + Say Y here if you want to enable Fibre Channel over Ethernet (FCoE) support + in the driver. + + If unsure, say N. + config CHELSIO_T4VF tristate Chelsio Communications T4/T5 Virtual Function Ethernet support depends on PCI diff --git a/drivers/net/ethernet/chelsio/cxgb4/Makefile b/drivers/net/ethernet/chelsio/cxgb4/Makefile index ae50cd7..07d9b68 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/Makefile +++ b/drivers/net/ethernet/chelsio/cxgb4/Makefile @@ -6,4 +6,5 @@ obj-$(CONFIG_CHELSIO_T4) += cxgb4.o cxgb4-objs := cxgb4_main.o l2t.o t4_hw.o sge.o clip_tbl.o cxgb4-$(CONFIG_CHELSIO_T4_DCB) += cxgb4_dcb.o +cxgb4-$(CONFIG_CHELSIO_T4_FCOE) += cxgb4_fcoe.o cxgb4-$(CONFIG_DEBUG_FS) += cxgb4_debugfs.o -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/3] Fix return code for ioctl( BLKRRPART ) if device is down
On 24/03/2015 11:16, Fam Zheng wrote: If issued right after link down, blockdev --rereadpt will be stuck for a while and then return normally. Although the underlying capacity and partition table are not correctly updated. And it means that userspace can't detect the error at all. Fix this by propargating the error of read capacity command through the stack, so that the ioctl could fail with -EIO. Fam Zheng (3): block: Return error in rescan_partitions if revalidating disk failed sd: Return error in sd_revalidate_disk if read capacity failed sd: Return -EIO if read capacity failed block/partition-generic.c | 6 +++--- drivers/scsi/sd.c | 22 +- 2 files changed, 16 insertions(+), 12 deletions(-) Reviewed-by: Paolo Bonzini pbonz...@redhat.com Though patch 3 could be seen as a change in userspace ABI, so I'm less sure about it. Paolo -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: BUG: SCSI aic7xxx driver and AMD IOMMU
On 03/23/2015 11:03 AM, Joerg Roedel wrote: Hi Mark, On Tue, Mar 03, 2015 at 02:36:19PM -0500, Mark Hounschell wrote: It looks like this problem is NOT a bug with the SCSI aic7xxx driver after all. I can duplicate this BUG very easily with other hardware. Simply removing a driver module (whether it its self, has actually used any of the DMA API or not) that is sitting on the same pci bus as a card that is actually using DMA will cause this. And that card that is in use and using DMA will no longer function. It looks and feels like unloading a module causes the IOMMU to improperly unmap valid mappings. You are right, I looked into the code and found the problem. I'll post a fix for testing this week. I'll be happy to test it. Regards Mark -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/3] Fix return code for ioctl( BLKRRPART ) if device is down
On Tue, 03/24 11:34, Paolo Bonzini wrote: On 24/03/2015 11:16, Fam Zheng wrote: If issued right after link down, blockdev --rereadpt will be stuck for a while and then return normally. Although the underlying capacity and partition table are not correctly updated. And it means that userspace can't detect the error at all. Fix this by propargating the error of read capacity command through the stack, so that the ioctl could fail with -EIO. Fam Zheng (3): block: Return error in rescan_partitions if revalidating disk failed sd: Return error in sd_revalidate_disk if read capacity failed sd: Return -EIO if read capacity failed block/partition-generic.c | 6 +++--- drivers/scsi/sd.c | 22 +- 2 files changed, 16 insertions(+), 12 deletions(-) Reviewed-by: Paolo Bonzini pbonz...@redhat.com Though patch 3 could be seen as a change in userspace ABI, so I'm less sure about it. The changed -EINVAL's are not to userspace before this series, so I think it is OK. Thanks for reviewing. Fam -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/3] sd: Return -EIO if read capacity failed
This improves the error code if BLKRRPART ioctl failed due to connection issue. Before: $ blockdev --rereadpt /dev/sda BLKRRPART: Invalid argument After: $ blockdev --rereadpt /dev/sda BLKRRPART: Input/output error Signed-off-by: Fam Zheng f...@redhat.com --- drivers/scsi/sd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 7e5ca3b..bb0e38d 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2019,7 +2019,7 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp, if (the_result) { sd_print_result(sdkp, Read Capacity(16) failed, the_result); read_capacity_error(sdkp, sdp, sshdr, sense_valid, the_result); - return -EINVAL; + return -EIO; } sector_size = get_unaligned_be32(buffer[8]); @@ -2101,7 +2101,7 @@ static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp, if (the_result) { sd_print_result(sdkp, Read Capacity(10) failed, the_result); read_capacity_error(sdkp, sdp, sshdr, sense_valid, the_result); - return -EINVAL; + return -EIO; } sector_size = get_unaligned_be32(buffer[4]); -- 1.9.3 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/3] block: Return error in rescan_partitions if revalidating disk failed
If the disk can't read capacity, we should return an error. Signed-off-by: Fam Zheng f...@redhat.com --- block/partition-generic.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/block/partition-generic.c b/block/partition-generic.c index 0d9e5f9..1e60d7d 100644 --- a/block/partition-generic.c +++ b/block/partition-generic.c @@ -427,11 +427,11 @@ rescan: return res; if (disk-fops-revalidate_disk) - disk-fops-revalidate_disk(disk); + res = disk-fops-revalidate_disk(disk); check_disk_size_change(disk, bdev); bdev-bd_invalidated = 0; - if (!get_capacity(disk) || !(state = check_partition(disk, bdev))) - return 0; + if (res || !get_capacity(disk) || !(state = check_partition(disk, bdev))) + return res; if (IS_ERR(state)) { /* * I/O error reading the partition table. If any -- 1.9.3 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/3] Fix return code for ioctl( BLKRRPART ) if device is down
If issued right after link down, blockdev --rereadpt will be stuck for a while and then return normally. Although the underlying capacity and partition table are not correctly updated. And it means that userspace can't detect the error at all. Fix this by propargating the error of read capacity command through the stack, so that the ioctl could fail with -EIO. Fam Zheng (3): block: Return error in rescan_partitions if revalidating disk failed sd: Return error in sd_revalidate_disk if read capacity failed sd: Return -EIO if read capacity failed block/partition-generic.c | 6 +++--- drivers/scsi/sd.c | 22 +- 2 files changed, 16 insertions(+), 12 deletions(-) -- 1.9.3 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/3] sd: Return error in sd_revalidate_disk if read capacity failed
When the read capacity commands failed, we should return an error to caller instead of silently continuing as normal. Most importantly, this fixes the error code of BLKRRPART ioctl. Also if the device is down, the following commands also likely to time out, and we could waste more time than necessary. Signed-off-by: Fam Zheng f...@redhat.com --- drivers/scsi/sd.c | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 6b78476..7e5ca3b 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -113,7 +113,7 @@ static int sd_init_command(struct scsi_cmnd *SCpnt); static void sd_uninit_command(struct scsi_cmnd *SCpnt); static int sd_done(struct scsi_cmnd *); static int sd_eh_action(struct scsi_cmnd *, int); -static void sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer); +static int sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer); static void scsi_disk_release(struct device *cdev); static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *); static void sd_print_result(const struct scsi_disk *, const char *, int); @@ -2145,7 +2145,7 @@ static int sd_try_rc16_first(struct scsi_device *sdp) /* * read disk capacity */ -static void +static int sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer) { int sector_size; @@ -2157,17 +2157,17 @@ sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer) if (sector_size == -EOVERFLOW) goto got_data; if (sector_size == -ENODEV) - return; + return -ENODEV; if (sector_size 0) sector_size = read_capacity_10(sdkp, sdp, buffer); if (sector_size 0) - return; + return sector_size; } else { sector_size = read_capacity_10(sdkp, sdp, buffer); if (sector_size == -EOVERFLOW) goto got_data; if (sector_size 0) - return; + return sector_size; if ((sizeof(sdkp-capacity) 4) (sdkp-capacity 0xULL)) { int old_sector_size = sector_size; @@ -2274,6 +2274,7 @@ got_data: blk_queue_physical_block_size(sdp-request_queue, sdkp-physical_block_size); sdkp-device-sector_size = sector_size; + return 0; } /* called with buffer of length 512 */ @@ -2753,6 +2754,7 @@ static int sd_revalidate_disk(struct gendisk *disk) struct scsi_device *sdp = sdkp-device; unsigned char *buffer; unsigned int max_xfer; + int ret = 0; SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, sd_revalidate_disk\n)); @@ -2778,7 +2780,9 @@ static int sd_revalidate_disk(struct gendisk *disk) * react badly if we do. */ if (sdkp-media_present) { - sd_read_capacity(sdkp, buffer); + ret = sd_read_capacity(sdkp, buffer); + if (ret) + goto out; if (sd_try_extended_inquiry(sdp)) { sd_read_block_provisioning(sdkp); @@ -2811,7 +2815,7 @@ static int sd_revalidate_disk(struct gendisk *disk) kfree(buffer); out: - return 0; + return ret; } /** -- 1.9.3 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH] [RESEND] aic7xxx: replace kmalloc/memset by kzalloc
-Original Message- From: Joe Perches [mailto:j...@perches.com] Sent: Tuesday, March 24, 2015 3:57 PM To: Michael Opdenacker Cc: Hannes Reinecke; jbottom...@parallels.com; Elliott, Robert (Server Storage); linux-scsi@vger.kernel.org; linux-ker...@vger.kernel.org Subject: Re: [PATCH] [RESEND] aic7xxx: replace kmalloc/memset by kzalloc On Tue, 2015-03-24 at 13:46 -0700, Michael Opdenacker wrote: ... On 03/22/2015 11:59 PM, Hannes Reinecke wrote: On 03/22/2015 05:31 PM, Michael Opdenacker wrote: This replaces kmalloc + memset by a call to kzalloc (or kcalloc when appropriate, which zeroes memory too) ... I'm sending a version that reverts the use of kcalloc() instead of kzalloc(). For reasons I don't understand, I didn't see the end of Robert Elliott's comment that the use of kcalloc() could prevent the compiler from detecting an overflow. I'm confused. I don't see that comment either, but the entire point of kcalloc is to prevent overflows by returning NULL when an overflow might occur. It was a reply to the original post on 2014-10-16, not the resend this month. From http://permalink.gmane.org/gmane.linux.kernel/1808168: kcalloc is helpful when one of the values is a variable that might cause the multiply to overflow during runtime. Here, two constants are being multiplied together, which can be done and checked by the compiler at compile time. Since kcalloc and kmalloc_array are both static inline functions: static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags) { if (size != 0 n SIZE_MAX / size) return NULL; return __kmalloc(n * size, flags); } static inline void *kcalloc(size_t n, size_t size, gfp_t flags) { return kmalloc_array(n, size, flags | __GFP_ZERO); } a compiler that detects an overflow will probably just reduce that to an inlined return NULL. BUILD_BUG_ON could be used to trigger a compile-time error, instead of building a kernel that returns a run-time error. -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] iscsi-target: Convert iscsi_thread_set usage to kthread.h
On 3/23/2015 2:21 PM, Sagi Grimberg wrote: On 3/21/2015 8:16 AM, Nicholas A. Bellinger wrote: From: Nicholas Bellinger n...@linux-iscsi.org This patch converts iscsi-target code to use modern kthread.h API callers for creating RX/TX threads for each new iscsi_conn descriptor, and releasing associated RX/TX threads during connection shutdown. This is done using iscsit_start_kthreads() - kthread_run() to start new kthreads from within iscsi_post_login_handler(), and invoking kthread_stop() from existing iscsit_close_connection() code. Also, convert iscsit_logout_post_handler_closesession() code to use cmpxchg when determing when iscsit_cause_connection_reinstatement() needs to sleep waiting for completion. I'll run some tests with this. Hi Nic, I can report that this series (minus patch 3/3 and along with some patches I'll send out soon) seems to resolve the list corruption issue I've seen. Overall the patches look good to me so feel free to include patches 1+2 with: Tested-by: Sagi Grimberg sa...@mellanox.com Thanks! Sagi. -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 6/7] scsi: storvsc: Don't assume that the scatterlist is not chained
-Original Message- From: Olaf Hering [mailto:o...@aepfle.de] Sent: Tuesday, March 24, 2015 1:56 AM To: KY Srinivasan Cc: gre...@linuxfoundation.org; linux-ker...@vger.kernel.org; de...@linuxdriverproject.org; jbottom...@parallels.com; h...@infradead.org; linux-scsi@vger.kernel.org; a...@canonical.com; vkuzn...@redhat.com; jasow...@redhat.com Subject: Re: [PATCH 6/7] scsi: storvsc: Don't assume that the scatterlist is not chained On Mon, Mar 23, K. Y. Srinivasan wrote: @@ -653,32 +640,39 @@ static unsigned int copy_from_bounce_buffer(struct scatterlist *orig_sgl, unsigned long bounce_addr = 0; unsigned long dest_addr = 0; unsigned long flags; + struct scatterlist *cur_dest_sgl; + struct scatterlist *cur_src_sgl; local_irq_save(flags); - + cur_dest_sgl = orig_sgl; + cur_src_sgl = bounce_sgl; for (i = 0; i orig_sgl_count; i++) { - dest_addr = sg_kmap_atomic(orig_sgl,i) + orig_sgl[i].offset; + dest_addr = (unsigned long) + kmap_atomic(sg_page(cur_dest_sgl)) + + cur_dest_sgl-offset; dest = dest_addr; destlen = orig_sgl[i].length; + destlen = cur_dest_sgl-length; Double assignment. Thanks Olaf; I will fix this and resubmit. K. Y Olaf
Re: [PATCH 0/3] FCoE support in cxgb4 driver
From: Varun Prakash va...@chelsio.com Date: Tue, 24 Mar 2015 19:14:44 +0530 This patch series enables FCoE support in cxgb4 driver, it enables FCOE_CRC and FCOE_MTU net device features. This series is created against net-next tree. Series applied, thank you. -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] [RESEND] aic7xxx: replace kmalloc/memset by kzalloc
Hi, On 03/22/2015 11:59 PM, Hannes Reinecke wrote: On 03/22/2015 05:31 PM, Michael Opdenacker wrote: This replaces kmalloc + memset by a call to kzalloc (or kcalloc when appropriate, which zeroes memory too) This also fixes one checkpatch.pl issue in the process. This improvement was suggested by make coccicheck Signed-off-by: Michael Opdenacker michael.opdenac...@free-electrons.com Reviewed-by: Hannes Reinecke h...@suse.de I'm sending a version that reverts the use of kcalloc() instead of kzalloc(). For reasons I don't understand, I didn't see the end of Robert Elliott's comment that the use of kcalloc() could prevent the compiler from detecting an overflow. Michael. -- Michael Opdenacker, CEO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com +33 484 258 098 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] [RESEND] aic7xxx: replace kmalloc/memset by kzalloc
On Tue, 2015-03-24 at 13:46 -0700, Michael Opdenacker wrote: Hi, On 03/22/2015 11:59 PM, Hannes Reinecke wrote: On 03/22/2015 05:31 PM, Michael Opdenacker wrote: This replaces kmalloc + memset by a call to kzalloc (or kcalloc when appropriate, which zeroes memory too) This also fixes one checkpatch.pl issue in the process. This improvement was suggested by make coccicheck Signed-off-by: Michael Opdenacker michael.opdenac...@free-electrons.com Reviewed-by: Hannes Reinecke h...@suse.de I'm sending a version that reverts the use of kcalloc() instead of kzalloc(). For reasons I don't understand, I didn't see the end of Robert Elliott's comment that the use of kcalloc() could prevent the compiler from detecting an overflow. I'm confused. I don't see that comment either, but the entire point of kcalloc is to prevent overflows by returning NULL when an overflow might occur. from include/linux/slab.h: /** * kmalloc_array - allocate memory for an array. * @n: number of elements. * @size: element size. * @flags: the type of memory to allocate (see kmalloc). */ static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags) { if (size != 0 n SIZE_MAX / size) return NULL; return __kmalloc(n * size, flags); } /** * kcalloc - allocate memory for an array. The memory is set to zero. * @n: number of elements. * @size: element size. * @flags: the type of memory to allocate (see kmalloc). */ static inline void *kcalloc(size_t n, size_t size, gfp_t flags) { return kmalloc_array(n, size, flags | __GFP_ZERO); } -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 6/7] scsi: storvsc: Don't assume that the scatterlist is not chained
On Mon, Mar 23, K. Y. Srinivasan wrote: @@ -653,32 +640,39 @@ static unsigned int copy_from_bounce_buffer(struct scatterlist *orig_sgl, unsigned long bounce_addr = 0; unsigned long dest_addr = 0; unsigned long flags; + struct scatterlist *cur_dest_sgl; + struct scatterlist *cur_src_sgl; local_irq_save(flags); - + cur_dest_sgl = orig_sgl; + cur_src_sgl = bounce_sgl; for (i = 0; i orig_sgl_count; i++) { - dest_addr = sg_kmap_atomic(orig_sgl,i) + orig_sgl[i].offset; + dest_addr = (unsigned long) + kmap_atomic(sg_page(cur_dest_sgl)) + + cur_dest_sgl-offset; dest = dest_addr; destlen = orig_sgl[i].length; + destlen = cur_dest_sgl-length; Double assignment. Olaf -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html