staging/rdma/hfi1: Use BIT macro
Subsystems (2)
PATCH 1/13 staging/rdma/hfi1: Use BIT macro
This patch fixes the checkpatch issue:
CHECK: Prefer using the BIT macro
--- drivers/staging/rdma/hfi1/chip.h | 48 ++++++++++++++++++------------------ drivers/staging/rdma/hfi1/common.h | 4 +- drivers/staging/rdma/hfi1/diag.c | 4 +- drivers/staging/rdma/hfi1/hfi.h | 22 ++++++++-------- drivers/staging/rdma/hfi1/init.c | 2 +- drivers/staging/rdma/hfi1/mad.c | 4 +- drivers/staging/rdma/hfi1/qp.h | 2 +- drivers/staging/rdma/hfi1/qsfp.h | 10 +++--- drivers/staging/rdma/hfi1/sdma.c | 8 +++--- drivers/staging/rdma/hfi1/verbs.h | 6 ++-- 10 files changed, 55 insertions(+), 55 deletions(-)
drivers/staging/rdma/hfi1/chip.h +24 -24
@@ -241,18 +241,18 @@#define HCMD_SUCCESS 2/* DC_DC8051_DBG_ERR_INFO_SET_BY_8051.ERROR - error flags */ -#define SPICO_ROM_FAILED (1 << 0) -#define UNKNOWN_FRAME (1 << 1) -#define TARGET_BER_NOT_MET (1 << 2) -#define FAILED_SERDES_INTERNAL_LOOPBACK (1 << 3) -#define FAILED_SERDES_INIT (1 << 4) -#define FAILED_LNI_POLLING (1 << 5) -#define FAILED_LNI_DEBOUNCE (1 << 6) -#define FAILED_LNI_ESTBCOMM (1 << 7) -#define FAILED_LNI_OPTEQ (1 << 8) -#define FAILED_LNI_VERIFY_CAP1 (1 << 9) -#define FAILED_LNI_VERIFY_CAP2 (1 << 10) -#define FAILED_LNI_CONFIGLT (1 << 11) +#define SPICO_ROM_FAILED BIT(0) +#define UNKNOWN_FRAME BIT(1) +#define TARGET_BER_NOT_MET BIT(2) +#define FAILED_SERDES_INTERNAL_LOOPBACK BIT(3) +#define FAILED_SERDES_INIT BIT(4) +#define FAILED_LNI_POLLING BIT(5) +#define FAILED_LNI_DEBOUNCE BIT(6) +#define FAILED_LNI_ESTBCOMM BIT(7) +#define FAILED_LNI_OPTEQ BIT(8) +#define FAILED_LNI_VERIFY_CAP1 BIT(9) +#define FAILED_LNI_VERIFY_CAP2 BIT(10) +#define FAILED_LNI_CONFIGLT BIT(11)#define FAILED_LNI (FAILED_LNI_POLLING | FAILED_LNI_DEBOUNCE \ | FAILED_LNI_ESTBCOMM | FAILED_LNI_OPTEQ \
@@ -261,16 +261,16 @@ | FAILED_LNI_CONFIGLT)/* DC_DC8051_DBG_ERR_INFO_SET_BY_8051.HOST_MSG - host message flags */ -#define HOST_REQ_DONE (1 << 0) -#define BC_PWR_MGM_MSG (1 << 1) -#define BC_SMA_MSG (1 << 2) -#define BC_BCC_UNKOWN_MSG (1 << 3) -#define BC_IDLE_UNKNOWN_MSG (1 << 4) -#define EXT_DEVICE_CFG_REQ (1 << 5) -#define VERIFY_CAP_FRAME (1 << 6) -#define LINKUP_ACHIEVED (1 << 7) -#define LINK_GOING_DOWN (1 << 8) -#define LINK_WIDTH_DOWNGRADED (1 << 9) +#define HOST_REQ_DONE BIT(0) +#define BC_PWR_MGM_MSG BIT(1) +#define BC_SMA_MSG BIT(2) +#define BC_BCC_UNKNOWN_MSG BIT(3) +#define BC_IDLE_UNKNOWN_MSG BIT(4) +#define EXT_DEVICE_CFG_REQ BIT(5) +#define VERIFY_CAP_FRAME BIT(6) +#define LINKUP_ACHIEVED BIT(7) +#define LINK_GOING_DOWN BIT(8) +#define LINK_WIDTH_DOWNGRADED BIT(9)/* DC_DC8051_CFG_EXT_DEV_1.REQ_TYPE - 8051 host requests */ #define HREQ_LOAD_CONFIG 0x01
@@ -334,14 +334,14 @@* the CSR fields hold multiples of this value. */ #define RCV_SHIFT 3 -#define RCV_INCREMENT (1 << RCV_SHIFT) +#define RCV_INCREMENT BIT(RCV_SHIFT)/* * Receive header queue entry increment - the CSR holds multiples of * this value. */ #define HDRQ_SIZE_SHIFT 5 -#define HDRQ_INCREMENT (1 << HDRQ_SIZE_SHIFT) +#define HDRQ_INCREMENT BIT(HDRQ_SIZE_SHIFT)/* * Freeze handling flags
drivers/staging/rdma/hfi1/common.h +2 -2
@@ -348,10 +348,10 @@ struct hfi1_message_header {#define HFI1_QPN_MASK 0xFFFFFF#define HFI1_FECN_SHIFT 31#define HFI1_FECN_MASK 1 -#define HFI1_FECN_SMASK (1 << HFI1_FECN_SHIFT) +#define HFI1_FECN_SMASK BIT(HFI1_FECN_SHIFT)#define HFI1_BECN_SHIFT 30#define HFI1_BECN_MASK 1 -#define HFI1_BECN_SMASK (1 << HFI1_BECN_SHIFT) +#define HFI1_BECN_SMASK BIT(HFI1_BECN_SHIFT)#define HFI1_MULTICAST_LID_BASE 0xC000static inline __u64 rhf_to_cpu (const __le32 *rbuf)
drivers/staging/rdma/hfi1/diag.c +2 -2
@@ -78,8 +78,8 @@ hfi1_cdbg(SNOOP, fmt, ##__VA_ARGS__) /* Snoop option mask */ -#define SNOOP_DROP_SEND (1 << 0) -#define SNOOP_USE_METADATA (1 << 1) +#define SNOOP_DROP_SEND BIT(0) +#define SNOOP_USE_METADATA BIT(1)static u8 snoop_flags;
drivers/staging/rdma/hfi1/hfi.h +11 -11
@@ -417,17 +417,17 @@ struct hfi1_sge_state;#define __HLS_GOING_OFFLINE_BP 9#define __HLS_LINK_COOLDOWN_BP 10 -#define HLS_UP_INIT (1 << __HLS_UP_INIT_BP) -#define HLS_UP_ARMED (1 << __HLS_UP_ARMED_BP) -#define HLS_UP_ACTIVE (1 << __HLS_UP_ACTIVE_BP) -#define HLS_DN_DOWNDEF (1 << __HLS_DN_DOWNDEF_BP)/* link down default */ -#define HLS_DN_POLL (1 << __HLS_DN_POLL_BP) -#define HLS_DN_DISABLE (1 << __HLS_DN_DISABLE_BP) -#define HLS_DN_OFFLINE (1 << __HLS_DN_OFFLINE_BP) -#define HLS_VERIFY_CAP (1 << __HLS_VERIFY_CAP_BP) -#define HLS_GOING_UP (1 << __HLS_GOING_UP_BP) -#define HLS_GOING_OFFLINE (1 << __HLS_GOING_OFFLINE_BP) -#define HLS_LINK_COOLDOWN (1 << __HLS_LINK_COOLDOWN_BP) +#define HLS_UP_INIT BIT(__HLS_UP_INIT_BP) +#define HLS_UP_ARMED BIT(__HLS_UP_ARMED_BP) +#define HLS_UP_ACTIVE BIT(__HLS_UP_ACTIVE_BP) +#define HLS_DN_DOWNDEF BIT(__HLS_DN_DOWNDEF_BP)/* link down default */ +#define HLS_DN_POLL BIT(__HLS_DN_POLL_BP) +#define HLS_DN_DISABLE BIT(__HLS_DN_DISABLE_BP) +#define HLS_DN_OFFLINE BIT(__HLS_DN_OFFLINE_BP) +#define HLS_VERIFY_CAP BIT(__HLS_VERIFY_CAP_BP) +#define HLS_GOING_UP BIT(__HLS_GOING_UP_BP) +#define HLS_GOING_OFFLINE BIT(__HLS_GOING_OFFLINE_BP) +#define HLS_LINK_COOLDOWN BIT(__HLS_LINK_COOLDOWN_BP)#define HLS_UP (HLS_UP_INIT | HLS_UP_ARMED | HLS_UP_ACTIVE)
drivers/staging/rdma/hfi1/init.c +1 -1
@@ -252,7 +252,7 @@ struct hfi1_ctxtdata *hfi1_create_ctxtdata(struct hfi1_pportdata *ppd, u32 ctxt)/* Validate and initialize Rcv Hdr Q variables */ if (rcvhdrcnt %HDRQ_INCREMENT ) {dd_dev_err (dd, -"ctxt%u: header queue count %d must be divisible by %d\n" , +"ctxt%u: header queue count %d must be divisible by %lud\n" , rcd->ctxt, rcvhdrcnt,HDRQ_INCREMENT ); goto bail; }
drivers/staging/rdma/hfi1/mad.c +2 -2
@@ -1781,7 +1781,7 @@ static int __subn_get_opa_cable_info(struct opa_smp *smp, u32 am, u8 *data,u32 len =OPA_AM_CI_LEN (am) +1 ;int ret; -#define __CI_PAGE_SIZE (1 << 7)/* 128 bytes */ +#define __CI_PAGE_SIZE BIT(7)/* 128 bytes */ #define __CI_PAGE_MASK ~(__CI_PAGE_SIZE - 1)#define __CI_PAGE_NUM (a) ((a) & __CI_PAGE_MASK)
@@ -3447,7 +3447,7 @@ struct opa_led_info { };#define OPA_LED_SHIFT 31 -#define OPA_LED_MASK (1 << OPA_LED_SHIFT) +#define OPA_LED_MASK BIT(OPA_LED_SHIFT) static int __subn_get_opa_led_info(struct opa_smp *smp, u32 am, u8 *data, struct ib_device *ibdev, u8 port,
drivers/staging/rdma/hfi1/qp.h +1 -1
@@ -54,7 +54,7 @@#include "verbs.h" #include "sdma.h" -#define QPN_MAX (1 << 24) +#define QPN_MAX BIT(24)#define QPNMAP_ENTRIES (QPN_MAX / PAGE_SIZE / BITS_PER_BYTE)/*
drivers/staging/rdma/hfi1/qsfp.h +5 -5
@@ -59,11 +59,11 @@* Below are masks for QSFP pins. Pins are the same for HFI0 and HFI1. * _N means asserted low */ -#define QSFP_HFI0_I2CCLK (1 << 0) -#define QSFP_HFI0_I2CDAT (1 << 1) -#define QSFP_HFI0_RESET_N (1 << 2) -#define QSFP_HFI0_INT_N (1 << 3) -#define QSFP_HFI0_MODPRST_N (1 << 4) +#define QSFP_HFI0_I2CCLK BIT(0) +#define QSFP_HFI0_I2CDAT BIT(1) +#define QSFP_HFI0_RESET_N BIT(2) +#define QSFP_HFI0_INT_N BIT(3) +#define QSFP_HFI0_MODPRST_N BIT(4)/* QSFP is paged at 256 bytes */ #define QSFP_PAGESIZE 256
drivers/staging/rdma/hfi1/sdma.c +4 -4
@@ -112,10 +112,10 @@ MODULE_PARM_DESC(desct_intr, "Number of SDMA descriptor before interrupt"); | SD(ENG_ERR_STATUS_SDMA_HEADER_REQUEST_FIFO_UNC_ERR_SMASK))/* sdma_sendctrl operations */ -#define SDMA_SENDCTRL_OP_ENABLE (1U << 0) -#define SDMA_SENDCTRL_OP_INTENABLE (1U << 1) -#define SDMA_SENDCTRL_OP_HALT (1U << 2) -#define SDMA_SENDCTRL_OP_CLEANUP (1U << 3) +#define SDMA_SENDCTRL_OP_ENABLE BIT(0) +#define SDMA_SENDCTRL_OP_INTENABLE BIT(1) +#define SDMA_SENDCTRL_OP_HALT BIT(2) +#define SDMA_SENDCTRL_OP_CLEANUP BIT(3)/* handle long defines */ #define SDMA_EGRESS_PACKET_OCCUPANCY_SMASK \
drivers/staging/rdma/hfi1/verbs.h +3 -3
@@ -120,9 +120,9 @@ struct hfi1_packet;#define HFI1_VENDOR_IPG cpu_to_be16(0xFFA0) -#define IB_BTH_REQ_ACK (1 << 31) -#define IB_BTH_SOLICITED (1 << 23) -#define IB_BTH_MIG_REQ (1 << 22) +#define IB_BTH_REQ_ACK BIT(31) +#define IB_BTH_SOLICITED BIT(23) +#define IB_BTH_MIG_REQ BIT(22)#define IB_GRH_VERSION 6#define IB_GRH_VERSION_MASK 0xF
Signature · 1 line
1.7.1
A message that is not in the archive (sent off-list or not yet received): 1447227213-15122-1-git-send-email-jubin.john-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
PATCH 2/13 staging/rdma/hfi1: Fix downgrade race
From: Dean Luick <[email protected]>
A link downgrade can race with link up. Avoid the race in two ways. First, by having the downgrade application logic take the link state mutex for all of its checking. Second, by waiting for the link to move out of the going up state.
--- drivers/staging/rdma/hfi1/chip.c | 31 ++++++++++++++++++++++++------- 1 files changed, 24 insertions(+), 7 deletions(-)
drivers/staging/rdma/hfi1/chip.c +24 -7
@@ -3907,18 +3907,32 @@ void handle_verify_cap(struct work_struct *work)*/ void apply_link_downgrade_policy (struct hfi1_pportdata *ppd,int refresh_widths) { -int skip =1 ;int do_bounce =0 ; -u16 lwde = ppd->link_width_downgrade_enabled; +int tries; +u16 lwde;u16 tx, rx; +/* use the hls lock to avoid a race with actual link up */ + tries =0 ; +retry:mutex_lock (&ppd->hls_lock);/* only apply if the link is up */ -if (ppd->host_link_state &HLS_UP ) - skip =0 ; -mutex_unlock (&ppd->hls_lock); -if (skip) -return ; +if (!(ppd->host_link_state &HLS_UP )) { +/* still going up..wait and retry */ +if (ppd->host_link_state &HLS_GOING_UP ) { +if (++tries <1000 ) { +mutex_unlock (&ppd->hls_lock); +usleep_range (100 ,120 );/* arbitrary */ + goto retry; + } +dd_dev_err (ppd->dd, +"%s: giving up waiting for link state change\n" , + __func__); + } + goto done; + } + + lwde = ppd->link_width_downgrade_enabled;if (refresh_widths) {get_link_widths (ppd->dd, &tx, &rx);
@@ -3956,6 +3970,9 @@ void apply_link_downgrade_policy(struct hfi1_pportdata *ppd, int refresh_widths) do_bounce =1 ; } +done: +mutex_unlock (&ppd->hls_lock); +if (do_bounce) {set_link_down_reason (ppd,OPA_LINKDOWN_REASON_WIDTH_POLICY ,0 ,OPA_LINKDOWN_REASON_WIDTH_POLICY );
Signature · 6 lines
1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/13 staging/rdma/hfi1: remove RxCtxRHQS from hfi1stats
In reply to a message not in the archiveFrom: Vennila Megavannan <[email protected]>
Removed the RxCtxRHQS counter being dumped into dev_cntrs
--- drivers/staging/rdma/hfi1/chip.c | 2 -- drivers/staging/rdma/hfi1/chip.h | 1 - drivers/staging/rdma/hfi1/chip_registers.h | 1 - 3 files changed, 0 insertions(+), 4 deletions(-)
drivers/staging/rdma/hfi1/chip.c +0 -2
@@ -1587,8 +1587,6 @@ static struct cntr_entry dev_cntrs[DEV_CNTR_LAST] = { [C_RX_TID_FLGMS] = RXE32_DEV_CNTR_ELEM(RxTidFLGMs,RCV_TID_FLOW_GEN_MISMATCH_CNT , CNTR_NORMAL), -[C_RX_CTX_RHQS ] =RXE32_DEV_CNTR_ELEM (RxCtxRHQS,RCV_CONTEXT_RHQ_STALL , - CNTR_NORMAL), [C_RX_CTX_EGRS ] =RXE32_DEV_CNTR_ELEM (RxCtxEgrS,RCV_CONTEXT_EGR_STALL , CNTR_NORMAL), [C_RCV_TID_FLSMS] = RXE32_DEV_CNTR_ELEM(RxTidFLSMs,
drivers/staging/rdma/hfi1/chip.h +0 -1
@@ -721,7 +721,6 @@ enum {C_RX_TID_FULL ,C_RX_TID_INVALID ,C_RX_TID_FLGMS , -C_RX_CTX_RHQS ,C_RX_CTX_EGRS ,C_RCV_TID_FLSMS , C_CCE_PCI_CR_ST,
drivers/staging/rdma/hfi1/chip_registers.h +0 -1
@@ -379,7 +379,6 @@#define DC_LCB_STS_ROUND_TRIP_LTP_CNT (DC_LCB_CSRS + 0x0000000004B0)#define RCV_BUF_OVFL_CNT 10#define RCV_CONTEXT_EGR_STALL 22 -#define RCV_CONTEXT_RHQ_STALL 21#define RCV_DATA_PKT_CNT 0#define RCV_DWORD_CNT 1#define RCV_TID_FLOW_GEN_MISMATCH_CNT 20
Signature · 6 lines
1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 4/13 staging/rdma/hfi: Remove rcv bubbles code
In reply to a message not in the archiveFrom: Ira Weiny <[email protected]>
Rcv bubbles were improperly calculated for HFIs, fix that here.
--- drivers/staging/rdma/hfi1/mad.c | 64 +------------------------------------- 1 files changed, 2 insertions(+), 62 deletions(-)
drivers/staging/rdma/hfi1/mad.c +2 -62
@@ -2271,34 +2271,8 @@ static void a0_portstatus(struct hfi1_pportdata *ppd, {if (!is_bx (ppd->dd)) {unsigned long vl; -int vfi =0 ;u64 max_vl_xmit_wait =0 , tmp;u32 vl_all_mask =VL_MASK_ALL ; -u64 rcv_data, rcv_bubble; - - rcv_data =be64_to_cpu (rsp->port_rcv_data); - rcv_bubble =be64_to_cpu (rsp->port_rcv_bubble); -/* In the measured time period, calculate the total number -* of flits that were received. Subtract out one false -* rcv_bubble increment for every 32 received flits but -* don't let the number go negative. -*/ -if (rcv_bubble >= (rcv_data>>5 )) { - rcv_bubble -= (rcv_data>>5 ); - rsp->port_rcv_bubble =cpu_to_be64 (rcv_bubble); - } -for_each_set_bit (vl, (unsigned long *)&(vl_select_mask), -8 *sizeof (vl_select_mask)) { - rcv_data =be64_to_cpu (rsp->vls[vfi].port_vl_rcv_data); - rcv_bubble = -be64_to_cpu (rsp->vls[vfi].port_vl_rcv_bubble); -if (rcv_bubble >= (rcv_data>>5 )) { - rcv_bubble -= (rcv_data>>5 ); - rsp->vls[vfi].port_vl_rcv_bubble = -cpu_to_be64 (rcv_bubble); - } - vfi++; - }for_each_set_bit (vl, (unsigned long *)&(vl_all_mask),8 *sizeof (vl_all_mask)) {
@@ -2363,8 +2337,6 @@ static int pma_get_opa_portstatus(struct opa_pma_mad *pmp, CNTR_INVALID_VL)); rsp->port_rcv_data =cpu_to_be64 (read_dev_cntr (dd,C_DC_RCV_FLITS ,CNTR_INVALID_VL )); - rsp->port_rcv_bubble = -cpu_to_be64 (read_dev_cntr (dd,C_DC_RCV_BBL ,CNTR_INVALID_VL )); rsp->port_xmit_pkts =cpu_to_be64 (read_dev_cntr (dd,C_DC_XMIT_PKTS ,CNTR_INVALID_VL )); rsp->port_rcv_pkts = cpu_to_be64(read_dev_cntr(dd, C_DC_RCV_PKTS,
@@ -2434,9 +2406,6 @@ static int pma_get_opa_portstatus(struct opa_pma_mad *pmp, tmp =read_dev_cntr (dd,C_DC_RX_FLIT_VL ,idx_from_vl (vl)); rsp->vls[vfi].port_vl_rcv_data =cpu_to_be64 (tmp); - rsp->vls[vfi].port_vl_rcv_bubble = -cpu_to_be64 (read_dev_cntr (dd,C_DC_RCV_BBL_VL , -idx_from_vl (vl))); rsp->vls[vfi].port_vl_rcv_pkts = cpu_to_be64(read_dev_cntr(dd, C_DC_RX_PKT_VL,
@@ -2519,32 +2488,8 @@ static void a0_datacounters(struct hfi1_devdata *dd, struct _port_dctrs *rsp,if (!is_bx (dd)) {unsigned long vl;int vfi =0 ; -u64 rcv_data, rcv_bubble, sum_vl_xmit_wait =0 ; - - rcv_data =be64_to_cpu (rsp->port_rcv_data); - rcv_bubble =be64_to_cpu (rsp->port_rcv_bubble); -/* In the measured time period, calculate the total number -* of flits that were received. Subtract out one false -* rcv_bubble increment for every 32 received flits but -* don't let the number go negative. -*/ -if (rcv_bubble >= (rcv_data>>5 )) { - rcv_bubble -= (rcv_data>>5 ); - rsp->port_rcv_bubble =cpu_to_be64 (rcv_bubble); - } -for_each_set_bit (vl, (unsigned long *)&(vl_select_mask), -8 *sizeof (vl_select_mask)) { - rcv_data =be64_to_cpu (rsp->vls[vfi].port_vl_rcv_data); - rcv_bubble = -be64_to_cpu (rsp->vls[vfi].port_vl_rcv_bubble); -if (rcv_bubble >= (rcv_data>>5 )) { - rcv_bubble -= (rcv_data>>5 ); - rsp->vls[vfi].port_vl_rcv_bubble = -cpu_to_be64 (rcv_bubble); - } - vfi++; - } - vfi =0 ; +u64 sum_vl_xmit_wait =0 ; +for_each_set_bit (vl, (unsigned long *)&(vl_select_mask),8 *sizeof (vl_select_mask)) { u64 tmp = sum_vl_xmit_wait +
@@ -2635,8 +2580,6 @@ static int pma_get_opa_datacounters(struct opa_pma_mad *pmp, CNTR_INVALID_VL)); rsp->port_rcv_data =cpu_to_be64 (read_dev_cntr (dd,C_DC_RCV_FLITS ,CNTR_INVALID_VL )); - rsp->port_rcv_bubble = -cpu_to_be64 (read_dev_cntr (dd,C_DC_RCV_BBL ,CNTR_INVALID_VL )); rsp->port_xmit_pkts =cpu_to_be64 (read_dev_cntr (dd,C_DC_XMIT_PKTS ,CNTR_INVALID_VL )); rsp->port_rcv_pkts = cpu_to_be64(read_dev_cntr(dd, C_DC_RCV_PKTS,
@@ -2675,9 +2618,6 @@ static int pma_get_opa_datacounters(struct opa_pma_mad *pmp, rsp->vls[vfi].port_vl_rcv_data =cpu_to_be64 (read_dev_cntr (dd,C_DC_RX_FLIT_VL ,idx_from_vl (vl))); - rsp->vls[vfi].port_vl_rcv_bubble = -cpu_to_be64 (read_dev_cntr (dd,C_DC_RCV_BBL_VL , -idx_from_vl (vl))); rsp->vls[vfi].port_vl_xmit_pkts = cpu_to_be64(read_port_cntr(ppd, C_TX_PKT_VL,
Signature · 6 lines
1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 5/13 staging/rdma/hfi1: Add space between concatenated string elements
In reply to a message not in the archiveSpace between concantenated string elements is more human readable and fixes the checkpatch issue:
CHECK: Concatenated strings should use spaces between elements
--- drivers/staging/rdma/hfi1/chip.c | 10 +++++----- drivers/staging/rdma/hfi1/driver.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/staging/rdma/hfi1/chip.c +5 -5
@@ -8865,8 +8865,8 @@ static int request_intx_irq(struct hfi1_devdata *dd) {int ret; -snprintf (dd->intx_name,sizeof (dd->intx_name),DRIVER_NAME "_%d" , - dd->unit); +snprintf (dd->intx_name,sizeof (dd->intx_name),DRIVER_NAME "_%d" , + dd->unit); ret =request_irq (dd->pcidev->irq, general_interrupt,IRQF_SHARED , dd->intx_name, dd);if (ret)
@@ -8968,7 +8968,7 @@ static int request_msix_irqs(struct hfi1_devdata *dd) handler = general_interrupt; arg = dd;snprintf (me->name,sizeof (me->name), -DRIVER_NAME "_%d" , dd->unit); +DRIVER_NAME "_%d" , dd->unit); err_info ="general" ; }else if (first_sdma <= i && i < last_sdma) { idx = i - first_sdma;
@@ -8976,7 +8976,7 @@ static int request_msix_irqs(struct hfi1_devdata *dd) handler = sdma_interrupt; arg = sde;snprintf (me->name,sizeof (me->name), -DRIVER_NAME "_%d sdma%d" , dd->unit, idx); +DRIVER_NAME "_%d sdma%d" , dd->unit, idx); err_info ="sdma" ;remap_sdma_interrupts (dd, idx, i); }else if (first_rx <= i && i < last_rx) {
@@ -8996,7 +8996,7 @@ static int request_msix_irqs(struct hfi1_devdata *dd) thread = receive_context_thread; arg = rcd;snprintf (me->name,sizeof (me->name), -DRIVER_NAME "_%d kctxt%d" , dd->unit, idx); +DRIVER_NAME "_%d kctxt%d" , dd->unit, idx); err_info ="receive context" ;remap_receive_available_interrupt (dd, idx, i); }else {
drivers/staging/rdma/hfi1/driver.c +1 -1
@@ -158,7 +158,7 @@ const char *get_unit_name(int unit) {static char iname[16 ]; -snprintf (iname,sizeof (iname),DRIVER_NAME "_%u" , unit); +snprintf (iname,sizeof (iname),DRIVER_NAME "_%u" , unit);return iname; }
Signature · 6 lines
1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 6/13 staging/rdma/hfi1: Move s_sde to the read mostly portion of the hfi1_qp structure
In reply to a message not in the archiveFrom: Harish Chegondi <[email protected]>
This would reduce L2 cache misses on s_sde in the _hfi1_schedule_send function when invoked from post_send thereby improving performance of post_send.
--- drivers/staging/rdma/hfi1/verbs.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/rdma/hfi1/verbs.h +1 -1
@@ -441,6 +441,7 @@ struct hfi1_qp {struct hfi1_swqe *s_wq;/* send work queue */ struct hfi1_mmap_info *ip;struct ahg_ib_header *s_hdr;/* next packet header to send */ +struct sdma_engine *s_sde;/* current sde */ u8 s_sc;/* SC[0..4] for next packet */ unsigned long timeout_jiffies;/* computed from timeout */
@@ -504,7 +505,6 @@ struct hfi1_qp {struct hfi1_swqe *s_wqe;struct hfi1_sge_state s_sge;/* current send request data */ struct hfi1_mregion *s_rdma_mr; -struct sdma_engine *s_sde;/* current sde */ u32 s_cur_size;/* size of send packet in bytes */ u32 s_len;/* total length of s_sge */ u32 s_rdma_read_len;/* total length of s_rdma_read_sge */
Signature · 6 lines
1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 7/13 staging/rdma/hfi1: rework is_a0() and is_bx()
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
The current is_bx() will incorrectly match on other steppings.
is_a0() is removed in favor of is_ax().
--- drivers/staging/rdma/hfi1/chip.c | 46 ++++++++++++++-------------------- drivers/staging/rdma/hfi1/chip.h | 1 - drivers/staging/rdma/hfi1/firmware.c | 2 +- drivers/staging/rdma/hfi1/hfi.h | 4 +- drivers/staging/rdma/hfi1/init.c | 2 +- drivers/staging/rdma/hfi1/pcie.c | 4 +- 6 files changed, 25 insertions(+), 34 deletions(-)
drivers/staging/rdma/hfi1/chip.c +19 -27
@@ -1871,13 +1871,6 @@ static struct cntr_entry port_cntrs[PORT_CNTR_LAST] = {/* ======================================================================== */ -/* return true if this is chip revision revision a0 */ -int is_a0 (struct hfi1_devdata *dd) -{ -return ((dd->revision >>CCE_REVISION_CHIP_REV_MINOR_SHIFT ) - &CCE_REVISION_CHIP_REV_MINOR_MASK ) ==0 ; -} -/* return true if this is chip revision revision a */ int is_ax (struct hfi1_devdata *dd) {
@@ -1893,7 +1886,7 @@ int is_bx(struct hfi1_devdata *dd)u8 chip_rev_minor = dd->revision >>CCE_REVISION_CHIP_REV_MINOR_SHIFT &CCE_REVISION_CHIP_REV_MINOR_MASK ; -return !!(chip_rev_minor &0x10 ); +return (chip_rev_minor &0xF0 ) ==0x10 ; }/*
@@ -2188,9 +2181,8 @@ static void handle_cce_err(struct hfi1_devdata *dd, u32 unused, u64 reg)dd_dev_info (dd,"CCE Error: %s\n" ,cce_err_status_string (buf,sizeof (buf), reg)); -if ((reg &CCE_ERR_STATUS_CCE_CLI2_ASYNC_FIFO_PARITY_ERR_SMASK ) - &&is_a0 (dd) - && (dd->icode !=ICODE_FUNCTIONAL_SIMULATOR )) { +if ((reg &CCE_ERR_STATUS_CCE_CLI2_ASYNC_FIFO_PARITY_ERR_SMASK ) && +is_ax (dd) && (dd->icode !=ICODE_FUNCTIONAL_SIMULATOR )) {/* this error requires a manual drop into SPC freeze mode */ /* then a fix up */ start_freeze_handling (dd->pport,FREEZE_SELF );
@@ -2250,7 +2242,7 @@ static void handle_rxe_err(struct hfi1_devdata *dd, u32 unused, u64 reg)* Freeze mode recovery is disabled for the errors * in RXE_FREEZE_ABORT_MASK */ -if (is_a0 (dd) && (reg &RXE_FREEZE_ABORT_MASK )) +if (is_ax (dd) && (reg &RXE_FREEZE_ABORT_MASK )) flags =FREEZE_ABORT ;start_freeze_handling (dd->pport, flags);
@@ -2353,7 +2345,7 @@ static void handle_egress_err(struct hfi1_devdata *dd, u32 unused, u64 reg)if (reg &ALL_TXE_EGRESS_FREEZE_ERR )start_freeze_handling (dd->pport,0 ); -if (is_a0 (dd) && (reg & +if (is_ax (dd) && (reg &SEND_EGRESS_ERR_STATUS_TX_CREDIT_RETURN_VL_ERR_SMASK ) && (dd->icode !=ICODE_FUNCTIONAL_SIMULATOR ))start_freeze_handling (dd->pport,0 );
@@ -3048,7 +3040,7 @@ static void adjust_lcb_for_fpga_serdes(struct hfi1_devdata *dd)/* else this is _p */ version =emulator_rev (dd); -if (!is_a0 (dd)) +if (!is_ax (dd)) version =0x2d ;/* all B0 use 0x2d or higher settings */ if (version <=0x12 ) {
@@ -3334,7 +3326,7 @@ void handle_freeze(struct work_struct *work)write_csr (dd,CCE_CTRL ,CCE_CTRL_SPC_UNFREEZE_SMASK );wait_for_freeze_status (dd,0 ); -if (is_a0 (dd)) { +if (is_ax (dd)) {write_csr (dd,CCE_CTRL ,CCE_CTRL_SPC_FREEZE_SMASK );wait_for_freeze_status (dd,1 );write_csr (dd,CCE_CTRL ,CCE_CTRL_SPC_UNFREEZE_SMASK );
@@ -3862,7 +3854,7 @@ void handle_verify_cap(struct work_struct *work)* REPLAY_BUF_MBE_SMASK * FLIT_INPUT_BUF_MBE_SMASK */ -if (is_a0 (dd)) {/* fixed in B0 */ +if (is_ax (dd)) {/* fixed in B0 */ reg =read_csr (dd,DC_LCB_CFG_LINK_KILL_EN ); reg |=DC_LCB_CFG_LINK_KILL_EN_REPLAY_BUF_MBE_SMASK |DC_LCB_CFG_LINK_KILL_EN_FLIT_INPUT_BUF_MBE_SMASK ;
@@ -7297,8 +7289,8 @@ static int set_buffer_control(struct hfi1_devdata *dd,*/ use_all_mask =0 ;if ((be16_to_cpu (new_bc->overall_shared_limit) < -be16_to_cpu (cur_bc.overall_shared_limit)) - || (is_a0 (dd) && any_shared_limit_changing)) { +be16_to_cpu (cur_bc.overall_shared_limit)) || + (is_ax (dd) && any_shared_limit_changing)) {set_global_shared (dd,0 ); cur_bc.overall_shared_limit =0 ; use_all_mask =1 ;
@@ -7472,7 +7464,7 @@ int fm_set_table(struct hfi1_pportdata *ppd, int which, void *t)*/ static int disable_data_vls (struct hfi1_devdata *dd) { -if (is_a0 (dd)) +if (is_ax (dd))return 1 ;pio_send_control (dd,PSC_DATA_VL_DISABLE );
@@ -7490,7 +7482,7 @@ static int disable_data_vls(struct hfi1_devdata *dd)*/ int open_fill_data_vls (struct hfi1_devdata *dd) { -if (is_a0 (dd)) +if (is_ax (dd))return 1 ;pio_send_control (dd,PSC_DATA_VL_ENABLE );
@@ -9921,7 +9913,7 @@ static void init_chip(struct hfi1_devdata *dd)/* restore command and BARs */ restore_pci_variables (dd); -if (is_a0 (dd)) { +if (is_ax (dd)) {dd_dev_info (dd,"Resetting CSRs with FLR\n" );hfi1_pcie_flr (dd);restore_pci_variables (dd);
@@ -9940,7 +9932,7 @@ static void init_chip(struct hfi1_devdata *dd)write_csr (dd,CCE_DC_CTRL ,0 );/* Set the LED off */ -if (is_a0 (dd)) +if (is_ax (dd))setextled (dd,0 );/* * Clear the QSFP reset.
@@ -9953,7 +9945,7 @@ static void init_chip(struct hfi1_devdata *dd)* I2CCLK and I2CDAT will change per direction, and INT_N and * MODPRS_N are input only and their value is ignored. */ -if (is_a0 (dd)) { +if (is_ax (dd)) {write_csr (dd,ASIC_QSFP1_OUT ,0x1f );write_csr (dd,ASIC_QSFP2_OUT ,0x1f ); }
@@ -9966,7 +9958,7 @@ static void init_early_variables(struct hfi1_devdata *dd)/* assign link credit variables */ dd->vau =CM_VAU ; dd->link_credits =CM_GLOBAL_CREDITS ; -if (is_a0 (dd)) +if (is_ax (dd)) dd->link_credits--; dd->vcu =cu_to_vcu (hfi1_cu);/* enough room for 8 MAD packets plus header - 17K */
@@ -10080,7 +10072,7 @@ static void init_qos(struct hfi1_devdata *dd, u32 first_ctxt)unsigned qpns_per_vl, ctxt, i, qpn, n =1 , m;u64 *rsmmap;u64 reg; -u8 rxcontext =is_a0 (dd) ?0 :0xff ;/* 0 is default if a0 ver. */ +u8 rxcontext =is_ax (dd) ?0 :0xff ;/* 0 is default if a0 ver. */ /* validate */ if (dd->n_krcv_queues <= MIN_KERNEL_KCTXTS ||
@@ -10291,7 +10283,7 @@ int hfi1_set_ctxt_jkey(struct hfi1_devdata *dd, unsigned ctxt, u16 jkey)* Enable send-side J_KEY integrity check, unless this is A0 h/w * (due to A0 erratum). */ -if (!is_a0 (dd)) { +if (!is_ax (dd)) { reg =read_kctxt_csr (dd, sctxt,SEND_CTXT_CHECK_ENABLE ); reg |=SEND_CTXT_CHECK_ENABLE_CHECK_JOB_KEY_SMASK ;write_kctxt_csr (dd, sctxt,SEND_CTXT_CHECK_ENABLE , reg);
@@ -10324,7 +10316,7 @@ int hfi1_clear_ctxt_jkey(struct hfi1_devdata *dd, unsigned ctxt)* This check would not have been enabled for A0 h/w, see * set_ctxt_jkey(). */ -if (!is_a0 (dd)) { +if (!is_ax (dd)) { reg =read_kctxt_csr (dd, sctxt,SEND_CTXT_CHECK_ENABLE ); reg &= ~SEND_CTXT_CHECK_ENABLE_CHECK_JOB_KEY_SMASK ;write_kctxt_csr (dd, sctxt,SEND_CTXT_CHECK_ENABLE , reg);
drivers/staging/rdma/hfi1/chip.h +0 -1
@@ -663,7 +663,6 @@ void get_linkup_link_widths(struct hfi1_pportdata *ppd);void read_ltp_rtt (struct hfi1_devdata *dd);void clear_linkup_counters (struct hfi1_devdata *dd);u32 hdrqempty (struct hfi1_ctxtdata *rcd); -int is_a0 (struct hfi1_devdata *dd);int is_ax (struct hfi1_devdata *dd);int is_bx (struct hfi1_devdata *dd);u32 read_physical_state (struct hfi1_devdata *dd);
drivers/staging/rdma/hfi1/firmware.c +1 -1
@@ -951,7 +951,7 @@ void sbus_request(struct hfi1_devdata *dd,static void turn_off_spicos (struct hfi1_devdata *dd,int flags) {/* only needed on A0 */ -if (!is_a0 (dd)) +if (!is_ax (dd))return ; dd_dev_info(dd, "Turning off spicos:%s%s\n",
drivers/staging/rdma/hfi1/hfi.h +2 -2
@@ -1713,7 +1713,7 @@ static inline u64 hfi1_pkt_default_send_ctxt_mask(struct hfi1_devdata *dd,else base_sc_integrity |=HFI1_PKT_KERNEL_SC_INTEGRITY ; -if (is_a0 (dd)) +if (is_ax (dd))/* turn off send-side job key checks - A0 erratum */ return base_sc_integrity & ~SEND_CTXT_CHECK_ENABLE_CHECK_JOB_KEY_SMASK ;
@@ -1740,7 +1740,7 @@ static inline u64 hfi1_pkt_base_sdma_integrity(struct hfi1_devdata *dd) | SEND_DMA_CHECK_ENABLE_CHECK_VL_SMASK |SEND_DMA_CHECK_ENABLE_CHECK_ENABLE_SMASK ; -if (is_a0 (dd)) +if (is_ax (dd))/* turn off send-side job key checks - A0 erratum */ return base_sdma_integrity & ~SEND_DMA_CHECK_ENABLE_CHECK_JOB_KEY_SMASK ;
drivers/staging/rdma/hfi1/init.c +1 -1
@@ -670,7 +670,7 @@ int hfi1_init(struct hfi1_devdata *dd, int reinit) dd->process_dma_send = hfi1_verbs_send_dma; dd->pio_inline_send = pio_copy; -if (is_a0 (dd)) { +if (is_ax (dd)) {atomic_set (&dd->drop_packet,DROP_PACKET_ON ); dd->do_drop =1 ; }else {
drivers/staging/rdma/hfi1/pcie.c +2 -2
@@ -915,7 +915,7 @@ int do_pcie_gen3_transition(struct hfi1_devdata *dd)/* * A0 needs an additional SBR */ -if (is_a0 (dd)) +if (is_ax (dd)) nsbr++;/*
@@ -1201,7 +1201,7 @@ retry:write_csr (dd,CCE_DC_CTRL ,0 );/* Set the LED off */ -if (is_a0 (dd)) +if (is_ax (dd))setextled (dd,0 );/* check for any per-lane errors */
Signature · 6 lines
1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 8/13 staging/rdma/hfi1: change krcvqs module parameter type from byte to uint
In reply to a message not in the archiveFrom: Mark F. Brown <[email protected]>
The krcvqs parameter is displayed incorrectly in sysfs. The workaround is to set the param type as uint.
--- drivers/staging/rdma/hfi1/hfi.h | 2 +- drivers/staging/rdma/hfi1/init.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rdma/hfi1/hfi.h +1 -1
@@ -1651,7 +1651,7 @@ extern unsigned int hfi1_cu;extern unsigned int user_credit_return_threshold;extern uint num_rcv_contexts;extern unsigned n_krcvqs; -extern u8 krcvqs[]; +extern uint krcvqs[];extern int krcvqsset;extern uint kdeth_qp;extern uint loopback;
drivers/staging/rdma/hfi1/init.c +2 -2
@@ -86,9 +86,9 @@ module_param_named(num_rcv_contexts, num_rcv_contexts, uint, S_IRUGO);MODULE_PARM_DESC ( num_rcv_contexts,"Set max number of user receive contexts to use" ); -u8 krcvqs[RXE_NUM_DATA_VL ]; +uint krcvqs[RXE_NUM_DATA_VL ];int krcvqsset; -module_param_array (krcvqs, byte, &krcvqsset,S_IRUGO ); +module_param_array (krcvqs, uint, &krcvqsset,S_IRUGO );MODULE_PARM_DESC (krcvqs,"Array of the number of kernel receive queues by VL" );/* computed based on above array */
Signature · 6 lines
1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 9/13 staging/rdma/hfi1: Change default krcvqs
In reply to a message not in the archiveChange the default number of krcvqs to number of numa nodes + 1 based on the performance data collected.
--- drivers/staging/rdma/hfi1/chip.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/rdma/hfi1/chip.c +1 -1
@@ -9174,7 +9174,7 @@ static int set_up_context_variables(struct hfi1_devdata *dd)if (n_krcvqs) num_kernel_contexts = n_krcvqs +MIN_KERNEL_KCTXTS ;else - num_kernel_contexts =num_online_nodes (); + num_kernel_contexts =num_online_nodes () +1 ; num_kernel_contexts =max_t (int,MIN_KERNEL_KCTXTS , num_kernel_contexts);/*
Signature · 6 lines
1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 10/13 staging/rdma/hfi1: adding per SDMA engine stats to hfistats
In reply to a message not in the archiveFrom: Vennila Megavannan <[email protected]>
Added the following per sdma engine stats:
- SendDmaDescFetchedCnt
- software maintained count of SDMA interrupts (SDmaInt, SDmaIdleInt, SDmaProgressInt)
- software maintained counts of SDMA error cases
--- drivers/staging/rdma/hfi1/chip.c | 110 +++++++++++++++++++++++++++- drivers/staging/rdma/hfi1/chip.h | 5 + drivers/staging/rdma/hfi1/chip_registers.h | 1 + drivers/staging/rdma/hfi1/hfi.h | 1 + drivers/staging/rdma/hfi1/sdma.c | 9 ++- drivers/staging/rdma/hfi1/sdma.h | 7 ++ 6 files changed, 129 insertions(+), 4 deletions(-)
drivers/staging/rdma/hfi1/chip.c +107 -3
@@ -1296,10 +1296,58 @@ static u64 dev_access_u32_csr(const struct cntr_entry *entry, void *context, int vl, int mode, u64 data) { struct hfi1_devdata *dd = context; +u64 csr = entry->csr; -if (vl !=CNTR_INVALID_VL ) -return 0 ; -return read_write_csr (dd, entry->csr, mode, data); +if (entry->flags &CNTR_SDMA ) { +if (vl ==CNTR_INVALID_VL ) +return 0 ; + csr +=0x100 * vl; + }else { +if (vl !=CNTR_INVALID_VL ) +return 0 ; + } +return read_write_csr (dd, csr, mode, data); +} + +static u64 access_sde_err_cnt (const struct cntr_entry *entry, +void *context,int idx,int mode,u64 data) +{ +struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + +if (dd->per_sdma && idx < dd->num_sdma) +return dd->per_sdma[idx].err_cnt; +return 0 ; +} + +static u64 access_sde_int_cnt (const struct cntr_entry *entry, +void *context,int idx,int mode,u64 data) +{ +struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + +if (dd->per_sdma && idx < dd->num_sdma) +return dd->per_sdma[idx].sdma_int_cnt; +return 0 ; +} + +static u64 access_sde_idle_int_cnt (const struct cntr_entry *entry, +void *context,int idx,int mode,u64 data) +{ +struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + +if (dd->per_sdma && idx < dd->num_sdma) +return dd->per_sdma[idx].idle_int_cnt; +return 0 ; +} + +static u64 access_sde_progress_int_cnt (const struct cntr_entry *entry, +void *context,int idx,int mode, +u64 data) +{ +struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + +if (dd->per_sdma && idx < dd->num_sdma) +return dd->per_sdma[idx].progress_int_cnt; +return 0 ; } static u64 dev_access_u64_csr(const struct cntr_entry *entry, void *context,
@@ -1728,6 +1776,22 @@ static struct cntr_entry dev_cntrs[DEV_CNTR_LAST] = { access_sw_kmem_wait), [C_SW_SEND_SCHED ] =CNTR_ELEM ("SendSched" ,0 ,0 ,CNTR_NORMAL , access_sw_send_schedule), +[C_SDMA_DESC_FETCHED_CNT ] =CNTR_ELEM ("SDEDscFdCn" , +SEND_DMA_DESC_FETCHED_CNT ,0 , +CNTR_NORMAL |CNTR_32BIT |CNTR_SDMA , + dev_access_u32_csr), +[C_SDMA_INT_CNT ] =CNTR_ELEM ("SDMAInt" ,0 ,0 , +CNTR_NORMAL |CNTR_32BIT |CNTR_SDMA , + access_sde_int_cnt), +[C_SDMA_ERR_CNT ] =CNTR_ELEM ("SDMAErrCt" ,0 ,0 , +CNTR_NORMAL |CNTR_32BIT |CNTR_SDMA , + access_sde_err_cnt), +[C_SDMA_IDLE_INT_CNT ] =CNTR_ELEM ("SDMAIdInt" ,0 ,0 , +CNTR_NORMAL |CNTR_32BIT |CNTR_SDMA , + access_sde_idle_int_cnt), +[C_SDMA_PROGRESS_INT_CNT ] =CNTR_ELEM ("SDMAPrIntCn" ,0 ,0 , +CNTR_NORMAL |CNTR_32BIT |CNTR_SDMA , + access_sde_progress_int_cnt) };static struct cntr_entry port_cntrs[PORT_CNTR_LAST ] = {
@@ -2520,6 +2584,7 @@ static void handle_sdma_eng_err(struct hfi1_devdata *dd,dd_dev_err (sde->dd,"CONFIG SDMA(%u) source: %u status 0x%llx\n" , sde->this_idx, source, (unsigned long long )status);#endif + sde->err_cnt++;sdma_engine_error (sde, status); }
@@ -7885,6 +7950,20 @@ u32 hfi1_read_cntrs(struct hfi1_devdata *dd, loff_t pos, char **namep, dd->cntrs[entry->offset + j] = val; } + }else if (entry->flags &CNTR_SDMA ) { +hfi1_cdbg (CNTR , +"\t Per SDMA Engine\n" ); +for (j =0 ; j < dd->chip_sdma_engines; + j++) { + val = + entry->rw_cntr (entry, dd, j, +CNTR_MODE_R ,0 ); +hfi1_cdbg (CNTR , +"\t\tRead 0x%llx for %d\n" , + val, j); + dd->cntrs[entry->offset + j] = + val; + } }else { val = entry->rw_cntr(entry, dd, CNTR_INVALID_VL,
@@ -8288,6 +8367,21 @@ static int init_cntrs(struct hfi1_devdata *dd) dd->ndevcntrs++; index++; } + }else if (dev_cntrs[i].flags &CNTR_SDMA ) { +hfi1_dbg_early ( +"\tProcessing per SDE counters chip enginers %u\n" , + dd->chip_sdma_engines); + dev_cntrs[i].offset = index; +for (j =0 ; j < dd->chip_sdma_engines; j++) { +memset (name,'\0' ,C_MAX_NAME ); +snprintf (name,C_MAX_NAME ,"%s%d" , + dev_cntrs[i].name, j); + sz +=strlen (name); + sz++; +hfi1_dbg_early ("\t\t%s\n" , name); + dd->ndevcntrs++; + index++; + } }else {/* +1 for newline */ sz +=strlen (dev_cntrs[i].name) +1 ;
@@ -8329,6 +8423,16 @@ static int init_cntrs(struct hfi1_devdata *dd) p +=strlen (name); *p++ ='\n' ; } + }else if (dev_cntrs[i].flags &CNTR_SDMA ) { +for (j =0 ; j <TXE_NUM_SDMA_ENGINES ; + j++) { +memset (name,'\0' ,C_MAX_NAME ); +snprintf (name,C_MAX_NAME ,"%s%d" , + dev_cntrs[i].name, j); +memcpy (p, name,strlen (name)); + p +=strlen (name); + *p++ ='\n' ; + } }else {memcpy (p, dev_cntrs[i].name,strlen (dev_cntrs[i].name));
drivers/staging/rdma/hfi1/chip.h +5 -0
@@ -786,6 +786,11 @@ enum {C_SW_PIO_WAIT ,C_SW_KMEM_WAIT ,C_SW_SEND_SCHED , +C_SDMA_DESC_FETCHED_CNT , +C_SDMA_INT_CNT , +C_SDMA_ERR_CNT , +C_SDMA_IDLE_INT_CNT , +C_SDMA_PROGRESS_INT_CNT ,DEV_CNTR_LAST /* Must be kept last */ };
drivers/staging/rdma/hfi1/chip_registers.h +1 -0
@@ -1287,5 +1287,6 @@#define CCE_INT_BLOCKED (CCE + 0x000000110C00)#define SEND_DMA_IDLE_CNT (TXE + 0x000000200040)#define SEND_DMA_DESC_FETCHED_CNT (TXE + 0x000000200058) +#define CCE_MSIX_PBA_OFFSET 0X0110000#endif /* DEF_CHIP_REG */
drivers/staging/rdma/hfi1/hfi.h +1 -0
@@ -483,6 +483,7 @@ struct hfi1_sge_state;#define CNTR_DISABLED 0x2/* Disable this counter */ #define CNTR_32BIT 0x4/* Simulate 64 bits for this counter */ #define CNTR_VL 0x8/* Per VL counter */ +#define CNTR_SDMA 0x10#define CNTR_INVALID_VL -1/* Specifies invalid VL */ #define CNTR_MODE_W 0x0#define CNTR_MODE_R 0x1
drivers/staging/rdma/hfi1/sdma.c +8 -1
@@ -1065,7 +1065,6 @@ int sdma_init(struct hfi1_devdata *dd, u8 port) sde->desc_avail =sdma_descq_freecnt (sde); sde->sdma_shift =ilog2 (descq_cnt); sde->sdma_mask = (1 << sde->sdma_shift) -1 ; - sde->descq_full_count =0 ;/* Create a mask for all 3 chip interrupt sources */ sde->imask = (u64 )1 << (0 *TXE_NUM_SDMA_ENGINES + this_idx)
@@ -1077,6 +1076,8 @@ int sdma_init(struct hfi1_devdata *dd, u8 port)/* Create a mask specifically for sdma_progress */ sde->progress_mask = (u64 )1 << (TXE_NUM_SDMA_ENGINES + this_idx); + sde->int_mask = + (u64 )1 << (0 *TXE_NUM_SDMA_ENGINES + this_idx);spin_lock_init (&sde->tail_lock);seqlock_init (&sde->head_lock);spin_lock_init (&sde->senddmactrl_lock);
@@ -1556,6 +1557,12 @@ void sdma_engine_interrupt(struct sdma_engine *sde, u64 status)trace_hfi1_sdma_engine_interrupt (sde, status);write_seqlock (&sde->head_lock);sdma_set_desc_cnt (sde, sdma_desct_intr); +if (status & sde->idle_mask) + sde->idle_int_cnt++; +else if (status & sde->progress_mask) + sde->progress_int_cnt++; +else if (status & sde->int_mask) + sde->sdma_int_cnt++;sdma_make_progress (sde, status);write_sequnlock (&sde->head_lock); }
drivers/staging/rdma/hfi1/sdma.h +7 -0
@@ -409,6 +409,7 @@ struct sdma_engine {u64 imask;/* clear interrupt mask */ u64 idle_mask;u64 progress_mask; +u64 int_mask;/* private: */ struct workqueue_struct *wq;/* private: */
@@ -465,6 +466,12 @@ struct sdma_engine {u16 tx_head;/* private: */ u64 last_status; +/* private */ +u64 err_cnt; +/* private */ +u64 sdma_int_cnt; +u64 idle_int_cnt; +u64 progress_int_cnt;/* private: */ struct list_head dmawait;
Signature · 6 lines
1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1447227213-15122-10-git-send-email-jubin.john-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Re: [PATCH 10/13] staging/rdma/hfi1: adding per SDMA engine stats to hfistats
drivers/staging/rdma/hfi1/chip.c static int init_cntrs(struct hfi1_devdata *dd) · line 8376
Quoted 11 lines · Jubin John
drivers/staging/rdma/hfi1/chip.c +7
-0@@ -8288,6 +8367,21 @@ static int init_cntrs(struct hfi1_devdata *dd) dd->ndevcntrs++; index++; } + }else if (dev_cntrs[i].flags &CNTR_SDMA ) { +hfi1_dbg_early ( +"\tProcessing per SDE counters chip enginers %u\n" , + dd->chip_sdma_engines); + dev_cntrs[i].offset = index; +for (j =0 ; j < dd->chip_sdma_engines; j++) { +memset (name,'\0' ,C_MAX_NAME );
This patch is ok, but none of the memsets in this function are needed. You could remove them in a later patch.
drivers/staging/rdma/hfi1/chip.c static int init_cntrs(struct hfi1_devdata *dd) · line 8381
Quoted 5 lines
drivers/staging/rdma/hfi1/chip.c +5
-0+snprintf (name,C_MAX_NAME ,"%s%d" , + dev_cntrs[i].name, j); + sz +=strlen (name); + sz++; +hfi1_dbg_early ("\t\t%s\n" , name);
We're basically just trying to calculate a bunch of strlen()s but there is a lot of extra code to generate debug output. It would be better to remove it in a later patch.
drivers/staging/rdma/hfi1/chip.c static int init_cntrs(struct hfi1_devdata *dd) · line 8384
Quoted 3 lines
drivers/staging/rdma/hfi1/chip.c +3
-0+ dd->ndevcntrs++; + index++; + }
regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 10/13] staging/rdma/hfi1: adding per SDMA engine stats to hfistats
Quoted 26 lines · Dan Carpenter
drivers/staging/rdma/hfi1/chip.c static int init_cntrs(struct hfi1_devdata *dd) · line 8376
Quoted 11 lines · Jubin John
drivers/staging/rdma/hfi1/chip.c +7
-0@@ -8288,6 +8367,21 @@ static int init_cntrs(struct hfi1_devdata *dd) dd->ndevcntrs++; index++; } + }else if (dev_cntrs[i].flags &CNTR_SDMA ) { +hfi1_dbg_early ( +"\tProcessing per SDE counters chip enginers %u\n" , + dd->chip_sdma_engines); + dev_cntrs[i].offset = index; +for (j =0 ; j < dd->chip_sdma_engines; j++) { +memset (name,'\0' ,C_MAX_NAME );This patch is ok, but none of the memsets in this function are needed. You could remove them in a later patch.
drivers/staging/rdma/hfi1/chip.c static int init_cntrs(struct hfi1_devdata *dd) · line 8381
Quoted 5 lines
drivers/staging/rdma/hfi1/chip.c +5
-0+snprintf (name,C_MAX_NAME ,"%s%d" , + dev_cntrs[i].name, j); + sz +=strlen (name); + sz++; +hfi1_dbg_early ("\t\t%s\n" , name);We're basically just trying to calculate a bunch of strlen()s but there is a lot of extra code to generate debug output. It would be better to remove it in a later patch.
Quoted 6 lines
drivers/staging/rdma/hfi1/chip.c static int init_cntrs(struct hfi1_devdata *dd) · line 8384
Quoted 3 lines
drivers/staging/rdma/hfi1/chip.c +3
-0+ dd->ndevcntrs++; + index++; + }regards,
dan carpenter
Hi Dan,
I will let this patch stand as-is and follow up with a clean up patch to remove the memsets and the debug code.
Thanks,
Jubin John
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 11/13 staging/rdma/hfi1: Remove unneeded variable index
In reply to a message not in the archiveFrom: Dean Luick <[email protected]>
The variable "index" increments the same as dd->ndevcntrs. Just use the later. Remove uneeded usage of "index" in the fill loop - it is not used there or later in the function.
--- drivers/staging/rdma/hfi1/chip.c | 19 +++++++------------ 1 files changed, 7 insertions(+), 12 deletions(-)
drivers/staging/rdma/hfi1/chip.c +7 -12
@@ -8327,7 +8327,7 @@ mod_timer(&dd->synth_stats_timer, jiffies + HZ * SYNTH_CNT_TIME);#define C_MAX_NAME 13/* 12 chars + one for /0 */ static int init_cntrs (struct hfi1_devdata *dd) { -int i, rcv_ctxts, index, j; +int i, rcv_ctxts, j;size_t sz;char *p;char name[C_MAX_NAME ];
@@ -8344,7 +8344,6 @@ static int init_cntrs(struct hfi1_devdata *dd)/* size names and determine how many we have*/ dd->ndevcntrs =0 ; sz =0 ; - index =0 ;for (i =0 ; i <DEV_CNTR_LAST ; i++) {hfi1_dbg_early ("Init cntr %s\n" , dev_cntrs[i].name);
@@ -8355,7 +8354,7 @@ static int init_cntrs(struct hfi1_devdata *dd)if (dev_cntrs[i].flags &CNTR_VL ) {hfi1_dbg_early ("\tProcessing VL cntr\n" ); - dev_cntrs[i].offset = index; + dev_cntrs[i].offset = dd->ndevcntrs;for (j =0 ; j <C_VL_COUNT ; j++) {memset (name,'\0' ,C_MAX_NAME ); snprintf(name, C_MAX_NAME, "%s%d",
@@ -8365,13 +8364,12 @@ static int init_cntrs(struct hfi1_devdata *dd) sz++;hfi1_dbg_early ("\t\t%s\n" , name); dd->ndevcntrs++; - index++; } }else if (dev_cntrs[i].flags &CNTR_SDMA ) {hfi1_dbg_early ("\tProcessing per SDE counters chip enginers %u\n" , dd->chip_sdma_engines); - dev_cntrs[i].offset = index; + dev_cntrs[i].offset = dd->ndevcntrs;for (j =0 ; j < dd->chip_sdma_engines; j++) {memset (name,'\0' ,C_MAX_NAME ); snprintf(name, C_MAX_NAME, "%s%d",
@@ -8380,24 +8378,22 @@ static int init_cntrs(struct hfi1_devdata *dd) sz++;hfi1_dbg_early ("\t\t%s\n" , name); dd->ndevcntrs++; - index++; } }else {/* +1 for newline */ sz +=strlen (dev_cntrs[i].name) +1 ; + dev_cntrs[i].offset = dd->ndevcntrs; dd->ndevcntrs++; - dev_cntrs[i].offset = index; - index++;hfi1_dbg_early ("\tAdding %s\n" , dev_cntrs[i].name); } }/* allocate space for the counter values */ - dd->cntrs =kcalloc (index,sizeof (u64),GFP_KERNEL ); + dd->cntrs =kcalloc (dd->ndevcntrs,sizeof (u64),GFP_KERNEL );if (!dd->cntrs) goto bail; - dd->scntrs =kcalloc (index,sizeof (u64),GFP_KERNEL ); + dd->scntrs =kcalloc (dd->ndevcntrs,sizeof (u64),GFP_KERNEL );if (!dd->scntrs) goto bail;
@@ -8409,7 +8405,7 @@ static int init_cntrs(struct hfi1_devdata *dd) goto bail;/* fill in the names */ -for (p = dd->cntrnames, i =0 , index =0 ; i <DEV_CNTR_LAST ; i++) { +for (p = dd->cntrnames, i =0 ; i <DEV_CNTR_LAST ; i++) {if (dev_cntrs[i].flags &CNTR_DISABLED ) {/* Nothing */ }else {
@@ -8439,7 +8435,6 @@ static int init_cntrs(struct hfi1_devdata *dd) p +=strlen (dev_cntrs[i].name); *p++ ='\n' ; } - index++; } }
Signature · 6 lines
1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 12/13 staging/rdma/hfi1: Read EFI variable for device description
In reply to a message not in the archiveFrom: Dean Luick <[email protected]>
Read an EFI variable for the device description. Create the infrastructure for additional variable reads.
--- drivers/staging/rdma/hfi1/Makefile | 2 +- drivers/staging/rdma/hfi1/chip.c | 38 ++++++-- drivers/staging/rdma/hfi1/efivar.c | 176 ++++++++++++++++++++++++++++++++++++ drivers/staging/rdma/hfi1/efivar.h | 60 ++++++++++++ 4 files changed, 267 insertions(+), 9 deletions(-) create mode 100644 drivers/staging/rdma/hfi1/efivar.c create mode 100644 drivers/staging/rdma/hfi1/efivar.h
drivers/staging/rdma/hfi1/Makefile +1 -1
@@ -7,7 +7,7 @@ # obj-$(CONFIG_INFINIBAND_HFI1) += hfi1.o -hfi1-y := chip.o cq.o device.o diag.o dma.o driver.o eprom.o file_ops.o firmware.o \ +hfi1-y := chip.o cq.o device.o diag.o dma.o driver.o efivar.o eprom.o file_ops.o firmware.o \ init.o intr.o keys.o mad.o mmap.o mr.o pcie.o pio.o pio_copy.o \ qp.o qsfp.o rc.o ruc.o sdma.o srq.o sysfs.o trace.o twsi.o \ uc.o ud.o user_pages.o user_sdma.o verbs_mcast.o verbs.o
drivers/staging/rdma/hfi1/chip.c +30 -8
@@ -63,6 +63,7 @@#include "pio.h" #include "sdma.h" #include "eprom.h" +#include "efivar.h" #define NUM_IB_PORTS 1
@@ -10524,6 +10525,32 @@ static void asic_should_init(struct hfi1_devdata *dd)spin_unlock_irqrestore (&hfi1_devs_lock, flags); } +/* +* Set dd->boardname. Use a generic name if a name is not returned from +* EFI variable space. +* +* Return 0 on success, -ENOMEM if space could not be allocated. +*/ +static int obtain_boardname (struct hfi1_devdata *dd) +{ +/* generic board description */ +const char generic[] = +"Intel Omni-Path Host Fabric Interface Adapter 100 Series" ; +unsigned long size; +int ret; + + ret =read_hfi1_efi_var (dd,"description" , &size, + (void **)&dd->boardname); +if (ret) { +dd_dev_err (dd,"Board description not found\n" ); +/* use generic description */ + dd->boardname =kstrdup (generic,GFP_KERNEL ); +if (!dd->boardname) +return -ENOMEM ; + } +return 0 ; +} +/** * Allocate and initialize the device structure for the hfi. * @dev: the pci_dev for hfi1_ib device
@@ -10721,18 +10748,13 @@ struct hfi1_devdata *hfi1_init_dd(struct pci_dev *pdev,parse_platform_config (dd); -/* add board names as they are defined */ - dd->boardname =kmalloc (64 ,GFP_KERNEL ); -if (!dd->boardname) + ret =obtain_boardname (dd); +if (ret) goto bail_cleanup; -snprintf (dd->boardname,64 ,"Board ID 0x%llx" , - dd->revision >>CCE_REVISION_BOARD_ID_LOWER_NIBBLE_SHIFT - &CCE_REVISION_BOARD_ID_LOWER_NIBBLE_MASK );snprintf (dd->boardversion,BOARD_VERS_MAX , -"ChipABI %u.%u, %s, ChipRev %u.%u, SW Compat %llu\n" , +"ChipABI %u.%u, ChipRev %u.%u, SW Compat %llu\n" ,HFI1_CHIP_VERS_MAJ ,HFI1_CHIP_VERS_MIN , - dd->boardname, (u32 )dd->majrev, (u32 )dd->minrev, (dd->revision >> CCE_REVISION_SW_SHIFT)
drivers/staging/rdma/hfi1/efivar.c new file +176 -0
176 lines not on this page · raw message
drivers/staging/rdma/hfi1/efivar.h new file +60 -0
60 lines not on this page · raw message
Signature · 6 lines
1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1447227213-15122-12-git-send-email-jubin.john-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Re: [PATCH 12/13] staging/rdma/hfi1: Read EFI variable for device description
Quoted 4 lines · Jubin John
drivers/staging/rdma/hfi1/efivar.c new file +4
-0+static int read_efi_var (const char *name,unsigned long *size, +void **return_data) +{ +int ret;
drivers/staging/rdma/hfi1/efivar.c line 80
Quoted 10 lines
drivers/staging/rdma/hfi1/efivar.c new file +10
-0+ +/* set failure return values */ + *size =0 ; + *return_data =NULL ; + +/* +* Use EFI run-time support to obtain an EFI variable. Support may +* be compiled out, so declare all variables inside. +*/ +if (efi_enabled (EFI_RUNTIME_SERVICES )) {
Flip this around:
if (!efi_enabled(EFI_RUNTIME_SERVICES)) return -ENOSYS;
drivers/staging/rdma/hfi1/efivar.c line 92
Quoted 12 lines
drivers/staging/rdma/hfi1/efivar.c new file +12
-0+efi_status_t status; +efi_char16_t *uni_name; +efi_guid_t guid; +unsigned long temp_size; +void *temp_buffer; +void *data; +int i; + + uni_name =kzalloc (sizeof (efi_char16_t) * (strlen (name) +1 ), +GFP_KERNEL ); + temp_buffer =kzalloc (EFI_DATA_SIZE ,GFP_KERNEL ); + data =NULL ;
No need.
Quoted 40 lines
drivers/staging/rdma/hfi1/efivar.c new file +40
-0+ +if (!uni_name || !temp_buffer) { + ret = -ENOMEM ; + goto fail; + } + +/* input: the size of the buffer */ + temp_size =EFI_DATA_SIZE ; + +/* convert ASCII to unicode - it is a 1:1 mapping */ +for (i =0 ; name[i]; i++) + uni_name[i] = name[i]; + +/* need a variable for our GUID */ + guid =HFI1_EFIVAR_GUID ; + +/* call into EFI runtime services */ + status = efi.get_variable ( + uni_name, + &guid, +NULL , + &temp_size, + temp_buffer); + +/* +* It would be nice to call efi_status_to_err() here, but that +* is in the EFIVAR_FS code and may not be compiled in. +* However, even that is insufficient since it does not cover +* EFI_BUFFER_TOO_SMALL which could be an important return. +* For now, just split out succces or not found. +*/ + ret = status ==EFI_SUCCESS ?0 : + status ==EFI_NOT_FOUND ? -ENOENT : + -EINVAL ; + +if (!ret) { +/* +* We have successfully read the EFI variable into our +* temporary buffer. Now allocate a correctly sized +* buffer.
drivers/staging/rdma/hfi1/efivar.c line 142
Quoted 10 lines
drivers/staging/rdma/hfi1/efivar.c new file +10
-0+*/ + data =kmalloc (temp_size,GFP_KERNEL ); +if (data) { +memcpy (data, temp_buffer, temp_size); + *size = temp_size; + *return_data = data; + }else { + ret = -ENOMEM ; + } + }
People often change the last two conditions in the function from error handling to success handling. I have ranted about it before many times so I should just paste a previous rant instead of commenting here. :P
http://www.spinics.net/lists/arm-kernel/msg457849.html
Success handling makes this look more complicated than it really is. This code is just a string of commands in a row with error handling. No need for if statements or indenting. Here is how it looks when it's pulled in one indent level and changed from success handling to error handling.
ret = status == EFI_SUCCESS ? 0 :
status == EFI_NOT_FOUND ? -ENOENT : -EINVAL;
if (ret)
goto free;
data = kmemdup(data, temp_size, GFP_KERNEL);
if (!data) {
ret = -ENOMEM;
goto free;
}
*size = temp_size;
*return_data = data;free:
kfree(uni_name); kfree(temp_buffer); return ret;
Quoted 21 lines
drivers/staging/rdma/hfi1/efivar.c new file +21
-0+ +fail: +kfree (uni_name); +kfree (temp_buffer); + }else { + ret = -ENOSYS ; + } + +return ret; +} + +/* +* Read an HFI1 EFI variable of the form: +* <PCIe address>-<kind> +* Return an kalloc'ed array and size of the data. +* +* Returns 0 on success, -errno on failure. +*/ +int read_hfi1_efi_var (struct hfi1_devdata *dd,const char *kind, +unsigned long *size,void **return_data) +{
drivers/staging/rdma/hfi1/efivar.c line 173
Quoted 10 lines
drivers/staging/rdma/hfi1/efivar.c new file +10
-0+char name[64 ]; + +/* create a common prefix */ +snprintf (name,sizeof (name),"%04x:%02x:%02x.%x-%s" , +pci_domain_nr (dd->pcidev->bus), + dd->pcidev->bus->number, +PCI_SLOT (dd->pcidev->devfn), +PCI_FUNC (dd->pcidev->devfn), + kind); + name[sizeof (name) -1 ] =0 ;/* make sure the string is terminated */
No need. snprintf() always puts a NUL terminator (technically it doesn't if the sizeof(name) is zero, I suppose).
drivers/staging/rdma/hfi1/efivar.c line 176
Quoted 3 lines
drivers/staging/rdma/hfi1/efivar.c new file +3
-0+ +return read_efi_var (name, size, return_data); +}
regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 12/13] staging/rdma/hfi1: Read EFI variable for device description
Quoted 31 lines
-----Original Message-----
From: [email protected] [mailto:linux-rdma- [email protected]] On Behalf Of Dan Carpenter
Sent: Wednesday, November 11, 2015 2:45 AM
To: John, Jubin <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH 12/13] staging/rdma/hfi1: Read EFI variable for device
descriptionQuoted 4 lines · Jubin John
drivers/staging/rdma/hfi1/efivar.c new file +4
-0+static int read_efi_var (const char *name,unsigned long *size, +void **return_data) +{ +int ret;drivers/staging/rdma/hfi1/efivar.c line 80
Quoted 10 lines
drivers/staging/rdma/hfi1/efivar.c new file +10
-0+ +/* set failure return values */ + *size =0 ; + *return_data =NULL ; + +/* +* Use EFI run-time support to obtain an EFI variable. Support may +* be compiled out, so declare all variables inside. +*/ +if (efi_enabled (EFI_RUNTIME_SERVICES )) {Flip this around:
Quoted 2 lines
if (!efi_enabled(EFI_RUNTIME_SERVICES)) return -ENOSYS;
The style here is very deliberate.
The issue is how efi_enabled() is defined via CONFIG options. The function can be turned into a 0 if certain CONFIG variables are not set. The code is structured to make all of the dependent variables disappear if efi_enabled() becomes 0. If the code is shifted as you suggest, we will get builds from the automatic builders that try all combinations with unused variables. This was done to avoid that.
The question: Which is preferred?
Quoted 135 lines
drivers/staging/rdma/hfi1/efivar.c line 92
Quoted 12 lines
drivers/staging/rdma/hfi1/efivar.c new file +12
-0+efi_status_t status; +efi_char16_t *uni_name; +efi_guid_t guid; +unsigned long temp_size; +void *temp_buffer; +void *data; +int i; + + uni_name =kzalloc (sizeof (efi_char16_t) * (strlen (name) +1 ), +GFP_KERNEL ); + temp_buffer =kzalloc (EFI_DATA_SIZE ,GFP_KERNEL ); + data =NULL ;No need.
Quoted 19 lines
drivers/staging/rdma/hfi1/efivar.c new file +19
-0+ +if (!uni_name || !temp_buffer) { + ret = -ENOMEM ; + goto fail; + } + +/* input: the size of the buffer */ + temp_size =EFI_DATA_SIZE ; + +/* convert ASCII to unicode - it is a 1:1 mapping */ +for (i =0 ; name[i]; i++) + uni_name[i] = name[i]; + +/* need a variable for our GUID */ + guid =HFI1_EFIVAR_GUID ; + +/* call into EFI runtime services */ + status = efi.get_variable( + uni_name,drivers/staging/rdma/hfi1/efivar.c
Quoted 10 lines
drivers/staging/rdma/hfi1/efivar.c new file +10
-0+ &guid, +NULL , + &temp_size, + temp_buffer); + +/* +* It would be nice to call efi_status_to_err() here, but that +* is in the EFIVAR_FS code and may not be compiled in. +* However, even that is insufficient since it does not cover +* EFI_BUFFER_TOO_SMALL which could be an important return.
Quoted 11 lines
drivers/staging/rdma/hfi1/efivar.c new file +11
-0+* For now, just split out succces or not found. +*/ + ret = status ==EFI_SUCCESS ?0 : + status ==EFI_NOT_FOUND ? -ENOENT : + -EINVAL ; + +if (!ret) { +/* +* We have successfully read the EFI variable into our +* temporary buffer. Now allocate a correctly sized +* buffer. drivers/staging/rdma/hfi1/efivar.c line 142
Quoted 10 lines
drivers/staging/rdma/hfi1/efivar.c new file +10
-0+*/ + data =kmalloc (temp_size,GFP_KERNEL ); +if (data) { +memcpy (data, temp_buffer, temp_size); + *size = temp_size; + *return_data = data; + }else { + ret = -ENOMEM ; + } + }People often change the last two conditions in the function from error handling to success handling. I have ranted about it before many times so I should just paste a previous rant instead of commenting here. :P
http://www.spinics.net/lists/arm-kernel/msg457849.html
Success handling makes this look more complicated than it really is. This code is just a string of commands in a row with error handling. No need for if statements or indenting. Here is how it looks when it's pulled in one indent level and changed from success handling to error handling.
ret = status == EFI_SUCCESS ? 0 : status == EFI_NOT_FOUND ? -ENOENT : -EINVAL; if (ret) goto free; data = kmemdup(data, temp_size, GFP_KERNEL); if (!data) { ret = -ENOMEM; goto free; } *size = temp_size; *return_data = data;free:
kfree(uni_name); kfree(temp_buffer); return ret;Quoted 21 lines
drivers/staging/rdma/hfi1/efivar.c new file +21
-0+ +fail: +kfree (uni_name); +kfree (temp_buffer); + }else { + ret = -ENOSYS ; + } + +return ret; +} + +/* +* Read an HFI1 EFI variable of the form: +* <PCIe address>-<kind> +* Return an kalloc'ed array and size of the data. +* +* Returns 0 on success, -errno on failure. +*/ +int read_hfi1_efi_var (struct hfi1_devdata *dd,const char *kind, +unsigned long *size,void **return_data) +{drivers/staging/rdma/hfi1/efivar.c line 173
Quoted 10 lines
drivers/staging/rdma/hfi1/efivar.c new file +10
-0+char name[64 ]; + +/* create a common prefix */ +snprintf (name,sizeof (name),"%04x:%02x:%02x.%x-%s" , +pci_domain_nr (dd->pcidev->bus), + dd->pcidev->bus->number, +PCI_SLOT (dd->pcidev->devfn), +PCI_FUNC (dd->pcidev->devfn), + kind); + name[sizeof (name) -1 ] =0 ;/* make sure the string is terminated */ No need.
snprintf()always puts a NUL terminator (technically it doesn't if the sizeof(name) is zero, I suppose).
Quoted 10 lines
drivers/staging/rdma/hfi1/efivar.c line 176
Quoted 3 lines
drivers/staging/rdma/hfi1/efivar.c new file +3
-0+ +return read_efi_var (name, size, return_data); +}regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 4AF12E8016D2BF46BCDFCE8FAA77A3580BC19F69-AtyAts71sc9cIJlls4ac1rfspsVTdybXVpNB7YpNyf8@public.gmane.org
Re: [PATCH 12/13] staging/rdma/hfi1: Read EFI variable for device description
Quoted 34 lines · Dean
Quoted 31 lines
-----Original Message-----
From: [email protected] [mailto:linux-rdma- [email protected]] On Behalf Of Dan Carpenter
Sent: Wednesday, November 11, 2015 2:45 AM
To: John, Jubin <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH 12/13] staging/rdma/hfi1: Read EFI variable for device
descriptionQuoted 4 lines · Jubin John
drivers/staging/rdma/hfi1/efivar.c new file +4
-0+static int read_efi_var (const char *name,unsigned long *size, +void **return_data) +{ +int ret;drivers/staging/rdma/hfi1/efivar.c line 80
Quoted 10 lines
drivers/staging/rdma/hfi1/efivar.c new file +10
-0+ +/* set failure return values */ + *size =0 ; + *return_data =NULL ; + +/* +* Use EFI run-time support to obtain an EFI variable. Support may +* be compiled out, so declare all variables inside. +*/ +if (efi_enabled (EFI_RUNTIME_SERVICES )) {Flip this around:
Quoted 2 lines
if (!efi_enabled(EFI_RUNTIME_SERVICES)) return -ENOSYS;
Quoted 6 lines
The style here is very deliberate.
The issue is how
efi_enabled()is defined via CONFIG options.
The function can be turned into a 0 if certain CONFIG variables are
not set. The code is structured to make all of the dependent variables disappear ifefi_enabled()becomes 0.
This all understand.
Quoted 3 lines
If the code is shifted as you suggest, we will get builds from the
automatic builders that try all combinations with unused variables.
This was done to avoid that.
I'm not sure I understand. You are doing this to try tricking the autobuilders into not testind certain configs? What? I don't understand what you mean by unused variables. There shouldn't be any unused variable warnings. If you are getting unused variable warnings can you post one so that I can take a look?
Maybe you are worried the function is a waste of memory if you declare the variables earlier before the if enabled check? It's not a problem. The compiler is smart enough to see the immediate return and removes the dead code.
Perhaps I am not seeing your concern.
regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 12/13] staging/rdma/hfi1: Read EFI variable for device description
Quoted 25 lines
-----Original Message-----
From: Dan Carpenter [mailto:[email protected]]
Sent: Wednesday, November 11, 2015 8:39 AM
To: Luick, Dean <[email protected]>
Cc: John, Jubin <[email protected]>; [email protected]; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH 12/13] staging/rdma/hfi1: Read EFI variable for device
descriptionQuoted 8 lines
Quoted 7 lines
drivers/staging/rdma/hfi1/efivar.c line 80
Quoted 1 line
drivers/staging/rdma/hfi1/efivar.c new file +1
-0+if (efi_enabled (EFI_RUNTIME_SERVICES )) {Flip this around:
if (!efi_enabled(EFI_RUNTIME_SERVICES)) return -ENOSYS;Quoted 6 lines
The style here is very deliberate.
The issue is how
efi_enabled()is defined via CONFIG options.
The function can be turned into a 0 if certain CONFIG variables are
not set. The code is structured to make all of the dependent variables disappear ifefi_enabled()becomes 0.
Quoted 8 lines
This all understand.
Quoted 3 lines
If the code is shifted as you suggest, we will get builds from the
automatic builders that try all combinations with unused variables.
This was done to avoid that.I'm not sure I understand. You are doing this to try tricking the autobuilders into not testind certain configs? What?
Certainly not. I did not explain this well.
Quoted 4 lines
I don't
understand what you mean by unused variables. There shouldn't be any unused variable warnings. If you are getting unused variable warnings can you post one so that I can take a look?
If you move the variables to the top and have the early return as you suggest, then in some CONFIG cases, there will be all those automatic variables declared but they are never used - the compiler has short-circuited the rest of the function. Will not the compiler complain about unused variables in those cases? That is the situation I was trying to avoid.
Dean
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 4AF12E8016D2BF46BCDFCE8FAA77A3580BC19FC8-AtyAts71sc9cIJlls4ac1rfspsVTdybXVpNB7YpNyf8@public.gmane.org
Re: [PATCH 12/13] staging/rdma/hfi1: Read EFI variable for device description
Quoted 34 lines · Dean
Quoted 25 lines
-----Original Message-----
From: Dan Carpenter [mailto:[email protected]]
Sent: Wednesday, November 11, 2015 8:39 AM
To: Luick, Dean <[email protected]>
Cc: John, Jubin <[email protected]>; [email protected]; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH 12/13] staging/rdma/hfi1: Read EFI variable for device
descriptionQuoted 8 lines
Quoted 7 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ if (efi_enabled(EFI_RUNTIME_SERVICES)) {Flip this around:
if (!efi_enabled(EFI_RUNTIME_SERVICES)) return -ENOSYS;Quoted 6 lines
The style here is very deliberate.
The issue is how
efi_enabled()is defined via CONFIG options.
The function can be turned into a 0 if certain CONFIG variables are
not set. The code is structured to make all of the dependent variables disappear ifefi_enabled()becomes 0.Quoted 8 lines
This all understand.
Quoted 3 lines
If the code is shifted as you suggest, we will get builds from the
automatic builders that try all combinations with unused variables.
This was done to avoid that.I'm not sure I understand. You are doing this to try tricking the autobuilders into not testind certain configs? What?
Quoted 8 lines
Certainly not. I did not explain this well.
Quoted 4 lines
I don't
understand what you mean by unused variables. There shouldn't be any unused variable warnings. If you are getting unused variable warnings can you post one so that I can take a look?If you move the variables to the top and have the early return as you suggest, then in some CONFIG cases, there will be all those automatic variables declared but they are never used - the compiler has short-circuited the rest of the function. Will not the compiler complain about unused variables in those cases? That is the situation I was trying to avoid.
Try it and see (hint, I don't think so...)
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
RE: [PATCH 12/13] staging/rdma/hfi1: Read EFI variable for device description
Quoted 11 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Wednesday, November 11, 2015 11:24 AMQuoted 1 line
If you move the variables to the top and have the early return as you suggest,
then in some CONFIG cases, there will be all those automatic variables declared but they are never used - the compiler has short-circuited the rest of the function. Will not the compiler complain about unused variables in those cases? That is the situation I was trying to avoid.
Try it and see (hint, I don't think so...)
I tested this - you are correct, no compiler warnings. Looks like my fears were premature. The failure logic will be inverted per Dan's comments.
Dean
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 13/13 staging/rdma/hfi1: Adjust EPROM partitions, add EPROM commands
In reply to a message not in the archiveFrom: Dean Luick <[email protected]>
Add a new EPROM partition, adjusting partition placement.
Add EPROM range commands as a supserset of the partition commands. Remove old partition commands.
Enhance EPROM erase, creating a range function and using the largest erase (sub) commands when possible.
--- drivers/staging/rdma/hfi1/eprom.c | 119 +++++++++++++++++++--------------- drivers/staging/rdma/hfi1/file_ops.c | 18 ++---- include/uapi/rdma/hfi/hfi1_user.h | 10 +-- 3 files changed, 77 insertions(+), 70 deletions(-)
drivers/staging/rdma/hfi1/eprom.c +67 -52
@@ -53,17 +53,26 @@#include "eprom.h" /* -* The EPROM is logically divided into two partitions: +* The EPROM is logically divided into three partitions: * partition 0: the first 128K, visible from PCI ROM BAR -* partition 1: the rest +* partition 1: 4K config file (sector size) +* partition 2: the rest */ #define P0_SIZE (128 * 1024) +#define P1_SIZE (4 * 1024)#define P1_START P0_SIZE +#define P2_START (P0_SIZE + P1_SIZE) + +/* erase sizes supported by the controller */ +#define SIZE_4KB (4 * 1024) +#define MASK_4KB (SIZE_4KB - 1) -/* largest erase size supported by the controller */ #define SIZE_32KB (32 * 1024)#define MASK_32KB (SIZE_32KB - 1) +#define SIZE_64KB (64 * 1024) +#define MASK_64KB (SIZE_64KB - 1) +/* controller page size, in bytes */ #define EP_PAGE_SIZE 256#define EEP_PAGE_MASK (EP_PAGE_SIZE - 1)
@@ -75,10 +84,12 @@#define CMD_READ_DATA (addr) ((0x03 << CMD_SHIFT) | addr)#define CMD_READ_SR1 ((0x05 << CMD_SHIFT))#define CMD_WRITE_ENABLE ((0x06 << CMD_SHIFT)) +#define CMD_SECTOR_ERASE_4KB (addr) ((0x20 << CMD_SHIFT) | addr)#define CMD_SECTOR_ERASE_32KB (addr) ((0x52 << CMD_SHIFT) | addr)#define CMD_CHIP_ERASE ((0x60 << CMD_SHIFT))#define CMD_READ_MANUF_DEV_ID ((0x90 << CMD_SHIFT))#define CMD_RELEASE_POWERDOWN_NOID ((0xab << CMD_SHIFT)) +#define CMD_SECTOR_ERASE_64KB (addr) ((0xd8 << CMD_SHIFT) | addr)/* controller interface speeds */ #define EP_SPEED_FULL 0x2/* full speed */
@@ -188,28 +199,43 @@ static int erase_chip(struct hfi1_devdata *dd) }/* -* Erase a range using the 32KB erase command. +* Erase a range. */ -static int erase_32kb_range (struct hfi1_devdata *dd,u32 start,u32 end) +static int erase_range (struct hfi1_devdata *dd,u32 start,u32 len) { +u32 end = start + len;int ret =0 ;if (end < start)return -EINVAL ; -if ((start &MASK_32KB ) || (end &MASK_32KB )) { +/* check the end points for the minimum erase */ +if ((start &MASK_4KB ) || (end &MASK_4KB )) {dd_dev_err (dd, -"%s: non-aligned range (0x%x,0x%x) for a 32KB erase\n" , +"%s: non-aligned range (0x%x,0x%x) for a 4KB erase\n" , __func__, start, end);return -EINVAL ; }write_enable (dd); -for (; start < end; start +=SIZE_32KB ) { +while (start < end) {write_csr (dd,ASIC_EEP_ADDR_CMD ,CMD_WRITE_ENABLE ); -write_csr (dd,ASIC_EEP_ADDR_CMD , -CMD_SECTOR_ERASE_32KB (start)); +/* check in order of largest to smallest */ +if (((start &MASK_64KB ) ==0 ) && (start +SIZE_64KB <= end)) { +write_csr (dd,ASIC_EEP_ADDR_CMD , +CMD_SECTOR_ERASE_64KB (start)); + start +=SIZE_64KB ; + }else if (((start &MASK_32KB ) ==0 ) && + (start +SIZE_32KB <= end)) { +write_csr (dd,ASIC_EEP_ADDR_CMD , +CMD_SECTOR_ERASE_32KB (start)); + start +=SIZE_32KB ; + }else {/* 4KB will work */ +write_csr (dd,ASIC_EEP_ADDR_CMD , +CMD_SECTOR_ERASE_4KB (start)); + start +=SIZE_4KB ; + } ret =wait_for_not_busy (dd);if (ret) goto done;
@@ -309,6 +335,18 @@ done:return ret; } +/* convert an range composite to a length, in bytes */ +static inline u32 extract_rlen (u32 composite) +{ +return (composite &0xffff ) *EP_PAGE_SIZE ; +} + +/* convert an range composite to a start, in bytes */ +static inline u32 extract_rstart (u32 composite) +{ +return (composite >>16 ) *EP_PAGE_SIZE ; +} +/* * Perform the given operation on the EPROM. Called from user space. The * user credentials have already been checked.
@@ -319,6 +357,8 @@ int handle_eprom_command(const struct hfi1_cmd *cmd) {struct hfi1_devdata *dd;u32 dev_id; +u32 rlen;/* range length */ +u32 rstart;/* range start */ int ret =0 ;/*
@@ -364,54 +404,29 @@ int handle_eprom_command(const struct hfi1_cmd *cmd) sizeof(u32))) ret = -EFAULT ;break ; +case HFI1_CMD_EP_ERASE_CHIP : ret =erase_chip (dd);break ; -case HFI1_CMD_EP_ERASE_P0 : -if (cmd->len !=P0_SIZE ) { - ret = -ERANGE ; -break ; - } - ret =erase_32kb_range (dd,0 , cmd->len); -break ; -case HFI1_CMD_EP_ERASE_P1 : -/* check for overflow */ -if (P1_START + cmd->len >ASIC_EEP_ADDR_CMD_EP_ADDR_MASK ) { - ret = -ERANGE ; -break ; - } - ret =erase_32kb_range (dd,P1_START ,P1_START + cmd->len); -break ; -case HFI1_CMD_EP_READ_P0 : -if (cmd->len !=P0_SIZE ) { - ret = -ERANGE ; -break ; - } - ret =read_length (dd,0 , cmd->len, cmd->addr); -break ; -case HFI1_CMD_EP_READ_P1 : -/* check for overflow */ -if (P1_START + cmd->len >ASIC_EEP_ADDR_CMD_EP_ADDR_MASK ) { - ret = -ERANGE ; -break ; - } - ret =read_length (dd,P1_START , cmd->len, cmd->addr); + +case HFI1_CMD_EP_ERASE_RANGE : + rlen =extract_rlen (cmd->len); + rstart =extract_rstart (cmd->len); + ret =erase_range (dd, rstart, rlen);break ; -case HFI1_CMD_EP_WRITE_P0 : -if (cmd->len >P0_SIZE ) { - ret = -ERANGE ; -break ; - } - ret =write_length (dd,0 , cmd->len, cmd->addr); + +case HFI1_CMD_EP_READ_RANGE : + rlen =extract_rlen (cmd->len); + rstart =extract_rstart (cmd->len); + ret =read_length (dd, rstart, rlen, cmd->addr);break ; -case HFI1_CMD_EP_WRITE_P1 : -/* check for overflow */ -if (P1_START + cmd->len >ASIC_EEP_ADDR_CMD_EP_ADDR_MASK ) { - ret = -ERANGE ; -break ; - } - ret =write_length (dd,P1_START , cmd->len, cmd->addr); + +case HFI1_CMD_EP_WRITE_RANGE : + rlen =extract_rlen (cmd->len); + rstart =extract_rstart (cmd->len); + ret =write_length (dd, rstart, rlen, cmd->addr);break ; +default :dd_dev_err (dd,"%s: unexpected command %d\n" , __func__, cmd->type);
drivers/staging/rdma/hfi1/file_ops.c +6 -12
@@ -254,12 +254,9 @@ static ssize_t hfi1_file_write(struct file *fp, const char __user *data,break ;case HFI1_CMD_EP_INFO :case HFI1_CMD_EP_ERASE_CHIP : -case HFI1_CMD_EP_ERASE_P0 : -case HFI1_CMD_EP_ERASE_P1 : -case HFI1_CMD_EP_READ_P0 : -case HFI1_CMD_EP_READ_P1 : -case HFI1_CMD_EP_WRITE_P0 : -case HFI1_CMD_EP_WRITE_P1 : +case HFI1_CMD_EP_ERASE_RANGE : +case HFI1_CMD_EP_READ_RANGE : +case HFI1_CMD_EP_WRITE_RANGE : uctxt_required =0 ;/* assigned user context not required */ must_be_root =1 ;/* validate user */ copy =0 ;
@@ -413,12 +410,9 @@ static ssize_t hfi1_file_write(struct file *fp, const char __user *data, }case HFI1_CMD_EP_INFO :case HFI1_CMD_EP_ERASE_CHIP : -case HFI1_CMD_EP_ERASE_P0 : -case HFI1_CMD_EP_ERASE_P1 : -case HFI1_CMD_EP_READ_P0 : -case HFI1_CMD_EP_READ_P1 : -case HFI1_CMD_EP_WRITE_P0 : -case HFI1_CMD_EP_WRITE_P1 : +case HFI1_CMD_EP_ERASE_RANGE : +case HFI1_CMD_EP_READ_RANGE : +case HFI1_CMD_EP_WRITE_RANGE : ret =handle_eprom_command (&cmd);break ; }
include/uapi/rdma/hfi/hfi1_user.h +4 -6
@@ -137,12 +137,10 @@/* separate EPROM commands from normal PSM commands */ #define HFI1_CMD_EP_INFO 64/* read EPROM device ID */ #define HFI1_CMD_EP_ERASE_CHIP 65/* erase whole EPROM */ -#define HFI1_CMD_EP_ERASE_P0 66/* erase EPROM partition 0 */ -#define HFI1_CMD_EP_ERASE_P1 67/* erase EPROM partition 1 */ -#define HFI1_CMD_EP_READ_P0 68/* read EPROM partition 0 */ -#define HFI1_CMD_EP_READ_P1 69/* read EPROM partition 1 */ -#define HFI1_CMD_EP_WRITE_P0 70/* write EPROM partition 0 */ -#define HFI1_CMD_EP_WRITE_P1 71/* write EPROM partition 1 */ +/* range 66-74 no longer used */ +#define HFI1_CMD_EP_ERASE_RANGE 75/* erase EPROM range */ +#define HFI1_CMD_EP_READ_RANGE 76/* read EPROM range */ +#define HFI1_CMD_EP_WRITE_RANGE 77/* write EPROM range */ #define _HFI1_EVENT_FROZEN_BIT 0#define _HFI1_EVENT_LINKDOWN_BIT 1
Signature · 6 lines
1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 8 lines · Jubin John
This patch fixes the checkpatch issue:
CHECK: Prefer using the BIT macroReviewed-by Dean Luick <[email protected]>Reviewed-by Ira Weiny <[email protected]>Reviewed-by Mike Marciniszyn <[email protected]>Signed-off-by Jubin John <[email protected]>---
<snip>
drivers/staging/rdma/hfi1/init.c struct hfi1_ctxtdata *hfi1_create_ctxtdata(struct hfi1_pportdata *ppd, u32 ctxt) · line 255
Quoted 11 lines
drivers/staging/rdma/hfi1/init.c +1
-1@@ -252,7 +252,7 @@ struct hfi1_ctxtdata *hfi1_create_ctxtdata(struct hfi1_pportdata *ppd, u32 ctxt)/* Validate and initialize Rcv Hdr Q variables */ if (rcvhdrcnt %HDRQ_INCREMENT ) { dd_dev_err(dd, - "ctxt%u: header queue count %d must be divisible by %d\n", + "ctxt%u: header queue count %d must be divisible by %lud\n",
This is an unrelated change. If you are sending the series based on Dan's comment on 12/13 then please remove this also.
regards
sudip
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 11 lines · Sudip Mukherjee
Quoted 8 lines · Jubin John
This patch fixes the checkpatch issue:
CHECK: Prefer using the BIT macroReviewed-by Dean Luick <[email protected]>Reviewed-by Ira Weiny <[email protected]>Reviewed-by Mike Marciniszyn <[email protected]>Signed-off-by Jubin John <[email protected]>---
<snip>
Quoted 1 line
Quoted 14 lines
drivers/staging/rdma/hfi1/init.c struct hfi1_ctxtdata *hfi1_create_ctxtdata(struct hfi1_pportdata *ppd, u32 ctxt) · line 255
Quoted 10 lines
drivers/staging/rdma/hfi1/init.c +1
-1@@ -252,7 +252,7 @@ struct hfi1_ctxtdata *hfi1_create_ctxtdata(struct hfi1_pportdata *ppd, u32 ctxt)/* Validate and initialize Rcv Hdr Q variables */ if (rcvhdrcnt %HDRQ_INCREMENT ) { dd_dev_err(dd, - "ctxt%u: header queue count %d must be divisible by %d\n", + "ctxt%u: header queue count %d must be divisible by %lud\n",This is an unrelated change. If you are sending the series based on Dan's comment on 12/13 then please remove this also.
This is not an unrelated change. This was needed due to the use of the BIT macro for HDRQ_INCREMENT in chip.h.
Otherwise, the following warning is shown during the build:drivers/staging/rdma/hfi1/init.c: In function ‘hfi1_create_ctxtdata’:drivers/staging/rdma/hfi1/init.c:254:4: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 6 has type ‘long unsigned int’ [-Wformat=]
dd_dev_err(dd,
Thanks,
Jubin John
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20151113160921.GA31028-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org
Quoted 26 lines · Jubin John
Quoted 11 lines · Sudip Mukherjee
Quoted 8 lines · Jubin John
This patch fixes the checkpatch issue:
CHECK: Prefer using the BIT macroReviewed-by Dean Luick <[email protected]>Reviewed-by Ira Weiny <[email protected]>Reviewed-by Mike Marciniszyn <[email protected]>Signed-off-by Jubin John <[email protected]>---
<snip>
Quoted 1 line
Quoted 14 lines
drivers/staging/rdma/hfi1/init.c struct hfi1_ctxtdata *hfi1_create_ctxtdata(struct hfi1_pportdata *ppd, u32 ctxt) · line 255
Quoted 10 lines
drivers/staging/rdma/hfi1/init.c +1
-1@@ -252,7 +252,7 @@ struct hfi1_ctxtdata *hfi1_create_ctxtdata(struct hfi1_pportdata *ppd, u32 ctxt)/* Validate and initialize Rcv Hdr Q variables */ if (rcvhdrcnt %HDRQ_INCREMENT ) { dd_dev_err(dd, - "ctxt%u: header queue count %d must be divisible by %d\n", + "ctxt%u: header queue count %d must be divisible by %lud\n",This is an unrelated change. If you are sending the series based on Dan's comment on 12/13 then please remove this also.
Quoted 9 lines
This is not an unrelated change. This was needed due to the use of the BIT macro for
HDRQ_INCREMENTinchip.h.
Otherwise, the following warning is shown during the build:drivers/staging/rdma/hfi1/init.c: In function ‘hfi1_create_ctxtdata’:drivers/staging/rdma/hfi1/init.c:254:4: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 6 has type ‘long unsigned int’ [-Wformat=]dd_dev_err(dd,
Sorry for the weird characters, they seem to have slipped in when I
copied that message.
Hopefully this is clearer:drivers/staging/rdma/hfi1/init.c: In function ‘hfi1_create_ctxtdata’:drivers/staging/rdma/hfi1/init.c:254:4: warning: format ‘%d’ expects argument of type ‘int’, but argument 6 has type ‘long unsigned int’ [-Wformat=]
dd_dev_err(dd,
^Quoted 6 lines
Thanks,
Jubin John
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20151113180344.GA10934-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org
Quoted 36 lines · Jubin John
Quoted 26 lines · Jubin John
Quoted 11 lines · Sudip Mukherjee
Quoted 8 lines · Jubin John
This patch fixes the checkpatch issue:
CHECK: Prefer using the BIT macroReviewed-by Dean Luick <[email protected]>Reviewed-by Ira Weiny <[email protected]>Reviewed-by Mike Marciniszyn <[email protected]>Signed-off-by Jubin John <[email protected]>---
<snip>
Quoted 1 line
Quoted 14 lines
drivers/staging/rdma/hfi1/init.c struct hfi1_ctxtdata *hfi1_create_ctxtdata(struct hfi1_pportdata *ppd, u32 ctxt) · line 255
Quoted 10 lines
drivers/staging/rdma/hfi1/init.c +1
-1@@ -252,7 +252,7 @@ struct hfi1_ctxtdata *hfi1_create_ctxtdata(struct hfi1_pportdata *ppd, u32 ctxt)/* Validate and initialize Rcv Hdr Q variables */ if (rcvhdrcnt %HDRQ_INCREMENT ) { dd_dev_err(dd, - "ctxt%u: header queue count %d must be divisible by %d\n", + "ctxt%u: header queue count %d must be divisible by %lud\n",This is an unrelated change. If you are sending the series based on Dan's comment on 12/13 then please remove this also.
Quoted 9 lines
This is not an unrelated change. This was needed due to the use of the BIT macro for
HDRQ_INCREMENTinchip.h.
Otherwise, the following warning is shown during the build:drivers/staging/rdma/hfi1/init.c: In function ‘hfi1_create_ctxtdata’:drivers/staging/rdma/hfi1/init.c:254:4: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 6 has type ‘long unsigned int’ [-Wformat=]dd_dev_err(dd,
Quoted 7 lines
Sorry for the weird characters, they seem to have slipped in when I
copied that message.
Hopefully this is clearer:drivers/staging/rdma/hfi1/init.c: In function ‘hfi1_create_ctxtdata’:drivers/staging/rdma/hfi1/init.c:254:4: warning: format ‘%d’ expects argument of type ‘int’, but argument 6 has type ‘long unsigned int’ [-Wformat=]dd_dev_err(dd, ^
Same thing happened again :( This was probably due to the gcc color
output on my terminal. Turned off gcc color and trying again:drivers/staging/rdma/hfi1/init.c: In function ‘hfi1_create_ctxtdata’:drivers/staging/rdma/hfi1/init.c:254:4: warning: format ‘%d’ expects argument of type ‘int’, but argument 6 has type ‘long unsigned int’ [-Wformat=]
dd_dev_err(dd,
^Sorry for the repeated messages.
Quoted 11 lines
Quoted 7 lines
Thanks,
Jubin John
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 26 lines · Jubin John
Quoted 11 lines · Sudip Mukherjee
Quoted 8 lines · Jubin John
This patch fixes the checkpatch issue:
CHECK: Prefer using the BIT macroReviewed-by Dean Luick <[email protected]>Reviewed-by Ira Weiny <[email protected]>Reviewed-by Mike Marciniszyn <[email protected]>Signed-off-by Jubin John <[email protected]>---
<snip>
Quoted 1 line
Quoted 14 lines
drivers/staging/rdma/hfi1/init.c struct hfi1_ctxtdata *hfi1_create_ctxtdata(struct hfi1_pportdata *ppd, u32 ctxt) · line 255
Quoted 10 lines
drivers/staging/rdma/hfi1/init.c +1
-1@@ -252,7 +252,7 @@ struct hfi1_ctxtdata *hfi1_create_ctxtdata(struct hfi1_pportdata *ppd, u32 ctxt)/* Validate and initialize Rcv Hdr Q variables */ if (rcvhdrcnt %HDRQ_INCREMENT ) { dd_dev_err(dd, - "ctxt%u: header queue count %d must be divisible by %d\n", + "ctxt%u: header queue count %d must be divisible by %lud\n",This is an unrelated change. If you are sending the series based on Dan's comment on 12/13 then please remove this also.
Quoted 8 lines
This is not an unrelated change. This was needed due to the use of the BIT macro for
HDRQ_INCREMENTinchip.h.
Otherwise, the following warning is shown during the build:drivers/staging/rdma/hfi1/init.c: In function ‘hfi1_create_ctxtdata’:drivers/staging/rdma/hfi1/init.c:254:4: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 6 has type ‘long unsigned int’ [-Wformat=]dd_dev_err(dd,
Then it should have better been mentioned in the commit message.
regards
sudip
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 36 lines · Sudip Mukherjee
Quoted 26 lines · Jubin John
Quoted 11 lines · Sudip Mukherjee
Quoted 8 lines · Jubin John
This patch fixes the checkpatch issue:
CHECK: Prefer using the BIT macroReviewed-by Dean Luick <[email protected]>Reviewed-by Ira Weiny <[email protected]>Reviewed-by Mike Marciniszyn <[email protected]>Signed-off-by Jubin John <[email protected]>---
<snip>
Quoted 1 line
Quoted 14 lines
drivers/staging/rdma/hfi1/init.c struct hfi1_ctxtdata *hfi1_create_ctxtdata(struct hfi1_pportdata *ppd, u32 ctxt) · line 255
Quoted 10 lines
drivers/staging/rdma/hfi1/init.c +1
-1@@ -252,7 +252,7 @@ struct hfi1_ctxtdata *hfi1_create_ctxtdata(struct hfi1_pportdata *ppd, u32 ctxt)/* Validate and initialize Rcv Hdr Q variables */ if (rcvhdrcnt %HDRQ_INCREMENT ) { dd_dev_err(dd, - "ctxt%u: header queue count %d must be divisible by %d\n", + "ctxt%u: header queue count %d must be divisible by %lud\n",This is an unrelated change. If you are sending the series based on Dan's comment on 12/13 then please remove this also.
Quoted 8 lines
This is not an unrelated change. This was needed due to the use of the BIT macro for
HDRQ_INCREMENTinchip.h.
Otherwise, the following warning is shown during the build:drivers/staging/rdma/hfi1/init.c: In function ‘hfi1_create_ctxtdata’:drivers/staging/rdma/hfi1/init.c:254:4: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 6 has type ‘long unsigned int’ [-Wformat=]dd_dev_err(dd,
Quoted 1 line
Then it should have better been mentioned in the commit message.
Ok, I will update the commit message in v2.
Thanks,
Jubin John
Quoted 3 lines
regards
sudip
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html