Message ID | 1508424118-27205-4-git-send-email-yishaih@mellanox.com (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
On Thu, 19 Oct 2017, Yishai Hadas wrote: > +#define IB_COUNTER_NAME_LEN 64 > +struct ib_counter_set_describe_attr { > + /* Type that this set refers to, use enum ib_counter_set_type */ > + u8 counted_type; Gap here of 7 bytes. Maybe move the field to get a more compact structure? > + /* Number of instances of this counter-set available in the hardware */ > + u64 num_of_cs; u16 or u32 should be enough right? > + /* Attributes of the set, use enum ib_counter_set_attributes */ > + u32 attributes; > + /* Number of counters in this set */ > + u8 entries_count; A counter set is limited to 255? Could there be counter sets that have a thousand or so? -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> On Thu, 19 Oct 2017, Yishai Hadas wrote: > > > +#define IB_COUNTER_NAME_LEN 64 > > +struct ib_counter_set_describe_attr { > > + /* Type that this set refers to, use enum ib_counter_set_type */ > > + u8 counted_type; > > Gap here of 7 bytes. Maybe move the field to get a more compact structure? > > > + /* Number of instances of this counter-set available in the hardware > */ > > + u64 num_of_cs; > > u16 or u32 should be enough right? Future API might be added to create user-customizable sets. How many potential subsets are for a set of 32 counters? More than 2^64. We might want to be able to support it. > > > + /* Attributes of the set, use enum ib_counter_set_attributes */ > > + u32 attributes; > > + /* Number of counters in this set */ > > + u8 entries_count; > > A counter set is limited to 255? Could there be counter sets that have a > thousand or so? A counter set is merely a set. I can't see a reason why would a user want to query a set which contains more than 256 counters. All at the same time. However, I agree that we could modify it to u16 or u32. [Guy Shattah] -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 10/21/2017 3:29 AM, Guy Shattah wrote: > > >> On Thu, 19 Oct 2017, Yishai Hadas wrote: >> >>> +#define IB_COUNTER_NAME_LEN 64 >>> +struct ib_counter_set_describe_attr { >>> + /* Type that this set refers to, use enum ib_counter_set_type */ >>> + u8 counted_type; >> >> Gap here of 7 bytes. Maybe move the field to get a more compact structure? >> >>> + /* Number of instances of this counter-set available in the hardware >> */ >>> + u64 num_of_cs; >> >> u16 or u32 should be enough right? > > Future API might be added to create user-customizable sets. > How many potential subsets are for a set of 32 counters? More than 2^64. > We might want to be able to support it. > >> >>> + /* Attributes of the set, use enum ib_counter_set_attributes */ >>> + u32 attributes; >>> + /* Number of counters in this set */ >>> + u8 entries_count; >> >> A counter set is limited to 255? Could there be counter sets that have a >> thousand or so? > > A counter set is merely a set. I can't see a reason why would a user want to query a set > which contains more than 256 counters. All at the same time. > However, I agree that we could modify it to u16 or u32. Thanks Christoper for looking at the series. In V1 will change this field to be u16 and re-order the fields in struct ib_counter_set_describe_attr to be more compact as you suggest. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index d8f1a5d..eda389a 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c @@ -2290,3 +2290,23 @@ void ib_drain_qp(struct ib_qp *qp) ib_drain_rq(qp); } EXPORT_SYMBOL(ib_drain_qp); + +/** + * ib_describe_counter_set - Describes a Counter Set + * @device: The device on which to describe a counter set. + * @cs_id: the counter set id to be described + * @cs_describe_attr: A list of description attributes + * required to get the outcome. + */ +int ib_describe_counter_set(struct ib_device *device, + u16 cs_id, + struct ib_counter_set_describe_attr *cs_describe_attr) +{ + if (!device->describe_counter_set) + return -ENOSYS; + + return device->describe_counter_set(device, cs_id, + cs_describe_attr, + NULL); +} +EXPORT_SYMBOL(ib_describe_counter_set); diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 0cc880d..44f92c3 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -2053,6 +2053,30 @@ struct ib_port_pkey_list { struct list_head pkey_list; }; +enum ib_counter_set_type { + IB_COUNTER_SET_FLOW, +}; + +enum ib_counter_set_attributes { + /* Is cache supported */ + IB_COUNTER_SET_ATTR_CACHED = 1 << 0, +}; + +#define IB_COUNTER_NAME_LEN 64 +struct ib_counter_set_describe_attr { + /* Type that this set refers to, use enum ib_counter_set_type */ + u8 counted_type; + /* Number of instances of this counter-set available in the hardware */ + u64 num_of_cs; + /* Attributes of the set, use enum ib_counter_set_attributes */ + u32 attributes; + /* Number of counters in this set */ + u8 entries_count; + /* Counters_names_buff length */ + u16 counters_names_len; + char *counters_names_buff; +}; + struct ib_device { /* Do not access @dma_device directly from ULP nor from HW drivers. */ struct device *dma_device; @@ -2308,6 +2332,11 @@ struct ib_device { struct ib_rwq_ind_table_init_attr *init_attr, struct ib_udata *udata); int (*destroy_rwq_ind_table)(struct ib_rwq_ind_table *wq_ind_table); + int (*describe_counter_set)(struct ib_device *device, + u16 cs_id, + struct ib_counter_set_describe_attr *cs_describe_attr, + struct ib_udata *udata); + /** * rdma netdev operation * @@ -3615,6 +3644,10 @@ struct ib_rwq_ind_table *ib_create_rwq_ind_table(struct ib_device *device, wq_ind_table_init_attr); int ib_destroy_rwq_ind_table(struct ib_rwq_ind_table *wq_ind_table); +int ib_describe_counter_set(struct ib_device *device, + u16 cs_id, + struct ib_counter_set_describe_attr *cs_describe_attr); + int ib_map_mr_sg(struct ib_mr *mr, struct scatterlist *sg, int sg_nents, unsigned int *sg_offset, unsigned int page_size);