Revert "net/smc: Allow SMC-D 1MB DMB allocations"
This reverts commit 3ab7fb1f47
.
This commit is contained in:
parent
43674763e3
commit
e913a37a4d
1 changed files with 15 additions and 16 deletions
|
@ -1375,30 +1375,21 @@ out:
|
|||
return rc;
|
||||
}
|
||||
|
||||
#define SMCD_DMBE_SIZES 6 /* 0 -> 16KB, 1 -> 32KB, .. 6 -> 1MB */
|
||||
#define SMCR_RMBE_SIZES 5 /* 0 -> 16KB, 1 -> 32KB, .. 5 -> 512KB */
|
||||
|
||||
/* convert the RMB size into the compressed notation (minimum 16K, see
|
||||
* SMCD/R_DMBE_SIZES.
|
||||
/* convert the RMB size into the compressed notation - minimum 16K.
|
||||
* In contrast to plain ilog2, this rounds towards the next power of 2,
|
||||
* so the socket application gets at least its desired sndbuf / rcvbuf size.
|
||||
*/
|
||||
static u8 smc_compress_bufsize(int size, bool is_smcd, bool is_rmb)
|
||||
static u8 smc_compress_bufsize(int size)
|
||||
{
|
||||
const unsigned int max_scat = SG_MAX_SINGLE_ALLOC * PAGE_SIZE;
|
||||
u8 compressed;
|
||||
|
||||
if (size <= SMC_BUF_MIN_SIZE)
|
||||
return 0;
|
||||
|
||||
size = (size - 1) >> 14; /* convert to 16K multiple */
|
||||
compressed = min_t(u8, ilog2(size) + 1,
|
||||
is_smcd ? SMCD_DMBE_SIZES : SMCR_RMBE_SIZES);
|
||||
|
||||
if (!is_smcd && is_rmb)
|
||||
/* RMBs are backed by & limited to max size of scatterlists */
|
||||
compressed = min_t(u8, compressed, ilog2(max_scat >> 14));
|
||||
|
||||
size = (size - 1) >> 14;
|
||||
compressed = ilog2(size) + 1;
|
||||
if (compressed >= SMC_RMBE_SIZES)
|
||||
compressed = SMC_RMBE_SIZES - 1;
|
||||
return compressed;
|
||||
}
|
||||
|
||||
|
@ -1617,12 +1608,17 @@ out:
|
|||
return rc;
|
||||
}
|
||||
|
||||
#define SMCD_DMBE_SIZES 6 /* 0 -> 16KB, 1 -> 32KB, .. 6 -> 1MB */
|
||||
|
||||
static struct smc_buf_desc *smcd_new_buf_create(struct smc_link_group *lgr,
|
||||
bool is_dmb, int bufsize)
|
||||
{
|
||||
struct smc_buf_desc *buf_desc;
|
||||
int rc;
|
||||
|
||||
if (smc_compress_bufsize(bufsize) > SMCD_DMBE_SIZES)
|
||||
return ERR_PTR(-EAGAIN);
|
||||
|
||||
/* try to alloc a new DMB */
|
||||
buf_desc = kzalloc(sizeof(*buf_desc), GFP_KERNEL);
|
||||
if (!buf_desc)
|
||||
|
@ -1670,8 +1666,9 @@ static int __smc_buf_create(struct smc_sock *smc, bool is_smcd, bool is_rmb)
|
|||
/* use socket send buffer size (w/o overhead) as start value */
|
||||
sk_buf_size = smc->sk.sk_sndbuf / 2;
|
||||
|
||||
for (bufsize_short = smc_compress_bufsize(sk_buf_size, is_smcd, is_rmb);
|
||||
for (bufsize_short = smc_compress_bufsize(sk_buf_size);
|
||||
bufsize_short >= 0; bufsize_short--) {
|
||||
|
||||
if (is_rmb) {
|
||||
lock = &lgr->rmbs_lock;
|
||||
buf_list = &lgr->rmbs[bufsize_short];
|
||||
|
@ -1680,6 +1677,8 @@ static int __smc_buf_create(struct smc_sock *smc, bool is_smcd, bool is_rmb)
|
|||
buf_list = &lgr->sndbufs[bufsize_short];
|
||||
}
|
||||
bufsize = smc_uncompress_bufsize(bufsize_short);
|
||||
if ((1 << get_order(bufsize)) > SG_MAX_SINGLE_ALLOC)
|
||||
continue;
|
||||
|
||||
/* check for reusable slot in the link group */
|
||||
buf_desc = smc_buf_get_slot(bufsize_short, lock, buf_list);
|
||||
|
|
Loading…
Reference in a new issue