ib_sg_dma changes
cover ib_sg_dma changes
This patch series modified the ib_sg_dma API to
eliminate the .dma_len and .dma_address methods.
In all present cases that overload these methods (ipath, qib, ehca), the lack of these methods are compensated for by code changes to the driver .map_sg to insure that the vanilla sg_dma_address() and sg_dma_len() will do the same thing as the equivalent former ib_sg_dma_address() and ib_sg_dma_len() calls into the drivers.
This patch series is a followup to this recent submission
http://marc.info/?l=linux-rdma&m=139602422108727&w=2
and Bart's similar comment in
http://marc.info/?l=linux-netdev&m=135643746610259&w=2.
Roland, I'm not sure of the history of these methods and what rationale caused them to be added?
There is obviously an interim step that could be done here to preseve the overload by not changing verbs, yet change qib/ipath/echa to not overload them. This would allow the drivers to work even when the "correct" API's had not been used by the ULP.
---
Mike Marciniszyn (4):
IB/core: Remove overload in ib_sg_dma*
IB/qib: remove ib_sg_dma_address() and ib_sg_dma_len() overloads IB/ipath: remove ib_sg_dma_address() and ib_sg_dma_len() overloads IB/ehca: remove ib_sg_dma_address() and ib_sg_dma_len() overloads
drivers/infiniband/hw/ehca/ehca_mrmw.c | 12 --------- drivers/infiniband/hw/ipath/ipath_dma.c | 43 +++++++++++-------------------- drivers/infiniband/hw/qib/qib_dma.c | 21 +++------------ include/rdma/ib_verbs.h | 14 ++++------ 4 files changed, 25 insertions(+), 65 deletions(-)
Signature · 5 lines
Mike -- 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): 20140328163500.5773.35838.stgit-K+u1se/DcYrLESAwzcoQNrvm/[email protected]
PATCH 1/4 IB/core: Remove overload in ib_sg_dma*
The code is replaced by driver specific
changes and avoids the pointer NULL test
for drivers that don't overload these
operations.
--- include/rdma/ib_verbs.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
include/rdma/ib_verbs.h +6 -8
@@ -1266,10 +1266,6 @@ struct ib_dma_mapping_ops {void (*unmap_sg)(struct ib_device *dev,struct scatterlist *sg,int nents,enum dma_data_direction direction); -u64 (*dma_address)(struct ib_device *dev, -struct scatterlist *sg); -unsigned int (*dma_len)(struct ib_device *dev, -struct scatterlist *sg); void (*sync_single_for_cpu)(struct ib_device *dev, u64 dma_handle, size_t size,
@@ -2089,12 +2085,13 @@ static inline void ib_dma_unmap_sg_attrs(struct ib_device *dev,* ib_sg_dma_address - Return the DMA address from a scatter/gather entry * @dev: The device for which the DMA addresses were created * @sg: The scatter/gather entry +* +* Note: this function is obsolete. To do: change all occurrences of +* ib_sg_dma_address() into sg_dma_address(). */ static inline u64 ib_sg_dma_address (struct ib_device *dev,struct scatterlist *sg) { -if (dev->dma_ops) -return dev->dma_ops->dma_address (dev, sg);return sg_dma_address (sg); }
@@ -2102,12 +2099,13 @@ static inline u64 ib_sg_dma_address(struct ib_device *dev,* ib_sg_dma_len - Return the DMA length from a scatter/gather entry * @dev: The device for which the DMA addresses were created * @sg: The scatter/gather entry +* +* Note: this function is obsolete. To do: change all occurrences of +* ib_sg_dma_len() into sg_dma_len(). */ static inline unsigned int ib_sg_dma_len (struct ib_device *dev,struct scatterlist *sg) { -if (dev->dma_ops) -return dev->dma_ops->dma_len (dev, sg);return sg_dma_len (sg); }
--
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 2/4 IB/qib: remove ib_sg_dma_address() and ib_sg_dma_len() overloads
In reply to a message not in the archiveThe code is replaced by logic in the .map_sg overload.
--- drivers/infiniband/hw/qib/qib_dma.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-)
drivers/infiniband/hw/qib/qib_dma.c +4 -17
@@ -108,6 +108,10 @@ static int qib_map_sg(struct ib_device *dev, struct scatterlist *sgl, ret =0 ;break ; } + sg->dma_address = addr + sg->offset; +#ifdef CONFIG_NEED_SG_DMA_LENGTH + sg->dma_length = sg->length; +#endif }return ret; }
@@ -119,21 +123,6 @@ static void qib_unmap_sg(struct ib_device *dev,BUG_ON (!valid_dma_direction (direction)); } -static u64 qib_sg_dma_address (struct ib_device *dev,struct scatterlist *sg) -{ -u64 addr = (u64 )page_address (sg_page (sg)); - -if (addr) - addr += sg->offset; -return addr; -} - -static unsigned int qib_sg_dma_len (struct ib_device *dev, -struct scatterlist *sg) -{ -return sg->length; -} -static void qib_sync_single_for_cpu (struct ib_device *dev,u64 addr,size_t size,enum dma_data_direction dir) {
@@ -173,8 +162,6 @@ struct ib_dma_mapping_ops qib_dma_mapping_ops = { .unmap_page = qib_dma_unmap_page, .map_sg = qib_map_sg, .unmap_sg = qib_unmap_sg, - .dma_address = qib_sg_dma_address, - .dma_len = qib_sg_dma_len, .sync_single_for_cpu = qib_sync_single_for_cpu, .sync_single_for_device = qib_sync_single_for_device, .alloc_coherent = qib_dma_alloc_coherent,
--
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/4 IB/ipath: remove ib_sg_dma_address() and ib_sg_dma_len() overloads
In reply to a message not in the archiveThe code is replaced by logic in the .map_sg overload.
--- drivers/infiniband/hw/ipath/ipath_dma.c | 43 +++++++++++-------------------- 1 file changed, 15 insertions(+), 28 deletions(-)
drivers/infiniband/hw/ipath/ipath_dma.c +15 -28
@@ -115,6 +115,10 @@ static int ipath_map_sg(struct ib_device *dev, struct scatterlist *sgl, ret =0 ;break ; } + sg->dma_address = addr + sg->offset; +#ifdef CONFIG_NEED_SG_DMA_LENGTH + sg->dma_length = sg->length; +#endif }return ret; }
@@ -126,21 +130,6 @@ static void ipath_unmap_sg(struct ib_device *dev,BUG_ON (!valid_dma_direction (direction)); } -static u64 ipath_sg_dma_address (struct ib_device *dev,struct scatterlist *sg) -{ -u64 addr = (u64 )page_address (sg_page (sg)); - -if (addr) - addr += sg->offset; -return addr; -} - -static unsigned int ipath_sg_dma_len (struct ib_device *dev, -struct scatterlist *sg) -{ -return sg->length; -} - static void ipath_sync_single_for_cpu(struct ib_device *dev, u64 addr, size_t size,
@@ -176,17 +165,15 @@ static void ipath_dma_free_coherent(struct ib_device *dev, size_t size, }struct ib_dma_mapping_ops ipath_dma_mapping_ops = { - ipath_mapping_error, - ipath_dma_map_single, - ipath_dma_unmap_single, - ipath_dma_map_page, - ipath_dma_unmap_page, - ipath_map_sg, - ipath_unmap_sg, - ipath_sg_dma_address, - ipath_sg_dma_len, - ipath_sync_single_for_cpu, - ipath_sync_single_for_device, - ipath_dma_alloc_coherent, - ipath_dma_free_coherent + .mapping_error = ipath_mapping_error, + .map_single = ipath_dma_map_single, + .unmap_single = ipath_dma_unmap_single, + .map_page = ipath_dma_map_page, + .unmap_page = ipath_dma_unmap_page, + .map_sg = ipath_map_sg, + .unmap_sg = ipath_unmap_sg, + .sync_single_for_cpu = ipath_sync_single_for_cpu, + .sync_single_for_device = ipath_sync_single_for_device, + .alloc_coherent = ipath_dma_alloc_coherent, + .free_coherent = ipath_dma_free_coherent };
--
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/4 IB/ehca: remove ib_sg_dma_address() and ib_sg_dma_len() overloads
In reply to a message not in the archiveThe method has been removed.
--- drivers/infiniband/hw/ehca/ehca_mrmw.c | 12 ------------ 1 file changed, 12 deletions(-)
drivers/infiniband/hw/ehca/ehca_mrmw.c +0 -12
@@ -2591,16 +2591,6 @@ static void ehca_dma_unmap_sg(struct ib_device *dev, struct scatterlist *sg,/* This is only a stub; nothing to be done here */ } -static u64 ehca_dma_address (struct ib_device *dev,struct scatterlist *sg) -{ -return sg->dma_address; -} - -static unsigned int ehca_dma_len (struct ib_device *dev,struct scatterlist *sg) -{ -return sg->length; -} -static void ehca_dma_sync_single_for_cpu (struct ib_device *dev,u64 addr,size_t size,enum dma_data_direction dir)
@@ -2653,8 +2643,6 @@ struct ib_dma_mapping_ops ehca_dma_mapping_ops = { .unmap_page = ehca_dma_unmap_page, .map_sg = ehca_dma_map_sg, .unmap_sg = ehca_dma_unmap_sg, - .dma_address = ehca_dma_address, - .dma_len = ehca_dma_len, .sync_single_for_cpu = ehca_dma_sync_single_for_cpu, .sync_single_for_device = ehca_dma_sync_single_for_device, .alloc_coherent = ehca_dma_alloc_coherent,
--
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
Hi,
Quoted 16 lines · Mike Marciniszyn
This patch series modified the
ib_sg_dmaAPI to eliminate the .dma_len and .dma_address methods.In all present cases that overload these methods (ipath, qib, ehca), the lack of these methods are compensated for by code changes to the driver .map_sg to insure that the vanilla
sg_dma_address()andsg_dma_len()will do the same thing as the equivalent formerib_sg_dma_address()andib_sg_dma_len()calls into the drivers.This patch series is a followup to this recent submission
http://marc.info/?l=linux-rdma&m=139602422108727&w=2
and Bart's similar comment in
http://marc.info/?l=linux-netdev&m=135643746610259&w=2.
Quoted 8 lines
Roland, I'm not sure of the history of these methods and what rationale caused them to be added?
There is obviously an interim step that could be done here to preseve the overload by not changing verbs, yet change qib/ipath/echa to not overload them. This would allow the drivers to work even when the "correct" API's had not been used by the ULP.
Hum, you should re-order the patch the other way:
first remove the functions in drivers, then remove the call to the functions, and finaly remove the function pointers in the structure. Otherwise you might break build for people doing some git bisect.
It's just a matter of making patch "[PATCH 1/4] IB/core: Remove overload in ib_sg_dma*" the last one.
BTW, You might want to provide a better explanation in the drivers functions remove patches (just duplicate the explanation).
Regards.
Signature · 8 lines
Yann Droneaud OPTEYA -- 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): 1396025852.3297.78.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/[email protected]
PiBJdCdzIGp1c3QgYSBtYXR0ZXIgb2YgbWFraW5nIHBhdGNoICJbUEFUQ0ggMS80XSBJQi9jb3Jl OiBSZW1vdmUgb3ZlcmxvYWQgaW4NCj4gaWJfc2dfZG1hKiIgdGhlIGxhc3Qgb25lLg0KPiANCj4g QlRXLCBZb3UgbWlnaHQgd2FudCB0byBwcm92aWRlIGEgYmV0dGVyIGV4cGxhbmF0aW9uIGluIHRo ZSBkcml2ZXJzIGZ1bmN0aW9ucw0KPiByZW1vdmUgcGF0Y2hlcyAoanVzdCBkdXBsaWNhdGUgdGhl IGV4cGxhbmF0aW9uKS4NCg0KVGFrZSBhIGxvb2sgYXQgdGhlIGxhdGVzdCBzZXJpZXMuDQoNCk1p a2UNCg==
--
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