> Subject: [Open-FCoE] [RFC v2 PATCH 5/5] Base Driver: Added support for > receive offload in base driver for storage target.
Title starts as "ixgbe: ..." should be enough, base driver is too wide, this is just to fix intel ixgbe to support offload when running in target mode. > > 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. > We have to figure out a way to be able to do both initiator and target at the same time if this is to merge to upstream ixgbe driver since the context setup for ddp is per i/o and currently we don't have a way to tell if it's write or read, thus having this would break initiator mode. Also, for initiator we don't want to see the last data frame's header at all. yi > Signed-off-by: Kiran Patil <[email protected]> > --- > > drivers/net/ixgbe/ixgbe_fcoe.c | 26 ++++++++++++++++++++++++++ > drivers/target/tcm_fc/tfc_cmd.c | 4 ++-- > 2 files changed, 28 insertions(+), 2 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 > diff --git a/drivers/target/tcm_fc/tfc_cmd.c > b/drivers/target/tcm_fc/tfc_cmd.c > index aaf9b26..13802ec 100644 > --- a/drivers/target/tcm_fc/tfc_cmd.c > +++ b/drivers/target/tcm_fc/tfc_cmd.c > @@ -274,8 +274,8 @@ int ft_write_pending(struct se_cmd *se_cmd) > /* Target is 'exchange responder' and sending XFER_READY > * to 'exchange initiator (initiator)' > */ > - if (ep->xid <= lport->lro_xid && > - fh->fh_r_ctl == FC_RCTL_DD_DATA_DESC) { > + if ((ep->xid <= lport->lro_xid) && > + (fh->fh_r_ctl == FC_RCTL_DD_DATA_DESC)) { > if (se_cmd->se_cmd_flags & SCF_SCSI_DATA_SG_IO_CDB) { > /* > * Map se_mem list to scatterlist, so that > > _______________________________________________ > devel mailing list > [email protected] > http://www.open-fcoe.org/mailman/listinfo/devel _______________________________________________ devel mailing list [email protected] http://www.open-fcoe.org/mailman/listinfo/devel
