crypto: chelsio - request to HW should wrap
-Tx request and data is copied to HW Q in 64B desc, check for end of queue and adjust the current position to start from beginning before passing the additional request info. -key context copy should check key length only -Few reverse christmas tree correction Signed-off-by: Atul Gupta <atul.gupta@chelsio.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
7024e0da72
commit
4c826fed67
|
@ -346,18 +346,23 @@ inline void *copy_cpltx_pktxt(struct sk_buff *skb,
|
||||||
struct net_device *dev,
|
struct net_device *dev,
|
||||||
void *pos)
|
void *pos)
|
||||||
{
|
{
|
||||||
|
struct cpl_tx_pkt_core *cpl;
|
||||||
|
struct sge_eth_txq *q;
|
||||||
struct adapter *adap;
|
struct adapter *adap;
|
||||||
struct port_info *pi;
|
struct port_info *pi;
|
||||||
struct sge_eth_txq *q;
|
|
||||||
struct cpl_tx_pkt_core *cpl;
|
|
||||||
u64 cntrl = 0;
|
|
||||||
u32 ctrl0, qidx;
|
u32 ctrl0, qidx;
|
||||||
|
u64 cntrl = 0;
|
||||||
|
int left;
|
||||||
|
|
||||||
pi = netdev_priv(dev);
|
pi = netdev_priv(dev);
|
||||||
adap = pi->adapter;
|
adap = pi->adapter;
|
||||||
qidx = skb->queue_mapping;
|
qidx = skb->queue_mapping;
|
||||||
q = &adap->sge.ethtxq[qidx + pi->first_qset];
|
q = &adap->sge.ethtxq[qidx + pi->first_qset];
|
||||||
|
|
||||||
|
left = (void *)q->q.stat - pos;
|
||||||
|
if (!left)
|
||||||
|
pos = q->q.desc;
|
||||||
|
|
||||||
cpl = (struct cpl_tx_pkt_core *)pos;
|
cpl = (struct cpl_tx_pkt_core *)pos;
|
||||||
|
|
||||||
cntrl = TXPKT_L4CSUM_DIS_F | TXPKT_IPCSUM_DIS_F;
|
cntrl = TXPKT_L4CSUM_DIS_F | TXPKT_IPCSUM_DIS_F;
|
||||||
|
@ -382,18 +387,17 @@ inline void *copy_key_cpltx_pktxt(struct sk_buff *skb,
|
||||||
void *pos,
|
void *pos,
|
||||||
struct ipsec_sa_entry *sa_entry)
|
struct ipsec_sa_entry *sa_entry)
|
||||||
{
|
{
|
||||||
struct adapter *adap;
|
|
||||||
struct port_info *pi;
|
|
||||||
struct sge_eth_txq *q;
|
|
||||||
unsigned int len, qidx;
|
|
||||||
struct _key_ctx *key_ctx;
|
struct _key_ctx *key_ctx;
|
||||||
int left, eoq, key_len;
|
int left, eoq, key_len;
|
||||||
|
struct sge_eth_txq *q;
|
||||||
|
struct adapter *adap;
|
||||||
|
struct port_info *pi;
|
||||||
|
unsigned int qidx;
|
||||||
|
|
||||||
pi = netdev_priv(dev);
|
pi = netdev_priv(dev);
|
||||||
adap = pi->adapter;
|
adap = pi->adapter;
|
||||||
qidx = skb->queue_mapping;
|
qidx = skb->queue_mapping;
|
||||||
q = &adap->sge.ethtxq[qidx + pi->first_qset];
|
q = &adap->sge.ethtxq[qidx + pi->first_qset];
|
||||||
len = sa_entry->enckey_len + sizeof(struct cpl_tx_pkt_core);
|
|
||||||
key_len = sa_entry->kctx_len;
|
key_len = sa_entry->kctx_len;
|
||||||
|
|
||||||
/* end of queue, reset pos to start of queue */
|
/* end of queue, reset pos to start of queue */
|
||||||
|
@ -411,19 +415,14 @@ inline void *copy_key_cpltx_pktxt(struct sk_buff *skb,
|
||||||
pos += sizeof(struct _key_ctx);
|
pos += sizeof(struct _key_ctx);
|
||||||
left -= sizeof(struct _key_ctx);
|
left -= sizeof(struct _key_ctx);
|
||||||
|
|
||||||
if (likely(len <= left)) {
|
if (likely(key_len <= left)) {
|
||||||
memcpy(key_ctx->key, sa_entry->key, key_len);
|
memcpy(key_ctx->key, sa_entry->key, key_len);
|
||||||
pos += key_len;
|
pos += key_len;
|
||||||
} else {
|
} else {
|
||||||
if (key_len <= left) {
|
memcpy(pos, sa_entry->key, left);
|
||||||
memcpy(pos, sa_entry->key, key_len);
|
memcpy(q->q.desc, sa_entry->key + left,
|
||||||
pos += key_len;
|
key_len - left);
|
||||||
} else {
|
pos = (u8 *)q->q.desc + (key_len - left);
|
||||||
memcpy(pos, sa_entry->key, left);
|
|
||||||
memcpy(q->q.desc, sa_entry->key + left,
|
|
||||||
key_len - left);
|
|
||||||
pos = (u8 *)q->q.desc + (key_len - left);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* Copy CPL TX PKT XT */
|
/* Copy CPL TX PKT XT */
|
||||||
pos = copy_cpltx_pktxt(skb, dev, pos);
|
pos = copy_cpltx_pktxt(skb, dev, pos);
|
||||||
|
|
Loading…
Reference in New Issue