kernel: fix OCF for linux 3.2
authorJonas Gorski <jogo@openwrt.org>
Thu, 19 Jan 2012 19:51:54 +0000 (19:51 +0000)
committerJonas Gorski <jogo@openwrt.org>
Thu, 19 Jan 2012 19:51:54 +0000 (19:51 +0000)
Add skb_frag_page from 3.2 to OCF for 3.1 and earlier and use it.

SVN-Revision: 29818

package/kernel/modules/crypto.mk
target/linux/generic/files/crypto/ocf/c7108/aes-7108.c
target/linux/generic/files/crypto/ocf/criov.c
target/linux/generic/files/crypto/ocf/cryptocteon/cryptocteon.c
target/linux/generic/files/crypto/ocf/cryptosoft.c
target/linux/generic/files/crypto/ocf/hifn/hifn7751.c
target/linux/generic/files/crypto/ocf/ocf-compat.h
target/linux/generic/files/crypto/ocf/safe/safe.c
target/linux/generic/files/crypto/ocf/ubsec_ssb/ubsec_ssb.c

index 44c4b5d7b7f562e2018f4c1799585c741c6a1714..c8be6f9460b471213e492f9ef7f4ffc4c95873d5 100644 (file)
@@ -401,7 +401,7 @@ $(eval $(call KernelPackage,crypto-misc))
 
 define KernelPackage/crypto-ocf
   TITLE:=OCF modules
-  DEPENDS:=+@OPENSSL_ENGINE @!TARGET_uml +kmod-crypto-manager @!LINUX_3_2||BROKEN
+  DEPENDS:=+@OPENSSL_ENGINE @!TARGET_uml +kmod-crypto-manager
   KCONFIG:= \
        CONFIG_OCF_OCF \
        CONFIG_OCF_CRYPTODEV \
index a5ac0549572c0c4781b9eb013d1e001c1019e478..d03540b64efe8e6ac683a8be67a1c8fe26b37ea9 100644 (file)
@@ -592,13 +592,13 @@ c7108_process(void *arg, struct cryptop *crp, int hint)
                         i < skb_shinfo(skb)->nr_frags &&
                         sg_num < SCATTERLIST_MAX; i++) {
                    if (skip < skb_shinfo(skb)->frags[i].size) {
-                       //sg[sg_num].page   = skb_shinfo(skb)->frags[i].page;
+                       //sg[sg_num].page   = skb_frag_page(&kb_shinfo(skb)->frags[i]);
                        //sg[sg_num].offset = skb_shinfo(skb)->frags[i].page_offset + skip;
                        len = skb_shinfo(skb)->frags[i].size - skip;
                        if (len + sg_len > crd->crd_len)
                            len = crd->crd_len - sg_len;
                        //sg[sg_num].length = len;
-                       sg_set_page(&sg[sg_num], skb_shinfo(skb)->frags[i].page, len, skb_shinfo(skb)->frags[i].page_offset + skip);
+                       sg_set_page(&sg[sg_num], skb_frag_page(&skb_shinfo(skb)->frags[i]), len, skb_shinfo(skb)->frags[i].page_offset + skip);
                        sg_len += sg[sg_num].length;
                        sg_num++;
                        skip = 0;
index d3d8cfd8f7745afd3cd29505051775060d7dbbe2..cdc731e29a4315c7fb76af48e88ced90d152009a 100644 (file)
@@ -156,7 +156,7 @@ skb_copy_bits_back(struct sk_buff *skb, int offset, caddr_t cp, int len)
        offset -= skb_headlen(skb);
        for (i = 0; len > 0 && i < skb_shinfo(skb)->nr_frags; i++) {
                if (offset < skb_shinfo(skb)->frags[i].size) {
-                       memcpy(page_address(skb_shinfo(skb)->frags[i].page) +
+                       memcpy(page_address(skb_frag_page(&skb_shinfo(skb)->frags[i])) +
                                        skb_shinfo(skb)->frags[i].page_offset,
                                        cp, min_t(int, skb_shinfo(skb)->frags[i].size, len));
                        len -= skb_shinfo(skb)->frags[i].size;
index 741e4fa31d5c8af27c682ea4d741035b7b959539..b0c10a295a678727acfba37ab6b16477f70c60cd 100644 (file)
@@ -473,7 +473,7 @@ octo_process(device_t dev, struct cryptop *crp, int hint)
                for (i = 0; i < skb_shinfo(skb)->nr_frags && sg_num < SCATTERLIST_MAX;
                                i++) {
                        len = skb_shinfo(skb)->frags[i].size;
-                       sg_set_page(&sg[sg_num], skb_shinfo(skb)->frags[i].page,
+                       sg_set_page(&sg[sg_num], skb_frag_page(&skb_shinfo(skb)->frags[i]),
                                        len, skb_shinfo(skb)->frags[i].page_offset);
                        sg_len += len;
                        sg_num++;
index 79aac923600fa42b38290400e28c250bd50bc938..f9ecdf927d41a237a2f4724ca9e42321ded50100 100644 (file)
@@ -777,7 +777,7 @@ static void swcr_process_req(struct swcr_req *req)
                                if (len + sg_len > crd->crd_len)
                                        len = crd->crd_len - sg_len;
                                sg_set_page(&req->sg[sg_num],
-                                       skb_shinfo(skb)->frags[i].page,
+                                       skb_frag_page(&skb_shinfo(skb)->frags[i]),
                                        len,
                                        skb_shinfo(skb)->frags[i].page_offset + skip);
                                sg_len += len;
index 4803a83a5a3836c610951797be6e26c73f21e39c..b7df81907c1b54ee5ff70852337ed4d01dde7e07 100644 (file)
@@ -241,7 +241,7 @@ pci_map_skb(struct hifn_softc *sc,struct hifn_operand *buf,struct sk_buff *skb)
        for (i = 0; i < skb_shinfo(skb)->nr_frags; ) {
                buf->segs[buf->nsegs].ds_len = skb_shinfo(skb)->frags[i].size;
                buf->segs[buf->nsegs].ds_addr = pci_map_single(sc->sc_pcidev,
-                               page_address(skb_shinfo(skb)->frags[i].page) +
+                               page_address(skb_frag_page(&skb_shinfo(skb)->frags[i])) +
                                        skb_shinfo(skb)->frags[i].page_offset,
                                buf->segs[buf->nsegs].ds_len, PCI_DMA_BIDIRECTIONAL);
                buf->mapsize += buf->segs[buf->nsegs].ds_len;
index 2d985360f273a24c5f1ceef4f922c61e4fc09e4a..b76c369dd6d759852b835cdf64d7c57151b35f2c 100644 (file)
@@ -359,6 +359,15 @@ static inline int ocf_run_thread(void *arg)
 #include <linux/kthread.h>
 #endif
 
+#include <linux/skbuff.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)
+static inline struct page *skb_frag_page(const skb_frag_t *frag)
+{
+       return frag->page;
+}
+#endif
+
 #endif /* __KERNEL__ */
 
 /****************************************************************************/
index 189b95f6097c587835af4cd98ee08ee25a418384..7d9b541177e5d0434a43d9c8ec8ef5b61d010d6d 100644 (file)
@@ -208,7 +208,7 @@ pci_map_skb(struct safe_softc *sc,struct safe_operand *buf,struct sk_buff *skb)
 
        for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
                pci_map_linear(sc, buf,
-                               page_address(skb_shinfo(skb)->frags[i].page) +
+                               page_address(skb_frag_page(&skb_shinfo(skb)->frags[i])) +
                                                        skb_shinfo(skb)->frags[i].page_offset,
                                skb_shinfo(skb)->frags[i].size);
        }
index aa0733f08b9510141daf1b5cfc8b6724af42701d..f5d7762360a57af88cf53a35b0f1bf1af5a37219 100644 (file)
@@ -297,18 +297,18 @@ dma_map_skb(struct ubsec_softc *sc, struct ubsec_dma_alloc* q_map, struct sk_buf
 
 #ifdef UBSEC_VERBOSE_DEBUG
         DPRINTF("%s - map %d 0x%x %d\n", __FUNCTION__, i + 1, 
-            (unsigned int)page_address(skb_shinfo(skb)->frags[i].page) +
+            (unsigned int)page_address(skb_frag_page(&skb_shinfo(skb)->frags[i])) +
             skb_shinfo(skb)->frags[i].page_offset, skb_shinfo(skb)->frags[i].size);
 #endif
 
         tmp = dma_map_single(sc->sc_dv,
-                             page_address(skb_shinfo(skb)->frags[i].page) +
+                             page_address(skb_frag_page(&skb_shinfo(skb)->frags[i])) +
                                  skb_shinfo(skb)->frags[i].page_offset, 
                              skb_shinfo(skb)->frags[i].size,
                              DMA_BIDIRECTIONAL);
 
         q_map[i + 1].dma_paddr = tmp;
-        q_map[i + 1].dma_vaddr = (void*)(page_address(skb_shinfo(skb)->frags[i].page) +
+        q_map[i + 1].dma_vaddr = (void*)(page_address(skb_frag_page(&skb_shinfo(skb)->frags[i])) +
                                   skb_shinfo(skb)->frags[i].page_offset);
         q_map[i + 1].dma_size = skb_shinfo(skb)->frags[i].size;