From: Kiran Patil <[email protected]>

Problem: Without changes in base driver (ixgbe), unable to offload "receive"
         for storage targets.

Fix:     Made necessary changes to set various bit and to add trailer for last 
packet.

Technical Details: Added support in base driver (ixgbe) for receive offload for 
targets
         by setting necessary bits in FCBUFF, FCRXCTRL, and extended skb to add
         valid trailer (EOF_T) (because in case of DDP offload, HW only copies 
header of
         last frame and doesn;t include trailer) otherwise ULD (FCoE) protocol
         driver drops the packet.

Signed-off-by: Kiran Patil <[email protected]>
---

 drivers/net/ixgbe/ixgbe_fcoe.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_fcoe.c b/drivers/net/ixgbe/ixgbe_fcoe.c
index 072327c..eb64082 100644
--- a/drivers/net/ixgbe/ixgbe_fcoe.c
+++ b/drivers/net/ixgbe/ixgbe_fcoe.c
@@ -244,6 +244,12 @@ int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid,
        fcbuff = (IXGBE_FCBUFF_4KB << IXGBE_FCBUFF_BUFFSIZE_SHIFT);
        fcbuff |= ((j & 0xff) << IXGBE_FCBUFF_BUFFCNT_SHIFT);
        fcbuff |= (firstoff << IXGBE_FCBUFF_OFFSET_SHIFT);
+
+       /*
+        * Setup the WRCONTX bit to 1, to allow DDP (Large Rx offload)
+        * for target.
+        */
+       fcbuff |= (IXGBE_FCBUFF_WRCONTX);
        fcbuff |= (IXGBE_FCBUFF_VALID);
 
        fcdmarw = xid;
@@ -354,6 +360,25 @@ int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter,
        }
 
 ddp_out:
+       if (fh->fh_r_ctl == FC_RCTL_DD_SOL_DATA) {
+               /*
+                * Extending the SKB to achieve minimum length check (46)
+                * otherwise packet gets dropped. Likewise, setting the trailer
+                * (fcoe_eof) to be EOF_T otherwise packets gets dropped and
+                * write reponse (good) doesn;t get sent out since packet
+                * doesn;t reach to TCM/LIO target codepath.
+                * NOTE: Setting CRC to known value, SW stack doesn't look at
+                * CRC of this packets.
+                */
+               struct fcoe_crc_eof *crc;
+
+               skb_put(skb, sizeof(*crc));
+               crc = (struct fcoe_crc *)&skb->data[sizeof(struct fcoe_hdr) +
+                                         sizeof(struct fc_frame_header)];
+               crc->fcoe_eof = FC_EOF_T;
+               /* This is just for debug purpose, faking the CRC */
+               crc->fcoe_crc32 = 0xDEADC0DE;
+       }
        return rc;
 }
 
@@ -554,6 +579,7 @@ void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter)
 
        IXGBE_WRITE_REG(hw, IXGBE_FCRXCTRL,
                        IXGBE_FCRXCTRL_FCOELLI |
+                       IXGBE_FCRXCTRL_LASTSEQH |
                        IXGBE_FCRXCTRL_FCCRCBO |
                        (FC_FCOE_VER << IXGBE_FCRXCTRL_FCOEVER_SHIFT));
 #ifdef CONFIG_IXGBE_DCB

_______________________________________________
devel mailing list
[email protected]
http://www.open-fcoe.org/mailman/listinfo/devel

Reply via email to