Skip to contentSkip to conversation

struct page vs page_link

DISCUSSION Mark Tuttle 2 participants 4 messages Feb 9, 2008 – Feb 13, 2008

lore
Share & tools
lore
#0 lore raw

Regarding:
commit 18dabf473e15850c0dbc8ff13ac1e2806d542c15

This actually breaks the 802.11 subsystem (http://80211.sf.net) which relies on the page struct. (ieee80211_crypt_wep.c, line 190) Can anyone suggest an alternative kernel function or method? As of 2.6.24, the 802.11 subsystem cannot compile.

Mark Tuttle

#1 lore raw
Quoted 8 lines · Mark Tuttle

Regarding:
commit 18dabf473e15850c0dbc8ff13ac1e2806d542c15

This actually breaks the 802.11 subsystem (http://80211.sf.net) which relies on the page struct. (ieee80211_crypt_wep.c, line 190) Can anyone suggest an alternative kernel function or method? As of 2.6.24, the 802.11 subsystem cannot compile.

Greetings Mark,

I have been updating the LIO-Target codebase to 2.6.24 recently, and posted some information about what I ended up doing for struct scatterlist->page changing to scatterlist->page_link and include/linux/scatterlist.h

http://lkml.org/lkml/2008/2/4/111

Hope this helps,

--nab

#2 lore raw

Thanks for that information, I analysed your code to get a better understanding of exactly what was going on and was able to successfully patch what I needed to.

http://www.tuttleresearch.com/80211patch.html

Much appreciated,
Mark Tuttle

Quoted 24 lines · Nicholas A. Bellinger
Quoted 8 lines · Mark Tuttle

Regarding:
commit 18dabf473e15850c0dbc8ff13ac1e2806d542c15

This actually breaks the 802.11 subsystem (http://80211.sf.net) which relies on the page struct. (ieee80211_crypt_wep.c, line 190) Can anyone suggest an alternative kernel function or method? As of 2.6.24, the 802.11 subsystem cannot compile.

Greetings Mark,

I have been updating the LIO-Target codebase to 2.6.24 recently, and posted some information about what I ended up doing for struct scatterlist->page changing to scatterlist->page_link and include/linux/scatterlist.h

http://lkml.org/lkml/2008/2/4/111

Hope this helps,

--nab

#3 lore raw

Hi Mark,

After Bark posted an BUG() when CONFIG_DEBUG_SG was used with LIO-Target, I add the proper usage of sg_table_init() and sg_mark_end() in the LIO-Target SE. Please update your case (if you are not doing it already). Here are my new changes for those who are still updating drivers to use the new include/linux/scatterlist.h API.

--nab

iscsi_linux_defs.h (revision 215) renamed from iscsi_linux_defs.h (revision 214) +3 -0
Index: include/iscsi_linux_defs.h
===================================================================
@@ -49,11 +49,14 @@
  * code, and use inline functions for legacy operation. 
  */
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
+# define SET_SG_TABLE(sg, cnt)         sg_init_table((struct scatterlist *)&sg[0], cnt);       \
+                                               sg_mark_end((struct scatterlist *)&sg[cnt - 1]);
 # define GET_ADDR_SG(sg)               sg_virt(sg)
 # define GET_PAGE_SG(sg)               sg_page(sg)
 # define SET_PAGE_SG(sg, page)         sg_assign_page(sg, page)
 #else
 #include <linux/scatterlist.h>
+#define SET_SG_TABLE(sg, cnt)  
 static inline void *GET_ADDR_SG(struct scatterlist *sg)
 {
        return(page_address(sg->page) + sg->offset);

As you can see, the pre 2.6.24 case expands to a nop.

In my case with LIO-Target and generating SC arrays going to the default path (which is common for PSCSI, IBLOCK, FILE, and RAMDISK_MCP) where se_mem_t list head struct page is mapped to struct page-link in the contigious struct scatterlist arrays.

In the iscsi_target_transport.c:transport_calc_sg_num() and scatterlist allocation for RAMDISK_DR and RAMDISK_MCP, I added the usage of SET_SG_TABLE right after the array of struct scatterlist right after the struct scatterlist array has been allocated and memset.

iscsi_target_rd.c (revision 217) renamed from iscsi_target_rd.c (revision 215) +2 -0
Index: target/iscsi_target_rd.c
===================================================================
@@ -209,6 +209,8 @@
                }
                memset(sg, 0, sg_per_table * sizeof(struct scatterlist));
 
+               SET_SG_TABLE(sg, sg_per_table);
+
                sg_table[i].sg_table = sg;
                sg_table[i].rd_sg_count = sg_per_table;
                sg_table[i].page_start_offset = page_offset;
iscsi_target_transport.c (revision 217) renamed from iscsi_target_transport.c (revision 215) +2 -0
Index: target/iscsi_target_transport.c
===================================================================
@@ -5096,6 +5096,8 @@
        }
        memset(task->task_buf, 0, task->task_sg_num * sizeof(struct scatterlist));
 
+       SET_SG_TABLE(task->task_buf, task->task_sg_num);
+
        DEBUG_SC("Successfully allocated task->task_sg_num: %u\n", task->task_sg_num);
        
        return(task->task_sg_num);
Quoted 40 lines · Mark Tuttle

Thanks for that information, I analysed your code to get a better understanding of exactly what was going on and was able to successfully patch what I needed to.

http://www.tuttleresearch.com/80211patch.html

Much appreciated,
Mark Tuttle

Quoted 17 lines · Nicholas A. Bellinger
Quoted 8 lines · Mark Tuttle

Regarding:
commit 18dabf473e15850c0dbc8ff13ac1e2806d542c15

This actually breaks the 802.11 subsystem (http://80211.sf.net) which relies on the page struct. (ieee80211_crypt_wep.c, line 190) Can anyone suggest an alternative kernel function or method? As of 2.6.24, the 802.11 subsystem cannot compile.

Greetings Mark,

I have been updating the LIO-Target codebase to 2.6.24 recently, and posted some information about what I ended up doing for struct scatterlist->page changing to scatterlist->page_link and include/linux/scatterlist.h

Quoted 7 lines

http://lkml.org/lkml/2008/2/4/111

Hope this helps,

--nab

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/