mirror of https://gitee.com/openkylin/linux.git
Merge branch 'opw-next' into staging-next
This pulls in all of the staging patches applied during the opw application process, and some other staging patches that were submitted during that period of time. All of these are for 3.14-rc1. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
commit
82d939ecf0
|
@ -68,11 +68,10 @@ static struct devalarm alarms[ANDROID_ALARM_TYPE_COUNT];
|
|||
*/
|
||||
static int is_wakeup(enum android_alarm_type type)
|
||||
{
|
||||
return (type == ANDROID_ALARM_RTC_WAKEUP ||
|
||||
type == ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP);
|
||||
return type == ANDROID_ALARM_RTC_WAKEUP ||
|
||||
type == ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP;
|
||||
}
|
||||
|
||||
|
||||
static void devalarm_start(struct devalarm *alrm, ktime_t exp)
|
||||
{
|
||||
if (is_wakeup(alrm->type))
|
||||
|
@ -111,7 +110,6 @@ static void alarm_clear(enum android_alarm_type alarm_type)
|
|||
}
|
||||
alarm_enabled &= ~alarm_type_mask;
|
||||
spin_unlock_irqrestore(&alarm_slock, flags);
|
||||
|
||||
}
|
||||
|
||||
static void alarm_set(enum android_alarm_type alarm_type,
|
||||
|
@ -280,6 +278,7 @@ static long alarm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
static long alarm_compat_ioctl(struct file *file, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
|
@ -371,7 +370,6 @@ static void devalarm_triggered(struct devalarm *alarm)
|
|||
spin_unlock_irqrestore(&alarm_slock, flags);
|
||||
}
|
||||
|
||||
|
||||
static enum hrtimer_restart devalarm_hrthandler(struct hrtimer *hrt)
|
||||
{
|
||||
struct devalarm *devalrm = container_of(hrt, struct devalarm, u.hrt);
|
||||
|
|
|
@ -28,7 +28,7 @@ struct sync_fence;
|
|||
|
||||
/**
|
||||
* struct sync_timeline_ops - sync object implementation ops
|
||||
* @driver_name: name of the implentation
|
||||
* @driver_name: name of the implementation
|
||||
* @dup: duplicate a sync_pt
|
||||
* @has_signaled: returns:
|
||||
* 1 if pt has signaled
|
||||
|
@ -37,12 +37,12 @@ struct sync_fence;
|
|||
* @compare: returns:
|
||||
* 1 if b will signal before a
|
||||
* 0 if a and b will signal at the same time
|
||||
* -1 if a will signabl before b
|
||||
* -1 if a will signal before b
|
||||
* @free_pt: called before sync_pt is freed
|
||||
* @release_obj: called before sync_timeline is freed
|
||||
* @print_obj: deprecated
|
||||
* @print_pt: deprecated
|
||||
* @fill_driver_data: write implmentation specific driver data to data.
|
||||
* @fill_driver_data: write implementation specific driver data to data.
|
||||
* should return an error if there is not enough room
|
||||
* as specified by size. This information is returned
|
||||
* to userspace by SYNC_IOC_FENCE_INFO.
|
||||
|
@ -88,9 +88,9 @@ struct sync_timeline_ops {
|
|||
/**
|
||||
* struct sync_timeline - sync object
|
||||
* @kref: reference count on fence.
|
||||
* @ops: ops that define the implementaiton of the sync_timeline
|
||||
* @ops: ops that define the implementation of the sync_timeline
|
||||
* @name: name of the sync_timeline. Useful for debugging
|
||||
* @destoryed: set when sync_timeline is destroyed
|
||||
* @destroyed: set when sync_timeline is destroyed
|
||||
* @child_list_head: list of children sync_pts for this sync_timeline
|
||||
* @child_list_lock: lock protecting @child_list_head, destroyed, and
|
||||
* sync_pt.status
|
||||
|
@ -119,12 +119,12 @@ struct sync_timeline {
|
|||
* @parent: sync_timeline to which this sync_pt belongs
|
||||
* @child_list: membership in sync_timeline.child_list_head
|
||||
* @active_list: membership in sync_timeline.active_list_head
|
||||
* @signaled_list: membership in temorary signaled_list on stack
|
||||
* @signaled_list: membership in temporary signaled_list on stack
|
||||
* @fence: sync_fence to which the sync_pt belongs
|
||||
* @pt_list: membership in sync_fence.pt_list_head
|
||||
* @status: 1: signaled, 0:active, <0: error
|
||||
* @timestamp: time which sync_pt status transitioned from active to
|
||||
* singaled or error.
|
||||
* signaled or error.
|
||||
*/
|
||||
struct sync_pt {
|
||||
struct sync_timeline *parent;
|
||||
|
@ -145,9 +145,9 @@ struct sync_pt {
|
|||
/**
|
||||
* struct sync_fence - sync fence
|
||||
* @file: file representing this fence
|
||||
* @kref: referenace count on fence.
|
||||
* @kref: reference count on fence.
|
||||
* @name: name of sync_fence. Useful for debugging
|
||||
* @pt_list_head: list of sync_pts in ths fence. immutable once fence
|
||||
* @pt_list_head: list of sync_pts in the fence. immutable once fence
|
||||
* is created
|
||||
* @waiter_list_head: list of asynchronous waiters on this fence
|
||||
* @waiter_list_lock: lock protecting @waiter_list_head and @status
|
||||
|
@ -201,23 +201,23 @@ static inline void sync_fence_waiter_init(struct sync_fence_waiter *waiter,
|
|||
|
||||
/**
|
||||
* sync_timeline_create() - creates a sync object
|
||||
* @ops: specifies the implemention ops for the object
|
||||
* @ops: specifies the implementation ops for the object
|
||||
* @size: size to allocate for this obj
|
||||
* @name: sync_timeline name
|
||||
*
|
||||
* Creates a new sync_timeline which will use the implemetation specified by
|
||||
* @ops. @size bytes will be allocated allowing for implemntation specific
|
||||
* data to be kept after the generic sync_timeline stuct.
|
||||
* Creates a new sync_timeline which will use the implementation specified by
|
||||
* @ops. @size bytes will be allocated allowing for implementation specific
|
||||
* data to be kept after the generic sync_timeline struct.
|
||||
*/
|
||||
struct sync_timeline *sync_timeline_create(const struct sync_timeline_ops *ops,
|
||||
int size, const char *name);
|
||||
|
||||
/**
|
||||
* sync_timeline_destory() - destorys a sync object
|
||||
* sync_timeline_destroy() - destroys a sync object
|
||||
* @obj: sync_timeline to destroy
|
||||
*
|
||||
* A sync implemntation should call this when the @obj is going away
|
||||
* (i.e. module unload.) @obj won't actually be freed until all its childern
|
||||
* A sync implementation should call this when the @obj is going away
|
||||
* (i.e. module unload.) @obj won't actually be freed until all its children
|
||||
* sync_pts are freed.
|
||||
*/
|
||||
void sync_timeline_destroy(struct sync_timeline *obj);
|
||||
|
@ -226,7 +226,7 @@ void sync_timeline_destroy(struct sync_timeline *obj);
|
|||
* sync_timeline_signal() - signal a status change on a sync_timeline
|
||||
* @obj: sync_timeline to signal
|
||||
*
|
||||
* A sync implemntation should call this any time one of it's sync_pts
|
||||
* A sync implementation should call this any time one of it's sync_pts
|
||||
* has signaled or has an error condition.
|
||||
*/
|
||||
void sync_timeline_signal(struct sync_timeline *obj);
|
||||
|
@ -236,8 +236,8 @@ void sync_timeline_signal(struct sync_timeline *obj);
|
|||
* @parent: sync_pt's parent sync_timeline
|
||||
* @size: size to allocate for this pt
|
||||
*
|
||||
* Creates a new sync_pt as a chiled of @parent. @size bytes will be
|
||||
* allocated allowing for implemntation specific data to be kept after
|
||||
* Creates a new sync_pt as a child of @parent. @size bytes will be
|
||||
* allocated allowing for implementation specific data to be kept after
|
||||
* the generic sync_timeline struct.
|
||||
*/
|
||||
struct sync_pt *sync_pt_create(struct sync_timeline *parent, int size);
|
||||
|
@ -287,7 +287,7 @@ struct sync_fence *sync_fence_merge(const char *name,
|
|||
struct sync_fence *sync_fence_fdget(int fd);
|
||||
|
||||
/**
|
||||
* sync_fence_put() - puts a refernnce of a sync fence
|
||||
* sync_fence_put() - puts a reference of a sync fence
|
||||
* @fence: fence to put
|
||||
*
|
||||
* Puts a reference on @fence. If this is the last reference, the fence and
|
||||
|
@ -297,7 +297,7 @@ void sync_fence_put(struct sync_fence *fence);
|
|||
|
||||
/**
|
||||
* sync_fence_install() - installs a fence into a file descriptor
|
||||
* @fence: fence to instal
|
||||
* @fence: fence to install
|
||||
* @fd: file descriptor in which to install the fence
|
||||
*
|
||||
* Installs @fence into @fd. @fd's should be acquired through get_unused_fd().
|
||||
|
@ -359,10 +359,10 @@ struct sync_merge_data {
|
|||
* struct sync_pt_info - detailed sync_pt information
|
||||
* @len: length of sync_pt_info including any driver_data
|
||||
* @obj_name: name of parent sync_timeline
|
||||
* @driver_name: name of driver implmenting the parent
|
||||
* @driver_name: name of driver implementing the parent
|
||||
* @status: status of the sync_pt 0:active 1:signaled <0:error
|
||||
* @timestamp_ns: timestamp of status change in nanoseconds
|
||||
* @driver_data: any driver dependant data
|
||||
* @driver_data: any driver dependent data
|
||||
*/
|
||||
struct sync_pt_info {
|
||||
__u32 len;
|
||||
|
@ -377,7 +377,7 @@ struct sync_pt_info {
|
|||
/**
|
||||
* struct sync_fence_info_data - data returned from fence info ioctl
|
||||
* @len: ioctl caller writes the size of the buffer its passing in.
|
||||
* ioctl returns length of sync_fence_data reutnred to userspace
|
||||
* ioctl returns length of sync_fence_data returned to userspace
|
||||
* including pt_info.
|
||||
* @name: name of fence
|
||||
* @status: status of fence. 1: signaled 0:active <0:error
|
||||
|
@ -418,7 +418,7 @@ struct sync_fence_info_data {
|
|||
* pt_info.
|
||||
*
|
||||
* pt_info is a buffer containing sync_pt_infos for every sync_pt in the fence.
|
||||
* To itterate over the sync_pt_infos, use the sync_pt_info.len field.
|
||||
* To iterate over the sync_pt_infos, use the sync_pt_info.len field.
|
||||
*/
|
||||
#define SYNC_IOC_FENCE_INFO _IOWR(SYNC_IOC_MAGIC, 2,\
|
||||
struct sync_fence_info_data)
|
||||
|
|
|
@ -160,7 +160,9 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
struct bcm_ioctl_buffer IoBuffer;
|
||||
int bytes;
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Parameters Passed to control IOCTL cmd=0x%X arg=0x%lX", cmd, arg);
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
|
||||
"Parameters Passed to control IOCTL cmd=0x%X arg=0x%lX",
|
||||
cmd, arg);
|
||||
|
||||
if (_IOC_TYPE(cmd) != BCM_IOCTL)
|
||||
return -EFAULT;
|
||||
|
@ -266,7 +268,8 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
(uiTempVar == EEPROM_REJECT_REG_3) ||
|
||||
(uiTempVar == EEPROM_REJECT_REG_4))) {
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "EEPROM Access Denied, not in VSG Mode\n");
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
|
||||
"EEPROM Access Denied, not in VSG Mode\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
|
@ -274,9 +277,11 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
(PUINT)sWrmBuffer.Data, sizeof(ULONG));
|
||||
|
||||
if (Status == STATUS_SUCCESS) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "WRM Done\n");
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG,
|
||||
DBG_LVL_ALL, "WRM Done\n");
|
||||
} else {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "WRM Failed\n");
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG,
|
||||
DBG_LVL_ALL, "WRM Failed\n");
|
||||
Status = -EFAULT;
|
||||
}
|
||||
break;
|
||||
|
@ -291,7 +296,8 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
(Adapter->bShutStatus == TRUE) ||
|
||||
(Adapter->bPreparingForLowPowerMode == TRUE)) {
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Device in Idle Mode, Blocking Rdms\n");
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
|
||||
"Device in Idle Mode, Blocking Rdms\n");
|
||||
return -EACCES;
|
||||
}
|
||||
|
||||
|
@ -317,7 +323,8 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
if ((((ULONG)sRdmBuffer.Register & 0x0F000000) != 0x0F000000) ||
|
||||
((ULONG)sRdmBuffer.Register & 0x3)) {
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "RDM Done On invalid Address : %x Access Denied.\n",
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
|
||||
"RDM Done On invalid Address : %x Access Denied.\n",
|
||||
(int)sRdmBuffer.Register);
|
||||
|
||||
kfree(temp_buff);
|
||||
|
@ -325,7 +332,8 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
}
|
||||
|
||||
uiTempVar = sRdmBuffer.Register & EEPROM_REJECT_MASK;
|
||||
bytes = rdmaltWithLock(Adapter, (UINT)sRdmBuffer.Register, (PUINT)temp_buff, IoBuffer.OutputLength);
|
||||
bytes = rdmaltWithLock(Adapter, (UINT)sRdmBuffer.Register,
|
||||
(PUINT)temp_buff, IoBuffer.OutputLength);
|
||||
|
||||
if (bytes > 0) {
|
||||
Status = STATUS_SUCCESS;
|
||||
|
@ -349,7 +357,8 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
(Adapter->bShutStatus == TRUE) ||
|
||||
(Adapter->bPreparingForLowPowerMode == TRUE)) {
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Device in Idle Mode, Blocking Wrms\n");
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
|
||||
"Device in Idle Mode, Blocking Wrms\n");
|
||||
return -EACCES;
|
||||
}
|
||||
|
||||
|
@ -367,7 +376,9 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
if ((((ULONG)sWrmBuffer.Register & 0x0F000000) != 0x0F000000) ||
|
||||
((ULONG)sWrmBuffer.Register & 0x3)) {
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "WRM Done On invalid Address : %x Access Denied.\n", (int)sWrmBuffer.Register);
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
|
||||
"WRM Done On invalid Address : %x Access Denied.\n",
|
||||
(int)sWrmBuffer.Register);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -379,17 +390,21 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
(uiTempVar == EEPROM_REJECT_REG_4)) &&
|
||||
(cmd == IOCTL_BCM_REGISTER_WRITE)) {
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "EEPROM Access Denied, not in VSG Mode\n");
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
|
||||
"EEPROM Access Denied, not in VSG Mode\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
Status = wrmaltWithLock(Adapter, (UINT)sWrmBuffer.Register,
|
||||
(PUINT)sWrmBuffer.Data, sWrmBuffer.Length);
|
||||
(PUINT)sWrmBuffer.Data,
|
||||
sWrmBuffer.Length);
|
||||
|
||||
if (Status == STATUS_SUCCESS) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, OSAL_DBG, DBG_LVL_ALL, "WRM Done\n");
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, OSAL_DBG,
|
||||
DBG_LVL_ALL, "WRM Done\n");
|
||||
} else {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "WRM Failed\n");
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG,
|
||||
DBG_LVL_ALL, "WRM Failed\n");
|
||||
Status = -EFAULT;
|
||||
}
|
||||
break;
|
||||
|
@ -405,7 +420,9 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
(Adapter->bShutStatus == TRUE) ||
|
||||
(Adapter->bPreparingForLowPowerMode == TRUE)) {
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "GPIO Can't be set/clear in Low power Mode");
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG,
|
||||
DBG_LVL_ALL,
|
||||
"GPIO Can't be set/clear in Low power Mode");
|
||||
return -EACCES;
|
||||
}
|
||||
|
||||
|
@ -423,7 +440,10 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
value = (1<<uiBit);
|
||||
|
||||
if (IsReqGpioIsLedInNVM(Adapter, value) == false) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Sorry, Requested GPIO<0x%X> is not correspond to LED !!!", value);
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG,
|
||||
DBG_LVL_ALL,
|
||||
"Sorry, Requested GPIO<0x%X> is not correspond to LED !!!",
|
||||
value);
|
||||
Status = -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
@ -431,27 +451,42 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
/* Set - setting 1 */
|
||||
if (uiOperation) {
|
||||
/* Set the gpio output register */
|
||||
Status = wrmaltWithLock(Adapter, BCM_GPIO_OUTPUT_SET_REG, (PUINT)(&value), sizeof(UINT));
|
||||
Status = wrmaltWithLock(Adapter,
|
||||
BCM_GPIO_OUTPUT_SET_REG,
|
||||
(PUINT)(&value), sizeof(UINT));
|
||||
|
||||
if (Status == STATUS_SUCCESS) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Set the GPIO bit\n");
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS,
|
||||
OSAL_DBG, DBG_LVL_ALL,
|
||||
"Set the GPIO bit\n");
|
||||
} else {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Failed to set the %dth GPIO\n", uiBit);
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS,
|
||||
OSAL_DBG, DBG_LVL_ALL,
|
||||
"Failed to set the %dth GPIO\n",
|
||||
uiBit);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* Set the gpio output register */
|
||||
Status = wrmaltWithLock(Adapter, BCM_GPIO_OUTPUT_CLR_REG, (PUINT)(&value), sizeof(UINT));
|
||||
Status = wrmaltWithLock(Adapter,
|
||||
BCM_GPIO_OUTPUT_CLR_REG,
|
||||
(PUINT)(&value), sizeof(UINT));
|
||||
|
||||
if (Status == STATUS_SUCCESS) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Set the GPIO bit\n");
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS,
|
||||
OSAL_DBG, DBG_LVL_ALL,
|
||||
"Set the GPIO bit\n");
|
||||
} else {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Failed to clear the %dth GPIO\n", uiBit);
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS,
|
||||
OSAL_DBG, DBG_LVL_ALL,
|
||||
"Failed to clear the %dth GPIO\n",
|
||||
uiBit);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bytes = rdmaltWithLock(Adapter, (UINT)GPIO_MODE_REGISTER, (PUINT)ucResetValue, sizeof(UINT));
|
||||
bytes = rdmaltWithLock(Adapter, (UINT)GPIO_MODE_REGISTER,
|
||||
(PUINT)ucResetValue, sizeof(UINT));
|
||||
if (bytes < 0) {
|
||||
Status = bytes;
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
|
||||
|
@ -467,9 +502,13 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
(PUINT)ucResetValue, sizeof(UINT));
|
||||
|
||||
if (Status == STATUS_SUCCESS) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Set the GPIO to output Mode\n");
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG,
|
||||
DBG_LVL_ALL,
|
||||
"Set the GPIO to output Mode\n");
|
||||
} else {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Failed to put GPIO in Output Mode\n");
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG,
|
||||
DBG_LVL_ALL,
|
||||
"Failed to put GPIO in Output Mode\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -477,13 +516,16 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
|
||||
case BCM_LED_THREAD_STATE_CHANGE_REQ: {
|
||||
struct bcm_user_thread_req threadReq = {0};
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "User made LED thread InActive");
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
|
||||
"User made LED thread InActive");
|
||||
|
||||
if ((Adapter->IdleMode == TRUE) ||
|
||||
(Adapter->bShutStatus == TRUE) ||
|
||||
(Adapter->bPreparingForLowPowerMode == TRUE)) {
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "GPIO Can't be set/clear in Low power Mode");
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG,
|
||||
DBG_LVL_ALL,
|
||||
"GPIO Can't be set/clear in Low power Mode");
|
||||
Status = -EACCES;
|
||||
break;
|
||||
}
|
||||
|
@ -500,10 +542,14 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
/* if LED thread is running(Actively or Inactively) set it state to make inactive */
|
||||
if (Adapter->LEDInfo.led_thread_running) {
|
||||
if (threadReq.ThreadState == LED_THREAD_ACTIVATION_REQ) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Activating thread req");
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS,
|
||||
OSAL_DBG, DBG_LVL_ALL,
|
||||
"Activating thread req");
|
||||
Adapter->DriverState = LED_THREAD_ACTIVE;
|
||||
} else {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "DeActivating Thread req.....");
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS,
|
||||
OSAL_DBG, DBG_LVL_ALL,
|
||||
"DeActivating Thread req.....");
|
||||
Adapter->DriverState = LED_THREAD_INACTIVE;
|
||||
}
|
||||
|
||||
|
@ -540,7 +586,8 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
|
||||
if (bytes < 0) {
|
||||
Status = bytes;
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "RDM Failed\n");
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
|
||||
"RDM Failed\n");
|
||||
return Status;
|
||||
} else {
|
||||
Status = STATUS_SUCCESS;
|
||||
|
@ -570,9 +617,11 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
return -EFAULT;
|
||||
|
||||
if (IsReqGpioIsLedInNVM(Adapter, pgpio_multi_info[WIMAX_IDX].uiGPIOMask) == false) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG,
|
||||
DBG_LVL_ALL,
|
||||
"Sorry, Requested GPIO<0x%X> is not correspond to NVM LED bit map<0x%X>!!!",
|
||||
pgpio_multi_info[WIMAX_IDX].uiGPIOMask, Adapter->gpioBitMap);
|
||||
pgpio_multi_info[WIMAX_IDX].uiGPIOMask,
|
||||
Adapter->gpioBitMap);
|
||||
Status = -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
@ -590,7 +639,8 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
(PUINT)ucResetValue, sizeof(ULONG));
|
||||
|
||||
if (Status != STATUS_SUCCESS) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "WRM to BCM_GPIO_OUTPUT_SET_REG Failed.");
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
|
||||
"WRM to BCM_GPIO_OUTPUT_SET_REG Failed.");
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -603,7 +653,8 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
Status = wrmaltWithLock(Adapter, BCM_GPIO_OUTPUT_CLR_REG, (PUINT)ucResetValue, sizeof(ULONG));
|
||||
|
||||
if (Status != STATUS_SUCCESS) {
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "WRM to BCM_GPIO_OUTPUT_CLR_REG Failed.");
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
|
||||
"WRM to BCM_GPIO_OUTPUT_CLR_REG Failed.");
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
@ -613,7 +664,8 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
|
||||
if (bytes < 0) {
|
||||
Status = bytes;
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "RDM to GPIO_PIN_STATE_REGISTER Failed.");
|
||||
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
|
||||
"RDM to GPIO_PIN_STATE_REGISTER Failed.");
|
||||
return Status;
|
||||
} else {
|
||||
Status = STATUS_SUCCESS;
|
||||
|
@ -1190,7 +1242,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
break;
|
||||
|
||||
case IOCTL_BCM_CAL_INIT: {
|
||||
UINT uiSectorSize = 0 ;
|
||||
UINT uiSectorSize = 0;
|
||||
if (Adapter->eNVMType == NVM_FLASH) {
|
||||
if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer)))
|
||||
return -EFAULT;
|
||||
|
@ -1403,7 +1455,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
|
||||
case IOCTL_BCM_FLASH2X_SECTION_READ: {
|
||||
struct bcm_flash2x_readwrite sFlash2xRead = {0};
|
||||
PUCHAR pReadBuff = NULL ;
|
||||
PUCHAR pReadBuff = NULL;
|
||||
UINT NOB = 0;
|
||||
UINT BuffSize = 0;
|
||||
UINT ReadBytes = 0;
|
||||
|
@ -1438,7 +1490,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
else
|
||||
BuffSize = NOB;
|
||||
|
||||
ReadOffset = sFlash2xRead.offset ;
|
||||
ReadOffset = sFlash2xRead.offset;
|
||||
OutPutBuff = IoBuffer.OutputBuffer;
|
||||
pReadBuff = (PCHAR)kzalloc(BuffSize , GFP_KERNEL);
|
||||
|
||||
|
@ -1483,7 +1535,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
NOB = NOB - ReadBytes;
|
||||
if (NOB) {
|
||||
ReadOffset = ReadOffset + ReadBytes;
|
||||
OutPutBuff = OutPutBuff + ReadBytes ;
|
||||
OutPutBuff = OutPutBuff + ReadBytes;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1538,7 +1590,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
if (NOB > Adapter->uiSectorSize)
|
||||
BuffSize = Adapter->uiSectorSize;
|
||||
else
|
||||
BuffSize = NOB ;
|
||||
BuffSize = NOB;
|
||||
|
||||
pWriteBuff = kmalloc(BuffSize, GFP_KERNEL);
|
||||
|
||||
|
@ -1841,10 +1893,10 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
|
|||
|
||||
case IOCTL_BCM_NVM_RAW_READ: {
|
||||
struct bcm_nvm_readwrite stNVMRead;
|
||||
INT NOB ;
|
||||
INT BuffSize ;
|
||||
INT NOB;
|
||||
INT BuffSize;
|
||||
INT ReadOffset = 0;
|
||||
UINT ReadBytes = 0 ;
|
||||
UINT ReadBytes = 0;
|
||||
PUCHAR pReadBuff;
|
||||
void __user *OutPutBuff;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -630,7 +630,7 @@ int ClearArea(DEVICE_EXTENSION *pdx, int nArea)
|
|||
}
|
||||
spin_unlock_irq(&pdx->stagedLock);
|
||||
|
||||
if (pPages) { /* if we decided to release the memory */
|
||||
if (pPages) { /* if we decided to release the memory */
|
||||
/* Now we must undo the pinning down of the pages. We will assume the worst and mark */
|
||||
/* all the pages as dirty. Don't be tempted to move this up above as you must not be */
|
||||
/* holding a spin lock to do this stuff as it is not atomic. */
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include "comedidev.h"
|
||||
#include "comedi_internal.h"
|
||||
|
@ -26,31 +27,21 @@
|
|||
#define COMEDI_PAGE_PROTECTION PAGE_KERNEL
|
||||
#endif
|
||||
|
||||
static void __comedi_buf_free(struct comedi_device *dev,
|
||||
struct comedi_subdevice *s,
|
||||
unsigned n_pages)
|
||||
static void comedi_buf_map_kref_release(struct kref *kref)
|
||||
{
|
||||
struct comedi_async *async = s->async;
|
||||
struct comedi_buf_map *bm =
|
||||
container_of(kref, struct comedi_buf_map, refcount);
|
||||
struct comedi_buf_page *buf;
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
|
||||
if (async->prealloc_buf) {
|
||||
vunmap(async->prealloc_buf);
|
||||
async->prealloc_buf = NULL;
|
||||
async->prealloc_bufsz = 0;
|
||||
}
|
||||
|
||||
if (!async->buf_page_list)
|
||||
return;
|
||||
|
||||
for (i = 0; i < n_pages; ++i) {
|
||||
buf = &async->buf_page_list[i];
|
||||
if (buf->virt_addr) {
|
||||
if (bm->page_list) {
|
||||
for (i = 0; i < bm->n_pages; i++) {
|
||||
buf = &bm->page_list[i];
|
||||
clear_bit(PG_reserved,
|
||||
&(virt_to_page(buf->virt_addr)->flags));
|
||||
if (s->async_dma_dir != DMA_NONE) {
|
||||
if (bm->dma_dir != DMA_NONE) {
|
||||
#ifdef CONFIG_HAS_DMA
|
||||
dma_free_coherent(dev->hw_dev,
|
||||
dma_free_coherent(bm->dma_hw_dev,
|
||||
PAGE_SIZE,
|
||||
buf->virt_addr,
|
||||
buf->dma_addr);
|
||||
|
@ -59,10 +50,26 @@ static void __comedi_buf_free(struct comedi_device *dev,
|
|||
free_page((unsigned long)buf->virt_addr);
|
||||
}
|
||||
}
|
||||
vfree(bm->page_list);
|
||||
}
|
||||
vfree(async->buf_page_list);
|
||||
async->buf_page_list = NULL;
|
||||
async->n_buf_pages = 0;
|
||||
if (bm->dma_dir != DMA_NONE)
|
||||
put_device(bm->dma_hw_dev);
|
||||
kfree(bm);
|
||||
}
|
||||
|
||||
static void __comedi_buf_free(struct comedi_device *dev,
|
||||
struct comedi_subdevice *s)
|
||||
{
|
||||
struct comedi_async *async = s->async;
|
||||
|
||||
if (async->prealloc_buf) {
|
||||
vunmap(async->prealloc_buf);
|
||||
async->prealloc_buf = NULL;
|
||||
async->prealloc_bufsz = 0;
|
||||
}
|
||||
|
||||
comedi_buf_map_put(async->buf_map);
|
||||
async->buf_map = NULL;
|
||||
}
|
||||
|
||||
static void __comedi_buf_alloc(struct comedi_device *dev,
|
||||
|
@ -71,6 +78,7 @@ static void __comedi_buf_alloc(struct comedi_device *dev,
|
|||
{
|
||||
struct comedi_async *async = s->async;
|
||||
struct page **pages = NULL;
|
||||
struct comedi_buf_map *bm;
|
||||
struct comedi_buf_page *buf;
|
||||
unsigned i;
|
||||
|
||||
|
@ -80,18 +88,29 @@ static void __comedi_buf_alloc(struct comedi_device *dev,
|
|||
return;
|
||||
}
|
||||
|
||||
async->buf_page_list = vzalloc(sizeof(*buf) * n_pages);
|
||||
if (async->buf_page_list)
|
||||
bm = kzalloc(sizeof(*async->buf_map), GFP_KERNEL);
|
||||
if (!bm)
|
||||
return;
|
||||
|
||||
async->buf_map = bm;
|
||||
kref_init(&bm->refcount);
|
||||
bm->dma_dir = s->async_dma_dir;
|
||||
if (bm->dma_dir != DMA_NONE)
|
||||
/* Need ref to hardware device to free buffer later. */
|
||||
bm->dma_hw_dev = get_device(dev->hw_dev);
|
||||
|
||||
bm->page_list = vzalloc(sizeof(*buf) * n_pages);
|
||||
if (bm->page_list)
|
||||
pages = vmalloc(sizeof(struct page *) * n_pages);
|
||||
|
||||
if (!pages)
|
||||
return;
|
||||
|
||||
for (i = 0; i < n_pages; i++) {
|
||||
buf = &async->buf_page_list[i];
|
||||
if (s->async_dma_dir != DMA_NONE)
|
||||
buf = &bm->page_list[i];
|
||||
if (bm->dma_dir != DMA_NONE)
|
||||
#ifdef CONFIG_HAS_DMA
|
||||
buf->virt_addr = dma_alloc_coherent(dev->hw_dev,
|
||||
buf->virt_addr = dma_alloc_coherent(bm->dma_hw_dev,
|
||||
PAGE_SIZE,
|
||||
&buf->dma_addr,
|
||||
GFP_KERNEL |
|
||||
|
@ -108,6 +127,7 @@ static void __comedi_buf_alloc(struct comedi_device *dev,
|
|||
|
||||
pages[i] = virt_to_page(buf->virt_addr);
|
||||
}
|
||||
bm->n_pages = i;
|
||||
|
||||
/* vmap the prealloc_buf if all the pages were allocated */
|
||||
if (i == n_pages)
|
||||
|
@ -117,6 +137,26 @@ static void __comedi_buf_alloc(struct comedi_device *dev,
|
|||
vfree(pages);
|
||||
}
|
||||
|
||||
void comedi_buf_map_get(struct comedi_buf_map *bm)
|
||||
{
|
||||
if (bm)
|
||||
kref_get(&bm->refcount);
|
||||
}
|
||||
|
||||
int comedi_buf_map_put(struct comedi_buf_map *bm)
|
||||
{
|
||||
if (bm)
|
||||
return kref_put(&bm->refcount, comedi_buf_map_kref_release);
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool comedi_buf_is_mmapped(struct comedi_async *async)
|
||||
{
|
||||
struct comedi_buf_map *bm = async->buf_map;
|
||||
|
||||
return bm && (atomic_read(&bm->refcount.refcount) > 1);
|
||||
}
|
||||
|
||||
int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s,
|
||||
unsigned long new_size)
|
||||
{
|
||||
|
@ -130,7 +170,7 @@ int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s,
|
|||
return 0;
|
||||
|
||||
/* deallocate old buffer */
|
||||
__comedi_buf_free(dev, s, async->n_buf_pages);
|
||||
__comedi_buf_free(dev, s);
|
||||
|
||||
/* allocate new buffer */
|
||||
if (new_size) {
|
||||
|
@ -140,10 +180,9 @@ int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s,
|
|||
|
||||
if (!async->prealloc_buf) {
|
||||
/* allocation failed */
|
||||
__comedi_buf_free(dev, s, n_pages);
|
||||
__comedi_buf_free(dev, s);
|
||||
return -ENOMEM;
|
||||
}
|
||||
async->n_buf_pages = n_pages;
|
||||
}
|
||||
async->prealloc_bufsz = new_size;
|
||||
|
||||
|
|
|
@ -89,11 +89,37 @@ static struct cdev comedi_cdev;
|
|||
|
||||
static void comedi_device_init(struct comedi_device *dev)
|
||||
{
|
||||
kref_init(&dev->refcount);
|
||||
spin_lock_init(&dev->spinlock);
|
||||
mutex_init(&dev->mutex);
|
||||
init_rwsem(&dev->attach_lock);
|
||||
dev->minor = -1;
|
||||
}
|
||||
|
||||
static void comedi_dev_kref_release(struct kref *kref)
|
||||
{
|
||||
struct comedi_device *dev =
|
||||
container_of(kref, struct comedi_device, refcount);
|
||||
|
||||
mutex_destroy(&dev->mutex);
|
||||
kfree(dev);
|
||||
}
|
||||
|
||||
int comedi_dev_put(struct comedi_device *dev)
|
||||
{
|
||||
if (dev)
|
||||
return kref_put(&dev->refcount, comedi_dev_kref_release);
|
||||
return 1;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(comedi_dev_put);
|
||||
|
||||
static struct comedi_device *comedi_dev_get(struct comedi_device *dev)
|
||||
{
|
||||
if (dev)
|
||||
kref_get(&dev->refcount);
|
||||
return dev;
|
||||
}
|
||||
|
||||
static void comedi_device_cleanup(struct comedi_device *dev)
|
||||
{
|
||||
struct module *driver_module = NULL;
|
||||
|
@ -111,7 +137,6 @@ static void comedi_device_cleanup(struct comedi_device *dev)
|
|||
dev->use_count--;
|
||||
}
|
||||
mutex_unlock(&dev->mutex);
|
||||
mutex_destroy(&dev->mutex);
|
||||
}
|
||||
|
||||
static bool comedi_clear_board_dev(struct comedi_device *dev)
|
||||
|
@ -147,12 +172,12 @@ static void comedi_free_board_dev(struct comedi_device *dev)
|
|||
MKDEV(COMEDI_MAJOR, dev->minor));
|
||||
}
|
||||
comedi_device_cleanup(dev);
|
||||
kfree(dev);
|
||||
comedi_dev_put(dev);
|
||||
}
|
||||
}
|
||||
|
||||
static struct comedi_subdevice
|
||||
*comedi_subdevice_from_minor(unsigned minor)
|
||||
*comedi_subdevice_from_minor(const struct comedi_device *dev, unsigned minor)
|
||||
{
|
||||
struct comedi_subdevice *s;
|
||||
unsigned int i = minor - COMEDI_NUM_BOARD_MINORS;
|
||||
|
@ -160,37 +185,45 @@ static struct comedi_subdevice
|
|||
BUG_ON(i >= COMEDI_NUM_SUBDEVICE_MINORS);
|
||||
mutex_lock(&comedi_subdevice_minor_table_lock);
|
||||
s = comedi_subdevice_minor_table[i];
|
||||
if (s && s->device != dev)
|
||||
s = NULL;
|
||||
mutex_unlock(&comedi_subdevice_minor_table_lock);
|
||||
return s;
|
||||
}
|
||||
|
||||
static struct comedi_device *comedi_dev_from_board_minor(unsigned minor)
|
||||
static struct comedi_device *comedi_dev_get_from_board_minor(unsigned minor)
|
||||
{
|
||||
struct comedi_device *dev;
|
||||
|
||||
BUG_ON(minor >= COMEDI_NUM_BOARD_MINORS);
|
||||
mutex_lock(&comedi_board_minor_table_lock);
|
||||
dev = comedi_board_minor_table[minor];
|
||||
dev = comedi_dev_get(comedi_board_minor_table[minor]);
|
||||
mutex_unlock(&comedi_board_minor_table_lock);
|
||||
return dev;
|
||||
}
|
||||
|
||||
static struct comedi_device *comedi_dev_from_subdevice_minor(unsigned minor)
|
||||
static struct comedi_device *comedi_dev_get_from_subdevice_minor(unsigned minor)
|
||||
{
|
||||
struct comedi_device *dev;
|
||||
struct comedi_subdevice *s;
|
||||
unsigned int i = minor - COMEDI_NUM_BOARD_MINORS;
|
||||
|
||||
s = comedi_subdevice_from_minor(minor);
|
||||
return s ? s->device : NULL;
|
||||
BUG_ON(i >= COMEDI_NUM_SUBDEVICE_MINORS);
|
||||
mutex_lock(&comedi_subdevice_minor_table_lock);
|
||||
s = comedi_subdevice_minor_table[i];
|
||||
dev = comedi_dev_get(s ? s->device : NULL);
|
||||
mutex_unlock(&comedi_subdevice_minor_table_lock);
|
||||
return dev;
|
||||
}
|
||||
|
||||
struct comedi_device *comedi_dev_from_minor(unsigned minor)
|
||||
struct comedi_device *comedi_dev_get_from_minor(unsigned minor)
|
||||
{
|
||||
if (minor < COMEDI_NUM_BOARD_MINORS)
|
||||
return comedi_dev_from_board_minor(minor);
|
||||
return comedi_dev_get_from_board_minor(minor);
|
||||
else
|
||||
return comedi_dev_from_subdevice_minor(minor);
|
||||
return comedi_dev_get_from_subdevice_minor(minor);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(comedi_dev_from_minor);
|
||||
EXPORT_SYMBOL_GPL(comedi_dev_get_from_minor);
|
||||
|
||||
static struct comedi_subdevice *
|
||||
comedi_read_subdevice(const struct comedi_device *dev, unsigned int minor)
|
||||
|
@ -198,10 +231,8 @@ comedi_read_subdevice(const struct comedi_device *dev, unsigned int minor)
|
|||
struct comedi_subdevice *s;
|
||||
|
||||
if (minor >= COMEDI_NUM_BOARD_MINORS) {
|
||||
s = comedi_subdevice_from_minor(minor);
|
||||
if (!s || s->device != dev)
|
||||
return NULL;
|
||||
if (s->subdev_flags & SDF_CMD_READ)
|
||||
s = comedi_subdevice_from_minor(dev, minor);
|
||||
if (s == NULL || (s->subdev_flags & SDF_CMD_READ))
|
||||
return s;
|
||||
}
|
||||
return dev->read_subdev;
|
||||
|
@ -213,10 +244,8 @@ comedi_write_subdevice(const struct comedi_device *dev, unsigned int minor)
|
|||
struct comedi_subdevice *s;
|
||||
|
||||
if (minor >= COMEDI_NUM_BOARD_MINORS) {
|
||||
s = comedi_subdevice_from_minor(minor);
|
||||
if (!s || s->device != dev)
|
||||
return NULL;
|
||||
if (s->subdev_flags & SDF_CMD_WRITE)
|
||||
s = comedi_subdevice_from_minor(dev, minor);
|
||||
if (s == NULL || (s->subdev_flags & SDF_CMD_WRITE))
|
||||
return s;
|
||||
}
|
||||
return dev->write_subdev;
|
||||
|
@ -235,7 +264,7 @@ static int resize_async_buffer(struct comedi_device *dev,
|
|||
DPRINTK("subdevice is busy, cannot resize buffer\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
if (async->mmap_count) {
|
||||
if (comedi_buf_is_mmapped(async)) {
|
||||
DPRINTK("subdevice is mmapped, cannot resize buffer\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
|
@ -269,7 +298,7 @@ static ssize_t max_read_buffer_kb_show(struct device *csdev,
|
|||
struct comedi_subdevice *s;
|
||||
unsigned int size = 0;
|
||||
|
||||
dev = comedi_dev_from_minor(minor);
|
||||
dev = comedi_dev_get_from_minor(minor);
|
||||
if (!dev)
|
||||
return -ENODEV;
|
||||
|
||||
|
@ -279,6 +308,7 @@ static ssize_t max_read_buffer_kb_show(struct device *csdev,
|
|||
size = s->async->max_bufsize / 1024;
|
||||
mutex_unlock(&dev->mutex);
|
||||
|
||||
comedi_dev_put(dev);
|
||||
return snprintf(buf, PAGE_SIZE, "%i\n", size);
|
||||
}
|
||||
|
||||
|
@ -299,7 +329,7 @@ static ssize_t max_read_buffer_kb_store(struct device *csdev,
|
|||
return -EINVAL;
|
||||
size *= 1024;
|
||||
|
||||
dev = comedi_dev_from_minor(minor);
|
||||
dev = comedi_dev_get_from_minor(minor);
|
||||
if (!dev)
|
||||
return -ENODEV;
|
||||
|
||||
|
@ -311,6 +341,7 @@ static ssize_t max_read_buffer_kb_store(struct device *csdev,
|
|||
err = -EINVAL;
|
||||
mutex_unlock(&dev->mutex);
|
||||
|
||||
comedi_dev_put(dev);
|
||||
return err ? err : count;
|
||||
}
|
||||
static DEVICE_ATTR_RW(max_read_buffer_kb);
|
||||
|
@ -323,7 +354,7 @@ static ssize_t read_buffer_kb_show(struct device *csdev,
|
|||
struct comedi_subdevice *s;
|
||||
unsigned int size = 0;
|
||||
|
||||
dev = comedi_dev_from_minor(minor);
|
||||
dev = comedi_dev_get_from_minor(minor);
|
||||
if (!dev)
|
||||
return -ENODEV;
|
||||
|
||||
|
@ -333,6 +364,7 @@ static ssize_t read_buffer_kb_show(struct device *csdev,
|
|||
size = s->async->prealloc_bufsz / 1024;
|
||||
mutex_unlock(&dev->mutex);
|
||||
|
||||
comedi_dev_put(dev);
|
||||
return snprintf(buf, PAGE_SIZE, "%i\n", size);
|
||||
}
|
||||
|
||||
|
@ -353,7 +385,7 @@ static ssize_t read_buffer_kb_store(struct device *csdev,
|
|||
return -EINVAL;
|
||||
size *= 1024;
|
||||
|
||||
dev = comedi_dev_from_minor(minor);
|
||||
dev = comedi_dev_get_from_minor(minor);
|
||||
if (!dev)
|
||||
return -ENODEV;
|
||||
|
||||
|
@ -365,6 +397,7 @@ static ssize_t read_buffer_kb_store(struct device *csdev,
|
|||
err = -EINVAL;
|
||||
mutex_unlock(&dev->mutex);
|
||||
|
||||
comedi_dev_put(dev);
|
||||
return err ? err : count;
|
||||
}
|
||||
static DEVICE_ATTR_RW(read_buffer_kb);
|
||||
|
@ -378,7 +411,7 @@ static ssize_t max_write_buffer_kb_show(struct device *csdev,
|
|||
struct comedi_subdevice *s;
|
||||
unsigned int size = 0;
|
||||
|
||||
dev = comedi_dev_from_minor(minor);
|
||||
dev = comedi_dev_get_from_minor(minor);
|
||||
if (!dev)
|
||||
return -ENODEV;
|
||||
|
||||
|
@ -388,6 +421,7 @@ static ssize_t max_write_buffer_kb_show(struct device *csdev,
|
|||
size = s->async->max_bufsize / 1024;
|
||||
mutex_unlock(&dev->mutex);
|
||||
|
||||
comedi_dev_put(dev);
|
||||
return snprintf(buf, PAGE_SIZE, "%i\n", size);
|
||||
}
|
||||
|
||||
|
@ -408,7 +442,7 @@ static ssize_t max_write_buffer_kb_store(struct device *csdev,
|
|||
return -EINVAL;
|
||||
size *= 1024;
|
||||
|
||||
dev = comedi_dev_from_minor(minor);
|
||||
dev = comedi_dev_get_from_minor(minor);
|
||||
if (!dev)
|
||||
return -ENODEV;
|
||||
|
||||
|
@ -420,6 +454,7 @@ static ssize_t max_write_buffer_kb_store(struct device *csdev,
|
|||
err = -EINVAL;
|
||||
mutex_unlock(&dev->mutex);
|
||||
|
||||
comedi_dev_put(dev);
|
||||
return err ? err : count;
|
||||
}
|
||||
static DEVICE_ATTR_RW(max_write_buffer_kb);
|
||||
|
@ -432,7 +467,7 @@ static ssize_t write_buffer_kb_show(struct device *csdev,
|
|||
struct comedi_subdevice *s;
|
||||
unsigned int size = 0;
|
||||
|
||||
dev = comedi_dev_from_minor(minor);
|
||||
dev = comedi_dev_get_from_minor(minor);
|
||||
if (!dev)
|
||||
return -ENODEV;
|
||||
|
||||
|
@ -442,6 +477,7 @@ static ssize_t write_buffer_kb_show(struct device *csdev,
|
|||
size = s->async->prealloc_bufsz / 1024;
|
||||
mutex_unlock(&dev->mutex);
|
||||
|
||||
comedi_dev_put(dev);
|
||||
return snprintf(buf, PAGE_SIZE, "%i\n", size);
|
||||
}
|
||||
|
||||
|
@ -462,7 +498,7 @@ static ssize_t write_buffer_kb_store(struct device *csdev,
|
|||
return -EINVAL;
|
||||
size *= 1024;
|
||||
|
||||
dev = comedi_dev_from_minor(minor);
|
||||
dev = comedi_dev_get_from_minor(minor);
|
||||
if (!dev)
|
||||
return -ENODEV;
|
||||
|
||||
|
@ -474,6 +510,7 @@ static ssize_t write_buffer_kb_store(struct device *csdev,
|
|||
err = -EINVAL;
|
||||
mutex_unlock(&dev->mutex);
|
||||
|
||||
comedi_dev_put(dev);
|
||||
return err ? err : count;
|
||||
}
|
||||
static DEVICE_ATTR_RW(write_buffer_kb);
|
||||
|
@ -562,12 +599,13 @@ static void do_become_nonbusy(struct comedi_device *dev,
|
|||
async->inttrig = NULL;
|
||||
kfree(async->cmd.chanlist);
|
||||
async->cmd.chanlist = NULL;
|
||||
s->busy = NULL;
|
||||
wake_up_interruptible_all(&s->async->wait_head);
|
||||
} else {
|
||||
dev_err(dev->class_dev,
|
||||
"BUG: (?) do_become_nonbusy called with async=NULL\n");
|
||||
s->busy = NULL;
|
||||
}
|
||||
|
||||
s->busy = NULL;
|
||||
}
|
||||
|
||||
static int do_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
|
||||
|
@ -582,6 +620,21 @@ static int do_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void comedi_device_cancel_all(struct comedi_device *dev)
|
||||
{
|
||||
struct comedi_subdevice *s;
|
||||
int i;
|
||||
|
||||
if (!dev->attached)
|
||||
return;
|
||||
|
||||
for (i = 0; i < dev->n_subdevices; i++) {
|
||||
s = &dev->subdevices[i];
|
||||
if (s->async)
|
||||
do_cancel(dev, s);
|
||||
}
|
||||
}
|
||||
|
||||
static int is_device_busy(struct comedi_device *dev)
|
||||
{
|
||||
struct comedi_subdevice *s;
|
||||
|
@ -594,7 +647,7 @@ static int is_device_busy(struct comedi_device *dev)
|
|||
s = &dev->subdevices[i];
|
||||
if (s->busy)
|
||||
return 1;
|
||||
if (s->async && s->async->mmap_count)
|
||||
if (s->async && comedi_buf_is_mmapped(s->async))
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1469,8 +1522,7 @@ static int do_cmd_ioctl(struct comedi_device *dev,
|
|||
if (async->cmd.flags & TRIG_WAKE_EOS)
|
||||
async->cb_mask |= COMEDI_CB_EOS;
|
||||
|
||||
comedi_set_subdevice_runflags(s, SRF_USER | SRF_ERROR | SRF_RUNNING,
|
||||
SRF_USER | SRF_RUNNING);
|
||||
comedi_set_subdevice_runflags(s, SRF_ERROR | SRF_RUNNING, SRF_RUNNING);
|
||||
|
||||
/* set s->busy _after_ setting SRF_RUNNING flag to avoid race with
|
||||
* comedi_read() or comedi_write() */
|
||||
|
@ -1700,8 +1752,6 @@ static int do_cancel_ioctl(struct comedi_device *dev, unsigned int arg,
|
|||
return -EBUSY;
|
||||
|
||||
ret = do_cancel(dev, s);
|
||||
if (comedi_get_subdevice_runflags(s) & SRF_USER)
|
||||
wake_up_interruptible(&s->async->wait_head);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -1748,12 +1798,9 @@ static long comedi_unlocked_ioctl(struct file *file, unsigned int cmd,
|
|||
unsigned long arg)
|
||||
{
|
||||
const unsigned minor = iminor(file_inode(file));
|
||||
struct comedi_device *dev = comedi_dev_from_minor(minor);
|
||||
struct comedi_device *dev = file->private_data;
|
||||
int rc;
|
||||
|
||||
if (!dev)
|
||||
return -ENODEV;
|
||||
|
||||
mutex_lock(&dev->mutex);
|
||||
|
||||
/* Device config is special, because it must work on
|
||||
|
@ -1852,28 +1899,18 @@ static long comedi_unlocked_ioctl(struct file *file, unsigned int cmd,
|
|||
|
||||
static void comedi_vm_open(struct vm_area_struct *area)
|
||||
{
|
||||
struct comedi_async *async;
|
||||
struct comedi_device *dev;
|
||||
struct comedi_buf_map *bm;
|
||||
|
||||
async = area->vm_private_data;
|
||||
dev = async->subdevice->device;
|
||||
|
||||
mutex_lock(&dev->mutex);
|
||||
async->mmap_count++;
|
||||
mutex_unlock(&dev->mutex);
|
||||
bm = area->vm_private_data;
|
||||
comedi_buf_map_get(bm);
|
||||
}
|
||||
|
||||
static void comedi_vm_close(struct vm_area_struct *area)
|
||||
{
|
||||
struct comedi_async *async;
|
||||
struct comedi_device *dev;
|
||||
struct comedi_buf_map *bm;
|
||||
|
||||
async = area->vm_private_data;
|
||||
dev = async->subdevice->device;
|
||||
|
||||
mutex_lock(&dev->mutex);
|
||||
async->mmap_count--;
|
||||
mutex_unlock(&dev->mutex);
|
||||
bm = area->vm_private_data;
|
||||
comedi_buf_map_put(bm);
|
||||
}
|
||||
|
||||
static struct vm_operations_struct comedi_vm_ops = {
|
||||
|
@ -1884,18 +1921,16 @@ static struct vm_operations_struct comedi_vm_ops = {
|
|||
static int comedi_mmap(struct file *file, struct vm_area_struct *vma)
|
||||
{
|
||||
const unsigned minor = iminor(file_inode(file));
|
||||
struct comedi_device *dev = comedi_dev_from_minor(minor);
|
||||
struct comedi_device *dev = file->private_data;
|
||||
struct comedi_subdevice *s;
|
||||
struct comedi_async *async;
|
||||
struct comedi_buf_map *bm;
|
||||
unsigned long start = vma->vm_start;
|
||||
unsigned long size;
|
||||
int n_pages;
|
||||
int i;
|
||||
int retval;
|
||||
|
||||
if (!dev)
|
||||
return -ENODEV;
|
||||
|
||||
mutex_lock(&dev->mutex);
|
||||
|
||||
if (!dev->attached) {
|
||||
|
@ -1936,8 +1971,13 @@ static int comedi_mmap(struct file *file, struct vm_area_struct *vma)
|
|||
}
|
||||
|
||||
n_pages = size >> PAGE_SHIFT;
|
||||
bm = async->buf_map;
|
||||
if (!bm || n_pages > bm->n_pages) {
|
||||
retval = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
for (i = 0; i < n_pages; ++i) {
|
||||
struct comedi_buf_page *buf = &async->buf_page_list[i];
|
||||
struct comedi_buf_page *buf = &bm->page_list[i];
|
||||
|
||||
if (remap_pfn_range(vma, start,
|
||||
page_to_pfn(virt_to_page(buf->virt_addr)),
|
||||
|
@ -1949,9 +1989,9 @@ static int comedi_mmap(struct file *file, struct vm_area_struct *vma)
|
|||
}
|
||||
|
||||
vma->vm_ops = &comedi_vm_ops;
|
||||
vma->vm_private_data = async;
|
||||
vma->vm_private_data = bm;
|
||||
|
||||
async->mmap_count++;
|
||||
vma->vm_ops->open(vma);
|
||||
|
||||
retval = 0;
|
||||
done:
|
||||
|
@ -1963,12 +2003,9 @@ static unsigned int comedi_poll(struct file *file, poll_table *wait)
|
|||
{
|
||||
unsigned int mask = 0;
|
||||
const unsigned minor = iminor(file_inode(file));
|
||||
struct comedi_device *dev = comedi_dev_from_minor(minor);
|
||||
struct comedi_device *dev = file->private_data;
|
||||
struct comedi_subdevice *s;
|
||||
|
||||
if (!dev)
|
||||
return -ENODEV;
|
||||
|
||||
mutex_lock(&dev->mutex);
|
||||
|
||||
if (!dev->attached) {
|
||||
|
@ -2008,39 +2045,75 @@ static ssize_t comedi_write(struct file *file, const char __user *buf,
|
|||
int n, m, count = 0, retval = 0;
|
||||
DECLARE_WAITQUEUE(wait, current);
|
||||
const unsigned minor = iminor(file_inode(file));
|
||||
struct comedi_device *dev = comedi_dev_from_minor(minor);
|
||||
struct comedi_device *dev = file->private_data;
|
||||
bool on_wait_queue = false;
|
||||
bool attach_locked;
|
||||
unsigned int old_detach_count;
|
||||
|
||||
if (!dev)
|
||||
return -ENODEV;
|
||||
/* Protect against device detachment during operation. */
|
||||
down_read(&dev->attach_lock);
|
||||
attach_locked = true;
|
||||
old_detach_count = dev->detach_count;
|
||||
|
||||
if (!dev->attached) {
|
||||
DPRINTK("no driver configured on comedi%i\n", dev->minor);
|
||||
return -ENODEV;
|
||||
retval = -ENODEV;
|
||||
goto out;
|
||||
}
|
||||
|
||||
s = comedi_write_subdevice(dev, minor);
|
||||
if (!s || !s->async)
|
||||
return -EIO;
|
||||
if (!s || !s->async) {
|
||||
retval = -EIO;
|
||||
goto out;
|
||||
}
|
||||
|
||||
async = s->async;
|
||||
|
||||
if (!s->busy || !nbytes)
|
||||
return 0;
|
||||
if (s->busy != file)
|
||||
return -EACCES;
|
||||
goto out;
|
||||
if (s->busy != file) {
|
||||
retval = -EACCES;
|
||||
goto out;
|
||||
}
|
||||
|
||||
add_wait_queue(&async->wait_head, &wait);
|
||||
on_wait_queue = true;
|
||||
while (nbytes > 0 && !retval) {
|
||||
set_current_state(TASK_INTERRUPTIBLE);
|
||||
|
||||
if (!comedi_is_subdevice_running(s)) {
|
||||
if (count == 0) {
|
||||
mutex_lock(&dev->mutex);
|
||||
struct comedi_subdevice *new_s;
|
||||
|
||||
if (comedi_is_subdevice_in_error(s))
|
||||
retval = -EPIPE;
|
||||
else
|
||||
retval = 0;
|
||||
do_become_nonbusy(dev, s);
|
||||
/*
|
||||
* To avoid deadlock, cannot acquire dev->mutex
|
||||
* while dev->attach_lock is held. Need to
|
||||
* remove task from the async wait queue before
|
||||
* releasing dev->attach_lock, as it might not
|
||||
* be valid afterwards.
|
||||
*/
|
||||
remove_wait_queue(&async->wait_head, &wait);
|
||||
on_wait_queue = false;
|
||||
up_read(&dev->attach_lock);
|
||||
attach_locked = false;
|
||||
mutex_lock(&dev->mutex);
|
||||
/*
|
||||
* Become non-busy unless things have changed
|
||||
* behind our back. Checking dev->detach_count
|
||||
* is unchanged ought to be sufficient (unless
|
||||
* there have been 2**32 detaches in the
|
||||
* meantime!), but check the subdevice pointer
|
||||
* as well just in case.
|
||||
*/
|
||||
new_s = comedi_write_subdevice(dev, minor);
|
||||
if (dev->attached &&
|
||||
old_detach_count == dev->detach_count &&
|
||||
s == new_s && new_s->async == async)
|
||||
do_become_nonbusy(dev, s);
|
||||
mutex_unlock(&dev->mutex);
|
||||
}
|
||||
break;
|
||||
|
@ -2090,8 +2163,12 @@ static ssize_t comedi_write(struct file *file, const char __user *buf,
|
|||
buf += n;
|
||||
break; /* makes device work like a pipe */
|
||||
}
|
||||
out:
|
||||
if (on_wait_queue)
|
||||
remove_wait_queue(&async->wait_head, &wait);
|
||||
set_current_state(TASK_RUNNING);
|
||||
remove_wait_queue(&async->wait_head, &wait);
|
||||
if (attach_locked)
|
||||
up_read(&dev->attach_lock);
|
||||
|
||||
return count ? count : retval;
|
||||
}
|
||||
|
@ -2104,25 +2181,35 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes,
|
|||
int n, m, count = 0, retval = 0;
|
||||
DECLARE_WAITQUEUE(wait, current);
|
||||
const unsigned minor = iminor(file_inode(file));
|
||||
struct comedi_device *dev = comedi_dev_from_minor(minor);
|
||||
struct comedi_device *dev = file->private_data;
|
||||
unsigned int old_detach_count;
|
||||
bool become_nonbusy = false;
|
||||
bool attach_locked;
|
||||
|
||||
if (!dev)
|
||||
return -ENODEV;
|
||||
/* Protect against device detachment during operation. */
|
||||
down_read(&dev->attach_lock);
|
||||
attach_locked = true;
|
||||
old_detach_count = dev->detach_count;
|
||||
|
||||
if (!dev->attached) {
|
||||
DPRINTK("no driver configured on comedi%i\n", dev->minor);
|
||||
return -ENODEV;
|
||||
retval = -ENODEV;
|
||||
goto out;
|
||||
}
|
||||
|
||||
s = comedi_read_subdevice(dev, minor);
|
||||
if (!s || !s->async)
|
||||
return -EIO;
|
||||
if (!s || !s->async) {
|
||||
retval = -EIO;
|
||||
goto out;
|
||||
}
|
||||
|
||||
async = s->async;
|
||||
if (!s->busy || !nbytes)
|
||||
return 0;
|
||||
if (s->busy != file)
|
||||
return -EACCES;
|
||||
goto out;
|
||||
if (s->busy != file) {
|
||||
retval = -EACCES;
|
||||
goto out;
|
||||
}
|
||||
|
||||
add_wait_queue(&async->wait_head, &wait);
|
||||
while (nbytes > 0 && !retval) {
|
||||
|
@ -2140,13 +2227,11 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes,
|
|||
|
||||
if (n == 0) {
|
||||
if (!comedi_is_subdevice_running(s)) {
|
||||
mutex_lock(&dev->mutex);
|
||||
do_become_nonbusy(dev, s);
|
||||
if (comedi_is_subdevice_in_error(s))
|
||||
retval = -EPIPE;
|
||||
else
|
||||
retval = 0;
|
||||
mutex_unlock(&dev->mutex);
|
||||
become_nonbusy = true;
|
||||
break;
|
||||
}
|
||||
if (file->f_flags & O_NONBLOCK) {
|
||||
|
@ -2184,14 +2269,37 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes,
|
|||
buf += n;
|
||||
break; /* makes device work like a pipe */
|
||||
}
|
||||
if (comedi_is_subdevice_idle(s)) {
|
||||
remove_wait_queue(&async->wait_head, &wait);
|
||||
set_current_state(TASK_RUNNING);
|
||||
if (become_nonbusy || comedi_is_subdevice_idle(s)) {
|
||||
struct comedi_subdevice *new_s;
|
||||
|
||||
/*
|
||||
* To avoid deadlock, cannot acquire dev->mutex
|
||||
* while dev->attach_lock is held.
|
||||
*/
|
||||
up_read(&dev->attach_lock);
|
||||
attach_locked = false;
|
||||
mutex_lock(&dev->mutex);
|
||||
if (async->buf_read_count - async->buf_write_count == 0)
|
||||
do_become_nonbusy(dev, s);
|
||||
/*
|
||||
* Check device hasn't become detached behind our back.
|
||||
* Checking dev->detach_count is unchanged ought to be
|
||||
* sufficient (unless there have been 2**32 detaches in the
|
||||
* meantime!), but check the subdevice pointer as well just in
|
||||
* case.
|
||||
*/
|
||||
new_s = comedi_read_subdevice(dev, minor);
|
||||
if (dev->attached && old_detach_count == dev->detach_count &&
|
||||
s == new_s && new_s->async == async) {
|
||||
if (become_nonbusy ||
|
||||
async->buf_read_count - async->buf_write_count == 0)
|
||||
do_become_nonbusy(dev, s);
|
||||
}
|
||||
mutex_unlock(&dev->mutex);
|
||||
}
|
||||
set_current_state(TASK_RUNNING);
|
||||
remove_wait_queue(&async->wait_head, &wait);
|
||||
out:
|
||||
if (attach_locked)
|
||||
up_read(&dev->attach_lock);
|
||||
|
||||
return count ? count : retval;
|
||||
}
|
||||
|
@ -2199,7 +2307,8 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes,
|
|||
static int comedi_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
const unsigned minor = iminor(inode);
|
||||
struct comedi_device *dev = comedi_dev_from_minor(minor);
|
||||
struct comedi_device *dev = comedi_dev_get_from_minor(minor);
|
||||
int rc;
|
||||
|
||||
if (!dev) {
|
||||
DPRINTK("invalid minor number\n");
|
||||
|
@ -2224,8 +2333,8 @@ static int comedi_open(struct inode *inode, struct file *file)
|
|||
goto ok;
|
||||
if (!capable(CAP_NET_ADMIN) && dev->in_request_module) {
|
||||
DPRINTK("in request module\n");
|
||||
mutex_unlock(&dev->mutex);
|
||||
return -ENODEV;
|
||||
rc = -ENODEV;
|
||||
goto out;
|
||||
}
|
||||
if (capable(CAP_NET_ADMIN) && dev->in_request_module)
|
||||
goto ok;
|
||||
|
@ -2242,8 +2351,8 @@ static int comedi_open(struct inode *inode, struct file *file)
|
|||
|
||||
if (!dev->attached && !capable(CAP_NET_ADMIN)) {
|
||||
DPRINTK("not attached and not CAP_NET_ADMIN\n");
|
||||
mutex_unlock(&dev->mutex);
|
||||
return -ENODEV;
|
||||
rc = -ENODEV;
|
||||
goto out;
|
||||
}
|
||||
ok:
|
||||
__module_get(THIS_MODULE);
|
||||
|
@ -2251,49 +2360,44 @@ static int comedi_open(struct inode *inode, struct file *file)
|
|||
if (dev->attached) {
|
||||
if (!try_module_get(dev->driver->module)) {
|
||||
module_put(THIS_MODULE);
|
||||
mutex_unlock(&dev->mutex);
|
||||
return -ENOSYS;
|
||||
rc = -ENOSYS;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
if (dev->attached && dev->use_count == 0 && dev->open) {
|
||||
int rc = dev->open(dev);
|
||||
rc = dev->open(dev);
|
||||
if (rc < 0) {
|
||||
module_put(dev->driver->module);
|
||||
module_put(THIS_MODULE);
|
||||
mutex_unlock(&dev->mutex);
|
||||
return rc;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
dev->use_count++;
|
||||
file->private_data = dev;
|
||||
rc = 0;
|
||||
|
||||
out:
|
||||
mutex_unlock(&dev->mutex);
|
||||
|
||||
return 0;
|
||||
if (rc)
|
||||
comedi_dev_put(dev);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int comedi_fasync(int fd, struct file *file, int on)
|
||||
{
|
||||
const unsigned minor = iminor(file_inode(file));
|
||||
struct comedi_device *dev = comedi_dev_from_minor(minor);
|
||||
|
||||
if (!dev)
|
||||
return -ENODEV;
|
||||
struct comedi_device *dev = file->private_data;
|
||||
|
||||
return fasync_helper(fd, file, on, &dev->async_queue);
|
||||
}
|
||||
|
||||
static int comedi_close(struct inode *inode, struct file *file)
|
||||
{
|
||||
const unsigned minor = iminor(inode);
|
||||
struct comedi_device *dev = comedi_dev_from_minor(minor);
|
||||
struct comedi_device *dev = file->private_data;
|
||||
struct comedi_subdevice *s = NULL;
|
||||
int i;
|
||||
|
||||
if (!dev)
|
||||
return -ENODEV;
|
||||
|
||||
mutex_lock(&dev->mutex);
|
||||
|
||||
if (dev->subdevices) {
|
||||
|
@ -2316,6 +2420,7 @@ static int comedi_close(struct inode *inode, struct file *file)
|
|||
dev->use_count--;
|
||||
|
||||
mutex_unlock(&dev->mutex);
|
||||
comedi_dev_put(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -2368,16 +2473,11 @@ void comedi_event(struct comedi_device *dev, struct comedi_subdevice *s)
|
|||
}
|
||||
|
||||
if (async->cb_mask & s->async->events) {
|
||||
if (comedi_get_subdevice_runflags(s) & SRF_USER) {
|
||||
wake_up_interruptible(&async->wait_head);
|
||||
if (s->subdev_flags & SDF_CMD_READ)
|
||||
kill_fasync(&dev->async_queue, SIGIO, POLL_IN);
|
||||
if (s->subdev_flags & SDF_CMD_WRITE)
|
||||
kill_fasync(&dev->async_queue, SIGIO, POLL_OUT);
|
||||
} else {
|
||||
if (async->cb_func)
|
||||
async->cb_func(s->async->events, async->cb_arg);
|
||||
}
|
||||
wake_up_interruptible(&async->wait_head);
|
||||
if (s->subdev_flags & SDF_CMD_READ)
|
||||
kill_fasync(&dev->async_queue, SIGIO, POLL_IN);
|
||||
if (s->subdev_flags & SDF_CMD_WRITE)
|
||||
kill_fasync(&dev->async_queue, SIGIO, POLL_OUT);
|
||||
}
|
||||
s->async->events = 0;
|
||||
}
|
||||
|
@ -2408,7 +2508,7 @@ struct comedi_device *comedi_alloc_board_minor(struct device *hardware_device)
|
|||
if (i == COMEDI_NUM_BOARD_MINORS) {
|
||||
mutex_unlock(&dev->mutex);
|
||||
comedi_device_cleanup(dev);
|
||||
kfree(dev);
|
||||
comedi_dev_put(dev);
|
||||
pr_err("comedi: error: ran out of minor numbers for board device files.\n");
|
||||
return ERR_PTR(-EBUSY);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,11 @@ void comedi_free_subdevice_minor(struct comedi_subdevice *s);
|
|||
int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s,
|
||||
unsigned long new_size);
|
||||
void comedi_buf_reset(struct comedi_async *async);
|
||||
bool comedi_buf_is_mmapped(struct comedi_async *async);
|
||||
void comedi_buf_map_get(struct comedi_buf_map *bm);
|
||||
int comedi_buf_map_put(struct comedi_buf_map *bm);
|
||||
unsigned int comedi_buf_write_n_allocated(struct comedi_async *async);
|
||||
void comedi_device_cancel_all(struct comedi_device *dev);
|
||||
|
||||
extern unsigned int comedi_default_buf_size_kb;
|
||||
extern unsigned int comedi_default_buf_maxsize_kb;
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
#define _COMEDIDEV_H
|
||||
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/spinlock_types.h>
|
||||
#include <linux/rwsem.h>
|
||||
#include <linux/kref.h>
|
||||
|
||||
#include "comedi.h"
|
||||
|
||||
|
@ -100,18 +104,22 @@ struct comedi_buf_page {
|
|||
dma_addr_t dma_addr;
|
||||
};
|
||||
|
||||
struct comedi_buf_map {
|
||||
struct device *dma_hw_dev;
|
||||
struct comedi_buf_page *page_list;
|
||||
unsigned int n_pages;
|
||||
enum dma_data_direction dma_dir;
|
||||
struct kref refcount;
|
||||
};
|
||||
|
||||
struct comedi_async {
|
||||
struct comedi_subdevice *subdevice;
|
||||
|
||||
void *prealloc_buf; /* pre-allocated buffer */
|
||||
unsigned int prealloc_bufsz; /* buffer size, in bytes */
|
||||
/* virtual and dma address of each page */
|
||||
struct comedi_buf_page *buf_page_list;
|
||||
unsigned n_buf_pages; /* num elements in buf_page_list */
|
||||
struct comedi_buf_map *buf_map; /* map of buffer pages */
|
||||
|
||||
unsigned int max_bufsize; /* maximum buffer size, bytes */
|
||||
/* current number of mmaps of prealloc_buf */
|
||||
unsigned int mmap_count;
|
||||
|
||||
/* byte count for writer (write completed) */
|
||||
unsigned int buf_write_count;
|
||||
|
@ -141,10 +149,7 @@ struct comedi_async {
|
|||
|
||||
wait_queue_head_t wait_head;
|
||||
|
||||
/* callback stuff */
|
||||
unsigned int cb_mask;
|
||||
int (*cb_func) (unsigned int flags, void *);
|
||||
void *cb_arg;
|
||||
|
||||
int (*inttrig) (struct comedi_device *dev, struct comedi_subdevice *s,
|
||||
unsigned int x);
|
||||
|
@ -173,6 +178,7 @@ struct comedi_device {
|
|||
|
||||
struct device *class_dev;
|
||||
int minor;
|
||||
unsigned int detach_count;
|
||||
/* hw_dev is passed to dma_alloc_coherent when allocating async buffers
|
||||
* for subdevices that have async_dma_dir set to something other than
|
||||
* DMA_NONE */
|
||||
|
@ -185,6 +191,8 @@ struct comedi_device {
|
|||
bool ioenabled:1;
|
||||
spinlock_t spinlock;
|
||||
struct mutex mutex;
|
||||
struct rw_semaphore attach_lock;
|
||||
struct kref refcount;
|
||||
|
||||
int n_subdevices;
|
||||
struct comedi_subdevice *subdevices;
|
||||
|
@ -231,7 +239,8 @@ enum comedi_minor_bits {
|
|||
static const unsigned COMEDI_SUBDEVICE_MINOR_SHIFT = 4;
|
||||
static const unsigned COMEDI_SUBDEVICE_MINOR_OFFSET = 1;
|
||||
|
||||
struct comedi_device *comedi_dev_from_minor(unsigned minor);
|
||||
struct comedi_device *comedi_dev_get_from_minor(unsigned minor);
|
||||
int comedi_dev_put(struct comedi_device *dev);
|
||||
|
||||
void init_polling(void);
|
||||
void cleanup_polling(void);
|
||||
|
@ -240,7 +249,6 @@ void stop_polling(struct comedi_device *);
|
|||
|
||||
/* subdevice runflags */
|
||||
enum subdevice_runflags {
|
||||
SRF_USER = 0x00000001,
|
||||
SRF_RT = 0x00000002,
|
||||
/* indicates an COMEDI_CB_ERROR event has occurred since the last
|
||||
* command was started */
|
||||
|
|
|
@ -95,7 +95,7 @@ int comedi_alloc_subdevices(struct comedi_device *dev, int num_subdevices)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(comedi_alloc_subdevices);
|
||||
|
||||
static void cleanup_device(struct comedi_device *dev)
|
||||
static void comedi_device_detach_cleanup(struct comedi_device *dev)
|
||||
{
|
||||
int i;
|
||||
struct comedi_subdevice *s;
|
||||
|
@ -133,10 +133,14 @@ static void cleanup_device(struct comedi_device *dev)
|
|||
|
||||
void comedi_device_detach(struct comedi_device *dev)
|
||||
{
|
||||
comedi_device_cancel_all(dev);
|
||||
down_write(&dev->attach_lock);
|
||||
dev->attached = false;
|
||||
dev->detach_count++;
|
||||
if (dev->driver)
|
||||
dev->driver->detach(dev);
|
||||
cleanup_device(dev);
|
||||
comedi_device_detach_cleanup(dev);
|
||||
up_write(&dev->attach_lock);
|
||||
}
|
||||
|
||||
static int poll_invalid(struct comedi_device *dev, struct comedi_subdevice *s)
|
||||
|
@ -355,8 +359,9 @@ static int comedi_device_postconfig(struct comedi_device *dev)
|
|||
ret = __comedi_device_postconfig(dev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
smp_wmb();
|
||||
down_write(&dev->attach_lock);
|
||||
dev->attached = true;
|
||||
up_write(&dev->attach_lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -657,7 +662,7 @@ void comedi_driver_unregister(struct comedi_driver *driver)
|
|||
|
||||
/* check for devices using this driver */
|
||||
for (i = 0; i < COMEDI_NUM_BOARD_MINORS; i++) {
|
||||
struct comedi_device *dev = comedi_dev_from_minor(i);
|
||||
struct comedi_device *dev = comedi_dev_get_from_minor(i);
|
||||
|
||||
if (!dev)
|
||||
continue;
|
||||
|
@ -671,6 +676,7 @@ void comedi_driver_unregister(struct comedi_driver *driver)
|
|||
comedi_device_detach(dev);
|
||||
}
|
||||
mutex_unlock(&dev->mutex);
|
||||
comedi_dev_put(dev);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(comedi_driver_unregister);
|
||||
|
|
|
@ -513,7 +513,7 @@ static int dio200_subdev_intr_cmd(struct comedi_device *dev,
|
|||
int event = 0;
|
||||
|
||||
spin_lock_irqsave(&subpriv->spinlock, flags);
|
||||
subpriv->active = 1;
|
||||
subpriv->active = true;
|
||||
|
||||
/* Set up end of acquisition. */
|
||||
switch (cmd->stop_src) {
|
||||
|
|
|
@ -345,7 +345,7 @@ int mite_buf_change(struct mite_dma_descriptor_ring *ring,
|
|||
for (i = 0; i < n_links; i++) {
|
||||
ring->descriptors[i].count = cpu_to_le32(PAGE_SIZE);
|
||||
ring->descriptors[i].addr =
|
||||
cpu_to_le32(async->buf_page_list[i].dma_addr);
|
||||
cpu_to_le32(async->buf_map->page_list[i].dma_addr);
|
||||
ring->descriptors[i].next =
|
||||
cpu_to_le32(ring->descriptors_dma_addr + (i +
|
||||
1) *
|
||||
|
|
|
@ -753,7 +753,7 @@ static void pcl818_ai_mode13dma_int(int mode, struct comedi_device *dev,
|
|||
} else {
|
||||
devpriv->ai_mode = INT_TYPE_AI3_DMA;
|
||||
outb(0x86 | (dev->irq << 4), dev->iobase + PCL818_CONTROL); /* Ext trig+IRQ+DMA */
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -35,7 +35,7 @@ MODULE_LICENSE("GPL");
|
|||
|
||||
struct comedi_device *comedi_open(const char *filename)
|
||||
{
|
||||
struct comedi_device *dev;
|
||||
struct comedi_device *dev, *retval = NULL;
|
||||
unsigned int minor;
|
||||
|
||||
if (strncmp(filename, "/dev/comedi", 11) != 0)
|
||||
|
@ -46,24 +46,27 @@ struct comedi_device *comedi_open(const char *filename)
|
|||
if (minor >= COMEDI_NUM_BOARD_MINORS)
|
||||
return NULL;
|
||||
|
||||
dev = comedi_dev_from_minor(minor);
|
||||
|
||||
if (!dev || !dev->attached)
|
||||
dev = comedi_dev_get_from_minor(minor);
|
||||
if (!dev)
|
||||
return NULL;
|
||||
|
||||
if (!try_module_get(dev->driver->module))
|
||||
return NULL;
|
||||
down_read(&dev->attach_lock);
|
||||
if (dev->attached)
|
||||
retval = dev;
|
||||
else
|
||||
retval = NULL;
|
||||
up_read(&dev->attach_lock);
|
||||
|
||||
return dev;
|
||||
if (retval == NULL)
|
||||
comedi_dev_put(dev);
|
||||
|
||||
return retval;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(comedi_open);
|
||||
|
||||
int comedi_close(struct comedi_device *d)
|
||||
int comedi_close(struct comedi_device *dev)
|
||||
{
|
||||
struct comedi_device *dev = (struct comedi_device *)d;
|
||||
|
||||
module_put(dev->driver->module);
|
||||
|
||||
comedi_dev_put(dev);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(comedi_close);
|
||||
|
@ -73,7 +76,14 @@ static int comedi_do_insn(struct comedi_device *dev,
|
|||
unsigned int *data)
|
||||
{
|
||||
struct comedi_subdevice *s;
|
||||
int ret = 0;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&dev->mutex);
|
||||
|
||||
if (!dev->attached) {
|
||||
ret = -EINVAL;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* a subdevice instruction */
|
||||
if (insn->subdev >= dev->n_subdevices) {
|
||||
|
@ -120,6 +130,7 @@ static int comedi_do_insn(struct comedi_device *dev,
|
|||
s->busy = NULL;
|
||||
error:
|
||||
|
||||
mutex_unlock(&dev->mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -169,9 +180,6 @@ int comedi_dio_bitfield2(struct comedi_device *dev, unsigned int subdev,
|
|||
unsigned int shift;
|
||||
int ret;
|
||||
|
||||
if (subdev >= dev->n_subdevices)
|
||||
return -EINVAL;
|
||||
|
||||
base_channel = CR_CHAN(base_channel);
|
||||
n_chan = comedi_get_n_channels(dev, subdev);
|
||||
if (base_channel >= n_chan)
|
||||
|
@ -211,23 +219,33 @@ int comedi_find_subdevice_by_type(struct comedi_device *dev, int type,
|
|||
unsigned int subd)
|
||||
{
|
||||
struct comedi_subdevice *s;
|
||||
int ret = -ENODEV;
|
||||
|
||||
if (subd > dev->n_subdevices)
|
||||
return -ENODEV;
|
||||
|
||||
for (; subd < dev->n_subdevices; subd++) {
|
||||
s = &dev->subdevices[subd];
|
||||
if (s->type == type)
|
||||
return subd;
|
||||
}
|
||||
return -1;
|
||||
down_read(&dev->attach_lock);
|
||||
if (dev->attached)
|
||||
for (; subd < dev->n_subdevices; subd++) {
|
||||
s = &dev->subdevices[subd];
|
||||
if (s->type == type) {
|
||||
ret = subd;
|
||||
break;
|
||||
}
|
||||
}
|
||||
up_read(&dev->attach_lock);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(comedi_find_subdevice_by_type);
|
||||
|
||||
int comedi_get_n_channels(struct comedi_device *dev, unsigned int subdevice)
|
||||
{
|
||||
struct comedi_subdevice *s = &dev->subdevices[subdevice];
|
||||
int n;
|
||||
|
||||
return s->n_chan;
|
||||
down_read(&dev->attach_lock);
|
||||
if (!dev->attached || subdevice >= dev->n_subdevices)
|
||||
n = 0;
|
||||
else
|
||||
n = dev->subdevices[subdevice].n_chan;
|
||||
up_read(&dev->attach_lock);
|
||||
|
||||
return n;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(comedi_get_n_channels);
|
||||
|
|
|
@ -41,16 +41,20 @@ static int comedi_read(struct seq_file *m, void *v)
|
|||
"driver_name, board_name, n_subdevices");
|
||||
|
||||
for (i = 0; i < COMEDI_NUM_BOARD_MINORS; i++) {
|
||||
struct comedi_device *dev = comedi_dev_from_minor(i);
|
||||
struct comedi_device *dev = comedi_dev_get_from_minor(i);
|
||||
|
||||
if (!dev)
|
||||
continue;
|
||||
|
||||
down_read(&dev->attach_lock);
|
||||
if (dev->attached) {
|
||||
devices_q = 1;
|
||||
seq_printf(m, "%2d: %-20s %-20s %4d\n",
|
||||
i, dev->driver->driver_name,
|
||||
dev->board_name, dev->n_subdevices);
|
||||
}
|
||||
up_read(&dev->attach_lock);
|
||||
comedi_dev_put(dev);
|
||||
}
|
||||
if (!devices_q)
|
||||
seq_puts(m, "no devices\n");
|
||||
|
|
|
@ -1059,7 +1059,7 @@ bool crystalhd_cmd_interrupt(struct crystalhd_cmd *ctx)
|
|||
{
|
||||
if (!ctx) {
|
||||
BCMLOG_ERR("Invalid arg..\n");
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
return crystalhd_hw_interrupt(ctx->adp, &ctx->hw_ctx);
|
||||
|
|
|
@ -28,9 +28,9 @@ extern int cxt1e1_log_level;
|
|||
#define COMET_NUM_UNITS 5 /* Number of points per entry in table */
|
||||
|
||||
/* forward references */
|
||||
static void SetPwrLevel(comet_t *comet);
|
||||
static void WrtRcvEqualizerTbl(ci_t *ci, comet_t *comet, u_int32_t *table);
|
||||
static void WrtXmtWaveformTbl(ci_t *ci, comet_t *comet, u_int8_t table[COMET_NUM_SAMPLES][COMET_NUM_UNITS]);
|
||||
static void SetPwrLevel(struct s_comet_reg *comet);
|
||||
static void WrtRcvEqualizerTbl(ci_t *ci, struct s_comet_reg *comet, u_int32_t *table);
|
||||
static void WrtXmtWaveformTbl(ci_t *ci, struct s_comet_reg *comet, u_int8_t table[COMET_NUM_SAMPLES][COMET_NUM_UNITS]);
|
||||
|
||||
|
||||
void *TWV_table[12] = {
|
||||
|
@ -58,7 +58,7 @@ lbo_tbl_lkup(int t1, int lbo) {
|
|||
return lbo - 1;
|
||||
}
|
||||
|
||||
void init_comet(void *ci, comet_t *comet, u_int32_t port_mode, int clockmaster,
|
||||
void init_comet(void *ci, struct s_comet_reg *comet, u_int32_t port_mode, int clockmaster,
|
||||
u_int8_t moreParams)
|
||||
{
|
||||
u_int8_t isT1mode;
|
||||
|
@ -159,8 +159,7 @@ void init_comet(void *ci, comet_t *comet, u_int32_t port_mode, int clockmaster,
|
|||
/* 60: t1 ALMI cfg */
|
||||
/* Configure Line Coding */
|
||||
|
||||
switch (port_mode)
|
||||
{
|
||||
switch (port_mode) {
|
||||
/* 1 - T1 B8ZS */
|
||||
case CFG_FRAME_SF:
|
||||
pci_write_32((u_int32_t *) &comet->cdrc_cfg, 0);
|
||||
|
@ -286,8 +285,7 @@ void init_comet(void *ci, comet_t *comet, u_int32_t port_mode, int clockmaster,
|
|||
|
||||
/* 0x30: "BRIF cfg"; 0x20 is 'CMODE', 0x03 is (bit) rate */
|
||||
/* note "rate bits can only be set once after reset" */
|
||||
if (clockmaster)
|
||||
{
|
||||
if (clockmaster) {
|
||||
/* CMODE == clockMode, 0=clock master (so all 3 others should be slave) */
|
||||
/* rate = 1.544 Mb/s */
|
||||
if (isT1mode)
|
||||
|
@ -302,16 +300,17 @@ void init_comet(void *ci, comet_t *comet, u_int32_t port_mode, int clockmaster,
|
|||
|
||||
/* Master Mode i.e.FPMODE=0 (@0x20) */
|
||||
pci_write_32((u_int32_t *) &comet->brif_fpcfg, 0x00);
|
||||
if ((moreParams & CFG_CLK_PORT_MASK) == CFG_CLK_PORT_INTERNAL)
|
||||
{
|
||||
if ((moreParams & CFG_CLK_PORT_MASK) == CFG_CLK_PORT_INTERNAL) {
|
||||
if (cxt1e1_log_level >= LOG_SBEBUG12)
|
||||
pr_info(">> %s: clockmaster internal clock\n", __func__);
|
||||
pr_info(">> %s: clockmaster internal clock\n",
|
||||
__func__);
|
||||
/* internal oscillator */
|
||||
pci_write_32((u_int32_t *) &comet->tx_time, 0x0d);
|
||||
} else {
|
||||
/* external clock source */
|
||||
if (cxt1e1_log_level >= LOG_SBEBUG12)
|
||||
pr_info(">> %s: clockmaster external clock\n", __func__);
|
||||
pr_info(">> %s: clockmaster external clock\n",
|
||||
__func__);
|
||||
/* loop timing(external) */
|
||||
pci_write_32((u_int32_t *) &comet->tx_time, 0x09);
|
||||
}
|
||||
|
@ -399,7 +398,7 @@ void init_comet(void *ci, comet_t *comet, u_int32_t port_mode, int clockmaster,
|
|||
** Returns: Nothing
|
||||
*/
|
||||
static void
|
||||
WrtXmtWaveform(ci_t *ci, comet_t *comet, u_int32_t sample, u_int32_t unit, u_int8_t data)
|
||||
WrtXmtWaveform(ci_t *ci, struct s_comet_reg *comet, u_int32_t sample, u_int32_t unit, u_int8_t data)
|
||||
{
|
||||
u_int8_t WaveformAddr;
|
||||
|
||||
|
@ -417,19 +416,20 @@ WrtXmtWaveform(ci_t *ci, comet_t *comet, u_int32_t sample, u_int32_t unit, u_int
|
|||
** Returns: Nothing
|
||||
*/
|
||||
static void
|
||||
WrtXmtWaveformTbl(ci_t *ci, comet_t *comet,
|
||||
WrtXmtWaveformTbl(ci_t *ci, struct s_comet_reg *comet,
|
||||
u_int8_t table[COMET_NUM_SAMPLES][COMET_NUM_UNITS])
|
||||
{
|
||||
u_int32_t sample, unit;
|
||||
|
||||
for (sample = 0; sample < COMET_NUM_SAMPLES; sample++)
|
||||
{
|
||||
for (sample = 0; sample < COMET_NUM_SAMPLES; sample++) {
|
||||
for (unit = 0; unit < COMET_NUM_UNITS; unit++)
|
||||
WrtXmtWaveform(ci, comet, sample, unit, table[sample][unit]);
|
||||
WrtXmtWaveform(ci, comet, sample, unit,
|
||||
table[sample][unit]);
|
||||
}
|
||||
|
||||
/* Enable transmitter and set output amplitude */
|
||||
pci_write_32((u_int32_t *) &comet->xlpg_cfg, table[COMET_NUM_SAMPLES][0]);
|
||||
pci_write_32((u_int32_t *) &comet->xlpg_cfg,
|
||||
table[COMET_NUM_SAMPLES][0]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -444,7 +444,7 @@ WrtXmtWaveformTbl(ci_t *ci, comet_t *comet,
|
|||
*/
|
||||
|
||||
static void
|
||||
WrtRcvEqualizerTbl(ci_t *ci, comet_t *comet, u_int32_t *table)
|
||||
WrtRcvEqualizerTbl(ci_t *ci, struct s_comet_reg *comet, u_int32_t *table)
|
||||
{
|
||||
u_int32_t ramaddr;
|
||||
volatile u_int32_t value;
|
||||
|
@ -457,7 +457,8 @@ WrtRcvEqualizerTbl(ci_t *ci, comet_t *comet, u_int32_t *table)
|
|||
/* for write order preservation when Optimizing driver */
|
||||
pci_flush_write(ci);
|
||||
/* write the addr, initiate a read */
|
||||
pci_write_32((u_int32_t *) &comet->rlps_eq_iaddr, (u_int8_t) ramaddr);
|
||||
pci_write_32((u_int32_t *) &comet->rlps_eq_iaddr,
|
||||
(u_int8_t) ramaddr);
|
||||
/* for write order preservation when Optimizing driver */
|
||||
pci_flush_write(ci);
|
||||
/*
|
||||
|
@ -470,9 +471,12 @@ WrtRcvEqualizerTbl(ci_t *ci, comet_t *comet, u_int32_t *table)
|
|||
}
|
||||
|
||||
value = *table++;
|
||||
pci_write_32((u_int32_t *) &comet->rlps_idata3, (u_int8_t) (value >> 24));
|
||||
pci_write_32((u_int32_t *) &comet->rlps_idata2, (u_int8_t) (value >> 16));
|
||||
pci_write_32((u_int32_t *) &comet->rlps_idata1, (u_int8_t) (value >> 8));
|
||||
pci_write_32((u_int32_t *) &comet->rlps_idata3,
|
||||
(u_int8_t) (value >> 24));
|
||||
pci_write_32((u_int32_t *) &comet->rlps_idata2,
|
||||
(u_int8_t) (value >> 16));
|
||||
pci_write_32((u_int32_t *) &comet->rlps_idata1,
|
||||
(u_int8_t) (value >> 8));
|
||||
pci_write_32((u_int32_t *) &comet->rlps_idata0, (u_int8_t) value);
|
||||
/* for write order preservation when Optimizing driver */
|
||||
pci_flush_write(ci);
|
||||
|
@ -484,7 +488,8 @@ WrtRcvEqualizerTbl(ci_t *ci, comet_t *comet, u_int32_t *table)
|
|||
/* for write order preservation when optimizing driver */
|
||||
pci_flush_write(ci);
|
||||
/* write the addr, initiate a read */
|
||||
pci_write_32((u_int32_t *) &comet->rlps_eq_iaddr, (u_int8_t) ramaddr);
|
||||
pci_write_32((u_int32_t *) &comet->rlps_eq_iaddr,
|
||||
(u_int8_t) ramaddr);
|
||||
/* for write order preservation when optimizing driver */
|
||||
pci_flush_write(ci);
|
||||
|
||||
|
@ -508,7 +513,7 @@ WrtRcvEqualizerTbl(ci_t *ci, comet_t *comet, u_int32_t *table)
|
|||
*/
|
||||
|
||||
static void
|
||||
SetPwrLevel(comet_t *comet)
|
||||
SetPwrLevel(struct s_comet_reg *comet)
|
||||
{
|
||||
volatile u_int32_t temp;
|
||||
|
||||
|
@ -550,12 +555,11 @@ SetPwrLevel(comet_t *comet)
|
|||
*/
|
||||
#if 0
|
||||
static void
|
||||
SetCometOps(comet_t *comet)
|
||||
SetCometOps(struct s_comet_reg *comet)
|
||||
{
|
||||
volatile u_int8_t rd_value;
|
||||
|
||||
if (comet == mConfig.C4Func1Base + (COMET0_OFFSET >> 2))
|
||||
{
|
||||
if (comet == mConfig.C4Func1Base + (COMET0_OFFSET >> 2)) {
|
||||
/* read the BRIF Configuration */
|
||||
rd_value = (u_int8_t) pci_read_32((u_int32_t *) &comet->brif_cfg);
|
||||
rd_value &= ~0x20;
|
||||
|
|
|
@ -25,304 +25,313 @@
|
|||
|
||||
#define VINT32 volatile u_int32_t
|
||||
|
||||
struct s_comet_reg
|
||||
{
|
||||
VINT32 gbl_cfg; /* 00 Global Cfg */
|
||||
VINT32 clkmon; /* 01 Clk Monitor */
|
||||
VINT32 rx_opt; /* 02 RX Options */
|
||||
VINT32 rx_line_cfg; /* 03 RX Line Interface Cfg */
|
||||
VINT32 tx_line_cfg; /* 04 TX Line Interface Cfg */
|
||||
VINT32 tx_frpass; /* 05 TX Framing & Bypass Options */
|
||||
VINT32 tx_time; /* 06 TX Timing Options */
|
||||
VINT32 intr_1; /* 07 Intr Source #1 */
|
||||
VINT32 intr_2; /* 08 Intr Source #2 */
|
||||
VINT32 intr_3; /* 09 Intr Source #3 */
|
||||
VINT32 mdiag; /* 0A Master Diagnostics */
|
||||
VINT32 mtest; /* 0B Master Test */
|
||||
VINT32 adiag; /* 0C Analog Diagnostics */
|
||||
VINT32 rev_id; /* 0D Rev/Chip Id/Global PMON Update */
|
||||
struct s_comet_reg {
|
||||
VINT32 gbl_cfg; /* 00 Global Cfg */
|
||||
VINT32 clkmon; /* 01 Clk Monitor */
|
||||
VINT32 rx_opt; /* 02 RX Options */
|
||||
VINT32 rx_line_cfg; /* 03 RX Line Interface Cfg */
|
||||
VINT32 tx_line_cfg; /* 04 TX Line Interface Cfg */
|
||||
VINT32 tx_frpass; /* 05 TX Framing & Bypass Options */
|
||||
VINT32 tx_time; /* 06 TX Timing Options */
|
||||
VINT32 intr_1; /* 07 Intr Source #1 */
|
||||
VINT32 intr_2; /* 08 Intr Source #2 */
|
||||
VINT32 intr_3; /* 09 Intr Source #3 */
|
||||
VINT32 mdiag; /* 0A Master Diagnostics */
|
||||
VINT32 mtest; /* 0B Master Test */
|
||||
VINT32 adiag; /* 0C Analog Diagnostics */
|
||||
VINT32 rev_id; /* 0D Rev/Chip Id/Global PMON Update */
|
||||
#define pmon rev_id
|
||||
VINT32 reset; /* 0E Reset */
|
||||
VINT32 prgd_phctl; /* 0F PRGD Positioning/Ctl & HDLC Ctl */
|
||||
VINT32 cdrc_cfg; /* 10 CDRC Cfg */
|
||||
VINT32 cdrc_ien; /* 11 CDRC Intr Enable */
|
||||
VINT32 cdrc_ists; /* 12 CDRC Intr Sts */
|
||||
VINT32 cdrc_alos; /* 13 CDRC Alternate Loss of Signal */
|
||||
VINT32 reset; /* 0E Reset */
|
||||
VINT32 prgd_phctl; /* 0F PRGD Positioning/Ctl & HDLC Ctl */
|
||||
VINT32 cdrc_cfg; /* 10 CDRC Cfg */
|
||||
VINT32 cdrc_ien; /* 11 CDRC Intr Enable */
|
||||
VINT32 cdrc_ists; /* 12 CDRC Intr Sts */
|
||||
VINT32 cdrc_alos; /* 13 CDRC Alternate Loss of Signal */
|
||||
|
||||
VINT32 rjat_ists; /* 14 RJAT Intr Sts */
|
||||
VINT32 rjat_n1clk; /* 15 RJAT Reference Clk Divisor (N1) Ctl */
|
||||
VINT32 rjat_n2clk; /* 16 RJAT Output Clk Divisor (N2) Ctl */
|
||||
VINT32 rjat_cfg; /* 17 RJAT Cfg */
|
||||
VINT32 rjat_ists; /* 14 RJAT Intr Sts */
|
||||
VINT32 rjat_n1clk; /* 15 RJAT Reference Clk Divisor (N1) Ctl */
|
||||
VINT32 rjat_n2clk; /* 16 RJAT Output Clk Divisor (N2) Ctl */
|
||||
VINT32 rjat_cfg; /* 17 RJAT Cfg */
|
||||
|
||||
VINT32 tjat_ists; /* 18 TJAT Intr Sts */
|
||||
VINT32 tjat_n1clk; /* 19 TJAT Reference Clk Divisor (N1) Ctl */
|
||||
VINT32 tjat_n2clk; /* 1A TJAT Output Clk Divisor (N2) Ctl */
|
||||
VINT32 tjat_cfg; /* 1B TJAT Cfg */
|
||||
VINT32 tjat_ists; /* 18 TJAT Intr Sts */
|
||||
VINT32 tjat_n1clk; /* 19 TJAT Reference Clk Divisor (N1) Ctl */
|
||||
VINT32 tjat_n2clk; /* 1A TJAT Output Clk Divisor (N2) Ctl */
|
||||
VINT32 tjat_cfg; /* 1B TJAT Cfg */
|
||||
|
||||
VINT32 rx_elst_cfg; /* 1C RX-ELST Cfg */
|
||||
VINT32 rx_elst_ists; /* 1D RX-ELST Intr Sts */
|
||||
VINT32 rx_elst_idle; /* 1E RX-ELST Idle Code */
|
||||
VINT32 _rx_elst_res1f; /* 1F RX-ELST Reserved */
|
||||
VINT32 rx_elst_cfg; /* 1C RX-ELST Cfg */
|
||||
VINT32 rx_elst_ists; /* 1D RX-ELST Intr Sts */
|
||||
VINT32 rx_elst_idle; /* 1E RX-ELST Idle Code */
|
||||
VINT32 _rx_elst_res1f; /* 1F RX-ELST Reserved */
|
||||
|
||||
VINT32 tx_elst_cfg; /* 20 TX-ELST Cfg */
|
||||
VINT32 tx_elst_ists; /* 21 TX-ELST Intr Sts */
|
||||
VINT32 _tx_elst_res22; /* 22 TX-ELST Reserved */
|
||||
VINT32 _tx_elst_res23; /* 23 TX-ELST Reserved */
|
||||
VINT32 __res24; /* 24 Reserved */
|
||||
VINT32 __res25; /* 25 Reserved */
|
||||
VINT32 __res26; /* 26 Reserved */
|
||||
VINT32 __res27; /* 27 Reserved */
|
||||
VINT32 tx_elst_cfg; /* 20 TX-ELST Cfg */
|
||||
VINT32 tx_elst_ists; /* 21 TX-ELST Intr Sts */
|
||||
VINT32 _tx_elst_res22; /* 22 TX-ELST Reserved */
|
||||
VINT32 _tx_elst_res23; /* 23 TX-ELST Reserved */
|
||||
VINT32 __res24; /* 24 Reserved */
|
||||
VINT32 __res25; /* 25 Reserved */
|
||||
VINT32 __res26; /* 26 Reserved */
|
||||
VINT32 __res27; /* 27 Reserved */
|
||||
|
||||
VINT32 rxce1_ctl; /* 28 RXCE RX Data Link 1 Ctl */
|
||||
VINT32 rxce1_bits; /* 29 RXCE RX Data Link 1 Bit Select */
|
||||
VINT32 rxce2_ctl; /* 2A RXCE RX Data Link 2 Ctl */
|
||||
VINT32 rxce2_bits; /* 2B RXCE RX Data Link 2 Bit Select */
|
||||
VINT32 rxce3_ctl; /* 2C RXCE RX Data Link 3 Ctl */
|
||||
VINT32 rxce3_bits; /* 2D RXCE RX Data Link 3 Bit Select */
|
||||
VINT32 _rxce_res2E; /* 2E RXCE Reserved */
|
||||
VINT32 _rxce_res2F; /* 2F RXCE Reserved */
|
||||
VINT32 rxce1_ctl; /* 28 RXCE RX Data Link 1 Ctl */
|
||||
VINT32 rxce1_bits; /* 29 RXCE RX Data Link 1 Bit Select */
|
||||
VINT32 rxce2_ctl; /* 2A RXCE RX Data Link 2 Ctl */
|
||||
VINT32 rxce2_bits; /* 2B RXCE RX Data Link 2 Bit Select */
|
||||
VINT32 rxce3_ctl; /* 2C RXCE RX Data Link 3 Ctl */
|
||||
VINT32 rxce3_bits; /* 2D RXCE RX Data Link 3 Bit Select */
|
||||
VINT32 _rxce_res2E; /* 2E RXCE Reserved */
|
||||
VINT32 _rxce_res2F; /* 2F RXCE Reserved */
|
||||
|
||||
VINT32 brif_cfg; /* 30 BRIF RX Backplane Cfg */
|
||||
VINT32 brif_fpcfg; /* 31 BRIF RX Backplane Frame Pulse Cfg */
|
||||
VINT32 brif_pfcfg; /* 32 BRIF RX Backplane Parity/F-Bit Cfg */
|
||||
VINT32 brif_tsoff; /* 33 BRIF RX Backplane Time Slot Offset */
|
||||
VINT32 brif_boff; /* 34 BRIF RX Backplane Bit Offset */
|
||||
VINT32 _brif_res35; /* 35 BRIF RX Backplane Reserved */
|
||||
VINT32 _brif_res36; /* 36 BRIF RX Backplane Reserved */
|
||||
VINT32 _brif_res37; /* 37 BRIF RX Backplane Reserved */
|
||||
VINT32 brif_cfg; /* 30 BRIF RX Backplane Cfg */
|
||||
VINT32 brif_fpcfg; /* 31 BRIF RX Backplane Frame Pulse Cfg */
|
||||
VINT32 brif_pfcfg; /* 32 BRIF RX Backplane Parity/F-Bit Cfg */
|
||||
VINT32 brif_tsoff; /* 33 BRIF RX Backplane Time Slot Offset */
|
||||
VINT32 brif_boff; /* 34 BRIF RX Backplane Bit Offset */
|
||||
VINT32 _brif_res35; /* 35 BRIF RX Backplane Reserved */
|
||||
VINT32 _brif_res36; /* 36 BRIF RX Backplane Reserved */
|
||||
VINT32 _brif_res37; /* 37 BRIF RX Backplane Reserved */
|
||||
|
||||
VINT32 txci1_ctl; /* 38 TXCI TX Data Link 1 Ctl */
|
||||
VINT32 txci1_bits; /* 39 TXCI TX Data Link 2 Bit Select */
|
||||
VINT32 txci2_ctl; /* 3A TXCI TX Data Link 1 Ctl */
|
||||
VINT32 txci2_bits; /* 3B TXCI TX Data Link 2 Bit Select */
|
||||
VINT32 txci3_ctl; /* 3C TXCI TX Data Link 1 Ctl */
|
||||
VINT32 txci3_bits; /* 3D TXCI TX Data Link 2 Bit Select */
|
||||
VINT32 _txci_res3E; /* 3E TXCI Reserved */
|
||||
VINT32 _txci_res3F; /* 3F TXCI Reserved */
|
||||
VINT32 txci1_ctl; /* 38 TXCI TX Data Link 1 Ctl */
|
||||
VINT32 txci1_bits; /* 39 TXCI TX Data Link 2 Bit Select */
|
||||
VINT32 txci2_ctl; /* 3A TXCI TX Data Link 1 Ctl */
|
||||
VINT32 txci2_bits; /* 3B TXCI TX Data Link 2 Bit Select */
|
||||
VINT32 txci3_ctl; /* 3C TXCI TX Data Link 1 Ctl */
|
||||
VINT32 txci3_bits; /* 3D TXCI TX Data Link 2 Bit Select */
|
||||
VINT32 _txci_res3E; /* 3E TXCI Reserved */
|
||||
VINT32 _txci_res3F; /* 3F TXCI Reserved */
|
||||
|
||||
VINT32 btif_cfg; /* 40 BTIF TX Backplane Cfg */
|
||||
VINT32 btif_fpcfg; /* 41 BTIF TX Backplane Frame Pulse Cfg */
|
||||
VINT32 btif_pcfgsts; /* 42 BTIF TX Backplane Parity Cfg & Sts */
|
||||
VINT32 btif_tsoff; /* 43 BTIF TX Backplane Time Slot Offset */
|
||||
VINT32 btif_boff; /* 44 BTIF TX Backplane Bit Offset */
|
||||
VINT32 _btif_res45; /* 45 BTIF TX Backplane Reserved */
|
||||
VINT32 _btif_res46; /* 46 BTIF TX Backplane Reserved */
|
||||
VINT32 _btif_res47; /* 47 BTIF TX Backplane Reserved */
|
||||
VINT32 t1_frmr_cfg; /* 48 T1 FRMR Cfg */
|
||||
VINT32 t1_frmr_ien; /* 49 T1 FRMR Intr Enable */
|
||||
VINT32 t1_frmr_ists; /* 4A T1 FRMR Intr Sts */
|
||||
VINT32 __res_4B; /* 4B Reserved */
|
||||
VINT32 ibcd_cfg; /* 4C IBCD Cfg */
|
||||
VINT32 ibcd_ies; /* 4D IBCD Intr Enable/Sts */
|
||||
VINT32 ibcd_act; /* 4E IBCD Activate Code */
|
||||
VINT32 ibcd_deact; /* 4F IBCD Deactivate Code */
|
||||
VINT32 btif_cfg; /* 40 BTIF TX Backplane Cfg */
|
||||
VINT32 btif_fpcfg; /* 41 BTIF TX Backplane Frame Pulse Cfg */
|
||||
VINT32 btif_pcfgsts; /* 42 BTIF TX Backplane Parity Cfg & Sts */
|
||||
VINT32 btif_tsoff; /* 43 BTIF TX Backplane Time Slot Offset */
|
||||
VINT32 btif_boff; /* 44 BTIF TX Backplane Bit Offset */
|
||||
VINT32 _btif_res45; /* 45 BTIF TX Backplane Reserved */
|
||||
VINT32 _btif_res46; /* 46 BTIF TX Backplane Reserved */
|
||||
VINT32 _btif_res47; /* 47 BTIF TX Backplane Reserved */
|
||||
VINT32 t1_frmr_cfg; /* 48 T1 FRMR Cfg */
|
||||
VINT32 t1_frmr_ien; /* 49 T1 FRMR Intr Enable */
|
||||
VINT32 t1_frmr_ists; /* 4A T1 FRMR Intr Sts */
|
||||
VINT32 __res_4B; /* 4B Reserved */
|
||||
VINT32 ibcd_cfg; /* 4C IBCD Cfg */
|
||||
VINT32 ibcd_ies; /* 4D IBCD Intr Enable/Sts */
|
||||
VINT32 ibcd_act; /* 4E IBCD Activate Code */
|
||||
VINT32 ibcd_deact; /* 4F IBCD Deactivate Code */
|
||||
|
||||
VINT32 sigx_cfg; /* 50 SIGX Cfg/Change of Signaling State */
|
||||
VINT32 sigx_acc_cos; /* 51 SIGX uP Access Sts/Change of Signaling State */
|
||||
VINT32 sigx_iac_cos; /* 52 SIGX Channel Indirect
|
||||
* Addr/Ctl/Change of Signaling State */
|
||||
VINT32 sigx_idb_cos; /* 53 SIGX Channel Indirect Data
|
||||
* Buffer/Change of Signaling State */
|
||||
VINT32 sigx_cfg; /* 50 SIGX Cfg/Change of Signaling State */
|
||||
VINT32 sigx_acc_cos; /* 51 SIGX
|
||||
* uP Access Sts/Change of Signaling State */
|
||||
VINT32 sigx_iac_cos; /* 52 SIGX Channel Indirect
|
||||
* Addr/Ctl/Change of Signaling State */
|
||||
VINT32 sigx_idb_cos; /* 53 SIGX Channel Indirect Data
|
||||
* Buffer/Change of Signaling State */
|
||||
|
||||
VINT32 t1_xbas_cfg; /* 54 T1 XBAS Cfg */
|
||||
VINT32 t1_xbas_altx; /* 55 T1 XBAS Alarm TX */
|
||||
VINT32 t1_xibc_ctl; /* 56 T1 XIBC Ctl */
|
||||
VINT32 t1_xibc_lbcode; /* 57 T1 XIBC Loopback Code */
|
||||
VINT32 t1_xbas_cfg; /* 54 T1 XBAS Cfg */
|
||||
VINT32 t1_xbas_altx; /* 55 T1 XBAS Alarm TX */
|
||||
VINT32 t1_xibc_ctl; /* 56 T1 XIBC Ctl */
|
||||
VINT32 t1_xibc_lbcode; /* 57 T1 XIBC Loopback Code */
|
||||
|
||||
VINT32 pmon_ies; /* 58 PMON Intr Enable/Sts */
|
||||
VINT32 pmon_fberr; /* 59 PMON Framing Bit Err Cnt */
|
||||
VINT32 pmon_feb_lsb; /* 5A PMON OFF/COFA/Far End Block Err Cnt (LSB) */
|
||||
VINT32 pmon_feb_msb; /* 5B PMON OFF/COFA/Far End Block Err Cnt (MSB) */
|
||||
VINT32 pmon_bed_lsb; /* 5C PMON Bit/Err/CRCE Cnt (LSB) */
|
||||
VINT32 pmon_bed_msb; /* 5D PMON Bit/Err/CRCE Cnt (MSB) */
|
||||
VINT32 pmon_lvc_lsb; /* 5E PMON LVC Cnt (LSB) */
|
||||
VINT32 pmon_lvc_msb; /* 5F PMON LVC Cnt (MSB) */
|
||||
VINT32 pmon_ies; /* 58 PMON Intr Enable/Sts */
|
||||
VINT32 pmon_fberr; /* 59 PMON Framing Bit Err Cnt */
|
||||
VINT32 pmon_feb_lsb; /* 5A PMON
|
||||
* OFF/COFA/Far End Block Err Cnt (LSB) */
|
||||
VINT32 pmon_feb_msb; /* 5B PMON
|
||||
* OFF/COFA/Far End Block Err Cnt (MSB) */
|
||||
VINT32 pmon_bed_lsb; /* 5C PMON Bit/Err/CRCE Cnt (LSB) */
|
||||
VINT32 pmon_bed_msb; /* 5D PMON Bit/Err/CRCE Cnt (MSB) */
|
||||
VINT32 pmon_lvc_lsb; /* 5E PMON LVC Cnt (LSB) */
|
||||
VINT32 pmon_lvc_msb; /* 5F PMON LVC Cnt (MSB) */
|
||||
|
||||
VINT32 t1_almi_cfg; /* 60 T1 ALMI Cfg */
|
||||
VINT32 t1_almi_ien; /* 61 T1 ALMI Intr Enable */
|
||||
VINT32 t1_almi_ists; /* 62 T1 ALMI Intr Sts */
|
||||
VINT32 t1_almi_detsts; /* 63 T1 ALMI Alarm Detection Sts */
|
||||
VINT32 t1_almi_cfg; /* 60 T1 ALMI Cfg */
|
||||
VINT32 t1_almi_ien; /* 61 T1 ALMI Intr Enable */
|
||||
VINT32 t1_almi_ists; /* 62 T1 ALMI Intr Sts */
|
||||
VINT32 t1_almi_detsts; /* 63 T1 ALMI Alarm Detection Sts */
|
||||
|
||||
VINT32 _t1_pdvd_res64; /* 64 T1 PDVD Reserved */
|
||||
VINT32 t1_pdvd_ies; /* 65 T1 PDVD Intr Enable/Sts */
|
||||
VINT32 _t1_xboc_res66; /* 66 T1 XBOC Reserved */
|
||||
VINT32 t1_xboc_code; /* 67 T1 XBOC Code */
|
||||
VINT32 _t1_xpde_res68; /* 68 T1 XPDE Reserved */
|
||||
VINT32 t1_xpde_ies; /* 69 T1 XPDE Intr Enable/Sts */
|
||||
VINT32 _t1_pdvd_res64; /* 64 T1 PDVD Reserved */
|
||||
VINT32 t1_pdvd_ies; /* 65 T1 PDVD Intr Enable/Sts */
|
||||
VINT32 _t1_xboc_res66; /* 66 T1 XBOC Reserved */
|
||||
VINT32 t1_xboc_code; /* 67 T1 XBOC Code */
|
||||
VINT32 _t1_xpde_res68; /* 68 T1 XPDE Reserved */
|
||||
VINT32 t1_xpde_ies; /* 69 T1 XPDE Intr Enable/Sts */
|
||||
|
||||
VINT32 t1_rboc_ena; /* 6A T1 RBOC Enable */
|
||||
VINT32 t1_rboc_sts; /* 6B T1 RBOC Code Sts */
|
||||
VINT32 t1_rboc_ena; /* 6A T1 RBOC Enable */
|
||||
VINT32 t1_rboc_sts; /* 6B T1 RBOC Code Sts */
|
||||
|
||||
VINT32 t1_tpsc_cfg; /* 6C TPSC Cfg */
|
||||
VINT32 t1_tpsc_sts; /* 6D TPSC uP Access Sts */
|
||||
VINT32 t1_tpsc_ciaddr; /* 6E TPSC Channel Indirect
|
||||
* Addr/Ctl */
|
||||
VINT32 t1_tpsc_cidata; /* 6F TPSC Channel Indirect Data
|
||||
* Buffer */
|
||||
VINT32 t1_rpsc_cfg; /* 70 RPSC Cfg */
|
||||
VINT32 t1_rpsc_sts; /* 71 RPSC uP Access Sts */
|
||||
VINT32 t1_rpsc_ciaddr; /* 72 RPSC Channel Indirect
|
||||
* Addr/Ctl */
|
||||
VINT32 t1_rpsc_cidata; /* 73 RPSC Channel Indirect Data
|
||||
* Buffer */
|
||||
VINT32 __res74; /* 74 Reserved */
|
||||
VINT32 __res75; /* 75 Reserved */
|
||||
VINT32 __res76; /* 76 Reserved */
|
||||
VINT32 __res77; /* 77 Reserved */
|
||||
VINT32 t1_tpsc_cfg; /* 6C TPSC Cfg */
|
||||
VINT32 t1_tpsc_sts; /* 6D TPSC uP Access Sts */
|
||||
VINT32 t1_tpsc_ciaddr; /* 6E TPSC Channel Indirect
|
||||
* Addr/Ctl */
|
||||
VINT32 t1_tpsc_cidata; /* 6F TPSC Channel Indirect Data
|
||||
* Buffer */
|
||||
VINT32 t1_rpsc_cfg; /* 70 RPSC Cfg */
|
||||
VINT32 t1_rpsc_sts; /* 71 RPSC uP Access Sts */
|
||||
VINT32 t1_rpsc_ciaddr; /* 72 RPSC Channel Indirect
|
||||
* Addr/Ctl */
|
||||
VINT32 t1_rpsc_cidata; /* 73 RPSC Channel Indirect Data
|
||||
* Buffer */
|
||||
VINT32 __res74; /* 74 Reserved */
|
||||
VINT32 __res75; /* 75 Reserved */
|
||||
VINT32 __res76; /* 76 Reserved */
|
||||
VINT32 __res77; /* 77 Reserved */
|
||||
|
||||
VINT32 t1_aprm_cfg; /* 78 T1 APRM Cfg/Ctl */
|
||||
VINT32 t1_aprm_load; /* 79 T1 APRM Manual Load */
|
||||
VINT32 t1_aprm_ists; /* 7A T1 APRM Intr Sts */
|
||||
VINT32 t1_aprm_1sec_2; /* 7B T1 APRM One Second Content Octet 2 */
|
||||
VINT32 t1_aprm_1sec_3; /* 7C T1 APRM One Second Content Octet 3 */
|
||||
VINT32 t1_aprm_1sec_4; /* 7D T1 APRM One Second Content Octet 4 */
|
||||
VINT32 t1_aprm_1sec_5; /* 7E T1 APRM One Second Content MSB (Octect 5) */
|
||||
VINT32 t1_aprm_1sec_6; /* 7F T1 APRM One Second Content MSB (Octect 6) */
|
||||
VINT32 t1_aprm_cfg; /* 78 T1 APRM Cfg/Ctl */
|
||||
VINT32 t1_aprm_load; /* 79 T1 APRM Manual Load */
|
||||
VINT32 t1_aprm_ists; /* 7A T1 APRM Intr Sts */
|
||||
VINT32 t1_aprm_1sec_2; /* 7B T1 APRM One Second Content Octet 2 */
|
||||
VINT32 t1_aprm_1sec_3; /* 7C T1 APRM One Second Content Octet 3 */
|
||||
VINT32 t1_aprm_1sec_4; /* 7D T1 APRM One Second Content Octet 4 */
|
||||
VINT32 t1_aprm_1sec_5; /* 7E T1 APRM
|
||||
* One Second Content MSB (Octect 5) */
|
||||
VINT32 t1_aprm_1sec_6; /* 7F T1 APRM
|
||||
* One Second Content MSB (Octect 6) */
|
||||
|
||||
VINT32 e1_tran_cfg; /* 80 E1 TRAN Cfg */
|
||||
VINT32 e1_tran_txalarm; /* 81 E1 TRAN TX Alarm/Diagnostic Ctl */
|
||||
VINT32 e1_tran_intctl; /* 82 E1 TRAN International Ctl */
|
||||
VINT32 e1_tran_extrab; /* 83 E1 TRAN Extra Bits Ctl */
|
||||
VINT32 e1_tran_ien; /* 84 E1 TRAN Intr Enable */
|
||||
VINT32 e1_tran_ists; /* 85 E1 TRAN Intr Sts */
|
||||
VINT32 e1_tran_nats; /* 86 E1 TRAN National Bit Codeword
|
||||
* Select */
|
||||
VINT32 e1_tran_nat; /* 87 E1 TRAN National Bit Codeword */
|
||||
VINT32 __res88; /* 88 Reserved */
|
||||
VINT32 __res89; /* 89 Reserved */
|
||||
VINT32 __res8A; /* 8A Reserved */
|
||||
VINT32 __res8B; /* 8B Reserved */
|
||||
VINT32 e1_tran_cfg; /* 80 E1 TRAN Cfg */
|
||||
VINT32 e1_tran_txalarm; /* 81 E1 TRAN TX Alarm/Diagnostic Ctl */
|
||||
VINT32 e1_tran_intctl; /* 82 E1 TRAN International Ctl */
|
||||
VINT32 e1_tran_extrab; /* 83 E1 TRAN Extra Bits Ctl */
|
||||
VINT32 e1_tran_ien; /* 84 E1 TRAN Intr Enable */
|
||||
VINT32 e1_tran_ists; /* 85 E1 TRAN Intr Sts */
|
||||
VINT32 e1_tran_nats; /* 86 E1 TRAN National Bit Codeword
|
||||
* Select */
|
||||
VINT32 e1_tran_nat; /* 87 E1 TRAN National Bit Codeword */
|
||||
VINT32 __res88; /* 88 Reserved */
|
||||
VINT32 __res89; /* 89 Reserved */
|
||||
VINT32 __res8A; /* 8A Reserved */
|
||||
VINT32 __res8B; /* 8B Reserved */
|
||||
|
||||
VINT32 _t1_frmr_res8C; /* 8C T1 FRMR Reserved */
|
||||
VINT32 _t1_frmr_res8D; /* 8D T1 FRMR Reserved */
|
||||
VINT32 __res8E; /* 8E Reserved */
|
||||
VINT32 __res8F; /* 8F Reserved */
|
||||
VINT32 _t1_frmr_res8C; /* 8C T1 FRMR Reserved */
|
||||
VINT32 _t1_frmr_res8D; /* 8D T1 FRMR Reserved */
|
||||
VINT32 __res8E; /* 8E Reserved */
|
||||
VINT32 __res8F; /* 8F Reserved */
|
||||
|
||||
VINT32 e1_frmr_aopts; /* 90 E1 FRMR Frame Alignment Options */
|
||||
VINT32 e1_frmr_mopts; /* 91 E1 FRMR Maintenance Mode Options */
|
||||
VINT32 e1_frmr_ien; /* 92 E1 FRMR Framing Sts Intr Enable */
|
||||
VINT32 e1_frmr_mien; /* 93 E1 FRMR Maintenance/Alarm Sts Intr Enable */
|
||||
VINT32 e1_frmr_ists; /* 94 E1 FRMR Framing Sts Intr Indication */
|
||||
VINT32 e1_frmr_mists; /* 95 E1 FRMR Maintenance/Alarm Sts Indication Enable */
|
||||
VINT32 e1_frmr_sts; /* 96 E1 FRMR Framing Sts */
|
||||
VINT32 e1_frmr_masts; /* 97 E1 FRMR Maintenance/Alarm Sts */
|
||||
VINT32 e1_frmr_nat_bits; /* 98 E1 FRMR International/National Bits */
|
||||
VINT32 e1_frmr_crc_lsb; /* 99 E1 FRMR CRC Err Cnt - LSB */
|
||||
VINT32 e1_frmr_crc_msb; /* 9A E1 FRMR CRC Err Cnt - MSB */
|
||||
VINT32 e1_frmr_nat_ien; /* 9B E1 FRMR National Bit Codeword Intr Enables */
|
||||
VINT32 e1_frmr_nat_ists; /* 9C E1 FRMR National Bit Codeword Intr/Sts */
|
||||
VINT32 e1_frmr_nat; /* 9D E1 FRMR National Bit Codewords */
|
||||
VINT32 e1_frmr_fp_ien; /* 9E E1 FRMR Frame Pulse/Alarm Intr Enables */
|
||||
VINT32 e1_frmr_fp_ists; /* 9F E1 FRMR Frame Pulse/Alarm Intr/Sts */
|
||||
VINT32 e1_frmr_aopts; /* 90 E1 FRMR Frame Alignment Options */
|
||||
VINT32 e1_frmr_mopts; /* 91 E1 FRMR Maintenance Mode Options */
|
||||
VINT32 e1_frmr_ien; /* 92 E1 FRMR Framing Sts Intr Enable */
|
||||
VINT32 e1_frmr_mien; /* 93 E1 FRMR
|
||||
* Maintenance/Alarm Sts Intr Enable */
|
||||
VINT32 e1_frmr_ists; /* 94 E1 FRMR Framing Sts Intr Indication */
|
||||
VINT32 e1_frmr_mists; /* 95 E1 FRMR
|
||||
* Maintenance/Alarm Sts Indication Enable */
|
||||
VINT32 e1_frmr_sts; /* 96 E1 FRMR Framing Sts */
|
||||
VINT32 e1_frmr_masts; /* 97 E1 FRMR Maintenance/Alarm Sts */
|
||||
VINT32 e1_frmr_nat_bits; /* 98 E1 FRMR International/National Bits */
|
||||
VINT32 e1_frmr_crc_lsb; /* 99 E1 FRMR CRC Err Cnt - LSB */
|
||||
VINT32 e1_frmr_crc_msb; /* 9A E1 FRMR CRC Err Cnt - MSB */
|
||||
VINT32 e1_frmr_nat_ien; /* 9B E1 FRMR
|
||||
* National Bit Codeword Intr Enables */
|
||||
VINT32 e1_frmr_nat_ists; /* 9C E1 FRMR
|
||||
* National Bit Codeword Intr/Sts */
|
||||
VINT32 e1_frmr_nat; /* 9D E1 FRMR National Bit Codewords */
|
||||
VINT32 e1_frmr_fp_ien; /* 9E E1 FRMR
|
||||
* Frame Pulse/Alarm Intr Enables */
|
||||
VINT32 e1_frmr_fp_ists; /* 9F E1 FRMR Frame Pulse/Alarm Intr/Sts */
|
||||
|
||||
VINT32 __resA0; /* A0 Reserved */
|
||||
VINT32 __resA1; /* A1 Reserved */
|
||||
VINT32 __resA2; /* A2 Reserved */
|
||||
VINT32 __resA3; /* A3 Reserved */
|
||||
VINT32 __resA4; /* A4 Reserved */
|
||||
VINT32 __resA5; /* A5 Reserved */
|
||||
VINT32 __resA6; /* A6 Reserved */
|
||||
VINT32 __resA7; /* A7 Reserved */
|
||||
VINT32 __resA0; /* A0 Reserved */
|
||||
VINT32 __resA1; /* A1 Reserved */
|
||||
VINT32 __resA2; /* A2 Reserved */
|
||||
VINT32 __resA3; /* A3 Reserved */
|
||||
VINT32 __resA4; /* A4 Reserved */
|
||||
VINT32 __resA5; /* A5 Reserved */
|
||||
VINT32 __resA6; /* A6 Reserved */
|
||||
VINT32 __resA7; /* A7 Reserved */
|
||||
|
||||
VINT32 tdpr1_cfg; /* A8 TDPR #1 Cfg */
|
||||
VINT32 tdpr1_utl; /* A9 TDPR #1 Upper TX Threshold */
|
||||
VINT32 tdpr1_ltl; /* AA TDPR #1 Lower TX Threshold */
|
||||
VINT32 tdpr1_ien; /* AB TDPR #1 Intr Enable */
|
||||
VINT32 tdpr1_ists; /* AC TDPR #1 Intr Sts/UDR Clear */
|
||||
VINT32 tdpr1_data; /* AD TDPR #1 TX Data */
|
||||
VINT32 __resAE; /* AE Reserved */
|
||||
VINT32 __resAF; /* AF Reserved */
|
||||
VINT32 tdpr2_cfg; /* B0 TDPR #2 Cfg */
|
||||
VINT32 tdpr2_utl; /* B1 TDPR #2 Upper TX Threshold */
|
||||
VINT32 tdpr2_ltl; /* B2 TDPR #2 Lower TX Threshold */
|
||||
VINT32 tdpr2_ien; /* B3 TDPR #2 Intr Enable */
|
||||
VINT32 tdpr2_ists; /* B4 TDPR #2 Intr Sts/UDR Clear */
|
||||
VINT32 tdpr2_data; /* B5 TDPR #2 TX Data */
|
||||
VINT32 __resB6; /* B6 Reserved */
|
||||
VINT32 __resB7; /* B7 Reserved1 */
|
||||
VINT32 tdpr3_cfg; /* B8 TDPR #3 Cfg */
|
||||
VINT32 tdpr3_utl; /* B9 TDPR #3 Upper TX Threshold */
|
||||
VINT32 tdpr3_ltl; /* BA TDPR #3 Lower TX Threshold */
|
||||
VINT32 tdpr3_ien; /* BB TDPR #3 Intr Enable */
|
||||
VINT32 tdpr3_ists; /* BC TDPR #3 Intr Sts/UDR Clear */
|
||||
VINT32 tdpr3_data; /* BD TDPR #3 TX Data */
|
||||
VINT32 __resBE; /* BE Reserved */
|
||||
VINT32 __resBF; /* BF Reserved */
|
||||
VINT32 tdpr1_cfg; /* A8 TDPR #1 Cfg */
|
||||
VINT32 tdpr1_utl; /* A9 TDPR #1 Upper TX Threshold */
|
||||
VINT32 tdpr1_ltl; /* AA TDPR #1 Lower TX Threshold */
|
||||
VINT32 tdpr1_ien; /* AB TDPR #1 Intr Enable */
|
||||
VINT32 tdpr1_ists; /* AC TDPR #1 Intr Sts/UDR Clear */
|
||||
VINT32 tdpr1_data; /* AD TDPR #1 TX Data */
|
||||
VINT32 __resAE; /* AE Reserved */
|
||||
VINT32 __resAF; /* AF Reserved */
|
||||
VINT32 tdpr2_cfg; /* B0 TDPR #2 Cfg */
|
||||
VINT32 tdpr2_utl; /* B1 TDPR #2 Upper TX Threshold */
|
||||
VINT32 tdpr2_ltl; /* B2 TDPR #2 Lower TX Threshold */
|
||||
VINT32 tdpr2_ien; /* B3 TDPR #2 Intr Enable */
|
||||
VINT32 tdpr2_ists; /* B4 TDPR #2 Intr Sts/UDR Clear */
|
||||
VINT32 tdpr2_data; /* B5 TDPR #2 TX Data */
|
||||
VINT32 __resB6; /* B6 Reserved */
|
||||
VINT32 __resB7; /* B7 Reserved1 */
|
||||
VINT32 tdpr3_cfg; /* B8 TDPR #3 Cfg */
|
||||
VINT32 tdpr3_utl; /* B9 TDPR #3 Upper TX Threshold */
|
||||
VINT32 tdpr3_ltl; /* BA TDPR #3 Lower TX Threshold */
|
||||
VINT32 tdpr3_ien; /* BB TDPR #3 Intr Enable */
|
||||
VINT32 tdpr3_ists; /* BC TDPR #3 Intr Sts/UDR Clear */
|
||||
VINT32 tdpr3_data; /* BD TDPR #3 TX Data */
|
||||
VINT32 __resBE; /* BE Reserved */
|
||||
VINT32 __resBF; /* BF Reserved */
|
||||
|
||||
VINT32 rdlc1_cfg; /* C0 RDLC #1 Cfg */
|
||||
VINT32 rdlc1_intctl; /* C1 RDLC #1 Intr Ctl */
|
||||
VINT32 rdlc1_sts; /* C2 RDLC #1 Sts */
|
||||
VINT32 rdlc1_data; /* C3 RDLC #1 Data */
|
||||
VINT32 rdlc1_paddr; /* C4 RDLC #1 Primary Addr Match */
|
||||
VINT32 rdlc1_saddr; /* C5 RDLC #1 Secondary Addr Match */
|
||||
VINT32 __resC6; /* C6 Reserved */
|
||||
VINT32 __resC7; /* C7 Reserved */
|
||||
VINT32 rdlc2_cfg; /* C8 RDLC #2 Cfg */
|
||||
VINT32 rdlc2_intctl; /* C9 RDLC #2 Intr Ctl */
|
||||
VINT32 rdlc2_sts; /* CA RDLC #2 Sts */
|
||||
VINT32 rdlc2_data; /* CB RDLC #2 Data */
|
||||
VINT32 rdlc2_paddr; /* CC RDLC #2 Primary Addr Match */
|
||||
VINT32 rdlc2_saddr; /* CD RDLC #2 Secondary Addr Match */
|
||||
VINT32 __resCE; /* CE Reserved */
|
||||
VINT32 __resCF; /* CF Reserved */
|
||||
VINT32 rdlc3_cfg; /* D0 RDLC #3 Cfg */
|
||||
VINT32 rdlc3_intctl; /* D1 RDLC #3 Intr Ctl */
|
||||
VINT32 rdlc3_sts; /* D2 RDLC #3 Sts */
|
||||
VINT32 rdlc3_data; /* D3 RDLC #3 Data */
|
||||
VINT32 rdlc3_paddr; /* D4 RDLC #3 Primary Addr Match */
|
||||
VINT32 rdlc3_saddr; /* D5 RDLC #3 Secondary Addr Match */
|
||||
VINT32 rdlc1_cfg; /* C0 RDLC #1 Cfg */
|
||||
VINT32 rdlc1_intctl; /* C1 RDLC #1 Intr Ctl */
|
||||
VINT32 rdlc1_sts; /* C2 RDLC #1 Sts */
|
||||
VINT32 rdlc1_data; /* C3 RDLC #1 Data */
|
||||
VINT32 rdlc1_paddr; /* C4 RDLC #1 Primary Addr Match */
|
||||
VINT32 rdlc1_saddr; /* C5 RDLC #1 Secondary Addr Match */
|
||||
VINT32 __resC6; /* C6 Reserved */
|
||||
VINT32 __resC7; /* C7 Reserved */
|
||||
VINT32 rdlc2_cfg; /* C8 RDLC #2 Cfg */
|
||||
VINT32 rdlc2_intctl; /* C9 RDLC #2 Intr Ctl */
|
||||
VINT32 rdlc2_sts; /* CA RDLC #2 Sts */
|
||||
VINT32 rdlc2_data; /* CB RDLC #2 Data */
|
||||
VINT32 rdlc2_paddr; /* CC RDLC #2 Primary Addr Match */
|
||||
VINT32 rdlc2_saddr; /* CD RDLC #2 Secondary Addr Match */
|
||||
VINT32 __resCE; /* CE Reserved */
|
||||
VINT32 __resCF; /* CF Reserved */
|
||||
VINT32 rdlc3_cfg; /* D0 RDLC #3 Cfg */
|
||||
VINT32 rdlc3_intctl; /* D1 RDLC #3 Intr Ctl */
|
||||
VINT32 rdlc3_sts; /* D2 RDLC #3 Sts */
|
||||
VINT32 rdlc3_data; /* D3 RDLC #3 Data */
|
||||
VINT32 rdlc3_paddr; /* D4 RDLC #3 Primary Addr Match */
|
||||
VINT32 rdlc3_saddr; /* D5 RDLC #3 Secondary Addr Match */
|
||||
|
||||
VINT32 csu_cfg; /* D6 CSU Cfg */
|
||||
VINT32 _csu_resD7; /* D7 CSU Reserved */
|
||||
VINT32 csu_cfg; /* D6 CSU Cfg */
|
||||
VINT32 _csu_resD7; /* D7 CSU Reserved */
|
||||
|
||||
VINT32 rlps_idata3; /* D8 RLPS Indirect Data, 24-31 */
|
||||
VINT32 rlps_idata2; /* D9 RLPS Indirect Data, 16-23 */
|
||||
VINT32 rlps_idata1; /* DA RLPS Indirect Data, 8-15 */
|
||||
VINT32 rlps_idata0; /* DB RLPS Indirect Data, 0-7 */
|
||||
VINT32 rlps_eqvr; /* DC RLPS Equalizer Voltage Reference
|
||||
* (E1 missing) */
|
||||
VINT32 _rlps_resDD; /* DD RLPS Reserved */
|
||||
VINT32 _rlps_resDE; /* DE RLPS Reserved */
|
||||
VINT32 _rlps_resDF; /* DF RLPS Reserved */
|
||||
VINT32 rlps_idata3; /* D8 RLPS Indirect Data, 24-31 */
|
||||
VINT32 rlps_idata2; /* D9 RLPS Indirect Data, 16-23 */
|
||||
VINT32 rlps_idata1; /* DA RLPS Indirect Data, 8-15 */
|
||||
VINT32 rlps_idata0; /* DB RLPS Indirect Data, 0-7 */
|
||||
VINT32 rlps_eqvr; /* DC RLPS Equalizer Voltage Reference
|
||||
* (E1 missing) */
|
||||
VINT32 _rlps_resDD; /* DD RLPS Reserved */
|
||||
VINT32 _rlps_resDE; /* DE RLPS Reserved */
|
||||
VINT32 _rlps_resDF; /* DF RLPS Reserved */
|
||||
|
||||
VINT32 prgd_ctl; /* E0 PRGD Ctl */
|
||||
VINT32 prgd_ies; /* E1 PRGD Intr Enable/Sts */
|
||||
VINT32 prgd_shift_len; /* E2 PRGD Shift Length */
|
||||
VINT32 prgd_tap; /* E3 PRGD Tap */
|
||||
VINT32 prgd_errin; /* E4 PRGD Err Insertion */
|
||||
VINT32 _prgd_resE5; /* E5 PRGD Reserved */
|
||||
VINT32 _prgd_resE6; /* E6 PRGD Reserved */
|
||||
VINT32 _prgd_resE7; /* E7 PRGD Reserved */
|
||||
VINT32 prgd_patin1; /* E8 PRGD Pattern Insertion #1 */
|
||||
VINT32 prgd_patin2; /* E9 PRGD Pattern Insertion #2 */
|
||||
VINT32 prgd_patin3; /* EA PRGD Pattern Insertion #3 */
|
||||
VINT32 prgd_patin4; /* EB PRGD Pattern Insertion #4 */
|
||||
VINT32 prgd_patdet1; /* EC PRGD Pattern Detector #1 */
|
||||
VINT32 prgd_patdet2; /* ED PRGD Pattern Detector #2 */
|
||||
VINT32 prgd_patdet3; /* EE PRGD Pattern Detector #3 */
|
||||
VINT32 prgd_patdet4; /* EF PRGD Pattern Detector #4 */
|
||||
VINT32 prgd_ctl; /* E0 PRGD Ctl */
|
||||
VINT32 prgd_ies; /* E1 PRGD Intr Enable/Sts */
|
||||
VINT32 prgd_shift_len; /* E2 PRGD Shift Length */
|
||||
VINT32 prgd_tap; /* E3 PRGD Tap */
|
||||
VINT32 prgd_errin; /* E4 PRGD Err Insertion */
|
||||
VINT32 _prgd_resE5; /* E5 PRGD Reserved */
|
||||
VINT32 _prgd_resE6; /* E6 PRGD Reserved */
|
||||
VINT32 _prgd_resE7; /* E7 PRGD Reserved */
|
||||
VINT32 prgd_patin1; /* E8 PRGD Pattern Insertion #1 */
|
||||
VINT32 prgd_patin2; /* E9 PRGD Pattern Insertion #2 */
|
||||
VINT32 prgd_patin3; /* EA PRGD Pattern Insertion #3 */
|
||||
VINT32 prgd_patin4; /* EB PRGD Pattern Insertion #4 */
|
||||
VINT32 prgd_patdet1; /* EC PRGD Pattern Detector #1 */
|
||||
VINT32 prgd_patdet2; /* ED PRGD Pattern Detector #2 */
|
||||
VINT32 prgd_patdet3; /* EE PRGD Pattern Detector #3 */
|
||||
VINT32 prgd_patdet4; /* EF PRGD Pattern Detector #4 */
|
||||
|
||||
VINT32 xlpg_cfg; /* F0 XLPG Line Driver Cfg */
|
||||
VINT32 xlpg_ctlsts; /* F1 XLPG Ctl/Sts */
|
||||
VINT32 xlpg_pwave_addr; /* F2 XLPG Pulse Waveform Storage Write Addr */
|
||||
VINT32 xlpg_pwave_data; /* F3 XLPG Pulse Waveform Storage Data */
|
||||
VINT32 xlpg_atest_pctl; /* F4 XLPG Analog Test Positive Ctl */
|
||||
VINT32 xlpg_atest_nctl; /* F5 XLPG Analog Test Negative Ctl */
|
||||
VINT32 xlpg_fdata_sel; /* F6 XLPG Fuse Data Select */
|
||||
VINT32 _xlpg_resF7; /* F7 XLPG Reserved */
|
||||
VINT32 xlpg_cfg; /* F0 XLPG Line Driver Cfg */
|
||||
VINT32 xlpg_ctlsts; /* F1 XLPG Ctl/Sts */
|
||||
VINT32 xlpg_pwave_addr; /* F2 XLPG
|
||||
* Pulse Waveform Storage Write Addr */
|
||||
VINT32 xlpg_pwave_data; /* F3 XLPG Pulse Waveform Storage Data */
|
||||
VINT32 xlpg_atest_pctl; /* F4 XLPG Analog Test Positive Ctl */
|
||||
VINT32 xlpg_atest_nctl; /* F5 XLPG Analog Test Negative Ctl */
|
||||
VINT32 xlpg_fdata_sel; /* F6 XLPG Fuse Data Select */
|
||||
VINT32 _xlpg_resF7; /* F7 XLPG Reserved */
|
||||
|
||||
VINT32 rlps_cfgsts; /* F8 RLPS Cfg & Sts */
|
||||
VINT32 rlps_alos_thresh; /* F9 RLPS ALOS Detection/Clearance Threshold */
|
||||
VINT32 rlps_alos_dper; /* FA RLPS ALOS Detection Period */
|
||||
VINT32 rlps_alos_cper; /* FB RLPS ALOS Clearance Period */
|
||||
VINT32 rlps_eq_iaddr; /* FC RLPS Equalization Indirect Addr */
|
||||
VINT32 rlps_eq_rwsel; /* FD RLPS Equalization Read/WriteB Select */
|
||||
VINT32 rlps_eq_ctlsts; /* FE RLPS Equalizer Loop Sts & Ctl */
|
||||
VINT32 rlps_eq_cfg; /* FF RLPS Equalizer Cfg */
|
||||
VINT32 rlps_cfgsts; /* F8 RLPS Cfg & Sts */
|
||||
VINT32 rlps_alos_thresh; /* F9 RLPS
|
||||
* ALOS Detection/Clearance Threshold */
|
||||
VINT32 rlps_alos_dper; /* FA RLPS ALOS Detection Period */
|
||||
VINT32 rlps_alos_cper; /* FB RLPS ALOS Clearance Period */
|
||||
VINT32 rlps_eq_iaddr; /* FC RLPS Equalization Indirect Addr */
|
||||
VINT32 rlps_eq_rwsel; /* FD RLPS Equalization Read/WriteB Select */
|
||||
VINT32 rlps_eq_ctlsts; /* FE RLPS Equalizer Loop Sts & Ctl */
|
||||
VINT32 rlps_eq_cfg; /* FF RLPS Equalizer Cfg */
|
||||
};
|
||||
|
||||
typedef struct s_comet_reg comet_t;
|
||||
|
||||
/* 00AH: MDIAG Register bit definitions */
|
||||
#define COMET_MDIAG_ID5 0x40
|
||||
#define COMET_MDIAG_LBMASK 0x3F
|
||||
|
@ -338,7 +347,7 @@ typedef struct s_comet_reg comet_t;
|
|||
|
||||
#ifdef __KERNEL__
|
||||
extern void
|
||||
init_comet(void *, comet_t *, u_int32_t, int, u_int8_t);
|
||||
init_comet(void *, struct s_comet_reg *, u_int32_t, int, u_int8_t);
|
||||
#endif
|
||||
|
||||
#endif /* _INC_COMET_H_ */
|
||||
|
|
|
@ -274,7 +274,7 @@ VMETRO_TRACE (void *x)
|
|||
void
|
||||
VMETRO_TRIGGER (ci_t *ci, int x)
|
||||
{
|
||||
comet_t *comet;
|
||||
struct s_comet_reg *comet;
|
||||
volatile u_int32_t data;
|
||||
|
||||
comet = ci->port[0].cometbase; /* default to COMET # 0 */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
unsigned int max_intcnt = 0;
|
||||
unsigned int max_bh = 0;
|
||||
static unsigned int max_intcnt = 0;
|
||||
static unsigned int max_bh = 0;
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* musycc.c -
|
||||
|
|
|
@ -194,7 +194,7 @@ checkPorts (ci_t *ci)
|
|||
* alarms conflicts with NCOMM's interrupt servicing implementation.
|
||||
*/
|
||||
|
||||
comet_t *comet;
|
||||
struct s_comet_reg *comet;
|
||||
volatile u_int32_t value;
|
||||
u_int32_t copyVal, LEDval;
|
||||
|
||||
|
@ -507,7 +507,7 @@ c4_cleanup (void)
|
|||
int
|
||||
c4_get_portcfg (ci_t *ci)
|
||||
{
|
||||
comet_t *comet;
|
||||
struct s_comet_reg *comet;
|
||||
int portnum, mask;
|
||||
u_int32_t wdata, rdata;
|
||||
|
||||
|
@ -561,7 +561,7 @@ c4_init (ci_t *ci, u_char *func0, u_char *func1)
|
|||
for (portnum = 0; portnum < MUSYCC_NPORTS; portnum++)
|
||||
{
|
||||
pi = &ci->port[portnum];
|
||||
pi->cometbase = (comet_t *) ((u_int32_t *) (func1 + COMET_OFFSET (portnum)));
|
||||
pi->cometbase = (struct s_comet_reg *) ((u_int32_t *) (func1 + COMET_OFFSET (portnum)));
|
||||
pi->reg = (struct musycc_globalr *) ((u_char *) ci->reg + (portnum * 0x800));
|
||||
pi->portnum = portnum;
|
||||
pi->p.portnum = portnum;
|
||||
|
@ -693,7 +693,7 @@ c4_init2 (ci_t *ci)
|
|||
int
|
||||
c4_loop_port (ci_t *ci, int portnum, u_int8_t cmd)
|
||||
{
|
||||
comet_t *comet;
|
||||
struct s_comet_reg *comet;
|
||||
volatile u_int32_t loopValue;
|
||||
|
||||
comet = ci->port[portnum].cometbase;
|
||||
|
@ -752,7 +752,7 @@ c4_loop_port (ci_t *ci, int portnum, u_int8_t cmd)
|
|||
status_t
|
||||
c4_frame_rw (ci_t *ci, struct sbecom_port_param *pp)
|
||||
{
|
||||
comet_t *comet;
|
||||
struct s_comet_reg *comet;
|
||||
volatile u_int32_t data;
|
||||
|
||||
if (pp->portnum >= ci->max_port)/* sanity check */
|
||||
|
|
|
@ -133,7 +133,7 @@ struct c4_port_info
|
|||
void *regram_saved; /* Original malloc value may have non-2KB
|
||||
* boundary. Need to save for use when
|
||||
* freeing. */
|
||||
comet_t *cometbase;
|
||||
struct s_comet_reg *cometbase;
|
||||
struct sbe_card_info *up;
|
||||
|
||||
/*
|
||||
|
|
|
@ -20,190 +20,185 @@
|
|||
#include "sbe_bid.h"
|
||||
|
||||
char *
|
||||
sbeid_get_bdname (ci_t *ci)
|
||||
sbeid_get_bdname(ci_t *ci)
|
||||
{
|
||||
char *np = NULL;
|
||||
char *np = NULL;
|
||||
|
||||
switch (ci->brd_id)
|
||||
{
|
||||
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1):
|
||||
np = "wanPTMC-256T3 <E1>";
|
||||
break;
|
||||
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1):
|
||||
np = "wanPTMC-256T3 <T1>";
|
||||
break;
|
||||
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1):
|
||||
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1_L):
|
||||
np = "wanPMC-C4T1E1";
|
||||
break;
|
||||
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1):
|
||||
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1_L):
|
||||
np = "wanPMC-C2T1E1";
|
||||
break;
|
||||
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1):
|
||||
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1_L):
|
||||
np = "wanPMC-C1T1E1";
|
||||
break;
|
||||
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1):
|
||||
np = "wanPCI-C4T1E1";
|
||||
break;
|
||||
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1):
|
||||
np = "wanPCI-C2T1E1";
|
||||
break;
|
||||
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1):
|
||||
np = "wanPCI-C1T1E1";
|
||||
break;
|
||||
default:
|
||||
/*** np = "<unknown>"; ***/
|
||||
np = "wanPCI-CxT1E1";
|
||||
break;
|
||||
}
|
||||
switch (ci->brd_id) {
|
||||
case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1):
|
||||
np = "wanPTMC-256T3 <E1>";
|
||||
break;
|
||||
case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1):
|
||||
np = "wanPTMC-256T3 <T1>";
|
||||
break;
|
||||
case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1):
|
||||
case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1_L):
|
||||
np = "wanPMC-C4T1E1";
|
||||
break;
|
||||
case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1):
|
||||
case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1_L):
|
||||
np = "wanPMC-C2T1E1";
|
||||
break;
|
||||
case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1):
|
||||
case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1_L):
|
||||
np = "wanPMC-C1T1E1";
|
||||
break;
|
||||
case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1):
|
||||
np = "wanPCI-C4T1E1";
|
||||
break;
|
||||
case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1):
|
||||
np = "wanPCI-C2T1E1";
|
||||
break;
|
||||
case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1):
|
||||
np = "wanPCI-C1T1E1";
|
||||
break;
|
||||
default:
|
||||
/*** np = "<unknown>"; ***/
|
||||
np = "wanPCI-CxT1E1";
|
||||
break;
|
||||
}
|
||||
|
||||
return np;
|
||||
return np;
|
||||
}
|
||||
|
||||
|
||||
/* given the presetting of brd_id, set the corresponding hdw_id */
|
||||
|
||||
void
|
||||
sbeid_set_hdwbid (ci_t *ci)
|
||||
sbeid_set_hdwbid(ci_t *ci)
|
||||
{
|
||||
/*
|
||||
* set SBE's unique hardware identification (for legacy boards might not
|
||||
* have this register implemented)
|
||||
*/
|
||||
/*
|
||||
* set SBE's unique hardware identification (for legacy boards might not
|
||||
* have this register implemented)
|
||||
*/
|
||||
|
||||
switch (ci->brd_id)
|
||||
{
|
||||
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1):
|
||||
ci->hdw_bid = SBE_BID_256T3_E1; /* 0x46 - SBE wanPTMC-256T3 (E1
|
||||
* Version) */
|
||||
break;
|
||||
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1):
|
||||
ci->hdw_bid = SBE_BID_256T3_T1; /* 0x42 - SBE wanPTMC-256T3 (T1
|
||||
* Version) */
|
||||
break;
|
||||
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1):
|
||||
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1_L):
|
||||
/*
|
||||
* This Board ID is a generic identification. Use the found number
|
||||
* of ports to further define this hardware.
|
||||
*/
|
||||
switch (ci->max_port)
|
||||
{
|
||||
default: /* shouldn't need a default, but have one
|
||||
* anyway */
|
||||
case 4:
|
||||
ci->hdw_bid = SBE_BID_PMC_C4T1E1; /* 0xC4 - SBE wanPMC-C4T1E1 */
|
||||
break;
|
||||
case 2:
|
||||
ci->hdw_bid = SBE_BID_PMC_C2T1E1; /* 0xC2 - SBE wanPMC-C2T1E1 */
|
||||
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1);
|
||||
break;
|
||||
case 1:
|
||||
ci->hdw_bid = SBE_BID_PMC_C1T1E1; /* 0xC1 - SBE wanPMC-C1T1E1 */
|
||||
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1):
|
||||
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1_L):
|
||||
ci->hdw_bid = SBE_BID_PMC_C2T1E1; /* 0xC2 - SBE wanPMC-C2T1E1 */
|
||||
break;
|
||||
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1):
|
||||
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1_L):
|
||||
ci->hdw_bid = SBE_BID_PMC_C1T1E1; /* 0xC1 - SBE wanPMC-C1T1E1 */
|
||||
break;
|
||||
switch (ci->brd_id) {
|
||||
case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1):
|
||||
ci->hdw_bid = SBE_BID_256T3_E1; /* 0x46 - SBE wanPTMC-256T3 (E1
|
||||
* Version) */
|
||||
break;
|
||||
case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1):
|
||||
ci->hdw_bid = SBE_BID_256T3_T1; /* 0x42 - SBE wanPTMC-256T3 (T1
|
||||
* Version) */
|
||||
break;
|
||||
case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1):
|
||||
case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1_L):
|
||||
/*
|
||||
* This Board ID is a generic identification. Use the found number
|
||||
* of ports to further define this hardware.
|
||||
*/
|
||||
switch (ci->max_port) {
|
||||
default: /* shouldn't need a default, but have one
|
||||
* anyway */
|
||||
case 4:
|
||||
ci->hdw_bid = SBE_BID_PMC_C4T1E1; /* 0xC4 - SBE wanPMC-C4T1E1 */
|
||||
break;
|
||||
case 2:
|
||||
ci->hdw_bid = SBE_BID_PMC_C2T1E1; /* 0xC2 - SBE wanPMC-C2T1E1 */
|
||||
ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1);
|
||||
break;
|
||||
case 1:
|
||||
ci->hdw_bid = SBE_BID_PMC_C1T1E1; /* 0xC1 - SBE wanPMC-C1T1E1 */
|
||||
ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1):
|
||||
case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1_L):
|
||||
ci->hdw_bid = SBE_BID_PMC_C2T1E1; /* 0xC2 - SBE wanPMC-C2T1E1 */
|
||||
break;
|
||||
case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1):
|
||||
case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1_L):
|
||||
ci->hdw_bid = SBE_BID_PMC_C1T1E1; /* 0xC1 - SBE wanPMC-C1T1E1 */
|
||||
break;
|
||||
#ifdef SBE_PMCC4_ENABLE
|
||||
/*
|
||||
* This case is entered as a result of the inability to obtain the
|
||||
* <bid> from the board's EEPROM. Assume a PCI board and set
|
||||
* <hdsbid> according to the number ofr found ports.
|
||||
*/
|
||||
case 0:
|
||||
/* start by assuming 4-port for ZERO casing */
|
||||
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1);
|
||||
/* drop thru to set hdw_bid and alternate PCI CxT1E1 settings */
|
||||
/*
|
||||
* This case is entered as a result of the inability to obtain the
|
||||
* <bid> from the board's EEPROM. Assume a PCI board and set
|
||||
* <hdsbid> according to the number ofr found ports.
|
||||
*/
|
||||
case 0:
|
||||
/* start by assuming 4-port for ZERO casing */
|
||||
ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1);
|
||||
/* drop thru to set hdw_bid and alternate PCI CxT1E1 settings */
|
||||
#endif
|
||||
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1):
|
||||
/*
|
||||
* This Board ID is a generic identification. Use the number of
|
||||
* found ports to further define this hardware.
|
||||
*/
|
||||
switch (ci->max_port)
|
||||
{
|
||||
default: /* shouldn't need a default, but have one
|
||||
* anyway */
|
||||
case 4:
|
||||
ci->hdw_bid = SBE_BID_PCI_C4T1E1; /* 0x04 - SBE wanPCI-C4T1E1 */
|
||||
break;
|
||||
case 2:
|
||||
ci->hdw_bid = SBE_BID_PCI_C2T1E1; /* 0x02 - SBE wanPCI-C2T1E1 */
|
||||
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1);
|
||||
break;
|
||||
case 1:
|
||||
ci->hdw_bid = SBE_BID_PCI_C1T1E1; /* 0x01 - SBE wanPCI-C1T1E1 */
|
||||
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1):
|
||||
ci->hdw_bid = SBE_BID_PCI_C2T1E1; /* 0x02 - SBE wanPCI-C2T1E1 */
|
||||
break;
|
||||
case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1):
|
||||
ci->hdw_bid = SBE_BID_PCI_C1T1E1; /* 0x01 - SBE wanPCI-C1T1E1 */
|
||||
break;
|
||||
default:
|
||||
/*** bid = "<unknown>"; ***/
|
||||
ci->hdw_bid = SBE_BID_PMC_C4T1E1; /* 0x41 - SBE wanPTMC-C4T1E1 */
|
||||
break;
|
||||
}
|
||||
case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1):
|
||||
/*
|
||||
* This Board ID is a generic identification. Use the number of
|
||||
* found ports to further define this hardware.
|
||||
*/
|
||||
switch (ci->max_port) {
|
||||
default: /* shouldn't need a default, but have one
|
||||
* anyway */
|
||||
case 4:
|
||||
ci->hdw_bid = SBE_BID_PCI_C4T1E1; /* 0x04 - SBE wanPCI-C4T1E1 */
|
||||
break;
|
||||
case 2:
|
||||
ci->hdw_bid = SBE_BID_PCI_C2T1E1; /* 0x02 - SBE wanPCI-C2T1E1 */
|
||||
ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1);
|
||||
break;
|
||||
case 1:
|
||||
ci->hdw_bid = SBE_BID_PCI_C1T1E1; /* 0x01 - SBE wanPCI-C1T1E1 */
|
||||
ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1):
|
||||
ci->hdw_bid = SBE_BID_PCI_C2T1E1; /* 0x02 - SBE wanPCI-C2T1E1 */
|
||||
break;
|
||||
case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1):
|
||||
ci->hdw_bid = SBE_BID_PCI_C1T1E1; /* 0x01 - SBE wanPCI-C1T1E1 */
|
||||
break;
|
||||
default:
|
||||
/*** bid = "<unknown>"; ***/
|
||||
ci->hdw_bid = SBE_BID_PMC_C4T1E1; /* 0x41 - SBE wanPTMC-C4T1E1 */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* given the presetting of hdw_bid, set the corresponding brd_id */
|
||||
|
||||
void
|
||||
sbeid_set_bdtype (ci_t *ci)
|
||||
sbeid_set_bdtype(ci_t *ci)
|
||||
{
|
||||
/* set SBE's unique PCI VENDOR/DEVID */
|
||||
switch (ci->hdw_bid)
|
||||
{
|
||||
case SBE_BID_C1T3: /* SBE wanPMC-C1T3 */
|
||||
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T3);
|
||||
break;
|
||||
case SBE_BID_C24TE1: /* SBE wanPTMC-C24TE1 */
|
||||
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_C24TE1);
|
||||
break;
|
||||
case SBE_BID_256T3_E1: /* SBE wanPTMC-256T3 E1 Version */
|
||||
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1);
|
||||
break;
|
||||
case SBE_BID_256T3_T1: /* SBE wanPTMC-256T3 T1 Version */
|
||||
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1);
|
||||
break;
|
||||
case SBE_BID_PMC_C4T1E1: /* 0xC4 - SBE wanPMC-C4T1E1 */
|
||||
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1);
|
||||
break;
|
||||
case SBE_BID_PMC_C2T1E1: /* 0xC2 - SBE wanPMC-C2T1E1 */
|
||||
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1);
|
||||
break;
|
||||
case SBE_BID_PMC_C1T1E1: /* 0xC1 - SBE wanPMC-C1T1E1 */
|
||||
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1);
|
||||
break;
|
||||
case SBE_BID_PCI_C4T1E1: /* 0x04 - SBE wanPCI-C4T1E1 */
|
||||
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1);
|
||||
break;
|
||||
case SBE_BID_PCI_C2T1E1: /* 0x02 - SBE wanPCI-C2T1E1 */
|
||||
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1);
|
||||
break;
|
||||
case SBE_BID_PCI_C1T1E1: /* 0x01 - SBE wanPCI-C1T1E1 */
|
||||
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1);
|
||||
break;
|
||||
/* set SBE's unique PCI VENDOR/DEVID */
|
||||
switch (ci->hdw_bid) {
|
||||
case SBE_BID_C1T3: /* SBE wanPMC-C1T3 */
|
||||
ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T3);
|
||||
break;
|
||||
case SBE_BID_C24TE1: /* SBE wanPTMC-C24TE1 */
|
||||
ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_C24TE1);
|
||||
break;
|
||||
case SBE_BID_256T3_E1: /* SBE wanPTMC-256T3 E1 Version */
|
||||
ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1);
|
||||
break;
|
||||
case SBE_BID_256T3_T1: /* SBE wanPTMC-256T3 T1 Version */
|
||||
ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1);
|
||||
break;
|
||||
case SBE_BID_PMC_C4T1E1: /* 0xC4 - SBE wanPMC-C4T1E1 */
|
||||
ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1);
|
||||
break;
|
||||
case SBE_BID_PMC_C2T1E1: /* 0xC2 - SBE wanPMC-C2T1E1 */
|
||||
ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1);
|
||||
break;
|
||||
case SBE_BID_PMC_C1T1E1: /* 0xC1 - SBE wanPMC-C1T1E1 */
|
||||
ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1);
|
||||
break;
|
||||
case SBE_BID_PCI_C4T1E1: /* 0x04 - SBE wanPCI-C4T1E1 */
|
||||
ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1);
|
||||
break;
|
||||
case SBE_BID_PCI_C2T1E1: /* 0x02 - SBE wanPCI-C2T1E1 */
|
||||
ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1);
|
||||
break;
|
||||
case SBE_BID_PCI_C1T1E1: /* 0x01 - SBE wanPCI-C1T1E1 */
|
||||
ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1);
|
||||
break;
|
||||
|
||||
default:
|
||||
/*** hdw_bid = "<unknown>"; ***/
|
||||
ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
/*** hdw_bid = "<unknown>"; ***/
|
||||
ci->brd_id = SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2232,6 +2232,177 @@ static ssize_t dgrp_net_read(struct file *file, char __user *buf, size_t count,
|
|||
return rtn;
|
||||
}
|
||||
|
||||
/*
|
||||
* Common Packet Handling code
|
||||
*/
|
||||
|
||||
static void handle_data_in_packet(struct nd_struct *nd, struct ch_struct *ch,
|
||||
long dlen, long plen, int n1, u8 *dbuf)
|
||||
{
|
||||
char *error;
|
||||
long n;
|
||||
long remain;
|
||||
u8 *buf;
|
||||
u8 *b;
|
||||
|
||||
remain = nd->nd_remain;
|
||||
nd->nd_tx_work = 1;
|
||||
|
||||
/*
|
||||
* Otherwise data should appear only when we are
|
||||
* in the CS_READY state.
|
||||
*/
|
||||
|
||||
if (ch->ch_state < CS_READY) {
|
||||
error = "Data received before RWIN established";
|
||||
nd->nd_remain = 0;
|
||||
nd->nd_state = NS_SEND_ERROR;
|
||||
nd->nd_error = error;
|
||||
}
|
||||
|
||||
/*
|
||||
* Assure that the data received is within the
|
||||
* allowable window.
|
||||
*/
|
||||
|
||||
n = (ch->ch_s_rwin - ch->ch_s_rin) & 0xffff;
|
||||
|
||||
if (dlen > n) {
|
||||
error = "Receive data overrun";
|
||||
nd->nd_remain = 0;
|
||||
nd->nd_state = NS_SEND_ERROR;
|
||||
nd->nd_error = error;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we received 3 or less characters,
|
||||
* assume it is a human typing, and set RTIME
|
||||
* to 10 milliseconds.
|
||||
*
|
||||
* If we receive 10 or more characters,
|
||||
* assume its not a human typing, and set RTIME
|
||||
* to 100 milliseconds.
|
||||
*/
|
||||
|
||||
if (ch->ch_edelay != DGRP_RTIME) {
|
||||
if (ch->ch_rtime != ch->ch_edelay) {
|
||||
ch->ch_rtime = ch->ch_edelay;
|
||||
ch->ch_flag |= CH_PARAM;
|
||||
}
|
||||
} else if (dlen <= 3) {
|
||||
if (ch->ch_rtime != 10) {
|
||||
ch->ch_rtime = 10;
|
||||
ch->ch_flag |= CH_PARAM;
|
||||
}
|
||||
} else {
|
||||
if (ch->ch_rtime != DGRP_RTIME) {
|
||||
ch->ch_rtime = DGRP_RTIME;
|
||||
ch->ch_flag |= CH_PARAM;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If a portion of the packet is outside the
|
||||
* buffer, shorten the effective length of the
|
||||
* data packet to be the amount of data received.
|
||||
*/
|
||||
|
||||
if (remain < plen)
|
||||
dlen -= plen - remain;
|
||||
|
||||
/*
|
||||
* Detect if receive flush is now complete.
|
||||
*/
|
||||
|
||||
if ((ch->ch_flag & CH_RX_FLUSH) != 0 &&
|
||||
((ch->ch_flush_seq - nd->nd_seq_out) & SEQ_MASK) >=
|
||||
((nd->nd_seq_in - nd->nd_seq_out) & SEQ_MASK)) {
|
||||
ch->ch_flag &= ~CH_RX_FLUSH;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we are ready to receive, move the data into
|
||||
* the receive buffer.
|
||||
*/
|
||||
|
||||
ch->ch_s_rin = (ch->ch_s_rin + dlen) & 0xffff;
|
||||
|
||||
if (ch->ch_state == CS_READY &&
|
||||
(ch->ch_tun.un_open_count != 0) &&
|
||||
(ch->ch_tun.un_flag & UN_CLOSING) == 0 &&
|
||||
(ch->ch_cflag & CF_CREAD) != 0 &&
|
||||
(ch->ch_flag & (CH_BAUD0 | CH_RX_FLUSH)) == 0 &&
|
||||
(ch->ch_send & RR_RX_FLUSH) == 0) {
|
||||
|
||||
if (ch->ch_rin + dlen >= RBUF_MAX) {
|
||||
n = RBUF_MAX - ch->ch_rin;
|
||||
|
||||
memcpy(ch->ch_rbuf + ch->ch_rin, dbuf, n);
|
||||
|
||||
ch->ch_rin = 0;
|
||||
dbuf += n;
|
||||
dlen -= n;
|
||||
}
|
||||
|
||||
memcpy(ch->ch_rbuf + ch->ch_rin, dbuf, dlen);
|
||||
|
||||
ch->ch_rin += dlen;
|
||||
|
||||
|
||||
/*
|
||||
* If we are not in fastcook mode, or
|
||||
* if there is a fastcook thread
|
||||
* waiting for data, send the data to
|
||||
* the line discipline.
|
||||
*/
|
||||
|
||||
if ((ch->ch_flag & CH_FAST_READ) == 0 ||
|
||||
ch->ch_inwait != 0) {
|
||||
dgrp_input(ch);
|
||||
}
|
||||
|
||||
/*
|
||||
* If there is a read thread waiting
|
||||
* in select, and we are in fastcook
|
||||
* mode, wake him up.
|
||||
*/
|
||||
|
||||
if (waitqueue_active(&ch->ch_tun.un_tty->read_wait) &&
|
||||
(ch->ch_flag & CH_FAST_READ) != 0)
|
||||
wake_up_interruptible(&ch->ch_tun.un_tty->read_wait);
|
||||
|
||||
/*
|
||||
* Wake any thread waiting in the
|
||||
* fastcook loop.
|
||||
*/
|
||||
|
||||
if ((ch->ch_flag & CH_INPUT) != 0) {
|
||||
ch->ch_flag &= ~CH_INPUT;
|
||||
wake_up_interruptible(&ch->ch_flag_wait);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Fabricate and insert a data packet header to
|
||||
* preced the remaining data when it comes in.
|
||||
*/
|
||||
|
||||
if (remain < plen) {
|
||||
dlen = plen - remain;
|
||||
b = buf;
|
||||
|
||||
b[0] = 0x90 + n1;
|
||||
put_unaligned_be16(dlen, b + 1);
|
||||
|
||||
remain = 3;
|
||||
if (remain > 0 && b != buf)
|
||||
memcpy(buf, b, remain);
|
||||
|
||||
nd->nd_remain = remain;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* dgrp_receive() -- decode data packets received from the remote PortServer.
|
||||
* @nd: pointer to a node structure
|
||||
|
@ -2306,7 +2477,8 @@ static void dgrp_receive(struct nd_struct *nd)
|
|||
plen = dlen + 1;
|
||||
|
||||
dbuf = b + 1;
|
||||
goto data;
|
||||
handle_data_in_packet(nd, ch, dlen, plen, n1, dbuf);
|
||||
break;
|
||||
|
||||
/*
|
||||
* Process 2-byte header data packet.
|
||||
|
@ -2320,7 +2492,8 @@ static void dgrp_receive(struct nd_struct *nd)
|
|||
plen = dlen + 2;
|
||||
|
||||
dbuf = b + 2;
|
||||
goto data;
|
||||
handle_data_in_packet(nd, ch, dlen, plen, n1, dbuf);
|
||||
break;
|
||||
|
||||
/*
|
||||
* Process 3-byte header data packet.
|
||||
|
@ -2335,159 +2508,6 @@ static void dgrp_receive(struct nd_struct *nd)
|
|||
|
||||
dbuf = b + 3;
|
||||
|
||||
/*
|
||||
* Common packet handling code.
|
||||
*/
|
||||
|
||||
data:
|
||||
nd->nd_tx_work = 1;
|
||||
|
||||
/*
|
||||
* Otherwise data should appear only when we are
|
||||
* in the CS_READY state.
|
||||
*/
|
||||
|
||||
if (ch->ch_state < CS_READY) {
|
||||
error = "Data received before RWIN established";
|
||||
goto prot_error;
|
||||
}
|
||||
|
||||
/*
|
||||
* Assure that the data received is within the
|
||||
* allowable window.
|
||||
*/
|
||||
|
||||
n = (ch->ch_s_rwin - ch->ch_s_rin) & 0xffff;
|
||||
|
||||
if (dlen > n) {
|
||||
error = "Receive data overrun";
|
||||
goto prot_error;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we received 3 or less characters,
|
||||
* assume it is a human typing, and set RTIME
|
||||
* to 10 milliseconds.
|
||||
*
|
||||
* If we receive 10 or more characters,
|
||||
* assume its not a human typing, and set RTIME
|
||||
* to 100 milliseconds.
|
||||
*/
|
||||
|
||||
if (ch->ch_edelay != DGRP_RTIME) {
|
||||
if (ch->ch_rtime != ch->ch_edelay) {
|
||||
ch->ch_rtime = ch->ch_edelay;
|
||||
ch->ch_flag |= CH_PARAM;
|
||||
}
|
||||
} else if (dlen <= 3) {
|
||||
if (ch->ch_rtime != 10) {
|
||||
ch->ch_rtime = 10;
|
||||
ch->ch_flag |= CH_PARAM;
|
||||
}
|
||||
} else {
|
||||
if (ch->ch_rtime != DGRP_RTIME) {
|
||||
ch->ch_rtime = DGRP_RTIME;
|
||||
ch->ch_flag |= CH_PARAM;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If a portion of the packet is outside the
|
||||
* buffer, shorten the effective length of the
|
||||
* data packet to be the amount of data received.
|
||||
*/
|
||||
|
||||
if (remain < plen)
|
||||
dlen -= plen - remain;
|
||||
|
||||
/*
|
||||
* Detect if receive flush is now complete.
|
||||
*/
|
||||
|
||||
if ((ch->ch_flag & CH_RX_FLUSH) != 0 &&
|
||||
((ch->ch_flush_seq - nd->nd_seq_out) & SEQ_MASK) >=
|
||||
((nd->nd_seq_in - nd->nd_seq_out) & SEQ_MASK)) {
|
||||
ch->ch_flag &= ~CH_RX_FLUSH;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we are ready to receive, move the data into
|
||||
* the receive buffer.
|
||||
*/
|
||||
|
||||
ch->ch_s_rin = (ch->ch_s_rin + dlen) & 0xffff;
|
||||
|
||||
if (ch->ch_state == CS_READY &&
|
||||
(ch->ch_tun.un_open_count != 0) &&
|
||||
(ch->ch_tun.un_flag & UN_CLOSING) == 0 &&
|
||||
(ch->ch_cflag & CF_CREAD) != 0 &&
|
||||
(ch->ch_flag & (CH_BAUD0 | CH_RX_FLUSH)) == 0 &&
|
||||
(ch->ch_send & RR_RX_FLUSH) == 0) {
|
||||
|
||||
if (ch->ch_rin + dlen >= RBUF_MAX) {
|
||||
n = RBUF_MAX - ch->ch_rin;
|
||||
|
||||
memcpy(ch->ch_rbuf + ch->ch_rin, dbuf, n);
|
||||
|
||||
ch->ch_rin = 0;
|
||||
dbuf += n;
|
||||
dlen -= n;
|
||||
}
|
||||
|
||||
memcpy(ch->ch_rbuf + ch->ch_rin, dbuf, dlen);
|
||||
|
||||
ch->ch_rin += dlen;
|
||||
|
||||
|
||||
/*
|
||||
* If we are not in fastcook mode, or
|
||||
* if there is a fastcook thread
|
||||
* waiting for data, send the data to
|
||||
* the line discipline.
|
||||
*/
|
||||
|
||||
if ((ch->ch_flag & CH_FAST_READ) == 0 ||
|
||||
ch->ch_inwait != 0) {
|
||||
dgrp_input(ch);
|
||||
}
|
||||
|
||||
/*
|
||||
* If there is a read thread waiting
|
||||
* in select, and we are in fastcook
|
||||
* mode, wake him up.
|
||||
*/
|
||||
|
||||
if (waitqueue_active(&ch->ch_tun.un_tty->read_wait) &&
|
||||
(ch->ch_flag & CH_FAST_READ) != 0)
|
||||
wake_up_interruptible(&ch->ch_tun.un_tty->read_wait);
|
||||
|
||||
/*
|
||||
* Wake any thread waiting in the
|
||||
* fastcook loop.
|
||||
*/
|
||||
|
||||
if ((ch->ch_flag & CH_INPUT) != 0) {
|
||||
ch->ch_flag &= ~CH_INPUT;
|
||||
|
||||
wake_up_interruptible(&ch->ch_flag_wait);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Fabricate and insert a data packet header to
|
||||
* preced the remaining data when it comes in.
|
||||
*/
|
||||
|
||||
if (remain < plen) {
|
||||
dlen = plen - remain;
|
||||
b = buf;
|
||||
|
||||
b[0] = 0x90 + n1;
|
||||
put_unaligned_be16(dlen, b + 1);
|
||||
|
||||
remain = 3;
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
|
||||
/*
|
||||
|
|
|
@ -344,25 +344,17 @@ void dwc2_hcd_init_usecs(struct dwc2_hsotg *hsotg)
|
|||
static int dwc2_find_single_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
|
||||
{
|
||||
unsigned short utime = qh->usecs;
|
||||
int done = 0;
|
||||
int i = 0;
|
||||
int ret = -1;
|
||||
int i;
|
||||
|
||||
while (!done) {
|
||||
for (i = 0; i < 8; i++) {
|
||||
/* At the start hsotg->frame_usecs[i] = max_uframe_usecs[i] */
|
||||
if (utime <= hsotg->frame_usecs[i]) {
|
||||
hsotg->frame_usecs[i] -= utime;
|
||||
qh->frame_usecs[i] += utime;
|
||||
ret = i;
|
||||
done = 1;
|
||||
} else {
|
||||
i++;
|
||||
if (i == 8)
|
||||
done = 1;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -372,21 +364,14 @@ static int dwc2_find_multi_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
|
|||
{
|
||||
unsigned short utime = qh->usecs;
|
||||
unsigned short xtime;
|
||||
int t_left = utime;
|
||||
int done = 0;
|
||||
int i = 0;
|
||||
int t_left;
|
||||
int i;
|
||||
int j;
|
||||
int ret = -1;
|
||||
int k;
|
||||
|
||||
while (!done) {
|
||||
if (hsotg->frame_usecs[i] <= 0) {
|
||||
i++;
|
||||
if (i == 8) {
|
||||
ret = -1;
|
||||
done = 1;
|
||||
}
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (hsotg->frame_usecs[i] <= 0)
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* we need n consecutive slots so use j as a start slot
|
||||
|
@ -400,50 +385,35 @@ static int dwc2_find_multi_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
|
|||
*/
|
||||
if (xtime + hsotg->frame_usecs[j] < utime) {
|
||||
if (hsotg->frame_usecs[j] <
|
||||
max_uframe_usecs[j]) {
|
||||
ret = -1;
|
||||
break;
|
||||
}
|
||||
max_uframe_usecs[j])
|
||||
continue;
|
||||
}
|
||||
if (xtime >= utime) {
|
||||
ret = i;
|
||||
break;
|
||||
t_left = utime;
|
||||
for (k = i; k < 8; k++) {
|
||||
t_left -= hsotg->frame_usecs[k];
|
||||
if (t_left <= 0) {
|
||||
qh->frame_usecs[k] +=
|
||||
hsotg->frame_usecs[k]
|
||||
+ t_left;
|
||||
hsotg->frame_usecs[k] = -t_left;
|
||||
return i;
|
||||
} else {
|
||||
qh->frame_usecs[k] +=
|
||||
hsotg->frame_usecs[k];
|
||||
hsotg->frame_usecs[k] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* add the frame time to x time */
|
||||
xtime += hsotg->frame_usecs[j];
|
||||
/* we must have a fully available next frame or break */
|
||||
if (xtime < utime &&
|
||||
hsotg->frame_usecs[j] == max_uframe_usecs[j]) {
|
||||
ret = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ret >= 0) {
|
||||
t_left = utime;
|
||||
for (j = i; t_left > 0 && j < 8; j++) {
|
||||
t_left -= hsotg->frame_usecs[j];
|
||||
if (t_left <= 0) {
|
||||
qh->frame_usecs[j] +=
|
||||
hsotg->frame_usecs[j] + t_left;
|
||||
hsotg->frame_usecs[j] = -t_left;
|
||||
ret = i;
|
||||
done = 1;
|
||||
} else {
|
||||
qh->frame_usecs[j] +=
|
||||
hsotg->frame_usecs[j];
|
||||
hsotg->frame_usecs[j] = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
i++;
|
||||
if (i == 8) {
|
||||
ret = -1;
|
||||
done = 1;
|
||||
}
|
||||
hsotg->frame_usecs[j] == max_uframe_usecs[j])
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int dwc2_find_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
|
||||
|
|
|
@ -135,7 +135,7 @@ MODULE_DEVICE_TABLE(of, dwc2_of_match_table);
|
|||
|
||||
static struct platform_driver dwc2_platform_driver = {
|
||||
.driver = {
|
||||
.name = (char *)dwc2_driver_name,
|
||||
.name = dwc2_driver_name,
|
||||
.of_match_table = dwc2_of_match_table,
|
||||
},
|
||||
.probe = dwc2_driver_probe,
|
||||
|
|
|
@ -27,132 +27,132 @@
|
|||
#define _BOOTH_
|
||||
|
||||
// Official bootloader
|
||||
static unsigned char bootimage [] = {
|
||||
0x00,0x00,0x01,0x5E,0x00,0x00
|
||||
,0x00,0x00,0x00,0x00,0x02,0xD7
|
||||
,0x00,0x00,0x01,0x5E,0x46,0xB3
|
||||
,0xE6,0x02,0x00,0x98,0xE6,0x8C
|
||||
,0x00,0x98,0xFB,0x92,0xFF,0xFF
|
||||
,0x98,0xFB,0x94,0xFF,0xFF,0x98
|
||||
,0xFB,0x06,0x08,0x00,0x98,0xFB
|
||||
,0x96,0x84,0x00,0x98,0xFB,0x08
|
||||
,0x1C,0x00,0x98,0xFB,0x51,0x25
|
||||
,0x10,0x1C,0x00,0xE6,0x51,0x01
|
||||
,0x07,0xFD,0x4C,0xFF,0x20,0xF5
|
||||
,0x51,0x02,0x20,0x08,0x00,0x4C
|
||||
,0xFF,0x20,0x3C,0x00,0xC0,0x64
|
||||
,0x98,0xC0,0x66,0x98,0xC0,0x68
|
||||
,0x98,0xC0,0x6A,0x98,0xC0,0x6C
|
||||
,0x98,0x90,0x08,0x90,0x09,0x90
|
||||
,0x0A,0x90,0x0B,0x90,0x0C,0x90
|
||||
,0x0D,0x90,0x0E,0x90,0x0F,0x90
|
||||
,0x04,0x90,0x06,0xFB,0x51,0x22
|
||||
,0x16,0x08,0x03,0xFB,0x51,0x52
|
||||
,0x16,0x08,0x04,0xFB,0x51,0x24
|
||||
,0x2B,0x08,0x06,0xFB,0x51,0x54
|
||||
,0x2B,0x08,0x07,0xFB,0x51,0x24
|
||||
,0x2B,0x08,0x09,0xFB,0x51,0x54
|
||||
,0x2B,0x08,0x0A,0xFB,0x51,0x12
|
||||
,0x16,0x08,0x0C,0xFB,0x51,0x52
|
||||
,0x16,0x08,0x0D,0x78,0x00,0x00
|
||||
,0x00,0x16,0x00,0x00,0xEC,0x31
|
||||
,0xAE,0x00,0x00,0x81,0x4C,0x0F
|
||||
,0xE6,0x43,0xFF,0xEC,0x31,0x4E
|
||||
,0x00,0x00,0x91,0xEC,0x31,0xAE
|
||||
,0x00,0x00,0x91,0x4C,0x0F,0xE6
|
||||
,0x43,0xFF,0xEC,0x31,0x5E,0x00
|
||||
,0x00,0xA1,0xEB,0x31,0x08,0x00
|
||||
,0x00,0xA6,0xEB,0x31,0x08,0x00
|
||||
,0x00,0xAC,0x3C,0x00,0xEB,0x31
|
||||
,0x08,0x00,0x00,0xA8,0x76,0xFE
|
||||
,0xFE,0x08,0xEB,0x31,0x08,0x20
|
||||
,0x00,0x00,0x76,0xFF,0xFF,0x18
|
||||
,0xED,0x31,0x08,0x20,0x00,0x00
|
||||
,0x26,0x10,0x04,0x10,0xF5,0x3C
|
||||
,0x01,0x3C,0x00,0x08,0x01,0x12
|
||||
,0x3C,0x11,0x3C,0x00,0x08,0x01
|
||||
,0x0B,0x08,0x00,0x6D,0xEC,0x31
|
||||
,0xAE,0x20,0x00,0x06,0xED,0x4D
|
||||
,0x08,0x00,0x00,0x67,0x80,0x6F
|
||||
,0x00,0x01,0x0B,0x6F,0x00,0x02
|
||||
,0x2E,0x76,0xEE,0x01,0x48,0x06
|
||||
,0x01,0x39,0xED,0x4D,0x18,0x00
|
||||
,0x02,0xED,0x4D,0x08,0x00,0x04
|
||||
,0x14,0x06,0xA4,0xED,0x31,0x22
|
||||
,0x00,0x00,0xAC,0x76,0xEE,0x07
|
||||
,0x48,0x6D,0x22,0x01,0x1E,0x08
|
||||
,0x01,0x58,0xEB,0x31,0x08,0x00
|
||||
,0x00,0xAC,0x06,0xFF,0xBA,0x3C
|
||||
,0x00,0xEB,0x31,0x08,0x20,0x00
|
||||
,0x04,0x3C,0x30,0xEB,0x31,0x08
|
||||
,0x20,0x00,0x02,0x3C,0x10,0xEB
|
||||
,0x31,0x08,0x20,0x00,0x00,0xED
|
||||
,0x31,0x08,0x20,0x00,0x00,0x04
|
||||
,0x10,0xF7,0xED,0x31,0x08,0x00
|
||||
,0x00,0xA2,0x91,0x00,0x9C,0x3C
|
||||
,0x80,0xEB,0x31,0x08,0x20,0x00
|
||||
,0x04,0x3C,0x20,0xEB,0x31,0x08
|
||||
,0x20,0x00,0x02,0x3C,0x10,0xEB
|
||||
,0x31,0x08,0x20,0x00,0x00,0xED
|
||||
,0x31,0x08,0x20,0x00,0x00,0x04
|
||||
,0x10,0xF7,0xED,0x31,0x08,0x20
|
||||
,0x00,0x04,0x42,0x10,0x90,0x08
|
||||
,0xEC,0x31,0xAE,0x20,0x00,0x06
|
||||
,0xA4,0x41,0x08,0x00,0xB6,0xED
|
||||
,0x41,0x28,0x7D,0xFF,0xFF,0x22
|
||||
,0xB3,0x40,0x98,0x2A,0x32,0xEB
|
||||
,0x41,0x28,0xB4,0x43,0xFC,0x05
|
||||
,0xFF,0xE6,0xA0,0x31,0x20,0x00
|
||||
,0x06,0xEB,0x31,0x08,0x20,0x00
|
||||
,0x04,0x3C,0x20,0xEB,0x31,0x08
|
||||
,0x20,0x00,0x02,0x3C,0x10,0xEB
|
||||
,0x31,0x08,0x20,0x00,0x00,0xED
|
||||
,0x31,0x08,0x20,0x00,0x00,0x04
|
||||
,0x10,0xF7,0xED,0x31,0x08,0x20
|
||||
,0x00,0x04,0x42,0x10,0x90,0x08
|
||||
,0xEC,0x31,0xAE,0x20,0x00,0x06
|
||||
,0xA4,0x41,0x08,0x00,0x68,0xED
|
||||
,0x41,0x28,0x7D,0xFF,0xFF,0x22
|
||||
,0xB3,0x40,0x98,0x2A,0x32,0xEB
|
||||
,0x41,0x28,0xB4,0x43,0xFC,0x05
|
||||
,0xFF,0xE6,0x48,0x04,0xEB,0x31
|
||||
,0x08,0x20,0x00,0x04,0xEB,0x31
|
||||
,0x18,0x20,0x00,0x02,0x3C,0x11
|
||||
,0xEB,0x31,0x18,0x20,0x00,0x00
|
||||
,0xED,0x31,0x08,0x20,0x00,0x00
|
||||
,0x04,0x10,0xF7,0xED,0x31,0x08
|
||||
,0x20,0x00,0x02,0x66,0x00,0x6F
|
||||
,0x00,0x01,0x16,0x76,0xEE,0x06
|
||||
,0x48,0x4A,0x1E,0x48,0x04,0xED
|
||||
,0x31,0x08,0x20,0x00,0x04,0xEB
|
||||
,0x31,0x08,0x00,0x00,0xA4,0x48
|
||||
,0x04,0xED,0x31,0x08,0x20,0x00
|
||||
,0x04,0xEB,0x31,0x08,0x00,0x00
|
||||
,0xA2,0x48,0x04,0x20,0x20,0x4A
|
||||
,0x7C,0x46,0x82,0x50,0x05,0x50
|
||||
,0x15,0xB5,0x1E,0x98,0xED,0x31
|
||||
,0x08,0x00,0x00,0xA8,0x10,0x47
|
||||
,0x3B,0x2C,0x01,0xDB,0x40,0x11
|
||||
,0x98,0xC1,0x1E,0x98,0x10,0x07
|
||||
,0x30,0xF9,0x40,0x07,0x18,0x98
|
||||
,0x2A,0x10,0xEB,0x31,0x08,0x00
|
||||
,0x00,0xA8,0xA4,0x1E,0x98,0xBB
|
||||
,0x1E,0x98,0x50,0x14,0x50,0x04
|
||||
,0x46,0x83,0x48,0x04,0x02,0x01
|
||||
,0x00,0x50,0x05,0x50,0x15,0x10
|
||||
,0x87,0x3F,0x90,0x2B,0x18,0x01
|
||||
,0x00,0xC0,0x31,0x00,0x00,0xAE
|
||||
,0xDF,0x41,0x00,0x08,0x00,0x1A
|
||||
,0x42,0x11,0x67,0x01,0xDF,0x41
|
||||
,0x02,0x08,0x00,0x10,0x42,0x11
|
||||
,0x62,0x01,0xB4,0x43,0x4A,0x68
|
||||
,0x50,0x14,0x50,0x04,0x24,0x10
|
||||
,0x48,0x04,0xF2,0x31,0x00,0x01
|
||||
,0x00,0x00,0xAE,0xF6,0x31,0x00
|
||||
,0x01,0x00,0x00,0xAE,0x62,0xE4
|
||||
,0xE5,0x61,0x04,0x48,0x04,0xE5
|
||||
,0x63,0x05,0x48,0x04,0x20,0x20
|
||||
,0x00,0x00,0x00,0x00
|
||||
static unsigned char bootimage[] = {
|
||||
0x00, 0x00, 0x01, 0x5E, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x02, 0xD7,
|
||||
0x00, 0x00, 0x01, 0x5E, 0x46, 0xB3,
|
||||
0xE6, 0x02, 0x00, 0x98, 0xE6, 0x8C,
|
||||
0x00, 0x98, 0xFB, 0x92, 0xFF, 0xFF,
|
||||
0x98, 0xFB, 0x94, 0xFF, 0xFF, 0x98,
|
||||
0xFB, 0x06, 0x08, 0x00, 0x98, 0xFB,
|
||||
0x96, 0x84, 0x00, 0x98, 0xFB, 0x08,
|
||||
0x1C, 0x00, 0x98, 0xFB, 0x51, 0x25,
|
||||
0x10, 0x1C, 0x00, 0xE6, 0x51, 0x01,
|
||||
0x07, 0xFD, 0x4C, 0xFF, 0x20, 0xF5,
|
||||
0x51, 0x02, 0x20, 0x08, 0x00, 0x4C,
|
||||
0xFF, 0x20, 0x3C, 0x00, 0xC0, 0x64,
|
||||
0x98, 0xC0, 0x66, 0x98, 0xC0, 0x68,
|
||||
0x98, 0xC0, 0x6A, 0x98, 0xC0, 0x6C,
|
||||
0x98, 0x90, 0x08, 0x90, 0x09, 0x90,
|
||||
0x0A, 0x90, 0x0B, 0x90, 0x0C, 0x90,
|
||||
0x0D, 0x90, 0x0E, 0x90, 0x0F, 0x90,
|
||||
0x04, 0x90, 0x06, 0xFB, 0x51, 0x22,
|
||||
0x16, 0x08, 0x03, 0xFB, 0x51, 0x52,
|
||||
0x16, 0x08, 0x04, 0xFB, 0x51, 0x24,
|
||||
0x2B, 0x08, 0x06, 0xFB, 0x51, 0x54,
|
||||
0x2B, 0x08, 0x07, 0xFB, 0x51, 0x24,
|
||||
0x2B, 0x08, 0x09, 0xFB, 0x51, 0x54,
|
||||
0x2B, 0x08, 0x0A, 0xFB, 0x51, 0x12,
|
||||
0x16, 0x08, 0x0C, 0xFB, 0x51, 0x52,
|
||||
0x16, 0x08, 0x0D, 0x78, 0x00, 0x00,
|
||||
0x00, 0x16, 0x00, 0x00, 0xEC, 0x31,
|
||||
0xAE, 0x00, 0x00, 0x81, 0x4C, 0x0F,
|
||||
0xE6, 0x43, 0xFF, 0xEC, 0x31, 0x4E,
|
||||
0x00, 0x00, 0x91, 0xEC, 0x31, 0xAE,
|
||||
0x00, 0x00, 0x91, 0x4C, 0x0F, 0xE6,
|
||||
0x43, 0xFF, 0xEC, 0x31, 0x5E, 0x00,
|
||||
0x00, 0xA1, 0xEB, 0x31, 0x08, 0x00,
|
||||
0x00, 0xA6, 0xEB, 0x31, 0x08, 0x00,
|
||||
0x00, 0xAC, 0x3C, 0x00, 0xEB, 0x31,
|
||||
0x08, 0x00, 0x00, 0xA8, 0x76, 0xFE,
|
||||
0xFE, 0x08, 0xEB, 0x31, 0x08, 0x20,
|
||||
0x00, 0x00, 0x76, 0xFF, 0xFF, 0x18,
|
||||
0xED, 0x31, 0x08, 0x20, 0x00, 0x00,
|
||||
0x26, 0x10, 0x04, 0x10, 0xF5, 0x3C,
|
||||
0x01, 0x3C, 0x00, 0x08, 0x01, 0x12,
|
||||
0x3C, 0x11, 0x3C, 0x00, 0x08, 0x01,
|
||||
0x0B, 0x08, 0x00, 0x6D, 0xEC, 0x31,
|
||||
0xAE, 0x20, 0x00, 0x06, 0xED, 0x4D,
|
||||
0x08, 0x00, 0x00, 0x67, 0x80, 0x6F,
|
||||
0x00, 0x01, 0x0B, 0x6F, 0x00, 0x02,
|
||||
0x2E, 0x76, 0xEE, 0x01, 0x48, 0x06,
|
||||
0x01, 0x39, 0xED, 0x4D, 0x18, 0x00,
|
||||
0x02, 0xED, 0x4D, 0x08, 0x00, 0x04,
|
||||
0x14, 0x06, 0xA4, 0xED, 0x31, 0x22,
|
||||
0x00, 0x00, 0xAC, 0x76, 0xEE, 0x07,
|
||||
0x48, 0x6D, 0x22, 0x01, 0x1E, 0x08,
|
||||
0x01, 0x58, 0xEB, 0x31, 0x08, 0x00,
|
||||
0x00, 0xAC, 0x06, 0xFF, 0xBA, 0x3C,
|
||||
0x00, 0xEB, 0x31, 0x08, 0x20, 0x00,
|
||||
0x04, 0x3C, 0x30, 0xEB, 0x31, 0x08,
|
||||
0x20, 0x00, 0x02, 0x3C, 0x10, 0xEB,
|
||||
0x31, 0x08, 0x20, 0x00, 0x00, 0xED,
|
||||
0x31, 0x08, 0x20, 0x00, 0x00, 0x04,
|
||||
0x10, 0xF7, 0xED, 0x31, 0x08, 0x00,
|
||||
0x00, 0xA2, 0x91, 0x00, 0x9C, 0x3C,
|
||||
0x80, 0xEB, 0x31, 0x08, 0x20, 0x00,
|
||||
0x04, 0x3C, 0x20, 0xEB, 0x31, 0x08,
|
||||
0x20, 0x00, 0x02, 0x3C, 0x10, 0xEB,
|
||||
0x31, 0x08, 0x20, 0x00, 0x00, 0xED,
|
||||
0x31, 0x08, 0x20, 0x00, 0x00, 0x04,
|
||||
0x10, 0xF7, 0xED, 0x31, 0x08, 0x20,
|
||||
0x00, 0x04, 0x42, 0x10, 0x90, 0x08,
|
||||
0xEC, 0x31, 0xAE, 0x20, 0x00, 0x06,
|
||||
0xA4, 0x41, 0x08, 0x00, 0xB6, 0xED,
|
||||
0x41, 0x28, 0x7D, 0xFF, 0xFF, 0x22,
|
||||
0xB3, 0x40, 0x98, 0x2A, 0x32, 0xEB,
|
||||
0x41, 0x28, 0xB4, 0x43, 0xFC, 0x05,
|
||||
0xFF, 0xE6, 0xA0, 0x31, 0x20, 0x00,
|
||||
0x06, 0xEB, 0x31, 0x08, 0x20, 0x00,
|
||||
0x04, 0x3C, 0x20, 0xEB, 0x31, 0x08,
|
||||
0x20, 0x00, 0x02, 0x3C, 0x10, 0xEB,
|
||||
0x31, 0x08, 0x20, 0x00, 0x00, 0xED,
|
||||
0x31, 0x08, 0x20, 0x00, 0x00, 0x04,
|
||||
0x10, 0xF7, 0xED, 0x31, 0x08, 0x20,
|
||||
0x00, 0x04, 0x42, 0x10, 0x90, 0x08,
|
||||
0xEC, 0x31, 0xAE, 0x20, 0x00, 0x06,
|
||||
0xA4, 0x41, 0x08, 0x00, 0x68, 0xED,
|
||||
0x41, 0x28, 0x7D, 0xFF, 0xFF, 0x22,
|
||||
0xB3, 0x40, 0x98, 0x2A, 0x32, 0xEB,
|
||||
0x41, 0x28, 0xB4, 0x43, 0xFC, 0x05,
|
||||
0xFF, 0xE6, 0x48, 0x04, 0xEB, 0x31,
|
||||
0x08, 0x20, 0x00, 0x04, 0xEB, 0x31,
|
||||
0x18, 0x20, 0x00, 0x02, 0x3C, 0x11,
|
||||
0xEB, 0x31, 0x18, 0x20, 0x00, 0x00,
|
||||
0xED, 0x31, 0x08, 0x20, 0x00, 0x00,
|
||||
0x04, 0x10, 0xF7, 0xED, 0x31, 0x08,
|
||||
0x20, 0x00, 0x02, 0x66, 0x00, 0x6F,
|
||||
0x00, 0x01, 0x16, 0x76, 0xEE, 0x06,
|
||||
0x48, 0x4A, 0x1E, 0x48, 0x04, 0xED,
|
||||
0x31, 0x08, 0x20, 0x00, 0x04, 0xEB,
|
||||
0x31, 0x08, 0x00, 0x00, 0xA4, 0x48,
|
||||
0x04, 0xED, 0x31, 0x08, 0x20, 0x00,
|
||||
0x04, 0xEB, 0x31, 0x08, 0x00, 0x00,
|
||||
0xA2, 0x48, 0x04, 0x20, 0x20, 0x4A,
|
||||
0x7C, 0x46, 0x82, 0x50, 0x05, 0x50,
|
||||
0x15, 0xB5, 0x1E, 0x98, 0xED, 0x31,
|
||||
0x08, 0x00, 0x00, 0xA8, 0x10, 0x47,
|
||||
0x3B, 0x2C, 0x01, 0xDB, 0x40, 0x11,
|
||||
0x98, 0xC1, 0x1E, 0x98, 0x10, 0x07,
|
||||
0x30, 0xF9, 0x40, 0x07, 0x18, 0x98,
|
||||
0x2A, 0x10, 0xEB, 0x31, 0x08, 0x00,
|
||||
0x00, 0xA8, 0xA4, 0x1E, 0x98, 0xBB,
|
||||
0x1E, 0x98, 0x50, 0x14, 0x50, 0x04,
|
||||
0x46, 0x83, 0x48, 0x04, 0x02, 0x01,
|
||||
0x00, 0x50, 0x05, 0x50, 0x15, 0x10,
|
||||
0x87, 0x3F, 0x90, 0x2B, 0x18, 0x01,
|
||||
0x00, 0xC0, 0x31, 0x00, 0x00, 0xAE,
|
||||
0xDF, 0x41, 0x00, 0x08, 0x00, 0x1A,
|
||||
0x42, 0x11, 0x67, 0x01, 0xDF, 0x41,
|
||||
0x02, 0x08, 0x00, 0x10, 0x42, 0x11,
|
||||
0x62, 0x01, 0xB4, 0x43, 0x4A, 0x68,
|
||||
0x50, 0x14, 0x50, 0x04, 0x24, 0x10,
|
||||
0x48, 0x04, 0xF2, 0x31, 0x00, 0x01,
|
||||
0x00, 0x00, 0xAE, 0xF6, 0x31, 0x00,
|
||||
0x01, 0x00, 0x00, 0xAE, 0x62, 0xE4,
|
||||
0xE5, 0x61, 0x04, 0x48, 0x04, 0xE5,
|
||||
0x63, 0x05, 0x48, 0x04, 0x20, 0x20,
|
||||
0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -81,29 +81,29 @@
|
|||
#define DWNLD_MAG1_PS_HDR_LOC 0x03
|
||||
|
||||
struct dsp_file_hdr {
|
||||
long version_id; // Version ID of this image format.
|
||||
long package_id; // Package ID of code release.
|
||||
long build_date; // Date/time stamp when file was built.
|
||||
long commands_offset; // Offset to attached commands in Pseudo Hdr format.
|
||||
long loader_offset; // Offset to bootloader code.
|
||||
long loader_code_address; // Start address of bootloader.
|
||||
long loader_code_end; // Where bootloader code ends.
|
||||
long loader_code_size;
|
||||
long version_data_offset; // Offset were scrambled version data begins.
|
||||
long version_data_size; // Size, in words, of scrambled version data.
|
||||
long nDspImages; // Number of DSP images in file.
|
||||
long version_id; // Version ID of this image format.
|
||||
long package_id; // Package ID of code release.
|
||||
long build_date; // Date/time stamp when file was built.
|
||||
long commands_offset; // Offset to attached commands in Pseudo Hdr format.
|
||||
long loader_offset; // Offset to bootloader code.
|
||||
long loader_code_address; // Start address of bootloader.
|
||||
long loader_code_end; // Where bootloader code ends.
|
||||
long loader_code_size;
|
||||
long version_data_offset; // Offset were scrambled version data begins.
|
||||
long version_data_size; // Size, in words, of scrambled version data.
|
||||
long nDspImages; // Number of DSP images in file.
|
||||
};
|
||||
|
||||
#pragma pack(1)
|
||||
struct dsp_image_info {
|
||||
long coff_date; // Date/time when DSP Coff image was built.
|
||||
long begin_offset; // Offset in file where image begins.
|
||||
long end_offset; // Offset in file where image begins.
|
||||
long run_address; // On chip Start address of DSP code.
|
||||
long image_size; // Size of image.
|
||||
long version; // Embedded version # of DSP code.
|
||||
unsigned short checksum; // DSP File checksum
|
||||
unsigned short pad1;
|
||||
long coff_date; // Date/time when DSP Coff image was built.
|
||||
long begin_offset; // Offset in file where image begins.
|
||||
long end_offset; // Offset in file where image begins.
|
||||
long run_address; // On chip Start address of DSP code.
|
||||
long image_size; // Size of image.
|
||||
long version; // Embedded version # of DSP code.
|
||||
unsigned short checksum; // DSP File checksum
|
||||
unsigned short pad1;
|
||||
};
|
||||
|
||||
|
||||
|
@ -151,7 +151,7 @@ static int check_usb_db(struct ft1000_usb *ft1000dev)
|
|||
}
|
||||
}
|
||||
|
||||
return HANDSHAKE_MAG_TIMEOUT_VALUE;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* gets the handshake and compares it with the expected value */
|
||||
|
@ -172,9 +172,8 @@ static u16 get_handshake(struct ft1000_usb *ft1000dev, u16 expected_value)
|
|||
ft1000dev->fcodeldr);
|
||||
ft1000dev->fcodeldr = 0;
|
||||
status = check_usb_db(ft1000dev);
|
||||
if (status != STATUS_SUCCESS) {
|
||||
if (status != 0) {
|
||||
DEBUG("get_handshake: check_usb_db failed\n");
|
||||
status = STATUS_FAILURE;
|
||||
break;
|
||||
}
|
||||
status = ft1000_write_register(ft1000dev,
|
||||
|
@ -202,7 +201,7 @@ static u16 get_handshake(struct ft1000_usb *ft1000dev, u16 expected_value)
|
|||
}
|
||||
|
||||
/* write the handshake value to the handshake location */
|
||||
static void put_handshake(struct ft1000_usb *ft1000dev,u16 handshake_value)
|
||||
static void put_handshake(struct ft1000_usb *ft1000dev, u16 handshake_value)
|
||||
{
|
||||
u32 tempx;
|
||||
u16 tempword;
|
||||
|
@ -268,11 +267,12 @@ static u16 get_handshake_usb(struct ft1000_usb *ft1000dev, u16 expected_value)
|
|||
return HANDSHAKE_TIMEOUT_VALUE;
|
||||
}
|
||||
|
||||
static void put_handshake_usb(struct ft1000_usb *ft1000dev,u16 handshake_value)
|
||||
static void put_handshake_usb(struct ft1000_usb *ft1000dev, u16 handshake_value)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; i<1000; i++);
|
||||
for (i = 0; i < 1000; i++)
|
||||
;
|
||||
}
|
||||
|
||||
static u16 get_request_type(struct ft1000_usb *ft1000dev)
|
||||
|
@ -450,7 +450,7 @@ static int write_dpram32_and_check(struct ft1000_usb *ft1000dev,
|
|||
static int write_blk(struct ft1000_usb *ft1000dev, u16 **pUsFile, u8 **pUcFile,
|
||||
long word_length)
|
||||
{
|
||||
int status = STATUS_SUCCESS;
|
||||
int status = 0;
|
||||
u16 dpram;
|
||||
int loopcnt, i;
|
||||
u16 tempword;
|
||||
|
@ -499,7 +499,7 @@ static int write_blk(struct ft1000_usb *ft1000dev, u16 **pUsFile, u8 **pUcFile,
|
|||
} else {
|
||||
status = write_dpram32_and_check(ft1000dev, tempbuffer,
|
||||
dpram);
|
||||
if (status != STATUS_SUCCESS) {
|
||||
if (status != 0) {
|
||||
DEBUG("FT1000:download:Write failed tempbuffer[31] = 0x%x\n", tempbuffer[31]);
|
||||
break;
|
||||
}
|
||||
|
@ -509,9 +509,9 @@ static int write_blk(struct ft1000_usb *ft1000dev, u16 **pUsFile, u8 **pUcFile,
|
|||
return status;
|
||||
}
|
||||
|
||||
static void usb_dnld_complete (struct urb *urb)
|
||||
static void usb_dnld_complete(struct urb *urb)
|
||||
{
|
||||
//DEBUG("****** usb_dnld_complete\n");
|
||||
//DEBUG("****** usb_dnld_complete\n");
|
||||
}
|
||||
|
||||
/* writes a block of DSP image to DPRAM
|
||||
|
@ -523,7 +523,7 @@ static void usb_dnld_complete (struct urb *urb)
|
|||
static int write_blk_fifo(struct ft1000_usb *ft1000dev, u16 **pUsFile,
|
||||
u8 **pUcFile, long word_length)
|
||||
{
|
||||
int Status = STATUS_SUCCESS;
|
||||
int Status = 0;
|
||||
int byte_length;
|
||||
|
||||
byte_length = word_length * 4;
|
||||
|
@ -586,12 +586,12 @@ static int request_code_segment(struct ft1000_usb *ft1000dev, u16 **s_file,
|
|||
/*NdisMSleep (100); */
|
||||
if (word_length > MAX_LENGTH) {
|
||||
DEBUG("FT1000:download:Download error: Max length exceeded\n");
|
||||
return STATUS_FAILURE;
|
||||
return -1;
|
||||
}
|
||||
if ((word_length * 2 + (long)c_file) > (long)endpoint) {
|
||||
/* Error, beyond boot code range.*/
|
||||
DEBUG("FT1000:download:Download error: Requested len=%d exceeds BOOT code boundary.\n", (int)word_length);
|
||||
return STATUS_FAILURE;
|
||||
return -1;
|
||||
}
|
||||
if (word_length & 0x1)
|
||||
word_length++;
|
||||
|
@ -615,7 +615,7 @@ static int request_code_segment(struct ft1000_usb *ft1000dev, u16 **s_file,
|
|||
int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
|
||||
u32 FileLength)
|
||||
{
|
||||
int status = STATUS_SUCCESS;
|
||||
int status = 0;
|
||||
u32 state;
|
||||
u16 handshake;
|
||||
struct pseudo_hdr *pseudo_header;
|
||||
|
@ -670,7 +670,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
|
|||
loader_code_size = file_hdr->loader_code_size;
|
||||
correct_version = false;
|
||||
|
||||
while ((status == STATUS_SUCCESS) && (state != STATE_DONE_FILE)) {
|
||||
while ((status == 0) && (state != STATE_DONE_FILE)) {
|
||||
switch (state) {
|
||||
case STATE_START_DWNLD:
|
||||
status = scram_start_dwnld(ft1000dev, &handshake,
|
||||
|
@ -717,7 +717,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
|
|||
DEBUG
|
||||
("FT1000:download:Download error: Bad request type=%d in BOOT download state.\n",
|
||||
request);
|
||||
status = STATUS_FAILURE;
|
||||
status = -1;
|
||||
break;
|
||||
}
|
||||
if (ft1000dev->usbboot)
|
||||
|
@ -729,7 +729,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
|
|||
} else {
|
||||
DEBUG
|
||||
("FT1000:download:Download error: Handshake failed\n");
|
||||
status = STATUS_FAILURE;
|
||||
status = -1;
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -773,7 +773,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
|
|||
} else {
|
||||
DEBUG
|
||||
("FT1000:download:Download error: Got Run address request before image offset request.\n");
|
||||
status = STATUS_FAILURE;
|
||||
status = -1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -789,7 +789,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
|
|||
} else {
|
||||
DEBUG
|
||||
("FT1000:download:Download error: Got Size request before image offset request.\n");
|
||||
status = STATUS_FAILURE;
|
||||
status = -1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -809,7 +809,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
|
|||
if (!correct_version) {
|
||||
DEBUG
|
||||
("FT1000:download:Download error: Got Code Segment request before image offset request.\n");
|
||||
status = STATUS_FAILURE;
|
||||
status = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -836,7 +836,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
|
|||
* Position ASIC DPRAM auto-increment pointer.
|
||||
*/
|
||||
|
||||
data = (u16 *) & mailbox_data->data[0];
|
||||
data = (u16 *) &mailbox_data->data[0];
|
||||
dpram = (u16) DWNLD_MAG1_PS_HDR_LOC;
|
||||
if (word_length & 0x1)
|
||||
word_length++;
|
||||
|
@ -850,7 +850,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
|
|||
status =
|
||||
fix_ft1000_write_dpram32
|
||||
(ft1000dev, dpram++,
|
||||
(u8 *) & templong);
|
||||
(u8 *) &templong);
|
||||
|
||||
}
|
||||
break;
|
||||
|
@ -948,7 +948,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
|
|||
DEBUG
|
||||
("FT1000:download:Download error: Bad Version Request = 0x%x.\n",
|
||||
(int)requested_version);
|
||||
status = STATUS_FAILURE;
|
||||
status = -1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -957,7 +957,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
|
|||
DEBUG
|
||||
("FT1000:download:Download error: Bad request type=%d in CODE download state.\n",
|
||||
request);
|
||||
status = STATUS_FAILURE;
|
||||
status = -1;
|
||||
break;
|
||||
}
|
||||
if (ft1000dev->usbboot)
|
||||
|
@ -969,7 +969,7 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
|
|||
} else {
|
||||
DEBUG
|
||||
("FT1000:download:Download error: Handshake failed\n");
|
||||
status = STATUS_FAILURE;
|
||||
status = -1;
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -1026,14 +1026,14 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
|
|||
}
|
||||
} else {
|
||||
kfree(pbuffer);
|
||||
status = STATUS_FAILURE;
|
||||
status = -1;
|
||||
}
|
||||
} else {
|
||||
status = STATUS_FAILURE;
|
||||
status = -1;
|
||||
}
|
||||
} else {
|
||||
/* Checksum did not compute */
|
||||
status = STATUS_FAILURE;
|
||||
status = -1;
|
||||
}
|
||||
DEBUG
|
||||
("ft1000:download: after STATE_SECTION_PROV, state = %d, status= %d\n",
|
||||
|
@ -1046,23 +1046,23 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
|
|||
break;
|
||||
|
||||
default:
|
||||
status = STATUS_FAILURE;
|
||||
status = -1;
|
||||
break;
|
||||
} /* End Switch */
|
||||
|
||||
if (status != STATUS_SUCCESS)
|
||||
if (status != 0)
|
||||
break;
|
||||
|
||||
/****
|
||||
// Check if Card is present
|
||||
status = Harley_Read_Register(&temp, FT1000_REG_SUP_IMASK);
|
||||
if ( (status != NDIS_STATUS_SUCCESS) || (temp == 0x0000) ) {
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
status = Harley_Read_Register(&temp, FT1000_REG_ASIC_ID);
|
||||
if ( (status != NDIS_STATUS_SUCCESS) || (temp == 0xffff) ) {
|
||||
break;
|
||||
break;
|
||||
}
|
||||
****/
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -33,13 +33,13 @@
|
|||
|
||||
#define seq_putx(m, message, size, var) \
|
||||
seq_printf(m, message); \
|
||||
for(i = 0; i < (size - 1); i++) \
|
||||
for (i = 0; i < (size - 1); i++) \
|
||||
seq_printf(m, "%02x:", var[i]); \
|
||||
seq_printf(m, "%02x\n", var[i])
|
||||
|
||||
#define seq_putd(m, message, size, var) \
|
||||
seq_printf(m, message); \
|
||||
for(i = 0; i < (size - 1); i++) \
|
||||
for (i = 0; i < (size - 1); i++) \
|
||||
seq_printf(m, "%d.", var[i]); \
|
||||
seq_printf(m, "%d\n", var[i])
|
||||
|
||||
|
@ -47,14 +47,14 @@
|
|||
#define FTNET_PROC init_net.proc_net
|
||||
|
||||
|
||||
int ft1000_read_dpram16 (struct ft1000_usb *ft1000dev, u16 indx,
|
||||
int ft1000_read_dpram16(struct ft1000_usb *ft1000dev, u16 indx,
|
||||
u8 *buffer, u8 highlow);
|
||||
|
||||
|
||||
static int ft1000ReadProc(struct seq_file *m, void *v)
|
||||
{
|
||||
static const char *status[] = {
|
||||
"Idle (Disconnect)",
|
||||
static const char *status[] = {
|
||||
"Idle (Disconnect)",
|
||||
"Searching",
|
||||
"Active (Connected)",
|
||||
"Waiting for L2",
|
||||
|
@ -127,10 +127,10 @@ static int ft1000ReadProc(struct seq_file *m, void *v)
|
|||
}
|
||||
|
||||
seq_printf(m, "Connection Time: %02ld:%02ld:%02ld\n",
|
||||
((delta / 3600) % 24), ((delta / 60) % 60), (delta % 60));
|
||||
((delta / 3600) % 24), ((delta / 60) % 60), (delta % 60));
|
||||
seq_printf(m, "Connection Time[s]: %ld\n", delta);
|
||||
seq_printf(m, "Asic ID: %s\n",
|
||||
(info->AsicID) == ELECTRABUZZ_ID ? "ELECTRABUZZ ASIC" : "MAGNEMITE ASIC");
|
||||
(info->AsicID) == ELECTRABUZZ_ID ? "ELECTRABUZZ ASIC" : "MAGNEMITE ASIC");
|
||||
seq_putx(m, "SKU: ", SKUSZ, info->Sku);
|
||||
seq_putx(m, "EUI64: ", EUISZ, info->eui64);
|
||||
seq_putd(m, "DSP version number: ", DSPVERSZ, info->DspVer);
|
||||
|
|
|
@ -45,13 +45,13 @@ static int ft1000_poll_thread(void *arg)
|
|||
msleep(10);
|
||||
if (!gPollingfailed) {
|
||||
ret = ft1000_poll(arg);
|
||||
if (ret != STATUS_SUCCESS) {
|
||||
if (ret != 0) {
|
||||
DEBUG("ft1000_poll_thread: polling failed\n");
|
||||
gPollingfailed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return STATUS_SUCCESS;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ft1000_probe(struct usb_interface *interface,
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
|
||||
#define PSEUDOSZ 16
|
||||
|
||||
#define SUCCESS 0x00
|
||||
|
||||
struct app_info_block {
|
||||
u32 nTxMsg; /* DPRAM msg sent to DSP with app_id */
|
||||
u32 nRxMsg; /* DPRAM msg rcv from dsp with app_id */
|
||||
|
@ -31,9 +29,6 @@ struct app_info_block {
|
|||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
|
||||
#define STATUS_SUCCESS 0
|
||||
#define STATUS_FAILURE 0x1001
|
||||
|
||||
#define FT1000_STATUS_CLOSING 0x01
|
||||
|
||||
#define DSPBCMSGID 0x10
|
||||
|
|
|
@ -44,18 +44,6 @@
|
|||
*/
|
||||
#define DEFAULT_MTU_SIZE 1500
|
||||
|
||||
#define gdm_dev_endian(n) (\
|
||||
n->phy_dev->get_endian(n->phy_dev->priv_dev))
|
||||
|
||||
#define gdm_lte_hci_send(n, d, l) (\
|
||||
n->phy_dev->send_hci_func(n->phy_dev->priv_dev, d, l, NULL, NULL))
|
||||
|
||||
#define gdm_lte_sdu_send(n, d, l, c, b, i, t) (\
|
||||
n->phy_dev->send_sdu_func(n->phy_dev->priv_dev, d, l, n->pdn_table.dft_eps_id, 0, c, b, i, t))
|
||||
|
||||
#define gdm_lte_rcv_with_cb(n, c, b, e) (\
|
||||
n->rcv_func(n->priv_dev, c, b, e))
|
||||
|
||||
#define IP_VERSION_4 4
|
||||
#define IP_VERSION_6 6
|
||||
|
||||
|
@ -458,13 +446,11 @@ static int gdm_lte_tx(struct sk_buff *skb, struct net_device *dev)
|
|||
|
||||
sscanf(dev->name, "lte%d", &idx);
|
||||
|
||||
ret = gdm_lte_sdu_send(nic,
|
||||
data_buf,
|
||||
data_len,
|
||||
tx_complete,
|
||||
nic,
|
||||
idx,
|
||||
nic_type);
|
||||
ret = nic->phy_dev->send_sdu_func(nic->phy_dev->priv_dev,
|
||||
data_buf, data_len,
|
||||
nic->pdn_table.dft_eps_id, 0,
|
||||
tx_complete, nic, idx,
|
||||
nic_type);
|
||||
|
||||
if (ret == TX_NO_BUFFER || ret == TX_NO_SPC) {
|
||||
netif_stop_queue(dev);
|
||||
|
@ -503,14 +489,18 @@ static int gdm_lte_event_send(struct net_device *dev, char *buf, int len)
|
|||
sscanf(dev->name, "lte%d", &idx);
|
||||
|
||||
return netlink_send(lte_event.sock, idx, 0, buf,
|
||||
gdm_dev16_to_cpu(gdm_dev_endian(nic), hci->len) + HCI_HEADER_SIZE);
|
||||
gdm_dev16_to_cpu(
|
||||
nic->phy_dev->get_endian(
|
||||
nic->phy_dev->priv_dev), hci->len)
|
||||
+ HCI_HEADER_SIZE);
|
||||
}
|
||||
|
||||
static void gdm_lte_event_rcv(struct net_device *dev, u16 type, void *msg, int len)
|
||||
{
|
||||
struct nic *nic = netdev_priv(dev);
|
||||
|
||||
gdm_lte_hci_send(nic, msg, len);
|
||||
nic->phy_dev->send_hci_func(nic->phy_dev->priv_dev, msg, len, NULL,
|
||||
NULL);
|
||||
}
|
||||
|
||||
int gdm_lte_event_init(void)
|
||||
|
@ -688,8 +678,14 @@ static void gdm_lte_pdn_table(struct net_device *dev, char *buf, int len)
|
|||
|
||||
if (pdn_table->activate) {
|
||||
nic->pdn_table.activate = pdn_table->activate;
|
||||
nic->pdn_table.dft_eps_id = gdm_dev32_to_cpu(gdm_dev_endian(nic), pdn_table->dft_eps_id);
|
||||
nic->pdn_table.nic_type = gdm_dev32_to_cpu(gdm_dev_endian(nic), pdn_table->nic_type);
|
||||
nic->pdn_table.dft_eps_id = gdm_dev32_to_cpu(
|
||||
nic->phy_dev->get_endian(
|
||||
nic->phy_dev->priv_dev),
|
||||
pdn_table->dft_eps_id);
|
||||
nic->pdn_table.nic_type = gdm_dev32_to_cpu(
|
||||
nic->phy_dev->get_endian(
|
||||
nic->phy_dev->priv_dev),
|
||||
pdn_table->nic_type);
|
||||
|
||||
netdev_info(dev, "pdn activated, nic_type=0x%x\n",
|
||||
nic->pdn_table.nic_type);
|
||||
|
@ -762,7 +758,7 @@ void start_rx_proc(struct phy_dev *phy_dev)
|
|||
int i;
|
||||
|
||||
for (i = 0; i < MAX_RX_SUBMIT_COUNT; i++)
|
||||
gdm_lte_rcv_with_cb(phy_dev, rx_complete, phy_dev, USB_COMPLETE);
|
||||
phy_dev->rcv_func(phy_dev->priv_dev, rx_complete, phy_dev, USB_COMPLETE);
|
||||
}
|
||||
|
||||
static struct net_device_ops gdm_netdev_ops = {
|
||||
|
|
|
@ -158,7 +158,6 @@ static int up_to_host(struct mux_rx *r)
|
|||
unsigned int start_flag;
|
||||
unsigned int payload_size;
|
||||
unsigned short packet_type;
|
||||
int remain;
|
||||
int dummy_cnt;
|
||||
u32 packet_size_sum = r->offset;
|
||||
int index;
|
||||
|
@ -176,8 +175,7 @@ static int up_to_host(struct mux_rx *r)
|
|||
break;
|
||||
}
|
||||
|
||||
remain = (MUX_HEADER_SIZE + payload_size) % 4;
|
||||
dummy_cnt = remain ? (4-remain) : 0;
|
||||
dummy_cnt = ALIGN(MUX_HEADER_SIZE + payload_size, 4);
|
||||
|
||||
if (len - packet_size_sum <
|
||||
MUX_HEADER_SIZE + payload_size + dummy_cnt) {
|
||||
|
@ -361,7 +359,6 @@ static int gdm_mux_send(void *priv_dev, void *data, int len, int tty_index,
|
|||
struct mux_pkt_header *mux_header;
|
||||
struct mux_tx *t = NULL;
|
||||
static u32 seq_num = 1;
|
||||
int remain;
|
||||
int dummy_cnt;
|
||||
int total_len;
|
||||
int ret;
|
||||
|
@ -375,8 +372,7 @@ static int gdm_mux_send(void *priv_dev, void *data, int len, int tty_index,
|
|||
|
||||
spin_lock_irqsave(&mux_dev->write_lock, flags);
|
||||
|
||||
remain = (MUX_HEADER_SIZE + len) % 4;
|
||||
dummy_cnt = remain ? (4 - remain) : 0;
|
||||
dummy_cnt = ALIGN(MUX_HEADER_SIZE + len, 4);
|
||||
|
||||
total_len = len + MUX_HEADER_SIZE + dummy_cnt;
|
||||
|
||||
|
|
|
@ -443,6 +443,8 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags)
|
|||
if (!imx_drm_device_get())
|
||||
ret = -EINVAL;
|
||||
|
||||
platform_set_drvdata(drm->platformdev, drm);
|
||||
|
||||
ret = 0;
|
||||
|
||||
err_init:
|
||||
|
@ -828,7 +830,7 @@ static int imx_drm_platform_probe(struct platform_device *pdev)
|
|||
|
||||
static int imx_drm_platform_remove(struct platform_device *pdev)
|
||||
{
|
||||
drm_platform_exit(&imx_drm_driver, pdev);
|
||||
drm_put_dev(platform_get_drvdata(pdev));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -167,9 +167,8 @@ static void imx_ldb_set_clock(struct imx_ldb *ldb, int mux, int chno,
|
|||
|
||||
/* set display clock mux to LDB input clock */
|
||||
ret = clk_set_parent(ldb->clk_sel[mux], ldb->clk[chno]);
|
||||
if (ret) {
|
||||
if (ret)
|
||||
dev_err(ldb->dev, "unable to set di%d parent clock to ldb_di%d\n", mux, chno);
|
||||
}
|
||||
}
|
||||
|
||||
static void imx_ldb_encoder_prepare(struct drm_encoder *encoder)
|
||||
|
@ -414,7 +413,7 @@ enum {
|
|||
LVDS_BIT_MAP_JEIDA
|
||||
};
|
||||
|
||||
static const char *imx_ldb_bit_mappings[] = {
|
||||
static const char * const imx_ldb_bit_mappings[] = {
|
||||
[LVDS_BIT_MAP_SPWG] = "spwg",
|
||||
[LVDS_BIT_MAP_JEIDA] = "jeida",
|
||||
};
|
||||
|
|
|
@ -189,12 +189,6 @@ struct keucr_media_area {
|
|||
WORD PhyBlock; /* Physical Block Number on Zone 0 */
|
||||
};
|
||||
|
||||
|
||||
extern BYTE IsSSFDCCompliance;
|
||||
extern BYTE IsXDCompliance;
|
||||
|
||||
extern DWORD ErrXDCode;
|
||||
extern DWORD ErrCode;
|
||||
extern WORD ReadBlock;
|
||||
extern WORD WriteBlock;
|
||||
extern DWORD MediaChange;
|
||||
|
|
|
@ -4,49 +4,28 @@
|
|||
#include "smcommon.h"
|
||||
#include "smil.h"
|
||||
|
||||
int Check_D_LogCHS(WORD *, BYTE *, BYTE *);
|
||||
void Initialize_D_Media(void);
|
||||
void PowerOff_D_Media(void);
|
||||
int Check_D_MediaPower(void);
|
||||
int Check_D_MediaExist(void);
|
||||
int Check_D_MediaWP(void);
|
||||
int Check_D_MediaFmt(struct us_data *);
|
||||
int Check_D_MediaFmtForEraseAll(struct us_data *);
|
||||
int Conv_D_MediaAddr(struct us_data *, DWORD);
|
||||
int Inc_D_MediaAddr(struct us_data *);
|
||||
int Check_D_FirstSect(void);
|
||||
int Check_D_LastSect(void);
|
||||
int Media_D_ReadOneSect(struct us_data *, WORD, BYTE *);
|
||||
int Media_D_WriteOneSect(struct us_data *, WORD, BYTE *);
|
||||
int Media_D_CopyBlockHead(struct us_data *);
|
||||
int Media_D_CopyBlockTail(struct us_data *);
|
||||
int Media_D_EraseOneBlock(void);
|
||||
int Media_D_EraseAllBlock(void);
|
||||
static int Conv_D_MediaAddr(struct us_data *, DWORD);
|
||||
static int Inc_D_MediaAddr(struct us_data *);
|
||||
static int Media_D_ReadOneSect(struct us_data *, WORD, BYTE *);
|
||||
|
||||
int Copy_D_BlockAll(struct us_data *, DWORD);
|
||||
int Copy_D_BlockHead(struct us_data *);
|
||||
int Copy_D_BlockTail(struct us_data *);
|
||||
int Reassign_D_BlockHead(struct us_data *);
|
||||
static int Copy_D_BlockAll(struct us_data *, DWORD);
|
||||
|
||||
int Assign_D_WriteBlock(void);
|
||||
int Release_D_ReadBlock(struct us_data *);
|
||||
int Release_D_WriteBlock(struct us_data *);
|
||||
int Release_D_CopySector(struct us_data *);
|
||||
static int Assign_D_WriteBlock(void);
|
||||
static int Release_D_ReadBlock(struct us_data *);
|
||||
static int Release_D_WriteBlock(struct us_data *);
|
||||
static int Release_D_CopySector(struct us_data *);
|
||||
|
||||
int Copy_D_PhyOneSect(struct us_data *);
|
||||
int Read_D_PhyOneSect(struct us_data *, WORD, BYTE *);
|
||||
int Write_D_PhyOneSect(struct us_data *, WORD, BYTE *);
|
||||
int Erase_D_PhyOneBlock(struct us_data *);
|
||||
static int Copy_D_PhyOneSect(struct us_data *);
|
||||
static int Read_D_PhyOneSect(struct us_data *, WORD, BYTE *);
|
||||
static int Erase_D_PhyOneBlock(struct us_data *);
|
||||
|
||||
int Set_D_PhyFmtValue(struct us_data *);
|
||||
int Search_D_CIS(struct us_data *);
|
||||
int Make_D_LogTable(struct us_data *);
|
||||
void Check_D_BlockIsFull(void);
|
||||
static int Set_D_PhyFmtValue(struct us_data *);
|
||||
static int Search_D_CIS(struct us_data *);
|
||||
static int Make_D_LogTable(struct us_data *);
|
||||
|
||||
int MarkFail_D_PhyOneBlock(struct us_data *);
|
||||
static int MarkFail_D_PhyOneBlock(struct us_data *);
|
||||
|
||||
DWORD ErrXDCode;
|
||||
DWORD ErrCode;
|
||||
static DWORD ErrCode;
|
||||
static BYTE WorkBuf[SECTSIZE];
|
||||
static BYTE Redundant[REDTSIZE];
|
||||
static BYTE WorkRedund[REDTSIZE];
|
||||
|
@ -65,10 +44,6 @@ static BYTE BitData[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };
|
|||
#define Clr_D_Bit(a, b) (a[(BYTE)((b) / 8)] &= ~BitData[(b) % 8])
|
||||
#define Chk_D_Bit(a, b) (a[(BYTE)((b) / 8)] & BitData[(b) % 8])
|
||||
|
||||
BYTE IsSSFDCCompliance;
|
||||
BYTE IsXDCompliance;
|
||||
|
||||
|
||||
/* ----- SM_FreeMem() ------------------------------------------------- */
|
||||
int SM_FreeMem(void)
|
||||
{
|
||||
|
@ -167,7 +142,7 @@ int Media_D_CopySector(struct us_data *us, DWORD start, WORD count, BYTE *buf)
|
|||
}
|
||||
|
||||
/* ----- Release_D_CopySector() ------------------------------------------ */
|
||||
int Release_D_CopySector(struct us_data *us)
|
||||
static int Release_D_CopySector(struct us_data *us)
|
||||
{
|
||||
Log2Phy[Media.Zone][Media.LogBlock] = WriteBlock;
|
||||
Media.PhyBlock = ReadBlock;
|
||||
|
@ -211,7 +186,7 @@ int Check_D_MediaFmt(struct us_data *us)
|
|||
|
||||
/* SmartMedia Physical Address Control Subroutine */
|
||||
/* ----- Conv_D_MediaAddr() --------------------------------------------- */
|
||||
int Conv_D_MediaAddr(struct us_data *us, DWORD addr)
|
||||
static int Conv_D_MediaAddr(struct us_data *us, DWORD addr)
|
||||
{
|
||||
DWORD temp;
|
||||
|
||||
|
@ -240,7 +215,7 @@ int Conv_D_MediaAddr(struct us_data *us, DWORD addr)
|
|||
}
|
||||
|
||||
/* ----- Inc_D_MediaAddr() ---------------------------------------------- */
|
||||
int Inc_D_MediaAddr(struct us_data *us)
|
||||
static int Inc_D_MediaAddr(struct us_data *us)
|
||||
{
|
||||
WORD LogBlock = Media.LogBlock;
|
||||
|
||||
|
@ -290,7 +265,7 @@ int Inc_D_MediaAddr(struct us_data *us)
|
|||
|
||||
/* SmartMedia Read/Write Subroutine with Retry */
|
||||
/* ----- Media_D_ReadOneSect() ------------------------------------------ */
|
||||
int Media_D_ReadOneSect(struct us_data *us, WORD count, BYTE *buf)
|
||||
static int Media_D_ReadOneSect(struct us_data *us, WORD count, BYTE *buf)
|
||||
{
|
||||
DWORD err, retry;
|
||||
|
||||
|
@ -334,7 +309,7 @@ int Media_D_ReadOneSect(struct us_data *us, WORD count, BYTE *buf)
|
|||
|
||||
/* SmartMedia Physical Sector Data Copy Subroutine */
|
||||
/* ----- Copy_D_BlockAll() ---------------------------------------------- */
|
||||
int Copy_D_BlockAll(struct us_data *us, DWORD mode)
|
||||
static int Copy_D_BlockAll(struct us_data *us, DWORD mode)
|
||||
{
|
||||
BYTE sect;
|
||||
|
||||
|
@ -371,7 +346,7 @@ int Copy_D_BlockAll(struct us_data *us, DWORD mode)
|
|||
|
||||
/* SmartMedia Physical Block Assign/Release Subroutine */
|
||||
/* ----- Assign_D_WriteBlock() ------------------------------------------ */
|
||||
int Assign_D_WriteBlock(void)
|
||||
static int Assign_D_WriteBlock(void)
|
||||
{
|
||||
ReadBlock = Media.PhyBlock;
|
||||
|
||||
|
@ -404,7 +379,7 @@ int Assign_D_WriteBlock(void)
|
|||
}
|
||||
|
||||
/* ----- Release_D_ReadBlock() ------------------------------------------ */
|
||||
int Release_D_ReadBlock(struct us_data *us)
|
||||
static int Release_D_ReadBlock(struct us_data *us)
|
||||
{
|
||||
DWORD mode;
|
||||
|
||||
|
@ -438,7 +413,7 @@ int Release_D_ReadBlock(struct us_data *us)
|
|||
}
|
||||
|
||||
/* ----- Release_D_WriteBlock() ----------------------------------------- */
|
||||
int Release_D_WriteBlock(struct us_data *us)
|
||||
static int Release_D_WriteBlock(struct us_data *us)
|
||||
{
|
||||
SectCopyMode = COMPLETED;
|
||||
Media.PhyBlock = WriteBlock;
|
||||
|
@ -452,7 +427,7 @@ int Release_D_WriteBlock(struct us_data *us)
|
|||
|
||||
/* SmartMedia Physical Sector Data Copy Subroutine */
|
||||
/* ----- Copy_D_PhyOneSect() -------------------------------------------- */
|
||||
int Copy_D_PhyOneSect(struct us_data *us)
|
||||
static int Copy_D_PhyOneSect(struct us_data *us)
|
||||
{
|
||||
int i;
|
||||
DWORD err, retry;
|
||||
|
@ -529,7 +504,7 @@ int Copy_D_PhyOneSect(struct us_data *us)
|
|||
|
||||
/* SmartMedia Physical Sector Read/Write/Erase Subroutine */
|
||||
/* ----- Read_D_PhyOneSect() -------------------------------------------- */
|
||||
int Read_D_PhyOneSect(struct us_data *us, WORD count, BYTE *buf)
|
||||
static int Read_D_PhyOneSect(struct us_data *us, WORD count, BYTE *buf)
|
||||
{
|
||||
int i;
|
||||
DWORD retry;
|
||||
|
@ -580,7 +555,7 @@ int Read_D_PhyOneSect(struct us_data *us, WORD count, BYTE *buf)
|
|||
}
|
||||
|
||||
/* ----- Erase_D_PhyOneBlock() ------------------------------------------ */
|
||||
int Erase_D_PhyOneBlock(struct us_data *us)
|
||||
static int Erase_D_PhyOneBlock(struct us_data *us)
|
||||
{
|
||||
if (Ssfdc_D_EraseBlock(us)) {
|
||||
ErrCode = ERR_HwError;
|
||||
|
@ -597,7 +572,7 @@ int Erase_D_PhyOneBlock(struct us_data *us)
|
|||
|
||||
/* SmartMedia Physical Format Check Local Subroutine */
|
||||
/* ----- Set_D_PhyFmtValue() -------------------------------------------- */
|
||||
int Set_D_PhyFmtValue(struct us_data *us)
|
||||
static int Set_D_PhyFmtValue(struct us_data *us)
|
||||
{
|
||||
if (Set_D_SsfdcModel(us->SM_DeviceID))
|
||||
return ERROR;
|
||||
|
@ -606,7 +581,7 @@ int Set_D_PhyFmtValue(struct us_data *us)
|
|||
}
|
||||
|
||||
/* ----- Search_D_CIS() ------------------------------------------------- */
|
||||
int Search_D_CIS(struct us_data *us)
|
||||
static int Search_D_CIS(struct us_data *us)
|
||||
{
|
||||
Media.Zone = 0;
|
||||
Media.Sector = 0;
|
||||
|
@ -660,7 +635,7 @@ int Search_D_CIS(struct us_data *us)
|
|||
}
|
||||
|
||||
/* ----- Make_D_LogTable() ---------------------------------------------- */
|
||||
int Make_D_LogTable(struct us_data *us)
|
||||
static int Make_D_LogTable(struct us_data *us)
|
||||
{
|
||||
WORD phyblock, logblock;
|
||||
|
||||
|
@ -761,7 +736,7 @@ int Make_D_LogTable(struct us_data *us)
|
|||
}
|
||||
|
||||
/* ----- MarkFail_D_PhyOneBlock() --------------------------------------- */
|
||||
int MarkFail_D_PhyOneBlock(struct us_data *us)
|
||||
static int MarkFail_D_PhyOneBlock(struct us_data *us)
|
||||
{
|
||||
BYTE sect;
|
||||
|
||||
|
|
|
@ -6,45 +6,16 @@
|
|||
#include "smcommon.h"
|
||||
#include "smil.h"
|
||||
|
||||
void _Set_D_SsfdcRdCmd(BYTE);
|
||||
void _Set_D_SsfdcRdAddr(BYTE);
|
||||
void _Set_D_SsfdcRdChip(void);
|
||||
void _Set_D_SsfdcRdStandby(void);
|
||||
void _Start_D_SsfdcRdHwECC(void);
|
||||
void _Stop_D_SsfdcRdHwECC(void);
|
||||
void _Load_D_SsfdcRdHwECC(BYTE);
|
||||
void _Set_D_SsfdcWrCmd(BYTE);
|
||||
void _Set_D_SsfdcWrAddr(BYTE);
|
||||
void _Set_D_SsfdcWrBlock(void);
|
||||
void _Set_D_SsfdcWrStandby(void);
|
||||
void _Start_D_SsfdcWrHwECC(void);
|
||||
void _Load_D_SsfdcWrHwECC(BYTE);
|
||||
int _Check_D_SsfdcBusy(WORD);
|
||||
int _Check_D_SsfdcStatus(void);
|
||||
void _Reset_D_SsfdcErr(void);
|
||||
void _Read_D_SsfdcBuf(BYTE *);
|
||||
void _Write_D_SsfdcBuf(BYTE *);
|
||||
void _Read_D_SsfdcByte(BYTE *);
|
||||
void _ReadRedt_D_SsfdcBuf(BYTE *);
|
||||
void _WriteRedt_D_SsfdcBuf(BYTE *);
|
||||
BYTE _Check_D_DevCode(BYTE);
|
||||
|
||||
void _Set_D_ECCdata(BYTE, BYTE *);
|
||||
void _Calc_D_ECCdata(BYTE *);
|
||||
|
||||
static BYTE _Check_D_DevCode(BYTE);
|
||||
static DWORD ErrXDCode;
|
||||
static BYTE IsSSFDCCompliance;
|
||||
static BYTE IsXDCompliance;
|
||||
|
||||
struct keucr_media_info Ssfdc;
|
||||
struct keucr_media_address Media;
|
||||
struct keucr_media_area CisArea;
|
||||
|
||||
static BYTE EccBuf[6];
|
||||
extern PBYTE SMHostAddr;
|
||||
extern DWORD ErrXDCode;
|
||||
|
||||
extern WORD ReadBlock;
|
||||
extern WORD WriteBlock;
|
||||
|
||||
|
||||
|
||||
#define EVEN 0 /* Even Page for 256byte/page */
|
||||
#define ODD 1 /* Odd Page for 256byte/page */
|
||||
|
|
|
@ -11,16 +11,12 @@
|
|||
#include "transport.h"
|
||||
#include "smil.h"
|
||||
|
||||
int SM_SCSI_Test_Unit_Ready(struct us_data *us, struct scsi_cmnd *srb);
|
||||
int SM_SCSI_Inquiry(struct us_data *us, struct scsi_cmnd *srb);
|
||||
int SM_SCSI_Mode_Sense(struct us_data *us, struct scsi_cmnd *srb);
|
||||
int SM_SCSI_Start_Stop(struct us_data *us, struct scsi_cmnd *srb);
|
||||
int SM_SCSI_Read_Capacity(struct us_data *us, struct scsi_cmnd *srb);
|
||||
int SM_SCSI_Read(struct us_data *us, struct scsi_cmnd *srb);
|
||||
int SM_SCSI_Write(struct us_data *us, struct scsi_cmnd *srb);
|
||||
|
||||
extern PBYTE SMHostAddr;
|
||||
extern DWORD ErrXDCode;
|
||||
static int SM_SCSI_Test_Unit_Ready(struct us_data *us, struct scsi_cmnd *srb);
|
||||
static int SM_SCSI_Inquiry(struct us_data *us, struct scsi_cmnd *srb);
|
||||
static int SM_SCSI_Mode_Sense(struct us_data *us, struct scsi_cmnd *srb);
|
||||
static int SM_SCSI_Read_Capacity(struct us_data *us, struct scsi_cmnd *srb);
|
||||
static int SM_SCSI_Read(struct us_data *us, struct scsi_cmnd *srb);
|
||||
static int SM_SCSI_Write(struct us_data *us, struct scsi_cmnd *srb);
|
||||
|
||||
/* ----- SM_SCSIIrp() -------------------------------------------------- */
|
||||
int SM_SCSIIrp(struct us_data *us, struct scsi_cmnd *srb)
|
||||
|
@ -57,7 +53,7 @@ int SM_SCSIIrp(struct us_data *us, struct scsi_cmnd *srb)
|
|||
}
|
||||
|
||||
/* ----- SM_SCSI_Test_Unit_Ready() ------------------------------------- */
|
||||
int SM_SCSI_Test_Unit_Ready(struct us_data *us, struct scsi_cmnd *srb)
|
||||
static int SM_SCSI_Test_Unit_Ready(struct us_data *us, struct scsi_cmnd *srb)
|
||||
{
|
||||
if (us->SM_Status.Insert && us->SM_Status.Ready)
|
||||
return USB_STOR_TRANSPORT_GOOD;
|
||||
|
@ -70,7 +66,7 @@ int SM_SCSI_Test_Unit_Ready(struct us_data *us, struct scsi_cmnd *srb)
|
|||
}
|
||||
|
||||
/* ----- SM_SCSI_Inquiry() --------------------------------------------- */
|
||||
int SM_SCSI_Inquiry(struct us_data *us, struct scsi_cmnd *srb)
|
||||
static int SM_SCSI_Inquiry(struct us_data *us, struct scsi_cmnd *srb)
|
||||
{
|
||||
BYTE data_ptr[36] = {0x00, 0x80, 0x02, 0x00, 0x1F, 0x00, 0x00, 0x00,
|
||||
0x55, 0x53, 0x42, 0x32, 0x2E, 0x30, 0x20,
|
||||
|
@ -84,7 +80,7 @@ int SM_SCSI_Inquiry(struct us_data *us, struct scsi_cmnd *srb)
|
|||
|
||||
|
||||
/* ----- SM_SCSI_Mode_Sense() ------------------------------------------ */
|
||||
int SM_SCSI_Mode_Sense(struct us_data *us, struct scsi_cmnd *srb)
|
||||
static int SM_SCSI_Mode_Sense(struct us_data *us, struct scsi_cmnd *srb)
|
||||
{
|
||||
BYTE mediaNoWP[12] = {0x0b, 0x00, 0x00, 0x08, 0x00, 0x00,
|
||||
0x71, 0xc0, 0x00, 0x00, 0x02, 0x00};
|
||||
|
@ -101,7 +97,7 @@ int SM_SCSI_Mode_Sense(struct us_data *us, struct scsi_cmnd *srb)
|
|||
}
|
||||
|
||||
/* ----- SM_SCSI_Read_Capacity() --------------------------------------- */
|
||||
int SM_SCSI_Read_Capacity(struct us_data *us, struct scsi_cmnd *srb)
|
||||
static int SM_SCSI_Read_Capacity(struct us_data *us, struct scsi_cmnd *srb)
|
||||
{
|
||||
unsigned int offset = 0;
|
||||
struct scatterlist *sg = NULL;
|
||||
|
@ -133,7 +129,7 @@ int SM_SCSI_Read_Capacity(struct us_data *us, struct scsi_cmnd *srb)
|
|||
}
|
||||
|
||||
/* ----- SM_SCSI_Read() -------------------------------------------------- */
|
||||
int SM_SCSI_Read(struct us_data *us, struct scsi_cmnd *srb)
|
||||
static int SM_SCSI_Read(struct us_data *us, struct scsi_cmnd *srb)
|
||||
{
|
||||
int result = 0;
|
||||
PBYTE Cdb = srb->cmnd;
|
||||
|
@ -165,7 +161,7 @@ int SM_SCSI_Read(struct us_data *us, struct scsi_cmnd *srb)
|
|||
}
|
||||
|
||||
/* ----- SM_SCSI_Write() -------------------------------------------------- */
|
||||
int SM_SCSI_Write(struct us_data *us, struct scsi_cmnd *srb)
|
||||
static int SM_SCSI_Write(struct us_data *us, struct scsi_cmnd *srb)
|
||||
{
|
||||
int result = 0;
|
||||
PBYTE Cdb = srb->cmnd;
|
||||
|
|
|
@ -61,7 +61,6 @@ int cfs_curproc_groups_nr(void);
|
|||
*/
|
||||
|
||||
/* check if task is running in compat mode.*/
|
||||
int current_is_32bit(void);
|
||||
#define current_pid() (current->pid)
|
||||
#define current_comm() (current->comm)
|
||||
int cfs_get_environ(const char *key, char *value, int *val_len);
|
||||
|
|
|
@ -110,41 +110,41 @@ struct libcfs_ioctl_handler {
|
|||
#define IOC_LIBCFS_TYPE 'e'
|
||||
#define IOC_LIBCFS_MIN_NR 30
|
||||
/* libcfs ioctls */
|
||||
#define IOC_LIBCFS_PANIC _IOWR('e', 30, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_CLEAR_DEBUG _IOWR('e', 31, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_MARK_DEBUG _IOWR('e', 32, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_LWT_CONTROL _IOWR('e', 33, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_LWT_SNAPSHOT _IOWR('e', 34, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_LWT_LOOKUP_STRING _IOWR('e', 35, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_MEMHOG _IOWR('e', 36, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_PING_TEST _IOWR('e', 37, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_PANIC _IOWR('e', 30, long)
|
||||
#define IOC_LIBCFS_CLEAR_DEBUG _IOWR('e', 31, long)
|
||||
#define IOC_LIBCFS_MARK_DEBUG _IOWR('e', 32, long)
|
||||
#define IOC_LIBCFS_LWT_CONTROL _IOWR('e', 33, long)
|
||||
#define IOC_LIBCFS_LWT_SNAPSHOT _IOWR('e', 34, long)
|
||||
#define IOC_LIBCFS_LWT_LOOKUP_STRING _IOWR('e', 35, long)
|
||||
#define IOC_LIBCFS_MEMHOG _IOWR('e', 36, long)
|
||||
#define IOC_LIBCFS_PING_TEST _IOWR('e', 37, long)
|
||||
/* lnet ioctls */
|
||||
#define IOC_LIBCFS_GET_NI _IOWR('e', 50, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_FAIL_NID _IOWR('e', 51, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_ADD_ROUTE _IOWR('e', 52, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_DEL_ROUTE _IOWR('e', 53, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_GET_ROUTE _IOWR('e', 54, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_NOTIFY_ROUTER _IOWR('e', 55, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_UNCONFIGURE _IOWR('e', 56, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_PORTALS_COMPATIBILITY _IOWR('e', 57, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_LNET_DIST _IOWR('e', 58, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_CONFIGURE _IOWR('e', 59, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_TESTPROTOCOMPAT _IOWR('e', 60, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_PING _IOWR('e', 61, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_DEBUG_PEER _IOWR('e', 62, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_LNETST _IOWR('e', 63, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_GET_NI _IOWR('e', 50, long)
|
||||
#define IOC_LIBCFS_FAIL_NID _IOWR('e', 51, long)
|
||||
#define IOC_LIBCFS_ADD_ROUTE _IOWR('e', 52, long)
|
||||
#define IOC_LIBCFS_DEL_ROUTE _IOWR('e', 53, long)
|
||||
#define IOC_LIBCFS_GET_ROUTE _IOWR('e', 54, long)
|
||||
#define IOC_LIBCFS_NOTIFY_ROUTER _IOWR('e', 55, long)
|
||||
#define IOC_LIBCFS_UNCONFIGURE _IOWR('e', 56, long)
|
||||
#define IOC_LIBCFS_PORTALS_COMPATIBILITY _IOWR('e', 57, long)
|
||||
#define IOC_LIBCFS_LNET_DIST _IOWR('e', 58, long)
|
||||
#define IOC_LIBCFS_CONFIGURE _IOWR('e', 59, long)
|
||||
#define IOC_LIBCFS_TESTPROTOCOMPAT _IOWR('e', 60, long)
|
||||
#define IOC_LIBCFS_PING _IOWR('e', 61, long)
|
||||
#define IOC_LIBCFS_DEBUG_PEER _IOWR('e', 62, long)
|
||||
#define IOC_LIBCFS_LNETST _IOWR('e', 63, long)
|
||||
/* lnd ioctls */
|
||||
#define IOC_LIBCFS_REGISTER_MYNID _IOWR('e', 70, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_CLOSE_CONNECTION _IOWR('e', 71, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_PUSH_CONNECTION _IOWR('e', 72, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_GET_CONN _IOWR('e', 73, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_DEL_PEER _IOWR('e', 74, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_ADD_PEER _IOWR('e', 75, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_GET_PEER _IOWR('e', 76, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_GET_TXDESC _IOWR('e', 77, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_ADD_INTERFACE _IOWR('e', 78, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_DEL_INTERFACE _IOWR('e', 79, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_GET_INTERFACE _IOWR('e', 80, IOCTL_LIBCFS_TYPE)
|
||||
#define IOC_LIBCFS_REGISTER_MYNID _IOWR('e', 70, long)
|
||||
#define IOC_LIBCFS_CLOSE_CONNECTION _IOWR('e', 71, long)
|
||||
#define IOC_LIBCFS_PUSH_CONNECTION _IOWR('e', 72, long)
|
||||
#define IOC_LIBCFS_GET_CONN _IOWR('e', 73, long)
|
||||
#define IOC_LIBCFS_DEL_PEER _IOWR('e', 74, long)
|
||||
#define IOC_LIBCFS_ADD_PEER _IOWR('e', 75, long)
|
||||
#define IOC_LIBCFS_GET_PEER _IOWR('e', 76, long)
|
||||
#define IOC_LIBCFS_GET_TXDESC _IOWR('e', 77, long)
|
||||
#define IOC_LIBCFS_ADD_INTERFACE _IOWR('e', 78, long)
|
||||
#define IOC_LIBCFS_DEL_INTERFACE _IOWR('e', 79, long)
|
||||
#define IOC_LIBCFS_GET_INTERFACE _IOWR('e', 80, long)
|
||||
|
||||
#define IOC_LIBCFS_MAX_NR 80
|
||||
|
||||
|
|
|
@ -63,9 +63,7 @@
|
|||
#include <linux/smp.h>
|
||||
#include <linux/ctype.h>
|
||||
#include <linux/compiler.h>
|
||||
#ifdef HAVE_MM_INLINE
|
||||
# include <linux/mm_inline.h>
|
||||
#endif
|
||||
#include <linux/mm_inline.h>
|
||||
#include <linux/kallsyms.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/scatterlist.h>
|
||||
|
@ -79,8 +77,6 @@
|
|||
module_param(name, type, perm);\
|
||||
MODULE_PARM_DESC(name, desc)
|
||||
|
||||
#define CFS_SYSFS_MODULE_PARM 1 /* module parameters accessible via sysfs */
|
||||
|
||||
/******************************************************************************/
|
||||
/* Light-weight trace
|
||||
* Support for temporary event tracing with minimal Heisenberg effect. */
|
||||
|
@ -179,14 +175,6 @@ extern int lwt_snapshot (cfs_cycles_t *now, int *ncpu, int *total_size,
|
|||
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
#define IOCTL_LIBCFS_TYPE long
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
# ifndef BITS_PER_LONG
|
||||
# define BITS_PER_LONG 64
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# define LI_POISON 0x5a5a5a5a
|
||||
#if BITS_PER_LONG > 32
|
||||
# define LL_POISON 0x5a5a5a5a5a5a5a5aL
|
||||
|
@ -197,8 +185,6 @@ extern int lwt_snapshot (cfs_cycles_t *now, int *ncpu, int *total_size,
|
|||
|
||||
/* this is a bit chunky */
|
||||
|
||||
#define _LWORDSIZE BITS_PER_LONG
|
||||
|
||||
# define LPU64 "%llu"
|
||||
# define LPD64 "%lld"
|
||||
# define LPX64 "%#llx"
|
||||
|
@ -218,24 +204,4 @@ extern int lwt_snapshot (cfs_cycles_t *now, int *ncpu, int *total_size,
|
|||
*/
|
||||
# define LPPID "%d"
|
||||
|
||||
|
||||
#undef _LWORDSIZE
|
||||
|
||||
/* compat macroses */
|
||||
|
||||
|
||||
#ifndef get_cpu
|
||||
# ifdef CONFIG_PREEMPT
|
||||
# define get_cpu() ({ preempt_disable(); smp_processor_id(); })
|
||||
# define put_cpu() preempt_enable()
|
||||
# else
|
||||
# define get_cpu() smp_processor_id()
|
||||
# define put_cpu()
|
||||
# endif
|
||||
#else
|
||||
#endif /* get_cpu & put_cpu */
|
||||
|
||||
#define INIT_CTL_NAME(a)
|
||||
#define INIT_STRATEGY(a)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -383,14 +383,6 @@ typedef enum {
|
|||
typedef unsigned LNET_SEQ_BASETYPE lnet_seq_t;
|
||||
#define LNET_SEQ_GT(a,b) (((signed LNET_SEQ_BASETYPE)((a) - (b))) > 0)
|
||||
|
||||
/* XXX
|
||||
* cygwin need the pragma line, not clear if it's needed in other places.
|
||||
* checking!!!
|
||||
*/
|
||||
#ifdef __CYGWIN__
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Information about an event on a MD.
|
||||
*/
|
||||
|
@ -462,9 +454,6 @@ typedef struct {
|
|||
*/
|
||||
volatile lnet_seq_t sequence;
|
||||
} lnet_event_t;
|
||||
#ifdef __CYGWIN__
|
||||
#pragma pop
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Event queue handler function type.
|
||||
|
|
|
@ -3230,7 +3230,6 @@ void __exit
|
|||
kiblnd_module_fini (void)
|
||||
{
|
||||
lnet_unregister_lnd(&the_o2iblnd);
|
||||
kiblnd_tunables_fini();
|
||||
}
|
||||
|
||||
int __init
|
||||
|
|
|
@ -106,9 +106,6 @@ typedef struct
|
|||
int *kib_fmr_pool_size; /* # FMRs in pool */
|
||||
int *kib_fmr_flush_trigger; /* When to trigger FMR flush */
|
||||
int *kib_fmr_cache; /* enable FMR pool cache? */
|
||||
#if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM
|
||||
ctl_table_header_t *kib_sysctl; /* sysctl interface */
|
||||
#endif
|
||||
int *kib_require_priv_port;/* accept only privileged ports */
|
||||
int *kib_use_priv_port; /* use privileged port for active connect */
|
||||
/* # threads on each CPT */
|
||||
|
|
|
@ -176,261 +176,6 @@ kib_tunables_t kiblnd_tunables = {
|
|||
.kib_nscheds = &nscheds
|
||||
};
|
||||
|
||||
#if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM
|
||||
|
||||
static char ipif_basename_space[32];
|
||||
|
||||
|
||||
enum {
|
||||
O2IBLND_SERVICE = 1,
|
||||
O2IBLND_CKSUM,
|
||||
O2IBLND_TIMEOUT,
|
||||
O2IBLND_NTX,
|
||||
O2IBLND_CREDITS,
|
||||
O2IBLND_PEER_TXCREDITS,
|
||||
O2IBLND_PEER_CREDITS_HIW,
|
||||
O2IBLND_PEER_RTRCREDITS,
|
||||
O2IBLND_PEER_TIMEOUT,
|
||||
O2IBLND_IPIF_BASENAME,
|
||||
O2IBLND_RETRY_COUNT,
|
||||
O2IBLND_RNR_RETRY_COUNT,
|
||||
O2IBLND_KEEPALIVE,
|
||||
O2IBLND_CONCURRENT_SENDS,
|
||||
O2IBLND_IB_MTU,
|
||||
O2IBLND_MAP_ON_DEMAND,
|
||||
O2IBLND_FMR_POOL_SIZE,
|
||||
O2IBLND_FMR_FLUSH_TRIGGER,
|
||||
O2IBLND_FMR_CACHE,
|
||||
O2IBLND_PMR_POOL_SIZE,
|
||||
O2IBLND_DEV_FAILOVER
|
||||
};
|
||||
|
||||
static ctl_table_t kiblnd_ctl_table[] = {
|
||||
{
|
||||
.ctl_name = O2IBLND_SERVICE,
|
||||
.procname = "service",
|
||||
.data = &service,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_dointvec
|
||||
},
|
||||
{
|
||||
.ctl_name = O2IBLND_CKSUM,
|
||||
.procname = "cksum",
|
||||
.data = &cksum,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_dointvec
|
||||
},
|
||||
{
|
||||
.ctl_name = O2IBLND_TIMEOUT,
|
||||
.procname = "timeout",
|
||||
.data = &timeout,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_dointvec
|
||||
},
|
||||
{
|
||||
.ctl_name = O2IBLND_NTX,
|
||||
.procname = "ntx",
|
||||
.data = &ntx,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_dointvec
|
||||
},
|
||||
{
|
||||
.ctl_name = O2IBLND_CREDITS,
|
||||
.procname = "credits",
|
||||
.data = &credits,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_dointvec
|
||||
},
|
||||
{
|
||||
.ctl_name = O2IBLND_PEER_TXCREDITS,
|
||||
.procname = "peer_credits",
|
||||
.data = &peer_credits,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_dointvec
|
||||
},
|
||||
{
|
||||
.ctl_name = O2IBLND_PEER_CREDITS_HIW,
|
||||
.procname = "peer_credits_hiw",
|
||||
.data = &peer_credits_hiw,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_dointvec
|
||||
},
|
||||
{
|
||||
.ctl_name = O2IBLND_PEER_RTRCREDITS,
|
||||
.procname = "peer_buffer_credits",
|
||||
.data = &peer_buffer_credits,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_dointvec
|
||||
},
|
||||
{
|
||||
.ctl_name = O2IBLND_PEER_TIMEOUT,
|
||||
.procname = "peer_timeout",
|
||||
.data = &peer_timeout,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_dointvec
|
||||
},
|
||||
{
|
||||
.ctl_name = O2IBLND_IPIF_BASENAME,
|
||||
.procname = "ipif_name",
|
||||
.data = ipif_basename_space,
|
||||
.maxlen = sizeof(ipif_basename_space),
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_dostring
|
||||
},
|
||||
{
|
||||
.ctl_name = O2IBLND_RETRY_COUNT,
|
||||
.procname = "retry_count",
|
||||
.data = &retry_count,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_dointvec
|
||||
},
|
||||
{
|
||||
.ctl_name = O2IBLND_RNR_RETRY_COUNT,
|
||||
.procname = "rnr_retry_count",
|
||||
.data = &rnr_retry_count,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_dointvec
|
||||
},
|
||||
{
|
||||
.ctl_name = O2IBLND_KEEPALIVE,
|
||||
.procname = "keepalive",
|
||||
.data = &keepalive,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_dointvec
|
||||
},
|
||||
{
|
||||
.ctl_name = O2IBLND_CONCURRENT_SENDS,
|
||||
.procname = "concurrent_sends",
|
||||
.data = &concurrent_sends,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_dointvec
|
||||
},
|
||||
{
|
||||
.ctl_name = O2IBLND_IB_MTU,
|
||||
.procname = "ib_mtu",
|
||||
.data = &ib_mtu,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_dointvec
|
||||
},
|
||||
{
|
||||
.ctl_name = O2IBLND_MAP_ON_DEMAND,
|
||||
.procname = "map_on_demand",
|
||||
.data = &map_on_demand,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_dointvec
|
||||
},
|
||||
|
||||
{
|
||||
.ctl_name = O2IBLND_FMR_POOL_SIZE,
|
||||
.procname = "fmr_pool_size",
|
||||
.data = &fmr_pool_size,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_dointvec
|
||||
},
|
||||
{
|
||||
.ctl_name = O2IBLND_FMR_FLUSH_TRIGGER,
|
||||
.procname = "fmr_flush_trigger",
|
||||
.data = &fmr_flush_trigger,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_dointvec
|
||||
},
|
||||
{
|
||||
.ctl_name = O2IBLND_FMR_CACHE,
|
||||
.procname = "fmr_cache",
|
||||
.data = &fmr_cache,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_dointvec
|
||||
},
|
||||
{
|
||||
.ctl_name = O2IBLND_PMR_POOL_SIZE,
|
||||
.procname = "pmr_pool_size",
|
||||
.data = &pmr_pool_size,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_dointvec
|
||||
},
|
||||
{
|
||||
.ctl_name = O2IBLND_DEV_FAILOVER,
|
||||
.procname = "dev_failover",
|
||||
.data = &dev_failover,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_dointvec
|
||||
},
|
||||
{0}
|
||||
};
|
||||
|
||||
static ctl_table_t kiblnd_top_ctl_table[] = {
|
||||
{
|
||||
.ctl_name = CTL_O2IBLND,
|
||||
.procname = "o2iblnd",
|
||||
.data = NULL,
|
||||
.maxlen = 0,
|
||||
.mode = 0555,
|
||||
.child = kiblnd_ctl_table
|
||||
},
|
||||
{0}
|
||||
};
|
||||
|
||||
void
|
||||
kiblnd_initstrtunable(char *space, char *str, int size)
|
||||
{
|
||||
strncpy(space, str, size);
|
||||
space[size-1] = 0;
|
||||
}
|
||||
|
||||
void
|
||||
kiblnd_sysctl_init (void)
|
||||
{
|
||||
kiblnd_initstrtunable(ipif_basename_space, ipif_name,
|
||||
sizeof(ipif_basename_space));
|
||||
|
||||
kiblnd_tunables.kib_sysctl =
|
||||
register_sysctl_table(kiblnd_top_ctl_table);
|
||||
|
||||
if (kiblnd_tunables.kib_sysctl == NULL)
|
||||
CWARN("Can't setup /proc tunables\n");
|
||||
}
|
||||
|
||||
void
|
||||
kiblnd_sysctl_fini (void)
|
||||
{
|
||||
if (kiblnd_tunables.kib_sysctl != NULL)
|
||||
unregister_sysctl_table(kiblnd_tunables.kib_sysctl);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void
|
||||
kiblnd_sysctl_init (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
kiblnd_sysctl_fini (void)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
int
|
||||
kiblnd_tunables_init (void)
|
||||
{
|
||||
|
@ -482,12 +227,5 @@ kiblnd_tunables_init (void)
|
|||
*kiblnd_tunables.kib_concurrent_sends, *kiblnd_tunables.kib_peertxcredits);
|
||||
}
|
||||
|
||||
kiblnd_sysctl_init();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
kiblnd_tunables_fini (void)
|
||||
{
|
||||
kiblnd_sysctl_fini();
|
||||
}
|
||||
|
|
|
@ -2866,7 +2866,6 @@ void __exit
|
|||
ksocknal_module_fini (void)
|
||||
{
|
||||
lnet_unregister_lnd(&the_ksocklnd);
|
||||
ksocknal_tunables_fini();
|
||||
}
|
||||
|
||||
int __init
|
||||
|
|
|
@ -124,9 +124,6 @@ typedef struct
|
|||
unsigned int *ksnd_zc_min_payload; /* minimum zero copy payload size */
|
||||
int *ksnd_zc_recv; /* enable ZC receive (for Chelsio TOE) */
|
||||
int *ksnd_zc_recv_min_nfrags; /* minimum # of fragments to enable ZC receive */
|
||||
#if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM
|
||||
ctl_table_header_t *ksnd_sysctl; /* sysctl interface */
|
||||
#endif
|
||||
} ksock_tunables_t;
|
||||
|
||||
typedef struct
|
||||
|
@ -592,9 +589,6 @@ extern int ksocknal_lib_get_conn_tunables (ksock_conn_t *conn, int *txmem,
|
|||
int *rxmem, int *nagle);
|
||||
|
||||
extern int ksocknal_tunables_init(void);
|
||||
extern void ksocknal_tunables_fini(void);
|
||||
extern int ksocknal_lib_tunables_init(void);
|
||||
extern void ksocknal_lib_tunables_fini(void);
|
||||
|
||||
extern void ksocknal_lib_csum_tx(ksock_tx_t *tx);
|
||||
|
||||
|
|
|
@ -36,313 +36,6 @@
|
|||
|
||||
#include "socklnd.h"
|
||||
|
||||
# if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM
|
||||
|
||||
|
||||
enum {
|
||||
SOCKLND_TIMEOUT = 1,
|
||||
SOCKLND_CREDITS,
|
||||
SOCKLND_PEER_TXCREDITS,
|
||||
SOCKLND_PEER_RTRCREDITS,
|
||||
SOCKLND_PEER_TIMEOUT,
|
||||
SOCKLND_NCONNDS,
|
||||
SOCKLND_RECONNECTS_MIN,
|
||||
SOCKLND_RECONNECTS_MAX,
|
||||
SOCKLND_EAGER_ACK,
|
||||
SOCKLND_ZERO_COPY,
|
||||
SOCKLND_TYPED,
|
||||
SOCKLND_BULK_MIN,
|
||||
SOCKLND_RX_BUFFER_SIZE,
|
||||
SOCKLND_TX_BUFFER_SIZE,
|
||||
SOCKLND_NAGLE,
|
||||
SOCKLND_IRQ_AFFINITY,
|
||||
SOCKLND_ROUND_ROBIN,
|
||||
SOCKLND_KEEPALIVE,
|
||||
SOCKLND_KEEPALIVE_IDLE,
|
||||
SOCKLND_KEEPALIVE_COUNT,
|
||||
SOCKLND_KEEPALIVE_INTVL,
|
||||
SOCKLND_BACKOFF_INIT,
|
||||
SOCKLND_BACKOFF_MAX,
|
||||
SOCKLND_PROTOCOL,
|
||||
SOCKLND_ZERO_COPY_RECV,
|
||||
SOCKLND_ZERO_COPY_RECV_MIN_NFRAGS
|
||||
};
|
||||
|
||||
static ctl_table_t ksocknal_ctl_table[] = {
|
||||
{
|
||||
.ctl_name = SOCKLND_TIMEOUT,
|
||||
.procname = "timeout",
|
||||
.data = &ksocknal_tunables.ksnd_timeout,
|
||||
.maxlen = sizeof (int),
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_dointvec,
|
||||
.strategy = &sysctl_intvec,
|
||||
},
|
||||
{
|
||||
.ctl_name = SOCKLND_CREDITS,
|
||||
.procname = "credits",
|
||||
.data = &ksocknal_tunables.ksnd_credits,
|
||||
.maxlen = sizeof (int),
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_dointvec,
|
||||
.strategy = &sysctl_intvec,
|
||||
},
|
||||
{
|
||||
.ctl_name = SOCKLND_PEER_TXCREDITS,
|
||||
.procname = "peer_credits",
|
||||
.data = &ksocknal_tunables.ksnd_peertxcredits,
|
||||
.maxlen = sizeof (int),
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_dointvec,
|
||||
.strategy = &sysctl_intvec,
|
||||
},
|
||||
{
|
||||
.ctl_name = SOCKLND_PEER_RTRCREDITS,
|
||||
.procname = "peer_buffer_credits",
|
||||
.data = &ksocknal_tunables.ksnd_peerrtrcredits,
|
||||
.maxlen = sizeof (int),
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_dointvec,
|
||||
.strategy = &sysctl_intvec,
|
||||
},
|
||||
{
|
||||
.ctl_name = SOCKLND_PEER_TIMEOUT,
|
||||
.procname = "peer_timeout",
|
||||
.data = &ksocknal_tunables.ksnd_peertimeout,
|
||||
.maxlen = sizeof (int),
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_dointvec
|
||||
.strategy = &sysctl_intvec,
|
||||
},
|
||||
{
|
||||
.ctl_name = SOCKLND_NCONNDS,
|
||||
.procname = "nconnds",
|
||||
.data = &ksocknal_tunables.ksnd_nconnds,
|
||||
.maxlen = sizeof (int),
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_dointvec,
|
||||
.strategy = &sysctl_intvec,
|
||||
},
|
||||
{
|
||||
.ctl_name = SOCKLND_RECONNECTS_MIN,
|
||||
.procname = "min_reconnectms",
|
||||
.data = &ksocknal_tunables.ksnd_min_reconnectms,
|
||||
.maxlen = sizeof (int),
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_dointvec,
|
||||
.strategy = &sysctl_intvec,
|
||||
},
|
||||
{
|
||||
.ctl_name = SOCKLND_RECONNECTS_MAX,
|
||||
.procname = "max_reconnectms",
|
||||
.data = &ksocknal_tunables.ksnd_max_reconnectms,
|
||||
.maxlen = sizeof (int),
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_dointvec,
|
||||
.strategy = &sysctl_intvec,
|
||||
},
|
||||
{
|
||||
.ctl_name = SOCKLND_EAGER_ACK,
|
||||
.procname = "eager_ack",
|
||||
.data = &ksocknal_tunables.ksnd_eager_ack,
|
||||
.maxlen = sizeof (int),
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_dointvec,
|
||||
.strategy = &sysctl_intvec,
|
||||
},
|
||||
{
|
||||
.ctl_name = SOCKLND_ZERO_COPY,
|
||||
.procname = "zero_copy",
|
||||
.data = &ksocknal_tunables.ksnd_zc_min_payload,
|
||||
.maxlen = sizeof (int),
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_dointvec,
|
||||
.strategy = &sysctl_intvec,
|
||||
},
|
||||
{
|
||||
.ctl_name = SOCKLND_ZERO_COPY_RECV,
|
||||
.procname = "zero_copy_recv",
|
||||
.data = &ksocknal_tunables.ksnd_zc_recv,
|
||||
.maxlen = sizeof (int),
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_dointvec,
|
||||
.strategy = &sysctl_intvec,
|
||||
},
|
||||
|
||||
{
|
||||
.ctl_name = SOCKLND_ZERO_COPY_RECV_MIN_NFRAGS,
|
||||
.procname = "zero_copy_recv",
|
||||
.data = &ksocknal_tunables.ksnd_zc_recv_min_nfrags,
|
||||
.maxlen = sizeof (int),
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_dointvec,
|
||||
.strategy = &sysctl_intvec,
|
||||
},
|
||||
{
|
||||
.ctl_name = SOCKLND_TYPED,
|
||||
.procname = "typed",
|
||||
.data = &ksocknal_tunables.ksnd_typed_conns,
|
||||
.maxlen = sizeof (int),
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_dointvec,
|
||||
.strategy = &sysctl_intvec,
|
||||
},
|
||||
{
|
||||
.ctl_name = SOCKLND_BULK_MIN,
|
||||
.procname = "min_bulk",
|
||||
.data = &ksocknal_tunables.ksnd_min_bulk,
|
||||
.maxlen = sizeof (int),
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_dointvec,
|
||||
.strategy = &sysctl_intvec,
|
||||
},
|
||||
{
|
||||
.ctl_name = SOCKLND_RX_BUFFER_SIZE,
|
||||
.procname = "rx_buffer_size",
|
||||
.data = &ksocknal_tunables.ksnd_rx_buffer_size,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_dointvec,
|
||||
.strategy = &sysctl_intvec,
|
||||
},
|
||||
{
|
||||
.ctl_name = SOCKLND_TX_BUFFER_SIZE,
|
||||
.procname = "tx_buffer_size",
|
||||
.data = &ksocknal_tunables.ksnd_tx_buffer_size,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_dointvec,
|
||||
.strategy = &sysctl_intvec,
|
||||
},
|
||||
{
|
||||
.ctl_name = SOCKLND_NAGLE,
|
||||
.procname = "nagle",
|
||||
.data = &ksocknal_tunables.ksnd_nagle,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_dointvec,
|
||||
.strategy = &sysctl_intvec,
|
||||
},
|
||||
{
|
||||
.ctl_name = SOCKLND_ROUND_ROBIN,
|
||||
.procname = "round_robin",
|
||||
.data = &ksocknal_tunables.ksnd_round_robin,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_dointvec,
|
||||
.strategy = &sysctl_intvec,
|
||||
},
|
||||
{
|
||||
.ctl_name = SOCKLND_KEEPALIVE,
|
||||
.procname = "keepalive",
|
||||
.data = &ksocknal_tunables.ksnd_keepalive,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_dointvec,
|
||||
.strategy = &sysctl_intvec,
|
||||
},
|
||||
{
|
||||
.ctl_name = SOCKLND_KEEPALIVE_IDLE,
|
||||
.procname = "keepalive_idle",
|
||||
.data = &ksocknal_tunables.ksnd_keepalive_idle,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_dointvec,
|
||||
.strategy = &sysctl_intvec,
|
||||
},
|
||||
{
|
||||
.ctl_name = SOCKLND_KEEPALIVE_COUNT,
|
||||
.procname = "keepalive_count",
|
||||
.data = &ksocknal_tunables.ksnd_keepalive_count,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_dointvec,
|
||||
.strategy = &sysctl_intvec,
|
||||
},
|
||||
{
|
||||
.ctl_name = SOCKLND_KEEPALIVE_INTVL,
|
||||
.procname = "keepalive_intvl",
|
||||
.data = &ksocknal_tunables.ksnd_keepalive_intvl,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_dointvec,
|
||||
.strategy = &sysctl_intvec,
|
||||
},
|
||||
#if SOCKNAL_VERSION_DEBUG
|
||||
{
|
||||
.ctl_name = SOCKLND_PROTOCOL,
|
||||
.procname = "protocol",
|
||||
.data = &ksocknal_tunables.ksnd_protocol,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_dointvec,
|
||||
.strategy = &sysctl_intvec,
|
||||
},
|
||||
#endif
|
||||
{0}
|
||||
};
|
||||
|
||||
|
||||
ctl_table_t ksocknal_top_ctl_table[] = {
|
||||
{
|
||||
.ctl_name = CTL_SOCKLND,
|
||||
.procname = "socknal",
|
||||
.data = NULL,
|
||||
.maxlen = 0,
|
||||
.mode = 0555,
|
||||
.child = ksocknal_ctl_table
|
||||
},
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
int
|
||||
ksocknal_lib_tunables_init ()
|
||||
{
|
||||
if (!*ksocknal_tunables.ksnd_typed_conns) {
|
||||
int rc = -EINVAL;
|
||||
#if SOCKNAL_VERSION_DEBUG
|
||||
if (*ksocknal_tunables.ksnd_protocol < 3)
|
||||
rc = 0;
|
||||
#endif
|
||||
if (rc != 0) {
|
||||
CERROR("Protocol V3.x MUST have typed connections\n");
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
if (*ksocknal_tunables.ksnd_zc_recv_min_nfrags < 2)
|
||||
*ksocknal_tunables.ksnd_zc_recv_min_nfrags = 2;
|
||||
if (*ksocknal_tunables.ksnd_zc_recv_min_nfrags > LNET_MAX_IOV)
|
||||
*ksocknal_tunables.ksnd_zc_recv_min_nfrags = LNET_MAX_IOV;
|
||||
|
||||
ksocknal_tunables.ksnd_sysctl =
|
||||
register_sysctl_table(ksocknal_top_ctl_table);
|
||||
|
||||
if (ksocknal_tunables.ksnd_sysctl == NULL)
|
||||
CWARN("Can't setup /proc tunables\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
ksocknal_lib_tunables_fini(void)
|
||||
{
|
||||
if (ksocknal_tunables.ksnd_sysctl != NULL)
|
||||
unregister_sysctl_table(ksocknal_tunables.ksnd_sysctl);
|
||||
}
|
||||
#else
|
||||
int
|
||||
ksocknal_lib_tunables_init(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
ksocknal_lib_tunables_fini(void)
|
||||
{
|
||||
}
|
||||
#endif /* # if CONFIG_SYSCTL && !CFS_SYSFS_MODULE_PARM */
|
||||
|
||||
int
|
||||
ksocknal_lib_get_conn_addrs (ksock_conn_t *conn)
|
||||
{
|
||||
|
|
|
@ -181,18 +181,8 @@ int ksocknal_tunables_init(void)
|
|||
ksocknal_tunables.ksnd_protocol = &protocol;
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM
|
||||
ksocknal_tunables.ksnd_sysctl = NULL;
|
||||
#endif
|
||||
|
||||
if (*ksocknal_tunables.ksnd_zc_min_payload < (2 << 10))
|
||||
*ksocknal_tunables.ksnd_zc_min_payload = (2 << 10);
|
||||
|
||||
/* initialize platform-sepcific tunables */
|
||||
return ksocknal_lib_tunables_init();
|
||||
return 0;
|
||||
};
|
||||
|
||||
void ksocknal_tunables_fini(void)
|
||||
{
|
||||
ksocknal_lib_tunables_fini();
|
||||
}
|
||||
|
|
|
@ -855,55 +855,46 @@ static ctl_table_t lnet_table[] = {
|
|||
* to go via /proc for portability.
|
||||
*/
|
||||
{
|
||||
INIT_CTL_NAME(PSDEV_LNET_STATS)
|
||||
.procname = "stats",
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_lnet_stats,
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(PSDEV_LNET_ROUTES)
|
||||
.procname = "routes",
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_lnet_routes,
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(PSDEV_LNET_ROUTERS)
|
||||
.procname = "routers",
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_lnet_routers,
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(PSDEV_LNET_PEERS)
|
||||
.procname = "peers",
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_lnet_peers,
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(PSDEV_LNET_PEERS)
|
||||
.procname = "buffers",
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_lnet_buffers,
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(PSDEV_LNET_NIS)
|
||||
.procname = "nis",
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_lnet_nis,
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(PSDEV_LNET_PTL_ROTOR)
|
||||
.procname = "portal_rotor",
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_lnet_portal_rotor,
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(0)
|
||||
}
|
||||
};
|
||||
|
||||
static ctl_table_t top_table[] = {
|
||||
{
|
||||
INIT_CTL_NAME(CTL_LNET)
|
||||
.procname = "lnet",
|
||||
.mode = 0555,
|
||||
.data = NULL,
|
||||
|
@ -911,7 +902,6 @@ static ctl_table_t top_table[] = {
|
|||
.child = lnet_table,
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(0)
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -723,12 +723,12 @@ lst_stat_query_ioctl(lstio_stat_args_t *args)
|
|||
|
||||
int lst_test_add_ioctl(lstio_test_args_t *args)
|
||||
{
|
||||
char *name;
|
||||
char *srcgrp = NULL;
|
||||
char *dstgrp = NULL;
|
||||
void *param = NULL;
|
||||
int ret = 0;
|
||||
int rc = -ENOMEM;
|
||||
char *batch_name;
|
||||
char *src_name = NULL;
|
||||
char *dst_name = NULL;
|
||||
void *param = NULL;
|
||||
int ret = 0;
|
||||
int rc = -ENOMEM;
|
||||
|
||||
if (args->lstio_tes_resultp == NULL ||
|
||||
args->lstio_tes_retp == NULL ||
|
||||
|
@ -755,16 +755,16 @@ int lst_test_add_ioctl(lstio_test_args_t *args)
|
|||
args->lstio_tes_param_len > PAGE_CACHE_SIZE - sizeof(lstcon_test_t)))
|
||||
return -EINVAL;
|
||||
|
||||
LIBCFS_ALLOC(name, args->lstio_tes_bat_nmlen + 1);
|
||||
if (name == NULL)
|
||||
LIBCFS_ALLOC(batch_name, args->lstio_tes_bat_nmlen + 1);
|
||||
if (batch_name == NULL)
|
||||
return rc;
|
||||
|
||||
LIBCFS_ALLOC(srcgrp, args->lstio_tes_sgrp_nmlen + 1);
|
||||
if (srcgrp == NULL)
|
||||
LIBCFS_ALLOC(src_name, args->lstio_tes_sgrp_nmlen + 1);
|
||||
if (src_name == NULL)
|
||||
goto out;
|
||||
|
||||
LIBCFS_ALLOC(dstgrp, args->lstio_tes_dgrp_nmlen + 1);
|
||||
if (dstgrp == NULL)
|
||||
LIBCFS_ALLOC(dst_name, args->lstio_tes_dgrp_nmlen + 1);
|
||||
if (dst_name == NULL)
|
||||
goto out;
|
||||
|
||||
if (args->lstio_tes_param != NULL) {
|
||||
|
@ -774,39 +774,37 @@ int lst_test_add_ioctl(lstio_test_args_t *args)
|
|||
}
|
||||
|
||||
rc = -EFAULT;
|
||||
if (copy_from_user(name,
|
||||
args->lstio_tes_bat_name,
|
||||
args->lstio_tes_bat_nmlen) ||
|
||||
copy_from_user(srcgrp,
|
||||
args->lstio_tes_sgrp_name,
|
||||
args->lstio_tes_sgrp_nmlen) ||
|
||||
copy_from_user(dstgrp,
|
||||
args->lstio_tes_dgrp_name,
|
||||
args->lstio_tes_dgrp_nmlen) ||
|
||||
if (copy_from_user(batch_name, args->lstio_tes_bat_name,
|
||||
args->lstio_tes_bat_nmlen) ||
|
||||
copy_from_user(src_name, args->lstio_tes_sgrp_name,
|
||||
args->lstio_tes_sgrp_nmlen) ||
|
||||
copy_from_user(dst_name, args->lstio_tes_dgrp_name,
|
||||
args->lstio_tes_dgrp_nmlen) ||
|
||||
copy_from_user(param, args->lstio_tes_param,
|
||||
args->lstio_tes_param_len))
|
||||
goto out;
|
||||
|
||||
rc = lstcon_test_add(name,
|
||||
rc = lstcon_test_add(batch_name,
|
||||
args->lstio_tes_type,
|
||||
args->lstio_tes_loop,
|
||||
args->lstio_tes_concur,
|
||||
args->lstio_tes_dist, args->lstio_tes_span,
|
||||
srcgrp, dstgrp, param, args->lstio_tes_param_len,
|
||||
src_name, dst_name, param,
|
||||
args->lstio_tes_param_len,
|
||||
&ret, args->lstio_tes_resultp);
|
||||
|
||||
if (ret != 0)
|
||||
rc = (copy_to_user(args->lstio_tes_retp, &ret,
|
||||
sizeof(ret))) ? -EFAULT : 0;
|
||||
out:
|
||||
if (name != NULL)
|
||||
LIBCFS_FREE(name, args->lstio_tes_bat_nmlen + 1);
|
||||
if (batch_name != NULL)
|
||||
LIBCFS_FREE(batch_name, args->lstio_tes_bat_nmlen + 1);
|
||||
|
||||
if (srcgrp != NULL)
|
||||
LIBCFS_FREE(srcgrp, args->lstio_tes_sgrp_nmlen + 1);
|
||||
if (src_name != NULL)
|
||||
LIBCFS_FREE(src_name, args->lstio_tes_sgrp_nmlen + 1);
|
||||
|
||||
if (dstgrp != NULL)
|
||||
LIBCFS_FREE(dstgrp, args->lstio_tes_dgrp_nmlen + 1);
|
||||
if (dst_name != NULL)
|
||||
LIBCFS_FREE(dst_name, args->lstio_tes_dgrp_nmlen + 1);
|
||||
|
||||
if (param != NULL)
|
||||
LIBCFS_FREE(param, args->lstio_tes_param_len);
|
||||
|
|
|
@ -311,7 +311,7 @@ lstcon_rpc_trans_abort(lstcon_rpc_trans_t *trans, int error)
|
|||
|
||||
sfw_abort_rpc(rpc);
|
||||
|
||||
if (error != ETIMEDOUT)
|
||||
if (error != ETIMEDOUT)
|
||||
continue;
|
||||
|
||||
nd = crpc->crp_node;
|
||||
|
|
|
@ -265,7 +265,7 @@ lstcon_group_decref(lstcon_group_t *grp)
|
|||
}
|
||||
|
||||
static int
|
||||
lstcon_group_find(char *name, lstcon_group_t **grpp)
|
||||
lstcon_group_find(const char *name, lstcon_group_t **grpp)
|
||||
{
|
||||
lstcon_group_t *grp;
|
||||
|
||||
|
@ -831,7 +831,7 @@ lstcon_group_info(char *name, lstcon_ndlist_ent_t *gents_p,
|
|||
}
|
||||
|
||||
int
|
||||
lstcon_batch_find(char *name, lstcon_batch_t **batpp)
|
||||
lstcon_batch_find(const char *name, lstcon_batch_t **batpp)
|
||||
{
|
||||
lstcon_batch_t *bat;
|
||||
|
||||
|
@ -1237,40 +1237,76 @@ lstcon_test_nodes_add(lstcon_test_t *test, struct list_head *result_up)
|
|||
goto again;
|
||||
}
|
||||
|
||||
int
|
||||
lstcon_test_add(char *name, int type, int loop, int concur,
|
||||
int dist, int span, char *src_name, char * dst_name,
|
||||
void *param, int paramlen, int *retp,
|
||||
struct list_head *result_up)
|
||||
static int
|
||||
lstcon_verify_batch(const char *name, lstcon_batch_t **batch)
|
||||
{
|
||||
lstcon_group_t *src_grp = NULL;
|
||||
lstcon_group_t *dst_grp = NULL;
|
||||
lstcon_test_t *test = NULL;
|
||||
lstcon_batch_t *batch;
|
||||
int rc;
|
||||
int rc;
|
||||
|
||||
rc = lstcon_batch_find(name, &batch);
|
||||
rc = lstcon_batch_find(name, batch);
|
||||
if (rc != 0) {
|
||||
CDEBUG(D_NET, "Can't find batch %s\n", name);
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (batch->bat_state != LST_BATCH_IDLE) {
|
||||
if ((*batch)->bat_state != LST_BATCH_IDLE) {
|
||||
CDEBUG(D_NET, "Can't change running batch %s\n", name);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
lstcon_verify_group(const char *name, lstcon_group_t **grp)
|
||||
{
|
||||
int rc;
|
||||
lstcon_ndlink_t *ndl;
|
||||
|
||||
rc = lstcon_group_find(name, grp);
|
||||
if (rc != 0) {
|
||||
CDEBUG(D_NET, "can't find group %s\n", name);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = lstcon_group_find(src_name, &src_grp);
|
||||
if (rc != 0) {
|
||||
CDEBUG(D_NET, "Can't find group %s\n", src_name);
|
||||
goto out;
|
||||
list_for_each_entry(ndl, &(*grp)->grp_ndl_list, ndl_link) {
|
||||
if (ndl->ndl_node->nd_state == LST_NODE_ACTIVE)
|
||||
return 0;
|
||||
}
|
||||
|
||||
rc = lstcon_group_find(dst_name, &dst_grp);
|
||||
if (rc != 0) {
|
||||
CDEBUG(D_NET, "Can't find group %s\n", dst_name);
|
||||
CDEBUG(D_NET, "Group %s has no ACTIVE nodes\n", name);
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
int
|
||||
lstcon_test_add(char *batch_name, int type, int loop,
|
||||
int concur, int dist, int span,
|
||||
char *src_name, char *dst_name,
|
||||
void *param, int paramlen, int *retp,
|
||||
struct list_head *result_up)
|
||||
{
|
||||
lstcon_test_t *test = NULL;
|
||||
int rc;
|
||||
lstcon_group_t *src_grp = NULL;
|
||||
lstcon_group_t *dst_grp = NULL;
|
||||
lstcon_batch_t *batch = NULL;
|
||||
|
||||
/*
|
||||
* verify that a batch of the given name exists, and the groups
|
||||
* that will be part of the batch exist and have at least one
|
||||
* active node
|
||||
*/
|
||||
rc = lstcon_verify_batch(batch_name, &batch);
|
||||
if (rc != 0)
|
||||
goto out;
|
||||
|
||||
rc = lstcon_verify_group(src_name, &src_grp);
|
||||
if (rc != 0)
|
||||
goto out;
|
||||
|
||||
rc = lstcon_verify_group(dst_name, &dst_grp);
|
||||
if (rc != 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (dst_grp->grp_userland)
|
||||
*retp = 1;
|
||||
|
@ -1284,18 +1320,18 @@ lstcon_test_add(char *name, int type, int loop, int concur,
|
|||
}
|
||||
|
||||
memset(test, 0, offsetof(lstcon_test_t, tes_param[paramlen]));
|
||||
test->tes_hdr.tsb_id = batch->bat_hdr.tsb_id;
|
||||
test->tes_batch = batch;
|
||||
test->tes_type = type;
|
||||
test->tes_oneside = 0; /* TODO */
|
||||
test->tes_loop = loop;
|
||||
test->tes_hdr.tsb_id = batch->bat_hdr.tsb_id;
|
||||
test->tes_batch = batch;
|
||||
test->tes_type = type;
|
||||
test->tes_oneside = 0; /* TODO */
|
||||
test->tes_loop = loop;
|
||||
test->tes_concur = concur;
|
||||
test->tes_stop_onerr = 1; /* TODO */
|
||||
test->tes_span = span;
|
||||
test->tes_dist = dist;
|
||||
test->tes_stop_onerr = 1; /* TODO */
|
||||
test->tes_span = span;
|
||||
test->tes_dist = dist;
|
||||
test->tes_cliidx = 0; /* just used for creating RPC */
|
||||
test->tes_src_grp = src_grp;
|
||||
test->tes_dst_grp = dst_grp;
|
||||
test->tes_src_grp = src_grp;
|
||||
test->tes_dst_grp = dst_grp;
|
||||
INIT_LIST_HEAD(&test->tes_trans_list);
|
||||
|
||||
if (param != NULL) {
|
||||
|
@ -1310,7 +1346,8 @@ lstcon_test_add(char *name, int type, int loop, int concur,
|
|||
|
||||
if (lstcon_trans_stat()->trs_rpc_errno != 0 ||
|
||||
lstcon_trans_stat()->trs_fwk_errno != 0)
|
||||
CDEBUG(D_NET, "Failed to add test %d to batch %s\n", type, name);
|
||||
CDEBUG(D_NET, "Failed to add test %d to batch %s\n", type,
|
||||
batch_name);
|
||||
|
||||
/* add to test list anyway, so user can check what's going on */
|
||||
list_add_tail(&test->tes_link, &batch->bat_test_list);
|
||||
|
|
|
@ -224,9 +224,9 @@ extern int lstcon_group_stat(char *grp_name, int timeout,
|
|||
struct list_head *result_up);
|
||||
extern int lstcon_nodes_stat(int count, lnet_process_id_t *ids_up,
|
||||
int timeout, struct list_head *result_up);
|
||||
extern int lstcon_test_add(char *name, int type, int loop, int concur,
|
||||
int dist, int span, char *src_name, char * dst_name,
|
||||
extern int lstcon_test_add(char *batch_name, int type, int loop,
|
||||
int concur, int dist, int span,
|
||||
char *src_name, char *dst_name,
|
||||
void *param, int paramlen, int *retp,
|
||||
struct list_head *result_up);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -504,10 +504,7 @@ static int __init fld_mod_init(void)
|
|||
fld_type_proc_dir = lprocfs_register(LUSTRE_FLD_NAME,
|
||||
proc_lustre_root,
|
||||
NULL, NULL);
|
||||
if (IS_ERR(fld_type_proc_dir))
|
||||
return PTR_ERR(fld_type_proc_dir);
|
||||
|
||||
return 0;
|
||||
return PTR_ERR_OR_ZERO(fld_type_proc_dir);
|
||||
}
|
||||
|
||||
static void __exit fld_mod_exit(void)
|
||||
|
|
|
@ -2388,7 +2388,11 @@ struct cl_io {
|
|||
* Right now, only two opertaions need to verify layout: glimpse
|
||||
* and setattr.
|
||||
*/
|
||||
ci_verify_layout:1;
|
||||
ci_verify_layout:1,
|
||||
/**
|
||||
* file is released, restore has to to be triggered by vvp layer
|
||||
*/
|
||||
ci_restore_needed:1;
|
||||
/**
|
||||
* Number of pages owned by this IO. For invariant checking.
|
||||
*/
|
||||
|
|
|
@ -52,8 +52,8 @@ struct lustre_intent_data {
|
|||
|
||||
struct lookup_intent {
|
||||
int it_op;
|
||||
int it_flags;
|
||||
int it_create_mode;
|
||||
__u64 it_flags;
|
||||
union {
|
||||
struct lustre_intent_data lustre;
|
||||
} d;
|
||||
|
|
|
@ -1,91 +0,0 @@
|
|||
/*
|
||||
* GPL HEADER START
|
||||
*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 only,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License version 2 for more details (a copy is included
|
||||
* in the LICENSE file that accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* version 2 along with this program; If not, see
|
||||
* http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*
|
||||
* GPL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*
|
||||
* Copyright (c) 2011, 2012, Intel Corporation.
|
||||
*/
|
||||
/*
|
||||
* This file is part of Lustre, http://www.lustre.org/
|
||||
* Lustre is a trademark of Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _LUSTRE_LU_TARGET_H
|
||||
#define _LUSTRE_LU_TARGET_H
|
||||
|
||||
#include <dt_object.h>
|
||||
#include <lustre_disk.h>
|
||||
|
||||
struct lu_target {
|
||||
struct obd_device *lut_obd;
|
||||
struct dt_device *lut_bottom;
|
||||
/** last_rcvd file */
|
||||
struct dt_object *lut_last_rcvd;
|
||||
/* transaction callbacks */
|
||||
struct dt_txn_callback lut_txn_cb;
|
||||
/** server data in last_rcvd file */
|
||||
struct lr_server_data lut_lsd;
|
||||
/** Server last transaction number */
|
||||
__u64 lut_last_transno;
|
||||
/** Lock protecting last transaction number */
|
||||
spinlock_t lut_translock;
|
||||
/** Lock protecting client bitmap */
|
||||
spinlock_t lut_client_bitmap_lock;
|
||||
/** Bitmap of known clients */
|
||||
unsigned long *lut_client_bitmap;
|
||||
};
|
||||
|
||||
typedef void (*tgt_cb_t)(struct lu_target *lut, __u64 transno,
|
||||
void *data, int err);
|
||||
struct tgt_commit_cb {
|
||||
tgt_cb_t tgt_cb_func;
|
||||
void *tgt_cb_data;
|
||||
};
|
||||
|
||||
void tgt_boot_epoch_update(struct lu_target *lut);
|
||||
int tgt_last_commit_cb_add(struct thandle *th, struct lu_target *lut,
|
||||
struct obd_export *exp, __u64 transno);
|
||||
int tgt_new_client_cb_add(struct thandle *th, struct obd_export *exp);
|
||||
int tgt_init(const struct lu_env *env, struct lu_target *lut,
|
||||
struct obd_device *obd, struct dt_device *dt);
|
||||
void tgt_fini(const struct lu_env *env, struct lu_target *lut);
|
||||
int tgt_client_alloc(struct obd_export *exp);
|
||||
void tgt_client_free(struct obd_export *exp);
|
||||
int tgt_client_del(const struct lu_env *env, struct obd_export *exp);
|
||||
int tgt_client_add(const struct lu_env *env, struct obd_export *exp, int);
|
||||
int tgt_client_new(const struct lu_env *env, struct obd_export *exp);
|
||||
int tgt_client_data_read(const struct lu_env *env, struct lu_target *tg,
|
||||
struct lsd_client_data *lcd, loff_t *off, int index);
|
||||
int tgt_client_data_write(const struct lu_env *env, struct lu_target *tg,
|
||||
struct lsd_client_data *lcd, loff_t *off, struct thandle *th);
|
||||
int tgt_server_data_read(const struct lu_env *env, struct lu_target *tg);
|
||||
int tgt_server_data_write(const struct lu_env *env, struct lu_target *tg,
|
||||
struct thandle *th);
|
||||
int tgt_server_data_update(const struct lu_env *env, struct lu_target *tg, int sync);
|
||||
int tgt_truncate_last_rcvd(const struct lu_env *env, struct lu_target *tg, loff_t off);
|
||||
|
||||
#endif /* __LUSTRE_LU_TARGET_H */
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* GPL HEADER START
|
||||
*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 only,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License version 2 for more details (a copy is included
|
||||
* in the LICENSE file that accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* version 2 along with this program; If not, see
|
||||
* http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*
|
||||
* GPL HEADER END
|
||||
*/
|
||||
/*
|
||||
* This file is part of Lustre, http://www.lustre.org/
|
||||
* Lustre is a trademark of Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
/*
|
||||
* NOTE: This file is DEPRECATED! Please include lustreapi.h directly
|
||||
* instead of this file. This file will be removed from a future version
|
||||
* of lustre!
|
||||
*/
|
||||
|
||||
#ifndef _LIBLUSTREAPI_H_
|
||||
#define _LIBLUSTREAPI_H_
|
||||
|
||||
#include <lustre/lustreapi.h>
|
||||
#warning "Including liblustreapi.h is deprecated. Include lustreapi.h directly."
|
||||
|
||||
#endif
|
|
@ -1725,10 +1725,7 @@ static inline __u32 lov_mds_md_size(__u16 stripes, __u32 lmm_magic)
|
|||
#define OBD_MD_MDS (0x0000000100000000ULL) /* where an inode lives on */
|
||||
#define OBD_MD_REINT (0x0000000200000000ULL) /* reintegrate oa */
|
||||
#define OBD_MD_MEA (0x0000000400000000ULL) /* CMD split EA */
|
||||
|
||||
/* OBD_MD_MDTIDX is used to get MDT index, but it is never been used overwire,
|
||||
* and it is already obsolete since 2.3 */
|
||||
/* #define OBD_MD_MDTIDX (0x0000000800000000ULL) */
|
||||
#define OBD_MD_TSTATE (0x0000000800000000ULL) /* transient state field */
|
||||
|
||||
#define OBD_MD_FLXATTR (0x0000001000000000ULL) /* xattr */
|
||||
#define OBD_MD_FLXATTRLS (0x0000002000000000ULL) /* xattr list */
|
||||
|
@ -2120,6 +2117,7 @@ extern void lustre_swab_generic_32s (__u32 *val);
|
|||
#define DISP_ENQ_OPEN_REF 0x00800000
|
||||
#define DISP_ENQ_CREATE_REF 0x01000000
|
||||
#define DISP_OPEN_LOCK 0x02000000
|
||||
#define DISP_OPEN_LEASE 0x04000000
|
||||
|
||||
/* INODE LOCK PARTS */
|
||||
#define MDS_INODELOCK_LOOKUP 0x000001 /* dentry, mode, owner, group */
|
||||
|
@ -2207,6 +2205,11 @@ static inline int ll_inode_to_ext_flags(int iflags)
|
|||
((iflags & S_IMMUTABLE) ? LUSTRE_IMMUTABLE_FL : 0));
|
||||
}
|
||||
|
||||
/* 64 possible states */
|
||||
enum md_transient_state {
|
||||
MS_RESTORE = (1 << 0), /* restore is running */
|
||||
};
|
||||
|
||||
struct mdt_body {
|
||||
struct lu_fid fid1;
|
||||
struct lu_fid fid2;
|
||||
|
@ -2218,7 +2221,9 @@ struct mdt_body {
|
|||
obd_time ctime;
|
||||
__u64 blocks; /* XID, in the case of MDS_READPAGE */
|
||||
__u64 ioepoch;
|
||||
__u64 unused1; /* was "ino" until 2.4.0 */
|
||||
__u64 t_state; /* transient file state defined in
|
||||
* enum md_transient_state
|
||||
* was "ino" until 2.4.0 */
|
||||
__u32 fsuid;
|
||||
__u32 fsgid;
|
||||
__u32 capability;
|
||||
|
@ -2373,6 +2378,10 @@ extern void lustre_swab_mdt_rec_setattr (struct mdt_rec_setattr *sa);
|
|||
* hsm restore) */
|
||||
#define MDS_OPEN_VOLATILE 0400000000000ULL /* File is volatile = created
|
||||
unlinked */
|
||||
#define MDS_OPEN_LEASE 01000000000000ULL /* Open the file and grant lease
|
||||
* delegation, succeed if it's not
|
||||
* being opened with conflict mode.
|
||||
*/
|
||||
|
||||
/* permission for create non-directory file */
|
||||
#define MAY_CREATE (1 << 7)
|
||||
|
|
|
@ -245,6 +245,9 @@ struct ost_id {
|
|||
#define LL_IOC_LMV_GETSTRIPE _IOWR('f', 241, struct lmv_user_md)
|
||||
#define LL_IOC_REMOVE_ENTRY _IOWR('f', 242, __u64)
|
||||
|
||||
#define LL_IOC_SET_LEASE _IOWR('f', 243, long)
|
||||
#define LL_IOC_GET_LEASE _IO('f', 244)
|
||||
|
||||
#define LL_STATFS_LMV 1
|
||||
#define LL_STATFS_LOV 2
|
||||
#define LL_STATFS_NODELAY 4
|
||||
|
|
|
@ -1,310 +0,0 @@
|
|||
/*
|
||||
* GPL HEADER START
|
||||
*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 only,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License version 2 for more details (a copy is included
|
||||
* in the LICENSE file that accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* version 2 along with this program; If not, see
|
||||
* http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*
|
||||
* GPL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*
|
||||
* Copyright (c) 2011, 2012, Whamcloud, Inc.
|
||||
*/
|
||||
/*
|
||||
* This file is part of Lustre, http://www.lustre.org/
|
||||
* Lustre is a trademark of Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _LUSTREAPI_H_
|
||||
#define _LUSTREAPI_H_
|
||||
|
||||
/** \defgroup llapi llapi
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include <lustre/lustre_user.h>
|
||||
|
||||
typedef void (*llapi_cb_t)(char *obd_type_name, char *obd_name, char *obd_uuid, void *args);
|
||||
|
||||
/* lustreapi message severity level */
|
||||
enum llapi_message_level {
|
||||
LLAPI_MSG_OFF = 0,
|
||||
LLAPI_MSG_FATAL = 1,
|
||||
LLAPI_MSG_ERROR = 2,
|
||||
LLAPI_MSG_WARN = 3,
|
||||
LLAPI_MSG_NORMAL = 4,
|
||||
LLAPI_MSG_INFO = 5,
|
||||
LLAPI_MSG_DEBUG = 6,
|
||||
LLAPI_MSG_MAX
|
||||
};
|
||||
|
||||
/* the bottom three bits reserved for llapi_message_level */
|
||||
#define LLAPI_MSG_MASK 0x00000007
|
||||
#define LLAPI_MSG_NO_ERRNO 0x00000010
|
||||
|
||||
extern void llapi_msg_set_level(int level);
|
||||
extern void llapi_error(int level, int rc, char *fmt, ...);
|
||||
#define llapi_err_noerrno(level, fmt, a...) \
|
||||
llapi_error((level) | LLAPI_MSG_NO_ERRNO, 0, fmt, ## a)
|
||||
extern void llapi_printf(int level, char *fmt, ...);
|
||||
extern int llapi_file_create(const char *name, unsigned long long stripe_size,
|
||||
int stripe_offset, int stripe_count,
|
||||
int stripe_pattern);
|
||||
extern int llapi_file_open(const char *name, int flags, int mode,
|
||||
unsigned long long stripe_size, int stripe_offset,
|
||||
int stripe_count, int stripe_pattern);
|
||||
extern int llapi_file_create_pool(const char *name,
|
||||
unsigned long long stripe_size,
|
||||
int stripe_offset, int stripe_count,
|
||||
int stripe_pattern, char *pool_name);
|
||||
extern int llapi_file_open_pool(const char *name, int flags, int mode,
|
||||
unsigned long long stripe_size,
|
||||
int stripe_offset, int stripe_count,
|
||||
int stripe_pattern, char *pool_name);
|
||||
extern int llapi_poollist(const char *name);
|
||||
extern int llapi_get_poollist(const char *name, char **poollist, int list_size,
|
||||
char *buffer, int buffer_size);
|
||||
extern int llapi_get_poolmembers(const char *poolname, char **members,
|
||||
int list_size, char *buffer, int buffer_size);
|
||||
extern int llapi_file_get_stripe(const char *path, struct lov_user_md *lum);
|
||||
#define HAVE_LLAPI_FILE_LOOKUP
|
||||
extern int llapi_file_lookup(int dirfd, const char *name);
|
||||
|
||||
#define VERBOSE_COUNT 0x1
|
||||
#define VERBOSE_SIZE 0x2
|
||||
#define VERBOSE_OFFSET 0x4
|
||||
#define VERBOSE_POOL 0x8
|
||||
#define VERBOSE_DETAIL 0x10
|
||||
#define VERBOSE_OBJID 0x20
|
||||
#define VERBOSE_GENERATION 0x40
|
||||
#define VERBOSE_MDTINDEX 0x80
|
||||
#define VERBOSE_ALL (VERBOSE_COUNT | VERBOSE_SIZE | VERBOSE_OFFSET | \
|
||||
VERBOSE_POOL | VERBOSE_OBJID | VERBOSE_GENERATION)
|
||||
|
||||
struct find_param {
|
||||
unsigned int maxdepth;
|
||||
time_t atime;
|
||||
time_t mtime;
|
||||
time_t ctime;
|
||||
int asign; /* cannot be bitfields due to using pointers to */
|
||||
int csign; /* access them during argument parsing. */
|
||||
int msign;
|
||||
int type;
|
||||
int size_sign:2, /* these need to be signed values */
|
||||
stripesize_sign:2,
|
||||
stripecount_sign:2;
|
||||
unsigned long long size;
|
||||
unsigned long long size_units;
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
|
||||
unsigned long zeroend:1,
|
||||
recursive:1,
|
||||
exclude_pattern:1,
|
||||
exclude_type:1,
|
||||
exclude_obd:1,
|
||||
exclude_mdt:1,
|
||||
exclude_gid:1,
|
||||
exclude_uid:1,
|
||||
check_gid:1, /* group ID */
|
||||
check_uid:1, /* user ID */
|
||||
check_pool:1, /* LOV pool name */
|
||||
check_size:1, /* file size */
|
||||
exclude_pool:1,
|
||||
exclude_size:1,
|
||||
exclude_atime:1,
|
||||
exclude_mtime:1,
|
||||
exclude_ctime:1,
|
||||
get_lmv:1, /* get MDT list from LMV */
|
||||
raw:1, /* do not fill in defaults */
|
||||
check_stripesize:1, /* LOV stripe size */
|
||||
exclude_stripesize:1,
|
||||
check_stripecount:1, /* LOV stripe count */
|
||||
exclude_stripecount:1;
|
||||
|
||||
int verbose;
|
||||
int quiet;
|
||||
|
||||
/* regular expression */
|
||||
char *pattern;
|
||||
|
||||
char *print_fmt;
|
||||
|
||||
struct obd_uuid *obduuid;
|
||||
int num_obds;
|
||||
int num_alloc_obds;
|
||||
int obdindex;
|
||||
int *obdindexes;
|
||||
|
||||
struct obd_uuid *mdtuuid;
|
||||
int num_mdts;
|
||||
int num_alloc_mdts;
|
||||
int mdtindex;
|
||||
int *mdtindexes;
|
||||
int file_mdtindex;
|
||||
|
||||
int lumlen;
|
||||
struct lov_user_mds_data *lmd;
|
||||
|
||||
char poolname[LOV_MAXPOOLNAME + 1];
|
||||
|
||||
int fp_lmv_count;
|
||||
struct lmv_user_md *fp_lmv_md;
|
||||
|
||||
unsigned long long stripesize;
|
||||
unsigned long long stripesize_units;
|
||||
unsigned long long stripecount;
|
||||
|
||||
/* In-process parameters. */
|
||||
unsigned long got_uuids:1,
|
||||
obds_printed:1,
|
||||
have_fileinfo:1; /* file attrs and LOV xattr */
|
||||
unsigned int depth;
|
||||
dev_t st_dev;
|
||||
};
|
||||
|
||||
extern int llapi_ostlist(char *path, struct find_param *param);
|
||||
extern int llapi_uuid_match(char *real_uuid, char *search_uuid);
|
||||
extern int llapi_getstripe(char *path, struct find_param *param);
|
||||
extern int llapi_find(char *path, struct find_param *param);
|
||||
|
||||
extern int llapi_file_fget_mdtidx(int fd, int *mdtidx);
|
||||
extern int llapi_dir_create_pool(const char *name, int flags, int stripe_offset,
|
||||
int stripe_count, int stripe_pattern,
|
||||
char *poolname);
|
||||
int llapi_direntry_remove(char *dname);
|
||||
extern int llapi_obd_statfs(char *path, __u32 type, __u32 index,
|
||||
struct obd_statfs *stat_buf,
|
||||
struct obd_uuid *uuid_buf);
|
||||
extern int llapi_ping(char *obd_type, char *obd_name);
|
||||
extern int llapi_target_check(int num_types, char **obd_types, char *dir);
|
||||
extern int llapi_file_get_lov_uuid(const char *path, struct obd_uuid *lov_uuid);
|
||||
extern int llapi_file_get_lmv_uuid(const char *path, struct obd_uuid *lmv_uuid);
|
||||
extern int llapi_file_fget_lov_uuid(int fd, struct obd_uuid *lov_uuid);
|
||||
extern int llapi_lov_get_uuids(int fd, struct obd_uuid *uuidp, int *ost_count);
|
||||
extern int llapi_lmv_get_uuids(int fd, struct obd_uuid *uuidp, int *mdt_count);
|
||||
extern int llapi_is_lustre_mnttype(const char *type);
|
||||
extern int llapi_search_ost(char *fsname, char *poolname, char *ostname);
|
||||
extern int llapi_get_obd_count(char *mnt, int *count, int is_mdt);
|
||||
extern int parse_size(char *optarg, unsigned long long *size,
|
||||
unsigned long long *size_units, int bytes_spec);
|
||||
extern int llapi_search_mounts(const char *pathname, int index,
|
||||
char *mntdir, char *fsname);
|
||||
extern int llapi_search_fsname(const char *pathname, char *fsname);
|
||||
extern int llapi_getname(const char *path, char *buf, size_t size);
|
||||
|
||||
extern void llapi_ping_target(char *obd_type, char *obd_name,
|
||||
char *obd_uuid, void *args);
|
||||
|
||||
extern int llapi_search_rootpath(char *pathname, const char *fsname);
|
||||
|
||||
struct mntent;
|
||||
#define HAVE_LLAPI_IS_LUSTRE_MNT
|
||||
extern int llapi_is_lustre_mnt(struct mntent *mnt);
|
||||
extern int llapi_quotachown(char *path, int flag);
|
||||
extern int llapi_quotacheck(char *mnt, int check_type);
|
||||
extern int llapi_poll_quotacheck(char *mnt, struct if_quotacheck *qchk);
|
||||
extern int llapi_quotactl(char *mnt, struct if_quotactl *qctl);
|
||||
extern int llapi_target_iterate(int type_num, char **obd_type, void *args,
|
||||
llapi_cb_t cb);
|
||||
extern int llapi_get_connect_flags(const char *mnt, __u64 *flags);
|
||||
extern int llapi_lsetfacl(int argc, char *argv[]);
|
||||
extern int llapi_lgetfacl(int argc, char *argv[]);
|
||||
extern int llapi_rsetfacl(int argc, char *argv[]);
|
||||
extern int llapi_rgetfacl(int argc, char *argv[]);
|
||||
extern int llapi_cp(int argc, char *argv[]);
|
||||
extern int llapi_ls(int argc, char *argv[]);
|
||||
extern int llapi_fid2path(const char *device, const char *fidstr, char *path,
|
||||
int pathlen, long long *recno, int *linkno);
|
||||
extern int llapi_path2fid(const char *path, lustre_fid *fid);
|
||||
extern int llapi_fd2fid(const int fd, lustre_fid *fid);
|
||||
|
||||
extern int llapi_get_version(char *buffer, int buffer_size, char **version);
|
||||
extern int llapi_get_data_version(int fd, __u64 *data_version, __u64 flags);
|
||||
extern int llapi_hsm_state_get(const char *path, struct hsm_user_state *hus);
|
||||
extern int llapi_hsm_state_set(const char *path, __u64 setmask, __u64 clearmask,
|
||||
__u32 archive_id);
|
||||
|
||||
extern int llapi_create_volatile_idx(char *directory, int idx, int mode);
|
||||
static inline int llapi_create_volatile(char *directory, int mode)
|
||||
{
|
||||
return llapi_create_volatile_idx(directory, -1, mode);
|
||||
}
|
||||
|
||||
|
||||
extern int llapi_fswap_layouts(const int fd1, const int fd2,
|
||||
__u64 dv1, __u64 dv2, __u64 flags);
|
||||
extern int llapi_swap_layouts(const char *path1, const char *path2,
|
||||
__u64 dv1, __u64 dv2, __u64 flags);
|
||||
|
||||
/* Changelog interface. priv is private state, managed internally
|
||||
by these functions */
|
||||
#define CHANGELOG_FLAG_FOLLOW 0x01 /* Not yet implemented */
|
||||
#define CHANGELOG_FLAG_BLOCK 0x02 /* Blocking IO makes sense in case of
|
||||
slow user parsing of the records, but it also prevents us from cleaning
|
||||
up if the records are not consumed. */
|
||||
|
||||
/* Records received are in extentded format now, though most of them are still
|
||||
* written in disk in changelog_rec format (to save space and time), it's
|
||||
* converted to extented format in the lustre api to ease changelog analysis. */
|
||||
#define HAVE_CHANGELOG_EXTEND_REC 1
|
||||
|
||||
extern int llapi_changelog_start(void **priv, int flags, const char *mdtname,
|
||||
long long startrec);
|
||||
extern int llapi_changelog_fini(void **priv);
|
||||
extern int llapi_changelog_recv(void *priv, struct changelog_ext_rec **rech);
|
||||
extern int llapi_changelog_free(struct changelog_ext_rec **rech);
|
||||
/* Allow records up to endrec to be destroyed; requires registered id. */
|
||||
extern int llapi_changelog_clear(const char *mdtname, const char *idstr,
|
||||
long long endrec);
|
||||
|
||||
/* HSM copytool interface.
|
||||
* priv is private state, managed internally by these functions
|
||||
*/
|
||||
struct hsm_copytool_private;
|
||||
extern int llapi_hsm_copytool_start(struct hsm_copytool_private **priv,
|
||||
char *fsname, int flags,
|
||||
int archive_count, int *archives);
|
||||
extern int llapi_hsm_copytool_fini(struct hsm_copytool_private **priv);
|
||||
extern int llapi_hsm_copytool_recv(struct hsm_copytool_private *priv,
|
||||
struct hsm_action_list **hal, int *msgsize);
|
||||
extern int llapi_hsm_copytool_free(struct hsm_action_list **hal);
|
||||
extern int llapi_hsm_copy_start(char *mnt, struct hsm_copy *copy,
|
||||
const struct hsm_action_item *hai);
|
||||
extern int llapi_hsm_copy_end(char *mnt, struct hsm_copy *copy,
|
||||
const struct hsm_progress *hp);
|
||||
extern int llapi_hsm_progress(char *mnt, struct hsm_progress *hp);
|
||||
extern int llapi_hsm_import(const char *dst, int archive, struct stat *st,
|
||||
unsigned long long stripe_size, int stripe_offset,
|
||||
int stripe_count, int stripe_pattern,
|
||||
char *pool_name, lustre_fid *newfid);
|
||||
|
||||
/* HSM user interface */
|
||||
extern struct hsm_user_request *llapi_hsm_user_request_alloc(int itemcount,
|
||||
int data_len);
|
||||
extern int llapi_hsm_request(char *mnt, struct hsm_user_request *request);
|
||||
extern int llapi_hsm_current_action(const char *path,
|
||||
struct hsm_current_action *hca);
|
||||
/** @} llapi */
|
||||
|
||||
#endif
|
|
@ -35,7 +35,7 @@
|
|||
#ifndef LDLM_ALL_FLAGS_MASK
|
||||
|
||||
/** l_flags bits marked as "all_flags" bits */
|
||||
#define LDLM_FL_ALL_FLAGS_MASK 0x007FFFFFC08F132FULL
|
||||
#define LDLM_FL_ALL_FLAGS_MASK 0x00FFFFFFC08F132FULL
|
||||
|
||||
/** l_flags bits marked as "ast" bits */
|
||||
#define LDLM_FL_AST_MASK 0x0000000080000000ULL
|
||||
|
@ -53,7 +53,7 @@
|
|||
#define LDLM_FL_INHERIT_MASK 0x0000000000800000ULL
|
||||
|
||||
/** l_flags bits marked as "local_only" bits */
|
||||
#define LDLM_FL_LOCAL_ONLY_MASK 0x007FFFFF00000000ULL
|
||||
#define LDLM_FL_LOCAL_ONLY_MASK 0x00FFFFFF00000000ULL
|
||||
|
||||
/** l_flags bits marked as "on_wire" bits */
|
||||
#define LDLM_FL_ON_WIRE_MASK 0x00000000C08F132FULL
|
||||
|
@ -358,6 +358,12 @@
|
|||
#define ldlm_set_ns_srv(_l) LDLM_SET_FLAG(( _l), 1ULL << 54)
|
||||
#define ldlm_clear_ns_srv(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 54)
|
||||
|
||||
/** Flag whether this lock can be reused. Used by exclusive open. */
|
||||
#define LDLM_FL_EXCL 0x0080000000000000ULL /* bit 55 */
|
||||
#define ldlm_is_excl(_l) LDLM_TEST_FLAG((_l), 1ULL << 55)
|
||||
#define ldlm_set_excl(_l) LDLM_SET_FLAG((_l), 1ULL << 55)
|
||||
#define ldlm_clear_excl(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 55)
|
||||
|
||||
/** test for ldlm_lock flag bit set */
|
||||
#define LDLM_TEST_FLAG(_l, _b) (((_l)->l_flags & (_b)) != 0)
|
||||
|
||||
|
@ -414,47 +420,49 @@ static int hf_lustre_ldlm_fl_server_lock = -1;
|
|||
static int hf_lustre_ldlm_fl_res_locked = -1;
|
||||
static int hf_lustre_ldlm_fl_waited = -1;
|
||||
static int hf_lustre_ldlm_fl_ns_srv = -1;
|
||||
static int hf_lustre_ldlm_fl_excl = -1;
|
||||
|
||||
const value_string lustre_ldlm_flags_vals[] = {
|
||||
{LDLM_FL_LOCK_CHANGED, "LDLM_FL_LOCK_CHANGED"},
|
||||
{LDLM_FL_BLOCK_GRANTED, "LDLM_FL_BLOCK_GRANTED"},
|
||||
{LDLM_FL_BLOCK_CONV, "LDLM_FL_BLOCK_CONV"},
|
||||
{LDLM_FL_BLOCK_WAIT, "LDLM_FL_BLOCK_WAIT"},
|
||||
{LDLM_FL_AST_SENT, "LDLM_FL_AST_SENT"},
|
||||
{LDLM_FL_REPLAY, "LDLM_FL_REPLAY"},
|
||||
{LDLM_FL_INTENT_ONLY, "LDLM_FL_INTENT_ONLY"},
|
||||
{LDLM_FL_HAS_INTENT, "LDLM_FL_HAS_INTENT"},
|
||||
{LDLM_FL_DISCARD_DATA, "LDLM_FL_DISCARD_DATA"},
|
||||
{LDLM_FL_NO_TIMEOUT, "LDLM_FL_NO_TIMEOUT"},
|
||||
{LDLM_FL_BLOCK_NOWAIT, "LDLM_FL_BLOCK_NOWAIT"},
|
||||
{LDLM_FL_TEST_LOCK, "LDLM_FL_TEST_LOCK"},
|
||||
{LDLM_FL_CANCEL_ON_BLOCK, "LDLM_FL_CANCEL_ON_BLOCK"},
|
||||
{LDLM_FL_DENY_ON_CONTENTION, "LDLM_FL_DENY_ON_CONTENTION"},
|
||||
{LDLM_FL_AST_DISCARD_DATA, "LDLM_FL_AST_DISCARD_DATA"},
|
||||
{LDLM_FL_FAIL_LOC, "LDLM_FL_FAIL_LOC"},
|
||||
{LDLM_FL_SKIPPED, "LDLM_FL_SKIPPED"},
|
||||
{LDLM_FL_CBPENDING, "LDLM_FL_CBPENDING"},
|
||||
{LDLM_FL_WAIT_NOREPROC, "LDLM_FL_WAIT_NOREPROC"},
|
||||
{LDLM_FL_CANCEL, "LDLM_FL_CANCEL"},
|
||||
{LDLM_FL_LOCAL_ONLY, "LDLM_FL_LOCAL_ONLY"},
|
||||
{LDLM_FL_FAILED, "LDLM_FL_FAILED"},
|
||||
{LDLM_FL_CANCELING, "LDLM_FL_CANCELING"},
|
||||
{LDLM_FL_LOCAL, "LDLM_FL_LOCAL"},
|
||||
{LDLM_FL_LVB_READY, "LDLM_FL_LVB_READY"},
|
||||
{LDLM_FL_KMS_IGNORE, "LDLM_FL_KMS_IGNORE"},
|
||||
{LDLM_FL_CP_REQD, "LDLM_FL_CP_REQD"},
|
||||
{LDLM_FL_CLEANED, "LDLM_FL_CLEANED"},
|
||||
{LDLM_FL_ATOMIC_CB, "LDLM_FL_ATOMIC_CB"},
|
||||
{LDLM_FL_BL_AST, "LDLM_FL_BL_AST"},
|
||||
{LDLM_FL_BL_DONE, "LDLM_FL_BL_DONE"},
|
||||
{LDLM_FL_NO_LRU, "LDLM_FL_NO_LRU"},
|
||||
{LDLM_FL_FAIL_NOTIFIED, "LDLM_FL_FAIL_NOTIFIED"},
|
||||
{LDLM_FL_DESTROYED, "LDLM_FL_DESTROYED"},
|
||||
{LDLM_FL_SERVER_LOCK, "LDLM_FL_SERVER_LOCK"},
|
||||
{LDLM_FL_RES_LOCKED, "LDLM_FL_RES_LOCKED"},
|
||||
{LDLM_FL_WAITED, "LDLM_FL_WAITED"},
|
||||
{LDLM_FL_NS_SRV, "LDLM_FL_NS_SRV"},
|
||||
{ 0, NULL }
|
||||
{LDLM_FL_LOCK_CHANGED, "LDLM_FL_LOCK_CHANGED"},
|
||||
{LDLM_FL_BLOCK_GRANTED, "LDLM_FL_BLOCK_GRANTED"},
|
||||
{LDLM_FL_BLOCK_CONV, "LDLM_FL_BLOCK_CONV"},
|
||||
{LDLM_FL_BLOCK_WAIT, "LDLM_FL_BLOCK_WAIT"},
|
||||
{LDLM_FL_AST_SENT, "LDLM_FL_AST_SENT"},
|
||||
{LDLM_FL_REPLAY, "LDLM_FL_REPLAY"},
|
||||
{LDLM_FL_INTENT_ONLY, "LDLM_FL_INTENT_ONLY"},
|
||||
{LDLM_FL_HAS_INTENT, "LDLM_FL_HAS_INTENT"},
|
||||
{LDLM_FL_DISCARD_DATA, "LDLM_FL_DISCARD_DATA"},
|
||||
{LDLM_FL_NO_TIMEOUT, "LDLM_FL_NO_TIMEOUT"},
|
||||
{LDLM_FL_BLOCK_NOWAIT, "LDLM_FL_BLOCK_NOWAIT"},
|
||||
{LDLM_FL_TEST_LOCK, "LDLM_FL_TEST_LOCK"},
|
||||
{LDLM_FL_CANCEL_ON_BLOCK, "LDLM_FL_CANCEL_ON_BLOCK"},
|
||||
{LDLM_FL_DENY_ON_CONTENTION, "LDLM_FL_DENY_ON_CONTENTION"},
|
||||
{LDLM_FL_AST_DISCARD_DATA, "LDLM_FL_AST_DISCARD_DATA"},
|
||||
{LDLM_FL_FAIL_LOC, "LDLM_FL_FAIL_LOC"},
|
||||
{LDLM_FL_SKIPPED, "LDLM_FL_SKIPPED"},
|
||||
{LDLM_FL_CBPENDING, "LDLM_FL_CBPENDING"},
|
||||
{LDLM_FL_WAIT_NOREPROC, "LDLM_FL_WAIT_NOREPROC"},
|
||||
{LDLM_FL_CANCEL, "LDLM_FL_CANCEL"},
|
||||
{LDLM_FL_LOCAL_ONLY, "LDLM_FL_LOCAL_ONLY"},
|
||||
{LDLM_FL_FAILED, "LDLM_FL_FAILED"},
|
||||
{LDLM_FL_CANCELING, "LDLM_FL_CANCELING"},
|
||||
{LDLM_FL_LOCAL, "LDLM_FL_LOCAL"},
|
||||
{LDLM_FL_LVB_READY, "LDLM_FL_LVB_READY"},
|
||||
{LDLM_FL_KMS_IGNORE, "LDLM_FL_KMS_IGNORE"},
|
||||
{LDLM_FL_CP_REQD, "LDLM_FL_CP_REQD"},
|
||||
{LDLM_FL_CLEANED, "LDLM_FL_CLEANED"},
|
||||
{LDLM_FL_ATOMIC_CB, "LDLM_FL_ATOMIC_CB"},
|
||||
{LDLM_FL_BL_AST, "LDLM_FL_BL_AST"},
|
||||
{LDLM_FL_BL_DONE, "LDLM_FL_BL_DONE"},
|
||||
{LDLM_FL_NO_LRU, "LDLM_FL_NO_LRU"},
|
||||
{LDLM_FL_FAIL_NOTIFIED, "LDLM_FL_FAIL_NOTIFIED"},
|
||||
{LDLM_FL_DESTROYED, "LDLM_FL_DESTROYED"},
|
||||
{LDLM_FL_SERVER_LOCK, "LDLM_FL_SERVER_LOCK"},
|
||||
{LDLM_FL_RES_LOCKED, "LDLM_FL_RES_LOCKED"},
|
||||
{LDLM_FL_WAITED, "LDLM_FL_WAITED"},
|
||||
{LDLM_FL_NS_SRV, "LDLM_FL_NS_SRV"},
|
||||
{LDLM_FL_EXCL, "LDLM_FL_EXCL"},
|
||||
{ 0, NULL }
|
||||
};
|
||||
#endif /* WIRESHARK_COMPILE */
|
||||
#endif /* LDLM_ALL_FLAGS_MASK */
|
||||
|
|
|
@ -81,11 +81,12 @@ struct client_obd *client_conn2cli(struct lustre_handle *conn);
|
|||
|
||||
struct md_open_data;
|
||||
struct obd_client_handle {
|
||||
struct lustre_handle och_fh;
|
||||
struct lu_fid och_fid;
|
||||
struct md_open_data *och_mod;
|
||||
__u32 och_magic;
|
||||
int och_flags;
|
||||
struct lustre_handle och_fh;
|
||||
struct lu_fid och_fid;
|
||||
struct md_open_data *och_mod;
|
||||
struct lustre_handle och_lease_handle; /* open lock for lease */
|
||||
__u32 och_magic;
|
||||
fmode_t och_flags;
|
||||
};
|
||||
#define OBD_CLIENT_HANDLE_MAGIC 0xd15ea5ed
|
||||
|
||||
|
|
|
@ -3470,15 +3470,6 @@ static inline void ptlrpc_lprocfs_brw(struct ptlrpc_request *req, int bytes) {}
|
|||
#endif
|
||||
/** @} */
|
||||
|
||||
/* ptlrpc/llog_server.c */
|
||||
int llog_origin_handle_open(struct ptlrpc_request *req);
|
||||
int llog_origin_handle_destroy(struct ptlrpc_request *req);
|
||||
int llog_origin_handle_prev_block(struct ptlrpc_request *req);
|
||||
int llog_origin_handle_next_block(struct ptlrpc_request *req);
|
||||
int llog_origin_handle_read_header(struct ptlrpc_request *req);
|
||||
int llog_origin_handle_close(struct ptlrpc_request *req);
|
||||
int llog_origin_handle_cancel(struct ptlrpc_request *req);
|
||||
|
||||
/* ptlrpc/llog_client.c */
|
||||
extern struct llog_operations llog_client_ops;
|
||||
|
||||
|
|
|
@ -1006,6 +1006,12 @@ int cl_setattr_ost(struct inode *inode, const struct iattr *attr,
|
|||
cl_io_fini(env, io);
|
||||
if (unlikely(io->ci_need_restart))
|
||||
goto again;
|
||||
/* HSM import case: file is released, cannot be restored
|
||||
* no need to fail except if restore registration failed
|
||||
* with -ENODATA */
|
||||
if (result == -ENODATA && io->ci_restore_needed &&
|
||||
io->ci_result != -ENODATA)
|
||||
result = 0;
|
||||
cl_env_put(env, &refcheck);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -1129,6 +1129,11 @@ static struct ldlm_lock *search_queue(struct list_head *queue,
|
|||
if (lock == old_lock)
|
||||
break;
|
||||
|
||||
/* Check if this lock can be matched.
|
||||
* Used by LU-2919(exclusive open) for open lease lock */
|
||||
if (ldlm_is_excl(lock))
|
||||
continue;
|
||||
|
||||
/* llite sometimes wants to match locks that will be
|
||||
* canceled when their users drop, but we allow it to match
|
||||
* if it passes in CBPENDING and the lock still has users.
|
||||
|
|
|
@ -597,45 +597,6 @@ static int ldlm_callback_handler(struct ptlrpc_request *req)
|
|||
rc = ldlm_handle_setinfo(req);
|
||||
ldlm_callback_reply(req, rc);
|
||||
return 0;
|
||||
case OBD_LOG_CANCEL: /* remove this eventually - for 1.4.0 compat */
|
||||
CERROR("shouldn't be handling OBD_LOG_CANCEL on DLM thread\n");
|
||||
req_capsule_set(&req->rq_pill, &RQF_LOG_CANCEL);
|
||||
if (OBD_FAIL_CHECK(OBD_FAIL_OBD_LOG_CANCEL_NET))
|
||||
return 0;
|
||||
rc = llog_origin_handle_cancel(req);
|
||||
if (OBD_FAIL_CHECK(OBD_FAIL_OBD_LOG_CANCEL_REP))
|
||||
return 0;
|
||||
ldlm_callback_reply(req, rc);
|
||||
return 0;
|
||||
case LLOG_ORIGIN_HANDLE_CREATE:
|
||||
req_capsule_set(&req->rq_pill, &RQF_LLOG_ORIGIN_HANDLE_CREATE);
|
||||
if (OBD_FAIL_CHECK(OBD_FAIL_OBD_LOGD_NET))
|
||||
return 0;
|
||||
rc = llog_origin_handle_open(req);
|
||||
ldlm_callback_reply(req, rc);
|
||||
return 0;
|
||||
case LLOG_ORIGIN_HANDLE_NEXT_BLOCK:
|
||||
req_capsule_set(&req->rq_pill,
|
||||
&RQF_LLOG_ORIGIN_HANDLE_NEXT_BLOCK);
|
||||
if (OBD_FAIL_CHECK(OBD_FAIL_OBD_LOGD_NET))
|
||||
return 0;
|
||||
rc = llog_origin_handle_next_block(req);
|
||||
ldlm_callback_reply(req, rc);
|
||||
return 0;
|
||||
case LLOG_ORIGIN_HANDLE_READ_HEADER:
|
||||
req_capsule_set(&req->rq_pill,
|
||||
&RQF_LLOG_ORIGIN_HANDLE_READ_HEADER);
|
||||
if (OBD_FAIL_CHECK(OBD_FAIL_OBD_LOGD_NET))
|
||||
return 0;
|
||||
rc = llog_origin_handle_read_header(req);
|
||||
ldlm_callback_reply(req, rc);
|
||||
return 0;
|
||||
case LLOG_ORIGIN_HANDLE_CLOSE:
|
||||
if (OBD_FAIL_CHECK(OBD_FAIL_OBD_LOGD_NET))
|
||||
return 0;
|
||||
rc = llog_origin_handle_close(req);
|
||||
ldlm_callback_reply(req, rc);
|
||||
return 0;
|
||||
case OBD_QC_CALLBACK:
|
||||
req_capsule_set(&req->rq_pill, &RQF_QC_CALLBACK);
|
||||
if (OBD_FAIL_CHECK(OBD_FAIL_OBD_QC_CALLBACK_NET))
|
||||
|
|
|
@ -610,18 +610,12 @@ int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req,
|
|||
lock->l_req_mode = newmode;
|
||||
}
|
||||
|
||||
if (memcmp(reply->lock_desc.l_resource.lr_name.name,
|
||||
lock->l_resource->lr_name.name,
|
||||
sizeof(struct ldlm_res_id))) {
|
||||
CDEBUG(D_INFO, "remote intent success, locking "
|
||||
"(%ld,%ld,%ld) instead of "
|
||||
"(%ld,%ld,%ld)\n",
|
||||
(long)reply->lock_desc.l_resource.lr_name.name[0],
|
||||
(long)reply->lock_desc.l_resource.lr_name.name[1],
|
||||
(long)reply->lock_desc.l_resource.lr_name.name[2],
|
||||
(long)lock->l_resource->lr_name.name[0],
|
||||
(long)lock->l_resource->lr_name.name[1],
|
||||
(long)lock->l_resource->lr_name.name[2]);
|
||||
if (!ldlm_res_eq(&reply->lock_desc.l_resource.lr_name,
|
||||
&lock->l_resource->lr_name)) {
|
||||
CDEBUG(D_INFO, "remote intent success, locking "DLDLMRES
|
||||
" instead of "DLDLMRES"\n",
|
||||
PLDLMRES(&reply->lock_desc.l_resource),
|
||||
PLDLMRES(lock->l_resource));
|
||||
|
||||
rc = ldlm_lock_change_resource(ns, lock,
|
||||
&reply->lock_desc.l_resource.lr_name);
|
||||
|
@ -910,7 +904,7 @@ int ldlm_cli_enqueue(struct obd_export *exp, struct ptlrpc_request **reqp,
|
|||
lock->l_conn_export = exp;
|
||||
lock->l_export = NULL;
|
||||
lock->l_blocking_ast = einfo->ei_cb_bl;
|
||||
lock->l_flags |= (*flags & LDLM_FL_NO_LRU);
|
||||
lock->l_flags |= (*flags & (LDLM_FL_NO_LRU | LDLM_FL_EXCL));
|
||||
|
||||
/* lock not sent to server yet */
|
||||
|
||||
|
@ -1333,7 +1327,7 @@ int ldlm_cli_cancel(struct lustre_handle *lockh,
|
|||
}
|
||||
|
||||
rc = ldlm_cli_cancel_local(lock);
|
||||
if (rc == LDLM_FL_LOCAL_ONLY) {
|
||||
if (rc == LDLM_FL_LOCAL_ONLY || cancel_flags & LCF_LOCAL) {
|
||||
LDLM_LOCK_RELEASE(lock);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1912,7 +1906,8 @@ int ldlm_cli_cancel_unused_resource(struct ldlm_namespace *ns,
|
|||
0, flags | LCF_BL_AST, opaque);
|
||||
rc = ldlm_cli_cancel_list(&cancels, count, NULL, flags);
|
||||
if (rc != ELDLM_OK)
|
||||
CERROR("ldlm_cli_cancel_unused_resource: %d\n", rc);
|
||||
CERROR("canceling unused lock "DLDLMRES": rc = %d\n",
|
||||
PLDLMRES(res), rc);
|
||||
|
||||
LDLM_RESOURCE_DELREF(res);
|
||||
ldlm_resource_putref(res);
|
||||
|
@ -1930,15 +1925,10 @@ static int ldlm_cli_hash_cancel_unused(struct cfs_hash *hs, struct cfs_hash_bd *
|
|||
{
|
||||
struct ldlm_resource *res = cfs_hash_object(hs, hnode);
|
||||
struct ldlm_cli_cancel_arg *lc = arg;
|
||||
int rc;
|
||||
|
||||
rc = ldlm_cli_cancel_unused_resource(ldlm_res_to_ns(res), &res->lr_name,
|
||||
NULL, LCK_MINMODE,
|
||||
lc->lc_flags, lc->lc_opaque);
|
||||
if (rc != 0) {
|
||||
CERROR("ldlm_cli_cancel_unused ("LPU64"): %d\n",
|
||||
res->lr_name.name[0], rc);
|
||||
}
|
||||
ldlm_cli_cancel_unused_resource(ldlm_res_to_ns(res), &res->lr_name,
|
||||
NULL, LCK_MINMODE,
|
||||
lc->lc_flags, lc->lc_opaque);
|
||||
/* must return 0 for hash iteration */
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -762,16 +762,9 @@ static int ldlm_resource_complain(struct cfs_hash *hs, struct cfs_hash_bd *bd,
|
|||
struct ldlm_resource *res = cfs_hash_object(hs, hnode);
|
||||
|
||||
lock_res(res);
|
||||
CERROR("Namespace %s resource refcount nonzero "
|
||||
"(%d) after lock cleanup; forcing "
|
||||
"cleanup.\n",
|
||||
ldlm_ns_name(ldlm_res_to_ns(res)),
|
||||
atomic_read(&res->lr_refcount) - 1);
|
||||
|
||||
CERROR("Resource: %p ("LPU64"/"LPU64"/"LPU64"/"
|
||||
LPU64") (rc: %d)\n", res,
|
||||
res->lr_name.name[0], res->lr_name.name[1],
|
||||
res->lr_name.name[2], res->lr_name.name[3],
|
||||
CERROR("%s: namespace resource "DLDLMRES
|
||||
" (%p) refcount nonzero (%d) after lock cleanup; forcing cleanup.\n",
|
||||
ldlm_ns_name(ldlm_res_to_ns(res)), PLDLMRES(res), res,
|
||||
atomic_read(&res->lr_refcount) - 1);
|
||||
|
||||
ldlm_resource_dump(D_ERROR, res);
|
||||
|
@ -1403,10 +1396,8 @@ void ldlm_resource_dump(int level, struct ldlm_resource *res)
|
|||
if (!((libcfs_debug | D_ERROR) & level))
|
||||
return;
|
||||
|
||||
CDEBUG(level, "--- Resource: %p ("LPU64"/"LPU64"/"LPU64"/"LPU64
|
||||
") (rc: %d)\n", res, res->lr_name.name[0], res->lr_name.name[1],
|
||||
res->lr_name.name[2], res->lr_name.name[3],
|
||||
atomic_read(&res->lr_refcount));
|
||||
CDEBUG(level, "--- Resource: "DLDLMRES" (%p) refcount = %d\n",
|
||||
PLDLMRES(res), res, atomic_read(&res->lr_refcount));
|
||||
|
||||
if (!list_empty(&res->lr_granted)) {
|
||||
CDEBUG(level, "Granted locks (in reverse order):\n");
|
||||
|
|
|
@ -140,18 +140,6 @@ int cfs_capable(cfs_cap_t cap)
|
|||
return capable(cfs_cap_unpack(cap));
|
||||
}
|
||||
|
||||
/* Check if task is running in 32-bit API mode, for the purpose of
|
||||
* userspace binary interfaces. On 32-bit Linux this is (unfortunately)
|
||||
* always true, even if the application is using LARGEFILE64 and 64-bit
|
||||
* APIs, because Linux provides no way for the filesystem to know if it
|
||||
* is called via 32-bit or 64-bit APIs. Other clients may vary. On
|
||||
* 64-bit systems, this will only be true if the binary is calling a
|
||||
* 32-bit system call. */
|
||||
int current_is_32bit(void)
|
||||
{
|
||||
return is_compat_task();
|
||||
}
|
||||
|
||||
static int cfs_access_process_vm(struct task_struct *tsk, unsigned long addr,
|
||||
void *buf, int len, int write)
|
||||
{
|
||||
|
@ -311,7 +299,6 @@ EXPORT_SYMBOL(cfs_cap_raised);
|
|||
EXPORT_SYMBOL(cfs_curproc_cap_pack);
|
||||
EXPORT_SYMBOL(cfs_curproc_cap_unpack);
|
||||
EXPORT_SYMBOL(cfs_capable);
|
||||
EXPORT_SYMBOL(current_is_32bit);
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
|
|
|
@ -371,7 +371,6 @@ static ctl_table_t lnet_table[] = {
|
|||
* to go via /proc for portability.
|
||||
*/
|
||||
{
|
||||
INIT_CTL_NAME(PSDEV_DEBUG)
|
||||
.procname = "debug",
|
||||
.data = &libcfs_debug,
|
||||
.maxlen = sizeof(int),
|
||||
|
@ -379,7 +378,6 @@ static ctl_table_t lnet_table[] = {
|
|||
.proc_handler = &proc_dobitmasks,
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(PSDEV_SUBSYSTEM_DEBUG)
|
||||
.procname = "subsystem_debug",
|
||||
.data = &libcfs_subsystem_debug,
|
||||
.maxlen = sizeof(int),
|
||||
|
@ -387,7 +385,6 @@ static ctl_table_t lnet_table[] = {
|
|||
.proc_handler = &proc_dobitmasks,
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(PSDEV_PRINTK)
|
||||
.procname = "printk",
|
||||
.data = &libcfs_printk,
|
||||
.maxlen = sizeof(int),
|
||||
|
@ -395,7 +392,6 @@ static ctl_table_t lnet_table[] = {
|
|||
.proc_handler = &proc_dobitmasks,
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(PSDEV_CONSOLE_RATELIMIT)
|
||||
.procname = "console_ratelimit",
|
||||
.data = &libcfs_console_ratelimit,
|
||||
.maxlen = sizeof(int),
|
||||
|
@ -403,21 +399,18 @@ static ctl_table_t lnet_table[] = {
|
|||
.proc_handler = &proc_dointvec
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(PSDEV_CONSOLE_MAX_DELAY_CS)
|
||||
.procname = "console_max_delay_centisecs",
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_console_max_delay_cs
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(PSDEV_CONSOLE_MIN_DELAY_CS)
|
||||
.procname = "console_min_delay_centisecs",
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_console_min_delay_cs
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(PSDEV_CONSOLE_BACKOFF)
|
||||
.procname = "console_backoff",
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
|
@ -425,7 +418,6 @@ static ctl_table_t lnet_table[] = {
|
|||
},
|
||||
|
||||
{
|
||||
INIT_CTL_NAME(PSDEV_DEBUG_PATH)
|
||||
.procname = "debug_path",
|
||||
.data = libcfs_debug_file_path_arr,
|
||||
.maxlen = sizeof(libcfs_debug_file_path_arr),
|
||||
|
@ -434,7 +426,6 @@ static ctl_table_t lnet_table[] = {
|
|||
},
|
||||
|
||||
{
|
||||
INIT_CTL_NAME(PSDEV_CPT_TABLE)
|
||||
.procname = "cpu_partition_table",
|
||||
.maxlen = 128,
|
||||
.mode = 0444,
|
||||
|
@ -442,7 +433,6 @@ static ctl_table_t lnet_table[] = {
|
|||
},
|
||||
|
||||
{
|
||||
INIT_CTL_NAME(PSDEV_LNET_UPCALL)
|
||||
.procname = "upcall",
|
||||
.data = lnet_upcall,
|
||||
.maxlen = sizeof(lnet_upcall),
|
||||
|
@ -450,7 +440,6 @@ static ctl_table_t lnet_table[] = {
|
|||
.proc_handler = &proc_dostring,
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(PSDEV_LNET_DEBUG_LOG_UPCALL)
|
||||
.procname = "debug_log_upcall",
|
||||
.data = lnet_debug_log_upcall,
|
||||
.maxlen = sizeof(lnet_debug_log_upcall),
|
||||
|
@ -458,54 +447,44 @@ static ctl_table_t lnet_table[] = {
|
|||
.proc_handler = &proc_dostring,
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(PSDEV_LNET_MEMUSED)
|
||||
.procname = "lnet_memused",
|
||||
.data = (int *)&libcfs_kmemory.counter,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_dointvec,
|
||||
INIT_STRATEGY(&sysctl_intvec)
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(PSDEV_LNET_CATASTROPHE)
|
||||
.procname = "catastrophe",
|
||||
.data = &libcfs_catastrophe,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0444,
|
||||
.proc_handler = &proc_dointvec,
|
||||
INIT_STRATEGY(&sysctl_intvec)
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(PSDEV_LNET_PANIC_ON_LBUG)
|
||||
.procname = "panic_on_lbug",
|
||||
.data = &libcfs_panic_on_lbug,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_dointvec,
|
||||
INIT_STRATEGY(&sysctl_intvec)
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(PSDEV_LNET_DUMP_KERNEL)
|
||||
.procname = "dump_kernel",
|
||||
.maxlen = 256,
|
||||
.mode = 0200,
|
||||
.proc_handler = &proc_dump_kernel,
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(PSDEV_LNET_DAEMON_FILE)
|
||||
.procname = "daemon_file",
|
||||
.mode = 0644,
|
||||
.maxlen = 256,
|
||||
.proc_handler = &proc_daemon_file,
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(PSDEV_LNET_DEBUG_MB)
|
||||
.procname = "debug_mb",
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_debug_mb,
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(PSDEV_LNET_WATCHDOG_RATELIMIT)
|
||||
.procname = "watchdog_ratelimit",
|
||||
.data = &libcfs_watchdog_ratelimit,
|
||||
.maxlen = sizeof(int),
|
||||
|
@ -514,7 +493,7 @@ static ctl_table_t lnet_table[] = {
|
|||
.extra1 = &min_watchdog_ratelimit,
|
||||
.extra2 = &max_watchdog_ratelimit,
|
||||
},
|
||||
{ INIT_CTL_NAME(PSDEV_LNET_FORCE_LBUG)
|
||||
{
|
||||
.procname = "force_lbug",
|
||||
.data = NULL,
|
||||
.maxlen = 0,
|
||||
|
@ -522,7 +501,6 @@ static ctl_table_t lnet_table[] = {
|
|||
.proc_handler = &libcfs_force_lbug
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(PSDEV_LNET_FAIL_LOC)
|
||||
.procname = "fail_loc",
|
||||
.data = &cfs_fail_loc,
|
||||
.maxlen = sizeof(cfs_fail_loc),
|
||||
|
@ -530,7 +508,6 @@ static ctl_table_t lnet_table[] = {
|
|||
.proc_handler = &proc_fail_loc
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(PSDEV_LNET_FAIL_VAL)
|
||||
.procname = "fail_val",
|
||||
.data = &cfs_fail_val,
|
||||
.maxlen = sizeof(int),
|
||||
|
@ -538,14 +515,12 @@ static ctl_table_t lnet_table[] = {
|
|||
.proc_handler = &proc_dointvec
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(0)
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef CONFIG_SYSCTL
|
||||
static ctl_table_t top_table[] = {
|
||||
{
|
||||
INIT_CTL_NAME(CTL_LNET)
|
||||
.procname = "lnet",
|
||||
.mode = 0555,
|
||||
.data = NULL,
|
||||
|
@ -553,7 +528,6 @@ static ctl_table_t top_table[] = {
|
|||
.child = lnet_table,
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(0)
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -56,11 +56,11 @@
|
|||
*/
|
||||
|
||||
static char libcfs_nidstrings[LNET_NIDSTR_COUNT][LNET_NIDSTR_SIZE];
|
||||
static int libcfs_nidstring_idx = 0;
|
||||
static int libcfs_nidstring_idx;
|
||||
|
||||
static spinlock_t libcfs_nidstring_lock;
|
||||
|
||||
void libcfs_init_nidstrings (void)
|
||||
void libcfs_init_nidstrings(void)
|
||||
{
|
||||
spin_lock_init(&libcfs_nidstring_lock);
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ void libcfs_init_nidstrings (void)
|
|||
# define NIDSTR_UNLOCK(f) spin_unlock_irqrestore(&libcfs_nidstring_lock, f)
|
||||
|
||||
static char *
|
||||
libcfs_next_nidstring (void)
|
||||
libcfs_next_nidstring(void)
|
||||
{
|
||||
char *str;
|
||||
unsigned long flags;
|
||||
|
@ -326,6 +326,7 @@ libcfs_isknown_lnd(int type)
|
|||
{
|
||||
return libcfs_lnd2netstrfns(type) != NULL;
|
||||
}
|
||||
EXPORT_SYMBOL(libcfs_isknown_lnd);
|
||||
|
||||
char *
|
||||
libcfs_lnd2modname(int lnd)
|
||||
|
@ -334,6 +335,7 @@ libcfs_lnd2modname(int lnd)
|
|||
|
||||
return (nf == NULL) ? NULL : nf->nf_modname;
|
||||
}
|
||||
EXPORT_SYMBOL(libcfs_lnd2modname);
|
||||
|
||||
char *
|
||||
libcfs_lnd2str(int lnd)
|
||||
|
@ -348,6 +350,7 @@ libcfs_lnd2str(int lnd)
|
|||
snprintf(str, LNET_NIDSTR_SIZE, "?%u?", lnd);
|
||||
return str;
|
||||
}
|
||||
EXPORT_SYMBOL(libcfs_lnd2str);
|
||||
|
||||
int
|
||||
libcfs_str2lnd(const char *str)
|
||||
|
@ -359,6 +362,7 @@ libcfs_str2lnd(const char *str)
|
|||
|
||||
return -1;
|
||||
}
|
||||
EXPORT_SYMBOL(libcfs_str2lnd);
|
||||
|
||||
char *
|
||||
libcfs_net2str(__u32 net)
|
||||
|
@ -377,6 +381,7 @@ libcfs_net2str(__u32 net)
|
|||
|
||||
return str;
|
||||
}
|
||||
EXPORT_SYMBOL(libcfs_net2str);
|
||||
|
||||
char *
|
||||
libcfs_nid2str(lnet_nid_t nid)
|
||||
|
@ -410,6 +415,7 @@ libcfs_nid2str(lnet_nid_t nid)
|
|||
|
||||
return str;
|
||||
}
|
||||
EXPORT_SYMBOL(libcfs_nid2str);
|
||||
|
||||
static struct netstrfns *
|
||||
libcfs_str2net_internal(const char *str, __u32 *net)
|
||||
|
@ -458,6 +464,7 @@ libcfs_str2net(const char *str)
|
|||
|
||||
return LNET_NIDNET(LNET_NID_ANY);
|
||||
}
|
||||
EXPORT_SYMBOL(libcfs_str2net);
|
||||
|
||||
lnet_nid_t
|
||||
libcfs_str2nid(const char *str)
|
||||
|
@ -475,7 +482,7 @@ libcfs_str2nid(const char *str)
|
|||
sep = str + strlen(str);
|
||||
net = LNET_MKNET(SOCKLND, 0);
|
||||
nf = libcfs_lnd2netstrfns(SOCKLND);
|
||||
LASSERT (nf != NULL);
|
||||
LASSERT(nf != NULL);
|
||||
}
|
||||
|
||||
if (!nf->nf_str2addr(str, (int)(sep - str), &addr))
|
||||
|
@ -483,6 +490,7 @@ libcfs_str2nid(const char *str)
|
|||
|
||||
return LNET_MKNID(net, addr);
|
||||
}
|
||||
EXPORT_SYMBOL(libcfs_str2nid);
|
||||
|
||||
char *
|
||||
libcfs_id2str(lnet_process_id_t id)
|
||||
|
@ -500,6 +508,7 @@ libcfs_id2str(lnet_process_id_t id)
|
|||
(id.pid & ~LNET_PID_USERFLAG), libcfs_nid2str(id.nid));
|
||||
return str;
|
||||
}
|
||||
EXPORT_SYMBOL(libcfs_id2str);
|
||||
|
||||
int
|
||||
libcfs_str2anynid(lnet_nid_t *nidp, const char *str)
|
||||
|
@ -512,6 +521,7 @@ libcfs_str2anynid(lnet_nid_t *nidp, const char *str)
|
|||
*nidp = libcfs_str2nid(str);
|
||||
return *nidp != LNET_NID_ANY;
|
||||
}
|
||||
EXPORT_SYMBOL(libcfs_str2anynid);
|
||||
|
||||
/**
|
||||
* Nid range list syntax.
|
||||
|
@ -765,6 +775,7 @@ cfs_free_nidlist(struct list_head *list)
|
|||
LIBCFS_FREE(nr, sizeof(struct nidrange));
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(cfs_free_nidlist);
|
||||
|
||||
/**
|
||||
* Parses nid range list.
|
||||
|
@ -803,6 +814,7 @@ cfs_parse_nidlist(char *str, int len, struct list_head *nidlist)
|
|||
}
|
||||
return 1;
|
||||
}
|
||||
EXPORT_SYMBOL(cfs_parse_nidlist);
|
||||
|
||||
/*
|
||||
* Nf_match_addr method for networks using numeric addresses
|
||||
|
@ -848,18 +860,4 @@ int cfs_match_nid(lnet_nid_t nid, struct list_head *nidlist)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
EXPORT_SYMBOL(libcfs_isknown_lnd);
|
||||
EXPORT_SYMBOL(libcfs_lnd2modname);
|
||||
EXPORT_SYMBOL(libcfs_lnd2str);
|
||||
EXPORT_SYMBOL(libcfs_str2lnd);
|
||||
EXPORT_SYMBOL(libcfs_net2str);
|
||||
EXPORT_SYMBOL(libcfs_nid2str);
|
||||
EXPORT_SYMBOL(libcfs_str2net);
|
||||
EXPORT_SYMBOL(libcfs_str2nid);
|
||||
EXPORT_SYMBOL(libcfs_id2str);
|
||||
EXPORT_SYMBOL(libcfs_str2anynid);
|
||||
EXPORT_SYMBOL(cfs_free_nidlist);
|
||||
EXPORT_SYMBOL(cfs_parse_nidlist);
|
||||
EXPORT_SYMBOL(cfs_match_nid);
|
||||
|
|
|
@ -241,6 +241,24 @@ int ll_md_close(struct obd_export *md_exp, struct inode *inode,
|
|||
if (unlikely(fd->fd_flags & LL_FILE_GROUP_LOCKED))
|
||||
ll_put_grouplock(inode, file, fd->fd_grouplock.cg_gid);
|
||||
|
||||
if (fd->fd_lease_och != NULL) {
|
||||
bool lease_broken;
|
||||
|
||||
/* Usually the lease is not released when the
|
||||
* application crashed, we need to release here. */
|
||||
rc = ll_lease_close(fd->fd_lease_och, inode, &lease_broken);
|
||||
CDEBUG(rc ? D_ERROR : D_INODE, "Clean up lease "DFID" %d/%d\n",
|
||||
PFID(&lli->lli_fid), rc, lease_broken);
|
||||
|
||||
fd->fd_lease_och = NULL;
|
||||
}
|
||||
|
||||
if (fd->fd_och != NULL) {
|
||||
rc = ll_close_inode_openhandle(md_exp, inode, fd->fd_och);
|
||||
fd->fd_och = NULL;
|
||||
GOTO(out, rc);
|
||||
}
|
||||
|
||||
/* Let's see if we have good enough OPEN lock on the file and if
|
||||
we can skip talking to MDS */
|
||||
if (file->f_dentry->d_inode) { /* Can this ever be false? */
|
||||
|
@ -277,6 +295,7 @@ int ll_md_close(struct obd_export *md_exp, struct inode *inode,
|
|||
file, file->f_dentry, file->f_dentry->d_name.name);
|
||||
}
|
||||
|
||||
out:
|
||||
LUSTRE_FPRIVATE(file) = NULL;
|
||||
ll_file_data_put(fd);
|
||||
ll_capa_close(inode);
|
||||
|
@ -431,22 +450,18 @@ void ll_ioepoch_open(struct ll_inode_info *lli, __u64 ioepoch)
|
|||
}
|
||||
}
|
||||
|
||||
static int ll_och_fill(struct obd_export *md_exp, struct ll_inode_info *lli,
|
||||
struct lookup_intent *it, struct obd_client_handle *och)
|
||||
static int ll_och_fill(struct obd_export *md_exp, struct lookup_intent *it,
|
||||
struct obd_client_handle *och)
|
||||
{
|
||||
struct ptlrpc_request *req = it->d.lustre.it_data;
|
||||
struct mdt_body *body;
|
||||
|
||||
LASSERT(och);
|
||||
|
||||
body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
|
||||
LASSERT(body != NULL); /* reply already checked out */
|
||||
|
||||
memcpy(&och->och_fh, &body->handle, sizeof(body->handle));
|
||||
och->och_fh = body->handle;
|
||||
och->och_fid = body->fid1;
|
||||
och->och_lease_handle.cookie = it->d.lustre.it_lock_handle;
|
||||
och->och_magic = OBD_CLIENT_HANDLE_MAGIC;
|
||||
och->och_fid = lli->lli_fid;
|
||||
och->och_flags = it->it_flags;
|
||||
ll_ioepoch_open(lli, body->ioepoch);
|
||||
|
||||
return md_set_open_replay_data(md_exp, och, req);
|
||||
}
|
||||
|
@ -466,20 +481,17 @@ int ll_local_open(struct file *file, struct lookup_intent *it,
|
|||
struct mdt_body *body;
|
||||
int rc;
|
||||
|
||||
rc = ll_och_fill(ll_i2sbi(inode)->ll_md_exp, lli, it, och);
|
||||
if (rc)
|
||||
rc = ll_och_fill(ll_i2sbi(inode)->ll_md_exp, it, och);
|
||||
if (rc != 0)
|
||||
return rc;
|
||||
|
||||
body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
|
||||
if ((it->it_flags & FMODE_WRITE) &&
|
||||
(body->valid & OBD_MD_FLSIZE))
|
||||
CDEBUG(D_INODE, "Epoch "LPU64" opened on "DFID"\n",
|
||||
lli->lli_ioepoch, PFID(&lli->lli_fid));
|
||||
ll_ioepoch_open(lli, body->ioepoch);
|
||||
}
|
||||
|
||||
LUSTRE_FPRIVATE(file) = fd;
|
||||
ll_readahead_init(inode, &fd->fd_ras);
|
||||
fd->fd_omode = it->it_flags;
|
||||
fd->fd_omode = it->it_flags & (FMODE_READ | FMODE_WRITE | FMODE_EXEC);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -681,6 +693,196 @@ int ll_file_open(struct inode *inode, struct file *file)
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int ll_md_blocking_lease_ast(struct ldlm_lock *lock,
|
||||
struct ldlm_lock_desc *desc, void *data, int flag)
|
||||
{
|
||||
int rc;
|
||||
struct lustre_handle lockh;
|
||||
|
||||
switch (flag) {
|
||||
case LDLM_CB_BLOCKING:
|
||||
ldlm_lock2handle(lock, &lockh);
|
||||
rc = ldlm_cli_cancel(&lockh, LCF_ASYNC);
|
||||
if (rc < 0) {
|
||||
CDEBUG(D_INODE, "ldlm_cli_cancel: %d\n", rc);
|
||||
return rc;
|
||||
}
|
||||
break;
|
||||
case LDLM_CB_CANCELING:
|
||||
/* do nothing */
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Acquire a lease and open the file.
|
||||
*/
|
||||
struct obd_client_handle *ll_lease_open(struct inode *inode, struct file *file,
|
||||
fmode_t fmode)
|
||||
{
|
||||
struct lookup_intent it = { .it_op = IT_OPEN };
|
||||
struct ll_sb_info *sbi = ll_i2sbi(inode);
|
||||
struct md_op_data *op_data;
|
||||
struct ptlrpc_request *req;
|
||||
struct lustre_handle old_handle = { 0 };
|
||||
struct obd_client_handle *och = NULL;
|
||||
int rc;
|
||||
int rc2;
|
||||
|
||||
if (fmode != FMODE_WRITE && fmode != FMODE_READ)
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
if (file != NULL) {
|
||||
struct ll_inode_info *lli = ll_i2info(inode);
|
||||
struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
|
||||
struct obd_client_handle **och_p;
|
||||
__u64 *och_usecount;
|
||||
|
||||
if (!(fmode & file->f_mode) || (file->f_mode & FMODE_EXEC))
|
||||
return ERR_PTR(-EPERM);
|
||||
|
||||
/* Get the openhandle of the file */
|
||||
rc = -EBUSY;
|
||||
mutex_lock(&lli->lli_och_mutex);
|
||||
if (fd->fd_lease_och != NULL) {
|
||||
mutex_unlock(&lli->lli_och_mutex);
|
||||
return ERR_PTR(rc);
|
||||
}
|
||||
|
||||
if (fd->fd_och == NULL) {
|
||||
if (file->f_mode & FMODE_WRITE) {
|
||||
LASSERT(lli->lli_mds_write_och != NULL);
|
||||
och_p = &lli->lli_mds_write_och;
|
||||
och_usecount = &lli->lli_open_fd_write_count;
|
||||
} else {
|
||||
LASSERT(lli->lli_mds_read_och != NULL);
|
||||
och_p = &lli->lli_mds_read_och;
|
||||
och_usecount = &lli->lli_open_fd_read_count;
|
||||
}
|
||||
if (*och_usecount == 1) {
|
||||
fd->fd_och = *och_p;
|
||||
*och_p = NULL;
|
||||
*och_usecount = 0;
|
||||
rc = 0;
|
||||
}
|
||||
}
|
||||
mutex_unlock(&lli->lli_och_mutex);
|
||||
if (rc < 0) /* more than 1 opener */
|
||||
return ERR_PTR(rc);
|
||||
|
||||
LASSERT(fd->fd_och != NULL);
|
||||
old_handle = fd->fd_och->och_fh;
|
||||
}
|
||||
|
||||
OBD_ALLOC_PTR(och);
|
||||
if (och == NULL)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
op_data = ll_prep_md_op_data(NULL, inode, inode, NULL, 0, 0,
|
||||
LUSTRE_OPC_ANY, NULL);
|
||||
if (IS_ERR(op_data))
|
||||
GOTO(out, rc = PTR_ERR(op_data));
|
||||
|
||||
/* To tell the MDT this openhandle is from the same owner */
|
||||
op_data->op_handle = old_handle;
|
||||
|
||||
it.it_flags = fmode | MDS_OPEN_LOCK | MDS_OPEN_BY_FID | MDS_OPEN_LEASE;
|
||||
rc = md_intent_lock(sbi->ll_md_exp, op_data, NULL, 0, &it, 0, &req,
|
||||
ll_md_blocking_lease_ast,
|
||||
/* LDLM_FL_NO_LRU: To not put the lease lock into LRU list, otherwise
|
||||
* it can be cancelled which may mislead applications that the lease is
|
||||
* broken;
|
||||
* LDLM_FL_EXCL: Set this flag so that it won't be matched by normal
|
||||
* open in ll_md_blocking_ast(). Otherwise as ll_md_blocking_lease_ast
|
||||
* doesn't deal with openhandle, so normal openhandle will be leaked. */
|
||||
LDLM_FL_NO_LRU | LDLM_FL_EXCL);
|
||||
ll_finish_md_op_data(op_data);
|
||||
if (req != NULL) {
|
||||
ptlrpc_req_finished(req);
|
||||
it_clear_disposition(&it, DISP_ENQ_COMPLETE);
|
||||
}
|
||||
if (rc < 0)
|
||||
GOTO(out_release_it, rc);
|
||||
|
||||
if (it_disposition(&it, DISP_LOOKUP_NEG))
|
||||
GOTO(out_release_it, rc = -ENOENT);
|
||||
|
||||
rc = it_open_error(DISP_OPEN_OPEN, &it);
|
||||
if (rc)
|
||||
GOTO(out_release_it, rc);
|
||||
|
||||
LASSERT(it_disposition(&it, DISP_ENQ_OPEN_REF));
|
||||
ll_och_fill(sbi->ll_md_exp, &it, och);
|
||||
|
||||
if (!it_disposition(&it, DISP_OPEN_LEASE)) /* old server? */
|
||||
GOTO(out_close, rc = -EOPNOTSUPP);
|
||||
|
||||
/* already get lease, handle lease lock */
|
||||
ll_set_lock_data(sbi->ll_md_exp, inode, &it, NULL);
|
||||
if (it.d.lustre.it_lock_mode == 0 ||
|
||||
it.d.lustre.it_lock_bits != MDS_INODELOCK_OPEN) {
|
||||
/* open lock must return for lease */
|
||||
CERROR(DFID "lease granted but no open lock, %d/%llu.\n",
|
||||
PFID(ll_inode2fid(inode)), it.d.lustre.it_lock_mode,
|
||||
it.d.lustre.it_lock_bits);
|
||||
GOTO(out_close, rc = -EPROTO);
|
||||
}
|
||||
|
||||
ll_intent_release(&it);
|
||||
return och;
|
||||
|
||||
out_close:
|
||||
rc2 = ll_close_inode_openhandle(sbi->ll_md_exp, inode, och);
|
||||
if (rc2)
|
||||
CERROR("Close openhandle returned %d\n", rc2);
|
||||
|
||||
/* cancel open lock */
|
||||
if (it.d.lustre.it_lock_mode != 0) {
|
||||
ldlm_lock_decref_and_cancel(&och->och_lease_handle,
|
||||
it.d.lustre.it_lock_mode);
|
||||
it.d.lustre.it_lock_mode = 0;
|
||||
}
|
||||
out_release_it:
|
||||
ll_intent_release(&it);
|
||||
out:
|
||||
OBD_FREE_PTR(och);
|
||||
return ERR_PTR(rc);
|
||||
}
|
||||
EXPORT_SYMBOL(ll_lease_open);
|
||||
|
||||
/**
|
||||
* Release lease and close the file.
|
||||
* It will check if the lease has ever broken.
|
||||
*/
|
||||
int ll_lease_close(struct obd_client_handle *och, struct inode *inode,
|
||||
bool *lease_broken)
|
||||
{
|
||||
struct ldlm_lock *lock;
|
||||
bool cancelled = true;
|
||||
int rc;
|
||||
|
||||
lock = ldlm_handle2lock(&och->och_lease_handle);
|
||||
if (lock != NULL) {
|
||||
lock_res_and_lock(lock);
|
||||
cancelled = ldlm_is_cancel(lock);
|
||||
unlock_res_and_lock(lock);
|
||||
ldlm_lock_put(lock);
|
||||
}
|
||||
|
||||
CDEBUG(D_INODE, "lease for "DFID" broken? %d\n",
|
||||
PFID(&ll_i2info(inode)->lli_fid), cancelled);
|
||||
|
||||
if (!cancelled)
|
||||
ldlm_cli_cancel(&och->och_lease_handle, 0);
|
||||
if (lease_broken != NULL)
|
||||
*lease_broken = cancelled;
|
||||
|
||||
rc = ll_close_inode_openhandle(ll_i2sbi(inode)->ll_md_exp, inode, och);
|
||||
return rc;
|
||||
}
|
||||
EXPORT_SYMBOL(ll_lease_close);
|
||||
|
||||
/* Fills the obdo with the attributes for the lsm */
|
||||
static int ll_lsm_getattr(struct lov_stripe_md *lsm, struct obd_export *exp,
|
||||
struct obd_capa *capa, struct obdo *obdo,
|
||||
|
@ -905,7 +1107,7 @@ ll_file_io_generic(const struct lu_env *env, struct vvp_io_args *args,
|
|||
cl_io_fini(env, io);
|
||||
/* If any bit been read/written (result != 0), we just return
|
||||
* short read/write instead of restart io. */
|
||||
if (result == 0 && io->ci_need_restart) {
|
||||
if ((result == 0 || result == -ENODATA) && io->ci_need_restart) {
|
||||
CDEBUG(D_VFSTRACE, "Restart %s on %s from %lld, count:%zd\n",
|
||||
iot == CIT_READ ? "read" : "write",
|
||||
file->f_dentry->d_name.name, *ppos, count);
|
||||
|
@ -1482,8 +1684,7 @@ int ll_release_openhandle(struct dentry *dentry, struct lookup_intent *it)
|
|||
if (!och)
|
||||
GOTO(out, rc = -ENOMEM);
|
||||
|
||||
ll_och_fill(ll_i2sbi(inode)->ll_md_exp,
|
||||
ll_i2info(inode), it, och);
|
||||
ll_och_fill(ll_i2sbi(inode)->ll_md_exp, it, och);
|
||||
|
||||
rc = ll_close_inode_openhandle(ll_i2sbi(inode)->ll_md_exp,
|
||||
inode, och);
|
||||
|
@ -2075,6 +2276,91 @@ long ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
|||
OBD_FREE_PTR(hca);
|
||||
return rc;
|
||||
}
|
||||
case LL_IOC_SET_LEASE: {
|
||||
struct ll_inode_info *lli = ll_i2info(inode);
|
||||
struct obd_client_handle *och = NULL;
|
||||
bool lease_broken;
|
||||
fmode_t mode = 0;
|
||||
|
||||
switch (arg) {
|
||||
case F_WRLCK:
|
||||
if (!(file->f_mode & FMODE_WRITE))
|
||||
return -EPERM;
|
||||
mode = FMODE_WRITE;
|
||||
break;
|
||||
case F_RDLCK:
|
||||
if (!(file->f_mode & FMODE_READ))
|
||||
return -EPERM;
|
||||
mode = FMODE_READ;
|
||||
break;
|
||||
case F_UNLCK:
|
||||
mutex_lock(&lli->lli_och_mutex);
|
||||
if (fd->fd_lease_och != NULL) {
|
||||
och = fd->fd_lease_och;
|
||||
fd->fd_lease_och = NULL;
|
||||
}
|
||||
mutex_unlock(&lli->lli_och_mutex);
|
||||
|
||||
if (och != NULL) {
|
||||
mode = och->och_flags &
|
||||
(FMODE_READ|FMODE_WRITE);
|
||||
rc = ll_lease_close(och, inode, &lease_broken);
|
||||
if (rc == 0 && lease_broken)
|
||||
mode = 0;
|
||||
} else {
|
||||
rc = -ENOLCK;
|
||||
}
|
||||
|
||||
/* return the type of lease or error */
|
||||
return rc < 0 ? rc : (int)mode;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
CDEBUG(D_INODE, "Set lease with mode %d\n", mode);
|
||||
|
||||
/* apply for lease */
|
||||
och = ll_lease_open(inode, file, mode);
|
||||
if (IS_ERR(och))
|
||||
return PTR_ERR(och);
|
||||
|
||||
rc = 0;
|
||||
mutex_lock(&lli->lli_och_mutex);
|
||||
if (fd->fd_lease_och == NULL) {
|
||||
fd->fd_lease_och = och;
|
||||
och = NULL;
|
||||
}
|
||||
mutex_unlock(&lli->lli_och_mutex);
|
||||
if (och != NULL) {
|
||||
/* impossible now that only excl is supported for now */
|
||||
ll_lease_close(och, inode, &lease_broken);
|
||||
rc = -EBUSY;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
case LL_IOC_GET_LEASE: {
|
||||
struct ll_inode_info *lli = ll_i2info(inode);
|
||||
struct ldlm_lock *lock = NULL;
|
||||
|
||||
rc = 0;
|
||||
mutex_lock(&lli->lli_och_mutex);
|
||||
if (fd->fd_lease_och != NULL) {
|
||||
struct obd_client_handle *och = fd->fd_lease_och;
|
||||
|
||||
lock = ldlm_handle2lock(&och->och_lease_handle);
|
||||
if (lock != NULL) {
|
||||
lock_res_and_lock(lock);
|
||||
if (!ldlm_is_cancel(lock))
|
||||
rc = och->och_flags &
|
||||
(FMODE_READ | FMODE_WRITE);
|
||||
unlock_res_and_lock(lock);
|
||||
ldlm_lock_put(lock);
|
||||
}
|
||||
}
|
||||
mutex_unlock(&lli->lli_och_mutex);
|
||||
|
||||
return rc;
|
||||
}
|
||||
default: {
|
||||
int err;
|
||||
|
||||
|
@ -2581,7 +2867,15 @@ int ll_inode_revalidate_it(struct dentry *dentry, struct lookup_intent *it,
|
|||
LTIME_S(inode->i_mtime) = ll_i2info(inode)->lli_lvb.lvb_mtime;
|
||||
LTIME_S(inode->i_ctime) = ll_i2info(inode)->lli_lvb.lvb_ctime;
|
||||
} else {
|
||||
rc = ll_glimpse_size(inode);
|
||||
/* In case of restore, the MDT has the right size and has
|
||||
* already send it back without granting the layout lock,
|
||||
* inode is up-to-date so glimpse is useless.
|
||||
* Also to glimpse we need the layout, in case of a running
|
||||
* restore the MDT holds the layout lock so the glimpse will
|
||||
* block up to the end of restore (getattr will block)
|
||||
*/
|
||||
if (!(ll_i2info(inode)->lli_flags & LLIF_FILE_RESTORING))
|
||||
rc = ll_glimpse_size(inode);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
@ -2628,6 +2922,38 @@ int ll_getattr(struct vfsmount *mnt, struct dentry *de, struct kstat *stat)
|
|||
return ll_getattr_it(mnt, de, &it, stat);
|
||||
}
|
||||
|
||||
int ll_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
|
||||
__u64 start, __u64 len)
|
||||
{
|
||||
int rc;
|
||||
size_t num_bytes;
|
||||
struct ll_user_fiemap *fiemap;
|
||||
unsigned int extent_count = fieinfo->fi_extents_max;
|
||||
|
||||
num_bytes = sizeof(*fiemap) + (extent_count *
|
||||
sizeof(struct ll_fiemap_extent));
|
||||
OBD_ALLOC_LARGE(fiemap, num_bytes);
|
||||
|
||||
if (fiemap == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
fiemap->fm_flags = fieinfo->fi_flags;
|
||||
fiemap->fm_extent_count = fieinfo->fi_extents_max;
|
||||
fiemap->fm_start = start;
|
||||
fiemap->fm_length = len;
|
||||
memcpy(&fiemap->fm_extents[0], fieinfo->fi_extents_start,
|
||||
sizeof(struct ll_fiemap_extent));
|
||||
|
||||
rc = ll_do_fiemap(inode, fiemap, num_bytes);
|
||||
|
||||
fieinfo->fi_flags = fiemap->fm_flags;
|
||||
fieinfo->fi_extents_mapped = fiemap->fm_mapped_extents;
|
||||
memcpy(fieinfo->fi_extents_start, &fiemap->fm_extents[0],
|
||||
fiemap->fm_mapped_extents * sizeof(struct ll_fiemap_extent));
|
||||
|
||||
OBD_FREE_LARGE(fiemap, num_bytes);
|
||||
return rc;
|
||||
}
|
||||
|
||||
struct posix_acl * ll_get_acl(struct inode *inode, int type)
|
||||
{
|
||||
|
@ -2676,17 +3002,12 @@ int ll_inode_permission(struct inode *inode, int mask)
|
|||
return rc;
|
||||
}
|
||||
|
||||
#define READ_METHOD aio_read
|
||||
#define READ_FUNCTION ll_file_aio_read
|
||||
#define WRITE_METHOD aio_write
|
||||
#define WRITE_FUNCTION ll_file_aio_write
|
||||
|
||||
/* -o localflock - only provides locally consistent flock locks */
|
||||
struct file_operations ll_file_operations = {
|
||||
.read = ll_file_read,
|
||||
.READ_METHOD = READ_FUNCTION,
|
||||
.aio_read = ll_file_aio_read,
|
||||
.write = ll_file_write,
|
||||
.WRITE_METHOD = WRITE_FUNCTION,
|
||||
.aio_write = ll_file_aio_write,
|
||||
.unlocked_ioctl = ll_file_ioctl,
|
||||
.open = ll_file_open,
|
||||
.release = ll_file_release,
|
||||
|
@ -2699,9 +3020,9 @@ struct file_operations ll_file_operations = {
|
|||
|
||||
struct file_operations ll_file_operations_flock = {
|
||||
.read = ll_file_read,
|
||||
.READ_METHOD = READ_FUNCTION,
|
||||
.aio_read = ll_file_aio_read,
|
||||
.write = ll_file_write,
|
||||
.WRITE_METHOD = WRITE_FUNCTION,
|
||||
.aio_write = ll_file_aio_write,
|
||||
.unlocked_ioctl = ll_file_ioctl,
|
||||
.open = ll_file_open,
|
||||
.release = ll_file_release,
|
||||
|
@ -2717,9 +3038,9 @@ struct file_operations ll_file_operations_flock = {
|
|||
/* These are for -o noflock - to return ENOSYS on flock calls */
|
||||
struct file_operations ll_file_operations_noflock = {
|
||||
.read = ll_file_read,
|
||||
.READ_METHOD = READ_FUNCTION,
|
||||
.aio_read = ll_file_aio_read,
|
||||
.write = ll_file_write,
|
||||
.WRITE_METHOD = WRITE_FUNCTION,
|
||||
.aio_write = ll_file_aio_write,
|
||||
.unlocked_ioctl = ll_file_ioctl,
|
||||
.open = ll_file_open,
|
||||
.release = ll_file_release,
|
||||
|
@ -2740,6 +3061,7 @@ struct inode_operations ll_file_inode_operations = {
|
|||
.getxattr = ll_getxattr,
|
||||
.listxattr = ll_listxattr,
|
||||
.removexattr = ll_removexattr,
|
||||
.fiemap = ll_fiemap,
|
||||
.get_acl = ll_get_acl,
|
||||
};
|
||||
|
||||
|
@ -3150,3 +3472,30 @@ int ll_layout_refresh(struct inode *inode, __u32 *gen)
|
|||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function send a restore request to the MDT
|
||||
*/
|
||||
int ll_layout_restore(struct inode *inode)
|
||||
{
|
||||
struct hsm_user_request *hur;
|
||||
int len, rc;
|
||||
|
||||
len = sizeof(struct hsm_user_request) +
|
||||
sizeof(struct hsm_user_item);
|
||||
OBD_ALLOC(hur, len);
|
||||
if (hur == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
hur->hur_request.hr_action = HUA_RESTORE;
|
||||
hur->hur_request.hr_archive_id = 0;
|
||||
hur->hur_request.hr_flags = 0;
|
||||
memcpy(&hur->hur_user_item[0].hui_fid, &ll_i2info(inode)->lli_fid,
|
||||
sizeof(hur->hur_user_item[0].hui_fid));
|
||||
hur->hur_user_item[0].hui_extent.length = -1;
|
||||
hur->hur_request.hr_itemcount = 1;
|
||||
rc = obd_iocontrol(LL_IOC_HSM_REQUEST, cl_i2sbi(inode)->ll_md_exp,
|
||||
len, hur, NULL);
|
||||
OBD_FREE(hur, len);
|
||||
return rc;
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include <lclient.h>
|
||||
#include <lustre_mdc.h>
|
||||
#include <linux/lustre_intent.h>
|
||||
#include <linux/compat.h>
|
||||
|
||||
#ifndef FMODE_EXEC
|
||||
#define FMODE_EXEC 0
|
||||
|
@ -124,6 +125,8 @@ enum lli_flags {
|
|||
LLIF_SRVLOCK = (1 << 5),
|
||||
/* File data is modified. */
|
||||
LLIF_DATA_MODIFIED = (1 << 6),
|
||||
/* File is being restored */
|
||||
LLIF_FILE_RESTORING = (1 << 7),
|
||||
};
|
||||
|
||||
struct ll_inode_info {
|
||||
|
@ -458,7 +461,7 @@ struct ll_sb_info {
|
|||
struct lu_fid ll_root_fid; /* root object fid */
|
||||
|
||||
int ll_flags;
|
||||
int ll_umounting:1;
|
||||
unsigned int ll_umounting:1;
|
||||
struct list_head ll_conn_chain; /* per-conn chain of SBs */
|
||||
struct lustre_client_ocd ll_lco;
|
||||
|
||||
|
@ -607,10 +610,14 @@ extern struct kmem_cache *ll_file_data_slab;
|
|||
struct lustre_handle;
|
||||
struct ll_file_data {
|
||||
struct ll_readahead_state fd_ras;
|
||||
int fd_omode;
|
||||
struct ccc_grouplock fd_grouplock;
|
||||
__u64 lfd_pos;
|
||||
__u32 fd_flags;
|
||||
fmode_t fd_omode;
|
||||
/* openhandle if lease exists for this file.
|
||||
* Borrow lli->lli_och_mutex to protect assignment */
|
||||
struct obd_client_handle *fd_lease_och;
|
||||
struct obd_client_handle *fd_och;
|
||||
struct file *fd_file;
|
||||
/* Indicate whether need to report failure when close.
|
||||
* true: failure is known, not report again.
|
||||
|
@ -643,7 +650,7 @@ static inline int ll_need_32bit_api(struct ll_sb_info *sbi)
|
|||
#if BITS_PER_LONG == 32
|
||||
return 1;
|
||||
#else
|
||||
return unlikely(current_is_32bit() || (sbi->ll_flags & LL_SBI_32BIT_API));
|
||||
return unlikely(is_compat_task() || (sbi->ll_flags & LL_SBI_32BIT_API));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -776,6 +783,11 @@ int ll_put_grouplock(struct inode *inode, struct file *file, unsigned long arg);
|
|||
int ll_fid2path(struct inode *inode, void *arg);
|
||||
int ll_data_version(struct inode *inode, __u64 *data_version, int extent_lock);
|
||||
|
||||
struct obd_client_handle *ll_lease_open(struct inode *inode, struct file *file,
|
||||
fmode_t mode);
|
||||
int ll_lease_close(struct obd_client_handle *och, struct inode *inode,
|
||||
bool *lease_broken);
|
||||
|
||||
/* llite/dcache.c */
|
||||
|
||||
int ll_dops_init(struct dentry *de, int block, int init_sa);
|
||||
|
@ -1578,5 +1590,6 @@ enum {
|
|||
|
||||
int ll_layout_conf(struct inode *inode, const struct cl_object_conf *conf);
|
||||
int ll_layout_refresh(struct inode *inode, __u32 *gen);
|
||||
int ll_layout_restore(struct inode *inode);
|
||||
|
||||
#endif /* LLITE_INTERNAL_H */
|
||||
|
|
|
@ -1353,6 +1353,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr)
|
|||
struct ll_inode_info *lli = ll_i2info(inode);
|
||||
struct md_op_data *op_data = NULL;
|
||||
struct md_open_data *mod = NULL;
|
||||
bool file_is_released = false;
|
||||
int rc = 0, rc1 = 0;
|
||||
|
||||
CDEBUG(D_VFSTRACE, "%s: setattr inode %p/fid:"DFID" from %llu to %llu, "
|
||||
|
@ -1436,10 +1437,40 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr)
|
|||
(attr->ia_valid & (ATTR_SIZE | ATTR_MTIME | ATTR_MTIME_SET)))
|
||||
op_data->op_flags = MF_EPOCH_OPEN;
|
||||
|
||||
/* truncate on a released file must failed with -ENODATA,
|
||||
* so size must not be set on MDS for released file
|
||||
* but other attributes must be set
|
||||
*/
|
||||
if (S_ISREG(inode->i_mode)) {
|
||||
struct lov_stripe_md *lsm;
|
||||
__u32 gen;
|
||||
|
||||
ll_layout_refresh(inode, &gen);
|
||||
lsm = ccc_inode_lsm_get(inode);
|
||||
if (lsm && lsm->lsm_pattern & LOV_PATTERN_F_RELEASED)
|
||||
file_is_released = true;
|
||||
ccc_inode_lsm_put(inode, lsm);
|
||||
}
|
||||
|
||||
/* clear size attr for released file
|
||||
* we clear the attribute send to MDT in op_data, not the original
|
||||
* received from caller in attr which is used later to
|
||||
* decide return code */
|
||||
if (file_is_released && (attr->ia_valid & ATTR_SIZE))
|
||||
op_data->op_attr.ia_valid &= ~ATTR_SIZE;
|
||||
|
||||
rc = ll_md_setattr(dentry, op_data, &mod);
|
||||
if (rc)
|
||||
GOTO(out, rc);
|
||||
|
||||
/* truncate failed, others succeed */
|
||||
if (file_is_released) {
|
||||
if (attr->ia_valid & ATTR_SIZE)
|
||||
GOTO(out, rc = -ENODATA);
|
||||
else
|
||||
GOTO(out, rc = 0);
|
||||
}
|
||||
|
||||
/* RPC to MDT is sent, cancel data modification flag */
|
||||
if (rc == 0 && (op_data->op_bias & MDS_DATA_MODIFIED)) {
|
||||
spin_lock(&lli->lli_lock);
|
||||
|
@ -1761,6 +1792,11 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md)
|
|||
LASSERT(md->oss_capa);
|
||||
ll_add_capa(inode, md->oss_capa);
|
||||
}
|
||||
|
||||
if (body->valid & OBD_MD_TSTATE) {
|
||||
if (body->t_state & MS_RESTORE)
|
||||
lli->lli_flags |= LLIF_FILE_RESTORING;
|
||||
}
|
||||
}
|
||||
|
||||
void ll_read_inode2(struct inode *inode, void *opaque)
|
||||
|
|
|
@ -233,12 +233,9 @@ int ll_md_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,
|
|||
ll_have_md_lock(inode, &bits, mode);
|
||||
|
||||
fid = ll_inode2fid(inode);
|
||||
if (lock->l_resource->lr_name.name[0] != fid_seq(fid) ||
|
||||
lock->l_resource->lr_name.name[1] != fid_oid(fid) ||
|
||||
lock->l_resource->lr_name.name[2] != fid_ver(fid)) {
|
||||
if (!fid_res_name_eq(fid, &lock->l_resource->lr_name))
|
||||
LDLM_ERROR(lock, "data mismatch with object "
|
||||
DFID" (%p)", PFID(fid), inode);
|
||||
}
|
||||
|
||||
if (bits & MDS_INODELOCK_OPEN) {
|
||||
int flags = 0;
|
||||
|
|
|
@ -121,8 +121,38 @@ static void vvp_io_fini(const struct lu_env *env, const struct cl_io_slice *ios)
|
|||
|
||||
CLOBINVRNT(env, obj, ccc_object_invariant(obj));
|
||||
|
||||
CDEBUG(D_VFSTRACE, "ignore/verify layout %d/%d, layout version %d.\n",
|
||||
io->ci_ignore_layout, io->ci_verify_layout, cio->cui_layout_gen);
|
||||
CDEBUG(D_VFSTRACE, DFID
|
||||
" ignore/verify layout %d/%d, layout version %d restore needed %d\n",
|
||||
PFID(lu_object_fid(&obj->co_lu)),
|
||||
io->ci_ignore_layout, io->ci_verify_layout,
|
||||
cio->cui_layout_gen, io->ci_restore_needed);
|
||||
|
||||
if (io->ci_restore_needed == 1) {
|
||||
int rc;
|
||||
|
||||
/* file was detected release, we need to restore it
|
||||
* before finishing the io
|
||||
*/
|
||||
rc = ll_layout_restore(ccc_object_inode(obj));
|
||||
/* if restore registration failed, no restart,
|
||||
* we will return -ENODATA */
|
||||
/* The layout will change after restore, so we need to
|
||||
* block on layout lock hold by the MDT
|
||||
* as MDT will not send new layout in lvb (see LU-3124)
|
||||
* we have to explicitly fetch it, all this will be done
|
||||
* by ll_layout_refresh()
|
||||
*/
|
||||
if (rc == 0) {
|
||||
io->ci_restore_needed = 0;
|
||||
io->ci_need_restart = 1;
|
||||
io->ci_verify_layout = 1;
|
||||
} else {
|
||||
io->ci_restore_needed = 1;
|
||||
io->ci_need_restart = 0;
|
||||
io->ci_verify_layout = 0;
|
||||
io->ci_result = rc;
|
||||
}
|
||||
}
|
||||
|
||||
if (!io->ci_ignore_layout && io->ci_verify_layout) {
|
||||
__u32 gen = 0;
|
||||
|
@ -130,9 +160,17 @@ static void vvp_io_fini(const struct lu_env *env, const struct cl_io_slice *ios)
|
|||
/* check layout version */
|
||||
ll_layout_refresh(ccc_object_inode(obj), &gen);
|
||||
io->ci_need_restart = cio->cui_layout_gen != gen;
|
||||
if (io->ci_need_restart)
|
||||
CDEBUG(D_VFSTRACE, "layout changed from %d to %d.\n",
|
||||
cio->cui_layout_gen, gen);
|
||||
if (io->ci_need_restart) {
|
||||
CDEBUG(D_VFSTRACE,
|
||||
DFID" layout changed from %d to %d.\n",
|
||||
PFID(lu_object_fid(&obj->co_lu)),
|
||||
cio->cui_layout_gen, gen);
|
||||
/* today successful restore is the only possible
|
||||
* case */
|
||||
/* restore was done, clear restoring state */
|
||||
ll_i2info(ccc_object_inode(obj))->lli_flags &=
|
||||
~LLIF_FILE_RESTORING;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1111,6 +1149,12 @@ int vvp_io_init(const struct lu_env *env, struct cl_object *obj,
|
|||
|
||||
CLOBINVRNT(env, obj, ccc_object_invariant(obj));
|
||||
|
||||
CDEBUG(D_VFSTRACE, DFID
|
||||
" ignore/verify layout %d/%d, layout version %d restore needed %d\n",
|
||||
PFID(lu_object_fid(&obj->co_lu)),
|
||||
io->ci_ignore_layout, io->ci_verify_layout,
|
||||
cio->cui_layout_gen, io->ci_restore_needed);
|
||||
|
||||
CL_IO_SLICE_CLEAN(cio, cui_cl);
|
||||
cl_io_slice_add(io, &cio->cui_cl, obj, &vvp_io_ops);
|
||||
vio->cui_ra_window_set = 0;
|
||||
|
|
|
@ -947,14 +947,23 @@ int lov_io_init_released(const struct lu_env *env, struct cl_object *obj,
|
|||
LASSERTF(0, "invalid type %d\n", io->ci_type);
|
||||
case CIT_MISC:
|
||||
case CIT_FSYNC:
|
||||
result = +1;
|
||||
result = 1;
|
||||
break;
|
||||
case CIT_SETATTR:
|
||||
/* the truncate to 0 is managed by MDT:
|
||||
* - in open, for open O_TRUNC
|
||||
* - in setattr, for truncate
|
||||
*/
|
||||
/* the truncate is for size > 0 so triggers a restore */
|
||||
if (cl_io_is_trunc(io))
|
||||
io->ci_restore_needed = 1;
|
||||
result = -ENODATA;
|
||||
break;
|
||||
case CIT_READ:
|
||||
case CIT_WRITE:
|
||||
case CIT_FAULT:
|
||||
/* TODO: need to restore the file. */
|
||||
result = -EBADF;
|
||||
io->ci_restore_needed = 1;
|
||||
result = -ENODATA;
|
||||
break;
|
||||
}
|
||||
if (result == 0) {
|
||||
|
|
|
@ -105,24 +105,22 @@ void lov_dump_lmm(int level, void *lmm)
|
|||
{
|
||||
int magic;
|
||||
|
||||
magic = ((struct lov_mds_md_v1 *)(lmm))->lmm_magic;
|
||||
magic = le32_to_cpu(((struct lov_mds_md *)lmm)->lmm_magic);
|
||||
switch (magic) {
|
||||
case LOV_MAGIC_V1:
|
||||
return lov_dump_lmm_v1(level, (struct lov_mds_md_v1 *)(lmm));
|
||||
lov_dump_lmm_v1(level, (struct lov_mds_md_v1 *)lmm);
|
||||
break;
|
||||
case LOV_MAGIC_V3:
|
||||
return lov_dump_lmm_v3(level, (struct lov_mds_md_v3 *)(lmm));
|
||||
lov_dump_lmm_v3(level, (struct lov_mds_md_v3 *)lmm);
|
||||
break;
|
||||
default:
|
||||
CERROR("Cannot recognize lmm_magic %x", magic);
|
||||
CDEBUG(level, "unrecognized lmm_magic %x, assuming %x\n",
|
||||
magic, LOV_MAGIC_V1);
|
||||
lov_dump_lmm_common(level, lmm);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#define LMM_ASSERT(test) \
|
||||
do { \
|
||||
if (!(test)) lov_dump_lmm(D_ERROR, lmm); \
|
||||
LASSERT(test); /* so we know what assertion failed */ \
|
||||
} while (0)
|
||||
|
||||
/* Pack LOV object metadata for disk storage. It is packed in LE byte
|
||||
* order and is opaque to the networking layer.
|
||||
*
|
||||
|
|
|
@ -260,29 +260,29 @@ LPROC_SEQ_FOPS_RO_TYPE(lov, kbytesfree);
|
|||
LPROC_SEQ_FOPS_RO_TYPE(lov, kbytesavail);
|
||||
|
||||
struct lprocfs_vars lprocfs_lov_obd_vars[] = {
|
||||
{ "uuid", &lov_uuid_fops, 0, 0 },
|
||||
{ "stripesize", &lov_stripesize_fops, 0 },
|
||||
{ "stripeoffset", &lov_stripeoffset_fops, 0 },
|
||||
{ "stripecount", &lov_stripecount_fops, 0 },
|
||||
{ "stripetype", &lov_stripetype_fops, 0 },
|
||||
{ "numobd", &lov_numobd_fops, 0, 0 },
|
||||
{ "activeobd", &lov_activeobd_fops, 0, 0 },
|
||||
{ "filestotal", &lov_filestotal_fops, 0, 0 },
|
||||
{ "filesfree", &lov_filesfree_fops, 0, 0 },
|
||||
/*{ "filegroups", lprocfs_rd_filegroups, 0, 0 },*/
|
||||
{ "blocksize", &lov_blksize_fops, 0, 0 },
|
||||
{ "kbytestotal", &lov_kbytestotal_fops, 0, 0 },
|
||||
{ "kbytesfree", &lov_kbytesfree_fops, 0, 0 },
|
||||
{ "kbytesavail", &lov_kbytesavail_fops, 0, 0 },
|
||||
{ "desc_uuid", &lov_desc_uuid_fops, 0, 0 },
|
||||
{ 0 }
|
||||
{ "uuid", &lov_uuid_fops, NULL, 0 },
|
||||
{ "stripesize", &lov_stripesize_fops, NULL },
|
||||
{ "stripeoffset", &lov_stripeoffset_fops, NULL },
|
||||
{ "stripecount", &lov_stripecount_fops, NULL },
|
||||
{ "stripetype", &lov_stripetype_fops, NULL },
|
||||
{ "numobd", &lov_numobd_fops, NULL, 0 },
|
||||
{ "activeobd", &lov_activeobd_fops, NULL, 0 },
|
||||
{ "filestotal", &lov_filestotal_fops, NULL, 0 },
|
||||
{ "filesfree", &lov_filesfree_fops, NULL, 0 },
|
||||
/*{ "filegroups", lprocfs_rd_filegroups, NULL, 0 },*/
|
||||
{ "blocksize", &lov_blksize_fops, NULL, 0 },
|
||||
{ "kbytestotal", &lov_kbytestotal_fops, NULL, 0 },
|
||||
{ "kbytesfree", &lov_kbytesfree_fops, NULL, 0 },
|
||||
{ "kbytesavail", &lov_kbytesavail_fops, NULL, 0 },
|
||||
{ "desc_uuid", &lov_desc_uuid_fops, NULL, 0 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
LPROC_SEQ_FOPS_RO_TYPE(lov, numrefs);
|
||||
|
||||
static struct lprocfs_vars lprocfs_lov_module_vars[] = {
|
||||
{ "num_refs", &lov_numrefs_fops, 0, 0 },
|
||||
{ 0 }
|
||||
{ "num_refs", &lov_numrefs_fops, NULL, 0 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
void lprocfs_lov_init_vars(struct lprocfs_static_vars *lvars)
|
||||
|
|
|
@ -1,760 +0,0 @@
|
|||
/*
|
||||
* GPL HEADER START
|
||||
*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 only,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License version 2 for more details (a copy is included
|
||||
* in the LICENSE file that accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* version 2 along with this program; If not, see
|
||||
* http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*
|
||||
* GPL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
*
|
||||
* Copyright (c) 2011, 2012, Intel Corporation.
|
||||
*/
|
||||
/*
|
||||
* This file is part of Lustre, http://www.lustre.org/
|
||||
* Lustre is a trademark of Sun Microsystems, Inc.
|
||||
*
|
||||
* lustre/lvfs/fsfilt_ext3.c
|
||||
*
|
||||
* Author: Andreas Dilger <adilger@clusterfs.com>
|
||||
*/
|
||||
|
||||
#define DEBUG_SUBSYSTEM S_FILTER
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/pagemap.h>
|
||||
#include <ldiskfs/ldiskfs_config.h>
|
||||
#include <ext4/ext4.h>
|
||||
#include <ext4/ext4_jbd2.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/quota.h>
|
||||
|
||||
#include <linux/libcfs/libcfs.h>
|
||||
#include <lustre_fsfilt.h>
|
||||
#include <obd.h>
|
||||
#include <linux/lustre_compat25.h>
|
||||
#include <linux/lprocfs_status.h>
|
||||
|
||||
#include <ext4/ext4_extents.h>
|
||||
|
||||
#ifdef HAVE_EXT_PBLOCK /* Name changed to ext4_ext_pblock for kernel 2.6.35 */
|
||||
#define ext3_ext_pblock(ex) ext_pblock((ex))
|
||||
#endif
|
||||
|
||||
/* for kernels 2.6.18 and later */
|
||||
#define FSFILT_SINGLEDATA_TRANS_BLOCKS(sb) EXT3_SINGLEDATA_TRANS_BLOCKS(sb)
|
||||
|
||||
#define fsfilt_ext3_ext_insert_extent(handle, inode, path, newext, flag) \
|
||||
ext3_ext_insert_extent(handle, inode, path, newext, flag)
|
||||
|
||||
#define ext3_mb_discard_inode_preallocations(inode) \
|
||||
ext3_discard_preallocations(inode)
|
||||
|
||||
#define fsfilt_log_start_commit(journal, tid) jbd2_log_start_commit(journal, tid)
|
||||
#define fsfilt_log_wait_commit(journal, tid) jbd2_log_wait_commit(journal, tid)
|
||||
|
||||
static struct kmem_cache *fcb_cache;
|
||||
|
||||
struct fsfilt_cb_data {
|
||||
struct ext4_journal_cb_entry cb_jcb; /* private data - MUST BE FIRST */
|
||||
fsfilt_cb_t cb_func; /* MDS/OBD completion function */
|
||||
struct obd_device *cb_obd; /* MDS/OBD completion device */
|
||||
__u64 cb_last_rcvd; /* MDS/OST last committed operation */
|
||||
void *cb_data; /* MDS/OST completion function data */
|
||||
};
|
||||
|
||||
static char *fsfilt_ext3_get_label(struct super_block *sb)
|
||||
{
|
||||
return EXT3_SB(sb)->s_es->s_volume_name;
|
||||
}
|
||||
|
||||
/* kernel has ext4_blocks_for_truncate since linux-3.1.1 */
|
||||
# include <ext4/truncate.h>
|
||||
|
||||
/*
|
||||
* We don't currently need any additional blocks for rmdir and
|
||||
* unlink transactions because we are storing the OST oa_id inside
|
||||
* the inode (which we will be changing anyways as part of this
|
||||
* transaction).
|
||||
*/
|
||||
static void *fsfilt_ext3_start(struct inode *inode, int op, void *desc_private,
|
||||
int logs)
|
||||
{
|
||||
/* For updates to the last received file */
|
||||
int nblocks = FSFILT_SINGLEDATA_TRANS_BLOCKS(inode->i_sb);
|
||||
journal_t *journal;
|
||||
void *handle;
|
||||
|
||||
if (current->journal_info) {
|
||||
CDEBUG(D_INODE, "increasing refcount on %p\n",
|
||||
current->journal_info);
|
||||
goto journal_start;
|
||||
}
|
||||
|
||||
switch(op) {
|
||||
case FSFILT_OP_UNLINK:
|
||||
/* delete one file + create/update logs for each stripe */
|
||||
nblocks += EXT3_DELETE_TRANS_BLOCKS(inode->i_sb);
|
||||
nblocks += (EXT3_INDEX_EXTRA_TRANS_BLOCKS +
|
||||
FSFILT_SINGLEDATA_TRANS_BLOCKS(inode->i_sb)) * logs;
|
||||
break;
|
||||
case FSFILT_OP_CANCEL_UNLINK:
|
||||
LASSERT(logs == 1);
|
||||
|
||||
/* blocks for log header bitmap update OR
|
||||
* blocks for catalog header bitmap update + unlink of logs +
|
||||
* blocks for delete the inode (include blocks truncating). */
|
||||
nblocks = (LLOG_CHUNK_SIZE >> inode->i_blkbits) +
|
||||
EXT3_DELETE_TRANS_BLOCKS(inode->i_sb) +
|
||||
ext4_blocks_for_truncate(inode) + 3;
|
||||
break;
|
||||
default: CERROR("unknown transaction start op %d\n", op);
|
||||
LBUG();
|
||||
}
|
||||
|
||||
LASSERT(current->journal_info == desc_private);
|
||||
journal = EXT3_SB(inode->i_sb)->s_journal;
|
||||
if (nblocks > journal->j_max_transaction_buffers) {
|
||||
CWARN("too many credits %d for op %ux%u using %d instead\n",
|
||||
nblocks, op, logs, journal->j_max_transaction_buffers);
|
||||
nblocks = journal->j_max_transaction_buffers;
|
||||
}
|
||||
|
||||
journal_start:
|
||||
LASSERTF(nblocks > 0, "can't start %d credit transaction\n", nblocks);
|
||||
handle = ext3_journal_start(inode, nblocks);
|
||||
|
||||
if (!IS_ERR(handle))
|
||||
LASSERT(current->journal_info == handle);
|
||||
else
|
||||
CERROR("error starting handle for op %u (%u credits): rc %ld\n",
|
||||
op, nblocks, PTR_ERR(handle));
|
||||
return handle;
|
||||
}
|
||||
|
||||
static int fsfilt_ext3_commit(struct inode *inode, void *h, int force_sync)
|
||||
{
|
||||
int rc;
|
||||
handle_t *handle = h;
|
||||
|
||||
LASSERT(current->journal_info == handle);
|
||||
if (force_sync)
|
||||
handle->h_sync = 1; /* recovery likes this */
|
||||
|
||||
rc = ext3_journal_stop(handle);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
#ifndef EXT3_EXTENTS_FL
|
||||
#define EXT3_EXTENTS_FL 0x00080000 /* Inode uses extents */
|
||||
#endif
|
||||
|
||||
#ifndef EXT_ASSERT
|
||||
#define EXT_ASSERT(cond) BUG_ON(!(cond))
|
||||
#endif
|
||||
|
||||
#define EXT_GENERATION(inode) (EXT4_I(inode)->i_ext_generation)
|
||||
#define ext3_ext_base inode
|
||||
#define ext3_ext_base2inode(inode) (inode)
|
||||
#define EXT_DEPTH(inode) ext_depth(inode)
|
||||
#define fsfilt_ext3_ext_walk_space(inode, block, num, cb, cbdata) \
|
||||
ext3_ext_walk_space(inode, block, num, cb, cbdata);
|
||||
|
||||
struct bpointers {
|
||||
unsigned long *blocks;
|
||||
unsigned long start;
|
||||
int num;
|
||||
int init_num;
|
||||
int create;
|
||||
};
|
||||
|
||||
static long ext3_ext_find_goal(struct inode *inode, struct ext3_ext_path *path,
|
||||
unsigned long block, int *aflags)
|
||||
{
|
||||
struct ext3_inode_info *ei = EXT3_I(inode);
|
||||
unsigned long bg_start;
|
||||
unsigned long colour;
|
||||
int depth;
|
||||
|
||||
if (path) {
|
||||
struct ext3_extent *ex;
|
||||
depth = path->p_depth;
|
||||
|
||||
/* try to predict block placement */
|
||||
if ((ex = path[depth].p_ext))
|
||||
return ext4_ext_pblock(ex) + (block - le32_to_cpu(ex->ee_block));
|
||||
|
||||
/* it looks index is empty
|
||||
* try to find starting from index itself */
|
||||
if (path[depth].p_bh)
|
||||
return path[depth].p_bh->b_blocknr;
|
||||
}
|
||||
|
||||
/* OK. use inode's group */
|
||||
bg_start = (ei->i_block_group * EXT3_BLOCKS_PER_GROUP(inode->i_sb)) +
|
||||
le32_to_cpu(EXT3_SB(inode->i_sb)->s_es->s_first_data_block);
|
||||
colour = (current->pid % 16) *
|
||||
(EXT3_BLOCKS_PER_GROUP(inode->i_sb) / 16);
|
||||
return bg_start + colour + block;
|
||||
}
|
||||
|
||||
#define ll_unmap_underlying_metadata(sb, blocknr) \
|
||||
unmap_underlying_metadata((sb)->s_bdev, blocknr)
|
||||
|
||||
#ifndef EXT3_MB_HINT_GROUP_ALLOC
|
||||
static unsigned long new_blocks(handle_t *handle, struct ext3_ext_base *base,
|
||||
struct ext3_ext_path *path, unsigned long block,
|
||||
unsigned long *count, int *err)
|
||||
{
|
||||
unsigned long pblock, goal;
|
||||
int aflags = 0;
|
||||
struct inode *inode = ext3_ext_base2inode(base);
|
||||
|
||||
goal = ext3_ext_find_goal(inode, path, block, &aflags);
|
||||
aflags |= 2; /* block have been already reserved */
|
||||
pblock = ext3_mb_new_blocks(handle, inode, goal, count, aflags, err);
|
||||
return pblock;
|
||||
|
||||
}
|
||||
#else
|
||||
static unsigned long new_blocks(handle_t *handle, struct ext3_ext_base *base,
|
||||
struct ext3_ext_path *path, unsigned long block,
|
||||
unsigned long *count, int *err)
|
||||
{
|
||||
struct inode *inode = ext3_ext_base2inode(base);
|
||||
struct ext3_allocation_request ar;
|
||||
unsigned long pblock;
|
||||
int aflags;
|
||||
|
||||
/* find neighbour allocated blocks */
|
||||
ar.lleft = block;
|
||||
*err = ext3_ext_search_left(base, path, &ar.lleft, &ar.pleft);
|
||||
if (*err)
|
||||
return 0;
|
||||
ar.lright = block;
|
||||
*err = ext3_ext_search_right(base, path, &ar.lright, &ar.pright);
|
||||
if (*err)
|
||||
return 0;
|
||||
|
||||
/* allocate new block */
|
||||
ar.goal = ext3_ext_find_goal(inode, path, block, &aflags);
|
||||
ar.inode = inode;
|
||||
ar.logical = block;
|
||||
ar.len = *count;
|
||||
ar.flags = EXT3_MB_HINT_DATA;
|
||||
pblock = ext3_mb_new_blocks(handle, &ar, err);
|
||||
*count = ar.len;
|
||||
return pblock;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int ext3_ext_new_extent_cb(struct ext3_ext_base *base,
|
||||
struct ext3_ext_path *path,
|
||||
struct ext3_ext_cache *cex,
|
||||
#ifdef HAVE_EXT_PREPARE_CB_EXTENT
|
||||
struct ext3_extent *ex,
|
||||
#endif
|
||||
void *cbdata)
|
||||
{
|
||||
struct bpointers *bp = cbdata;
|
||||
struct inode *inode = ext3_ext_base2inode(base);
|
||||
struct ext3_extent nex;
|
||||
unsigned long pblock;
|
||||
unsigned long tgen;
|
||||
int err, i;
|
||||
unsigned long count;
|
||||
handle_t *handle;
|
||||
|
||||
#ifdef EXT3_EXT_CACHE_EXTENT
|
||||
if (cex->ec_type == EXT3_EXT_CACHE_EXTENT)
|
||||
#else
|
||||
if ((cex->ec_len != 0) && (cex->ec_start != 0))
|
||||
#endif
|
||||
{
|
||||
err = EXT_CONTINUE;
|
||||
goto map;
|
||||
}
|
||||
|
||||
if (bp->create == 0) {
|
||||
i = 0;
|
||||
if (cex->ec_block < bp->start)
|
||||
i = bp->start - cex->ec_block;
|
||||
if (i >= cex->ec_len)
|
||||
CERROR("nothing to do?! i = %d, e_num = %u\n",
|
||||
i, cex->ec_len);
|
||||
for (; i < cex->ec_len && bp->num; i++) {
|
||||
*(bp->blocks) = 0;
|
||||
bp->blocks++;
|
||||
bp->num--;
|
||||
bp->start++;
|
||||
}
|
||||
|
||||
return EXT_CONTINUE;
|
||||
}
|
||||
|
||||
tgen = EXT_GENERATION(base);
|
||||
count = ext3_ext_calc_credits_for_insert(base, path);
|
||||
|
||||
handle = ext3_journal_start(inode, count+EXT3_ALLOC_NEEDED+1);
|
||||
if (IS_ERR(handle)) {
|
||||
return PTR_ERR(handle);
|
||||
}
|
||||
|
||||
if (tgen != EXT_GENERATION(base)) {
|
||||
/* the tree has changed. so path can be invalid at moment */
|
||||
ext3_journal_stop(handle);
|
||||
return EXT_REPEAT;
|
||||
}
|
||||
|
||||
/* In 2.6.32 kernel, ext4_ext_walk_space()'s callback func is not
|
||||
* protected by i_data_sem as whole. so we patch it to store
|
||||
* generation to path and now verify the tree hasn't changed */
|
||||
down_write((&EXT4_I(inode)->i_data_sem));
|
||||
|
||||
/* validate extent, make sure the extent tree does not changed */
|
||||
if (EXT_GENERATION(base) != path[0].p_generation) {
|
||||
/* cex is invalid, try again */
|
||||
up_write(&EXT4_I(inode)->i_data_sem);
|
||||
ext3_journal_stop(handle);
|
||||
return EXT_REPEAT;
|
||||
}
|
||||
|
||||
count = cex->ec_len;
|
||||
pblock = new_blocks(handle, base, path, cex->ec_block, &count, &err);
|
||||
if (!pblock)
|
||||
goto out;
|
||||
EXT_ASSERT(count <= cex->ec_len);
|
||||
|
||||
/* insert new extent */
|
||||
nex.ee_block = cpu_to_le32(cex->ec_block);
|
||||
ext3_ext_store_pblock(&nex, pblock);
|
||||
nex.ee_len = cpu_to_le16(count);
|
||||
err = fsfilt_ext3_ext_insert_extent(handle, base, path, &nex, 0);
|
||||
if (err) {
|
||||
/* free data blocks we just allocated */
|
||||
/* not a good idea to call discard here directly,
|
||||
* but otherwise we'd need to call it every free() */
|
||||
#ifdef EXT3_MB_HINT_GROUP_ALLOC
|
||||
ext3_mb_discard_inode_preallocations(inode);
|
||||
#endif
|
||||
#ifdef HAVE_EXT_FREE_BLOCK_WITH_BUFFER_HEAD /* Introduced in 2.6.32-rc7 */
|
||||
ext3_free_blocks(handle, inode, NULL, ext4_ext_pblock(&nex),
|
||||
cpu_to_le16(nex.ee_len), 0);
|
||||
#else
|
||||
ext3_free_blocks(handle, inode, ext4_ext_pblock(&nex),
|
||||
cpu_to_le16(nex.ee_len), 0);
|
||||
#endif
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* Putting len of the actual extent we just inserted,
|
||||
* we are asking ext3_ext_walk_space() to continue
|
||||
* scaning after that block
|
||||
*/
|
||||
cex->ec_len = le16_to_cpu(nex.ee_len);
|
||||
cex->ec_start = ext4_ext_pblock(&nex);
|
||||
BUG_ON(le16_to_cpu(nex.ee_len) == 0);
|
||||
BUG_ON(le32_to_cpu(nex.ee_block) != cex->ec_block);
|
||||
|
||||
out:
|
||||
up_write((&EXT4_I(inode)->i_data_sem));
|
||||
ext3_journal_stop(handle);
|
||||
map:
|
||||
if (err >= 0) {
|
||||
/* map blocks */
|
||||
if (bp->num == 0) {
|
||||
CERROR("hmm. why do we find this extent?\n");
|
||||
CERROR("initial space: %lu:%u\n",
|
||||
bp->start, bp->init_num);
|
||||
#ifdef EXT3_EXT_CACHE_EXTENT
|
||||
CERROR("current extent: %u/%u/%llu %d\n",
|
||||
cex->ec_block, cex->ec_len,
|
||||
(unsigned long long)cex->ec_start,
|
||||
cex->ec_type);
|
||||
#else
|
||||
CERROR("current extent: %u/%u/%llu\n",
|
||||
cex->ec_block, cex->ec_len,
|
||||
(unsigned long long)cex->ec_start);
|
||||
#endif
|
||||
}
|
||||
i = 0;
|
||||
if (cex->ec_block < bp->start)
|
||||
i = bp->start - cex->ec_block;
|
||||
if (i >= cex->ec_len)
|
||||
CERROR("nothing to do?! i = %d, e_num = %u\n",
|
||||
i, cex->ec_len);
|
||||
for (; i < cex->ec_len && bp->num; i++) {
|
||||
*(bp->blocks) = cex->ec_start + i;
|
||||
#ifdef EXT3_EXT_CACHE_EXTENT
|
||||
if (cex->ec_type != EXT3_EXT_CACHE_EXTENT)
|
||||
#else
|
||||
if ((cex->ec_len == 0) || (cex->ec_start == 0))
|
||||
#endif
|
||||
{
|
||||
/* unmap any possible underlying metadata from
|
||||
* the block device mapping. bug 6998. */
|
||||
ll_unmap_underlying_metadata(inode->i_sb,
|
||||
*(bp->blocks));
|
||||
}
|
||||
bp->blocks++;
|
||||
bp->num--;
|
||||
bp->start++;
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
int fsfilt_map_nblocks(struct inode *inode, unsigned long block,
|
||||
unsigned long num, unsigned long *blocks,
|
||||
int create)
|
||||
{
|
||||
struct ext3_ext_base *base = inode;
|
||||
struct bpointers bp;
|
||||
int err;
|
||||
|
||||
CDEBUG(D_OTHER, "blocks %lu-%lu requested for inode %u\n",
|
||||
block, block + num - 1, (unsigned) inode->i_ino);
|
||||
|
||||
bp.blocks = blocks;
|
||||
bp.start = block;
|
||||
bp.init_num = bp.num = num;
|
||||
bp.create = create;
|
||||
|
||||
err = fsfilt_ext3_ext_walk_space(base, block, num,
|
||||
ext3_ext_new_extent_cb, &bp);
|
||||
ext3_ext_invalidate_cache(base);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int fsfilt_ext3_map_ext_inode_pages(struct inode *inode, struct page **page,
|
||||
int pages, unsigned long *blocks,
|
||||
int create)
|
||||
{
|
||||
int blocks_per_page = PAGE_CACHE_SIZE >> inode->i_blkbits;
|
||||
int rc = 0, i = 0;
|
||||
struct page *fp = NULL;
|
||||
int clen = 0;
|
||||
|
||||
CDEBUG(D_OTHER, "inode %lu: map %d pages from %lu\n",
|
||||
inode->i_ino, pages, (*page)->index);
|
||||
|
||||
/* pages are sorted already. so, we just have to find
|
||||
* contig. space and process them properly */
|
||||
while (i < pages) {
|
||||
if (fp == NULL) {
|
||||
/* start new extent */
|
||||
fp = *page++;
|
||||
clen = 1;
|
||||
i++;
|
||||
continue;
|
||||
} else if (fp->index + clen == (*page)->index) {
|
||||
/* continue the extent */
|
||||
page++;
|
||||
clen++;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* process found extent */
|
||||
rc = fsfilt_map_nblocks(inode, fp->index * blocks_per_page,
|
||||
clen * blocks_per_page, blocks,
|
||||
create);
|
||||
if (rc)
|
||||
GOTO(cleanup, rc);
|
||||
|
||||
/* look for next extent */
|
||||
fp = NULL;
|
||||
blocks += blocks_per_page * clen;
|
||||
}
|
||||
|
||||
if (fp)
|
||||
rc = fsfilt_map_nblocks(inode, fp->index * blocks_per_page,
|
||||
clen * blocks_per_page, blocks,
|
||||
create);
|
||||
cleanup:
|
||||
return rc;
|
||||
}
|
||||
|
||||
int fsfilt_ext3_map_bm_inode_pages(struct inode *inode, struct page **page,
|
||||
int pages, unsigned long *blocks,
|
||||
int create)
|
||||
{
|
||||
int blocks_per_page = PAGE_CACHE_SIZE >> inode->i_blkbits;
|
||||
unsigned long *b;
|
||||
int rc = 0, i;
|
||||
|
||||
for (i = 0, b = blocks; i < pages; i++, page++) {
|
||||
rc = ext3_map_inode_page(inode, *page, b, create);
|
||||
if (rc) {
|
||||
CERROR("ino %lu, blk %lu create %d: rc %d\n",
|
||||
inode->i_ino, *b, create, rc);
|
||||
break;
|
||||
}
|
||||
|
||||
b += blocks_per_page;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
int fsfilt_ext3_map_inode_pages(struct inode *inode, struct page **page,
|
||||
int pages, unsigned long *blocks,
|
||||
int create, struct mutex *optional_mutex)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (EXT3_I(inode)->i_flags & EXT3_EXTENTS_FL) {
|
||||
rc = fsfilt_ext3_map_ext_inode_pages(inode, page, pages,
|
||||
blocks, create);
|
||||
return rc;
|
||||
}
|
||||
if (optional_mutex != NULL)
|
||||
mutex_lock(optional_mutex);
|
||||
rc = fsfilt_ext3_map_bm_inode_pages(inode, page, pages, blocks, create);
|
||||
if (optional_mutex != NULL)
|
||||
mutex_unlock(optional_mutex);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int fsfilt_ext3_read(struct inode *inode, void *buf, int size, loff_t *offs)
|
||||
{
|
||||
unsigned long block;
|
||||
struct buffer_head *bh;
|
||||
int err, blocksize, csize, boffs, osize = size;
|
||||
|
||||
/* prevent reading after eof */
|
||||
spin_lock(&inode->i_lock);
|
||||
if (i_size_read(inode) < *offs + size) {
|
||||
size = i_size_read(inode) - *offs;
|
||||
spin_unlock(&inode->i_lock);
|
||||
if (size < 0) {
|
||||
CDEBUG(D_EXT2, "size %llu is too short for read @%llu\n",
|
||||
i_size_read(inode), *offs);
|
||||
return -EBADR;
|
||||
} else if (size == 0) {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
spin_unlock(&inode->i_lock);
|
||||
}
|
||||
|
||||
blocksize = 1 << inode->i_blkbits;
|
||||
|
||||
while (size > 0) {
|
||||
block = *offs >> inode->i_blkbits;
|
||||
boffs = *offs & (blocksize - 1);
|
||||
csize = min(blocksize - boffs, size);
|
||||
bh = ext3_bread(NULL, inode, block, 0, &err);
|
||||
if (!bh) {
|
||||
CERROR("can't read block: %d\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
memcpy(buf, bh->b_data + boffs, csize);
|
||||
brelse(bh);
|
||||
|
||||
*offs += csize;
|
||||
buf += csize;
|
||||
size -= csize;
|
||||
}
|
||||
return osize;
|
||||
}
|
||||
EXPORT_SYMBOL(fsfilt_ext3_read);
|
||||
|
||||
static int fsfilt_ext3_read_record(struct file * file, void *buf,
|
||||
int size, loff_t *offs)
|
||||
{
|
||||
int rc;
|
||||
rc = fsfilt_ext3_read(file->f_dentry->d_inode, buf, size, offs);
|
||||
if (rc > 0)
|
||||
rc = 0;
|
||||
return rc;
|
||||
}
|
||||
|
||||
int fsfilt_ext3_write_handle(struct inode *inode, void *buf, int bufsize,
|
||||
loff_t *offs, handle_t *handle)
|
||||
{
|
||||
struct buffer_head *bh = NULL;
|
||||
loff_t old_size = i_size_read(inode), offset = *offs;
|
||||
loff_t new_size = i_size_read(inode);
|
||||
unsigned long block;
|
||||
int err = 0, blocksize = 1 << inode->i_blkbits, size, boffs;
|
||||
|
||||
while (bufsize > 0) {
|
||||
if (bh != NULL)
|
||||
brelse(bh);
|
||||
|
||||
block = offset >> inode->i_blkbits;
|
||||
boffs = offset & (blocksize - 1);
|
||||
size = min(blocksize - boffs, bufsize);
|
||||
bh = ext3_bread(handle, inode, block, 1, &err);
|
||||
if (!bh) {
|
||||
CERROR("can't read/create block: %d\n", err);
|
||||
break;
|
||||
}
|
||||
|
||||
err = ext3_journal_get_write_access(handle, bh);
|
||||
if (err) {
|
||||
CERROR("journal_get_write_access() returned error %d\n",
|
||||
err);
|
||||
break;
|
||||
}
|
||||
LASSERT(bh->b_data + boffs + size <= bh->b_data + bh->b_size);
|
||||
memcpy(bh->b_data + boffs, buf, size);
|
||||
err = ext3_journal_dirty_metadata(handle, bh);
|
||||
if (err) {
|
||||
CERROR("journal_dirty_metadata() returned error %d\n",
|
||||
err);
|
||||
break;
|
||||
}
|
||||
if (offset + size > new_size)
|
||||
new_size = offset + size;
|
||||
offset += size;
|
||||
bufsize -= size;
|
||||
buf += size;
|
||||
}
|
||||
if (bh)
|
||||
brelse(bh);
|
||||
|
||||
/* correct in-core and on-disk sizes */
|
||||
if (new_size > i_size_read(inode)) {
|
||||
spin_lock(&inode->i_lock);
|
||||
if (new_size > i_size_read(inode))
|
||||
i_size_write(inode, new_size);
|
||||
if (i_size_read(inode) > EXT3_I(inode)->i_disksize)
|
||||
EXT3_I(inode)->i_disksize = i_size_read(inode);
|
||||
if (i_size_read(inode) > old_size) {
|
||||
spin_unlock(&inode->i_lock);
|
||||
mark_inode_dirty(inode);
|
||||
} else {
|
||||
spin_unlock(&inode->i_lock);
|
||||
}
|
||||
}
|
||||
|
||||
if (err == 0)
|
||||
*offs = offset;
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL(fsfilt_ext3_write_handle);
|
||||
|
||||
static int fsfilt_ext3_write_record(struct file *file, void *buf, int bufsize,
|
||||
loff_t *offs, int force_sync)
|
||||
{
|
||||
struct inode *inode = file->f_dentry->d_inode;
|
||||
handle_t *handle;
|
||||
int err, block_count = 0, blocksize;
|
||||
|
||||
/* Determine how many transaction credits are needed */
|
||||
blocksize = 1 << inode->i_blkbits;
|
||||
block_count = (*offs & (blocksize - 1)) + bufsize;
|
||||
block_count = (block_count + blocksize - 1) >> inode->i_blkbits;
|
||||
|
||||
handle = ext3_journal_start(inode,
|
||||
block_count * EXT3_DATA_TRANS_BLOCKS(inode->i_sb) + 2);
|
||||
if (IS_ERR(handle)) {
|
||||
CERROR("can't start transaction for %d blocks (%d bytes)\n",
|
||||
block_count * EXT3_DATA_TRANS_BLOCKS(inode->i_sb) + 2,
|
||||
bufsize);
|
||||
return PTR_ERR(handle);
|
||||
}
|
||||
|
||||
err = fsfilt_ext3_write_handle(inode, buf, bufsize, offs, handle);
|
||||
|
||||
if (!err && force_sync)
|
||||
handle->h_sync = 1; /* recovery likes this */
|
||||
|
||||
ext3_journal_stop(handle);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int fsfilt_ext3_setup(struct super_block *sb)
|
||||
{
|
||||
if (!EXT3_HAS_COMPAT_FEATURE(sb,
|
||||
EXT3_FEATURE_COMPAT_HAS_JOURNAL)) {
|
||||
CERROR("ext3 mounted without journal\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
#ifdef S_PDIROPS
|
||||
CWARN("Enabling PDIROPS\n");
|
||||
set_opt(EXT3_SB(sb)->s_mount_opt, PDIROPS);
|
||||
sb->s_flags |= S_PDIROPS;
|
||||
#endif
|
||||
if (!EXT3_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_DIR_INDEX))
|
||||
CWARN("filesystem doesn't have dir_index feature enabled\n");
|
||||
return 0;
|
||||
}
|
||||
static struct fsfilt_operations fsfilt_ext3_ops = {
|
||||
.fs_type = "ext3",
|
||||
.fs_owner = THIS_MODULE,
|
||||
.fs_getlabel = fsfilt_ext3_get_label,
|
||||
.fs_start = fsfilt_ext3_start,
|
||||
.fs_commit = fsfilt_ext3_commit,
|
||||
.fs_map_inode_pages = fsfilt_ext3_map_inode_pages,
|
||||
.fs_write_record = fsfilt_ext3_write_record,
|
||||
.fs_read_record = fsfilt_ext3_read_record,
|
||||
.fs_setup = fsfilt_ext3_setup,
|
||||
};
|
||||
|
||||
static int __init fsfilt_ext3_init(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
fcb_cache = kmem_cache_create("fsfilt_ext3_fcb",
|
||||
sizeof(struct fsfilt_cb_data), 0, 0);
|
||||
if (!fcb_cache) {
|
||||
CERROR("error allocating fsfilt journal callback cache\n");
|
||||
GOTO(out, rc = -ENOMEM);
|
||||
}
|
||||
|
||||
rc = fsfilt_register_ops(&fsfilt_ext3_ops);
|
||||
|
||||
if (rc) {
|
||||
int err = kmem_cache_destroy(fcb_cache);
|
||||
LASSERTF(err == 0, "error destroying new cache: rc %d\n", err);
|
||||
}
|
||||
out:
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void __exit fsfilt_ext3_exit(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
fsfilt_unregister_ops(&fsfilt_ext3_ops);
|
||||
rc = kmem_cache_destroy(fcb_cache);
|
||||
LASSERTF(rc == 0, "couldn't destroy fcb_cache slab\n");
|
||||
}
|
||||
|
||||
module_init(fsfilt_ext3_init);
|
||||
module_exit(fsfilt_ext3_exit);
|
||||
|
||||
MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
|
||||
MODULE_DESCRIPTION("Lustre ext3 Filesystem Helper v0.1");
|
||||
MODULE_LICENSE("GPL");
|
|
@ -69,7 +69,7 @@ void mdc_create_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
|
|||
const void *data, int datalen, __u32 mode, __u32 uid,
|
||||
__u32 gid, cfs_cap_t capability, __u64 rdev);
|
||||
void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
|
||||
__u32 mode, __u64 rdev, __u32 flags, const void *data,
|
||||
__u32 mode, __u64 rdev, __u64 flags, const void *data,
|
||||
int datalen);
|
||||
void mdc_unlink_pack(struct ptlrpc_request *req, struct md_op_data *op_data);
|
||||
void mdc_link_pack(struct ptlrpc_request *req, struct md_op_data *op_data);
|
||||
|
|
|
@ -174,12 +174,12 @@ void mdc_create_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
|
|||
}
|
||||
}
|
||||
|
||||
static __u64 mds_pack_open_flags(__u32 flags, __u32 mode)
|
||||
static __u64 mds_pack_open_flags(__u64 flags, __u32 mode)
|
||||
{
|
||||
__u64 cr_flags = (flags & (FMODE_READ | FMODE_WRITE |
|
||||
MDS_OPEN_HAS_EA | MDS_OPEN_HAS_OBJS |
|
||||
MDS_OPEN_OWNEROVERRIDE | MDS_OPEN_LOCK |
|
||||
MDS_OPEN_BY_FID));
|
||||
MDS_OPEN_BY_FID | MDS_OPEN_LEASE));
|
||||
if (flags & O_CREAT)
|
||||
cr_flags |= MDS_OPEN_CREAT;
|
||||
if (flags & O_EXCL)
|
||||
|
@ -207,7 +207,7 @@ static __u64 mds_pack_open_flags(__u32 flags, __u32 mode)
|
|||
|
||||
/* packing of MDS records */
|
||||
void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
|
||||
__u32 mode, __u64 rdev, __u32 flags, const void *lmm,
|
||||
__u32 mode, __u64 rdev, __u64 flags, const void *lmm,
|
||||
int lmmlen)
|
||||
{
|
||||
struct mdt_rec_create *rec;
|
||||
|
@ -234,6 +234,7 @@ void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
|
|||
rec->cr_suppgid2 = op_data->op_suppgids[1];
|
||||
rec->cr_bias = op_data->op_bias;
|
||||
rec->cr_umask = current_umask();
|
||||
rec->cr_old_handle = op_data->op_handle;
|
||||
|
||||
mdc_pack_capa(req, &RMF_CAPA1, op_data->op_capa1);
|
||||
/* the next buffer is child capa, which is used for replay,
|
||||
|
|
|
@ -75,6 +75,12 @@ EXPORT_SYMBOL(it_clear_disposition);
|
|||
|
||||
int it_open_error(int phase, struct lookup_intent *it)
|
||||
{
|
||||
if (it_disposition(it, DISP_OPEN_LEASE)) {
|
||||
if (phase >= DISP_OPEN_LEASE)
|
||||
return it->d.lustre.it_status;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
if (it_disposition(it, DISP_OPEN_OPEN)) {
|
||||
if (phase >= DISP_OPEN_OPEN)
|
||||
return it->d.lustre.it_status;
|
||||
|
@ -281,14 +287,21 @@ static struct ptlrpc_request *mdc_intent_open_pack(struct obd_export *exp,
|
|||
/* XXX: openlock is not cancelled for cross-refs. */
|
||||
/* If inode is known, cancel conflicting OPEN locks. */
|
||||
if (fid_is_sane(&op_data->op_fid2)) {
|
||||
if (it->it_flags & (FMODE_WRITE|MDS_OPEN_TRUNC))
|
||||
mode = LCK_CW;
|
||||
if (it->it_flags & MDS_OPEN_LEASE) { /* try to get lease */
|
||||
if (it->it_flags & FMODE_WRITE)
|
||||
mode = LCK_EX;
|
||||
else
|
||||
mode = LCK_PR;
|
||||
} else {
|
||||
if (it->it_flags & (FMODE_WRITE|MDS_OPEN_TRUNC))
|
||||
mode = LCK_CW;
|
||||
#ifdef FMODE_EXEC
|
||||
else if (it->it_flags & FMODE_EXEC)
|
||||
mode = LCK_PR;
|
||||
else if (it->it_flags & FMODE_EXEC)
|
||||
mode = LCK_PR;
|
||||
#endif
|
||||
else
|
||||
mode = LCK_CR;
|
||||
else
|
||||
mode = LCK_CR;
|
||||
}
|
||||
count = mdc_resource_get_unused(exp, &op_data->op_fid2,
|
||||
&cancels, mode,
|
||||
MDS_INODELOCK_OPEN);
|
||||
|
@ -958,13 +971,8 @@ static int mdc_finish_intent_lock(struct obd_export *exp,
|
|||
|
||||
LASSERTF(fid_res_name_eq(&mdt_body->fid1,
|
||||
&lock->l_resource->lr_name),
|
||||
"Lock res_id: %lu/%lu/%lu, fid: %lu/%lu/%lu.\n",
|
||||
(unsigned long)lock->l_resource->lr_name.name[0],
|
||||
(unsigned long)lock->l_resource->lr_name.name[1],
|
||||
(unsigned long)lock->l_resource->lr_name.name[2],
|
||||
(unsigned long)fid_seq(&mdt_body->fid1),
|
||||
(unsigned long)fid_oid(&mdt_body->fid1),
|
||||
(unsigned long)fid_ver(&mdt_body->fid1));
|
||||
"Lock res_id: "DLDLMRES", fid: "DFID"\n",
|
||||
PLDLMRES(lock->l_resource), PFID(&mdt_body->fid1));
|
||||
LDLM_LOCK_PUT(lock);
|
||||
|
||||
memcpy(&old_lock, lockh, sizeof(*lockh));
|
||||
|
@ -1065,10 +1073,10 @@ int mdc_intent_lock(struct obd_export *exp, struct md_op_data *op_data,
|
|||
LASSERT(it);
|
||||
|
||||
CDEBUG(D_DLMTRACE, "(name: %.*s,"DFID") in obj "DFID
|
||||
", intent: %s flags %#o\n", op_data->op_namelen,
|
||||
op_data->op_name, PFID(&op_data->op_fid2),
|
||||
PFID(&op_data->op_fid1), ldlm_it2str(it->it_op),
|
||||
it->it_flags);
|
||||
", intent: %s flags %#Lo\n", op_data->op_namelen,
|
||||
op_data->op_name, PFID(&op_data->op_fid2),
|
||||
PFID(&op_data->op_fid1), ldlm_it2str(it->it_op),
|
||||
it->it_flags);
|
||||
|
||||
lockh.cookie = 0;
|
||||
if (fid_is_sane(&op_data->op_fid2) &&
|
||||
|
@ -1194,9 +1202,10 @@ int mdc_intent_getattr_async(struct obd_export *exp,
|
|||
int rc = 0;
|
||||
__u64 flags = LDLM_FL_HAS_INTENT;
|
||||
|
||||
CDEBUG(D_DLMTRACE,"name: %.*s in inode "DFID", intent: %s flags %#o\n",
|
||||
op_data->op_namelen, op_data->op_name, PFID(&op_data->op_fid1),
|
||||
ldlm_it2str(it->it_op), it->it_flags);
|
||||
CDEBUG(D_DLMTRACE,
|
||||
"name: %.*s in inode "DFID", intent: %s flags %#Lo\n",
|
||||
op_data->op_namelen, op_data->op_name, PFID(&op_data->op_fid1),
|
||||
ldlm_it2str(it->it_op), it->it_flags);
|
||||
|
||||
fid_build_reg_res_name(&op_data->op_fid1, &res_id);
|
||||
req = mdc_intent_getattr_pack(exp, it, op_data);
|
||||
|
|
|
@ -788,8 +788,8 @@ static int mgc_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,
|
|||
/* We've given up the lock, prepare ourselves to update. */
|
||||
LDLM_DEBUG(lock, "MGC cancel CB");
|
||||
|
||||
CDEBUG(D_MGC, "Lock res "LPX64" (%.8s)\n",
|
||||
lock->l_resource->lr_name.name[0],
|
||||
CDEBUG(D_MGC, "Lock res "DLDLMRES" (%.8s)\n",
|
||||
PLDLMRES(lock->l_resource),
|
||||
(char *)&lock->l_resource->lr_name.name[0]);
|
||||
|
||||
if (!cld) {
|
||||
|
|
|
@ -282,7 +282,6 @@ int LL_PROC_PROTO(proc_at_history)
|
|||
#ifdef CONFIG_SYSCTL
|
||||
static ctl_table_t obd_table[] = {
|
||||
{
|
||||
INIT_CTL_NAME(OBD_TIMEOUT)
|
||||
.procname = "timeout",
|
||||
.data = &obd_timeout,
|
||||
.maxlen = sizeof(int),
|
||||
|
@ -290,7 +289,6 @@ static ctl_table_t obd_table[] = {
|
|||
.proc_handler = &proc_set_timeout
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(OBD_DEBUG_PEER_ON_TIMEOUT)
|
||||
.procname = "debug_peer_on_timeout",
|
||||
.data = &obd_debug_peer_on_timeout,
|
||||
.maxlen = sizeof(int),
|
||||
|
@ -298,7 +296,6 @@ static ctl_table_t obd_table[] = {
|
|||
.proc_handler = &proc_dointvec
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(OBD_DUMP_ON_TIMEOUT)
|
||||
.procname = "dump_on_timeout",
|
||||
.data = &obd_dump_on_timeout,
|
||||
.maxlen = sizeof(int),
|
||||
|
@ -306,7 +303,6 @@ static ctl_table_t obd_table[] = {
|
|||
.proc_handler = &proc_dointvec
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(OBD_DUMP_ON_EVICTION)
|
||||
.procname = "dump_on_eviction",
|
||||
.data = &obd_dump_on_eviction,
|
||||
.maxlen = sizeof(int),
|
||||
|
@ -314,7 +310,6 @@ static ctl_table_t obd_table[] = {
|
|||
.proc_handler = &proc_dointvec
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(OBD_MEMUSED)
|
||||
.procname = "memused",
|
||||
.data = NULL,
|
||||
.maxlen = 0,
|
||||
|
@ -322,7 +317,6 @@ static ctl_table_t obd_table[] = {
|
|||
.proc_handler = &proc_memory_alloc
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(OBD_PAGESUSED)
|
||||
.procname = "pagesused",
|
||||
.data = NULL,
|
||||
.maxlen = 0,
|
||||
|
@ -330,7 +324,6 @@ static ctl_table_t obd_table[] = {
|
|||
.proc_handler = &proc_pages_alloc
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(OBD_MAXMEMUSED)
|
||||
.procname = "memused_max",
|
||||
.data = NULL,
|
||||
.maxlen = 0,
|
||||
|
@ -338,7 +331,6 @@ static ctl_table_t obd_table[] = {
|
|||
.proc_handler = &proc_mem_max
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(OBD_MAXPAGESUSED)
|
||||
.procname = "pagesused_max",
|
||||
.data = NULL,
|
||||
.maxlen = 0,
|
||||
|
@ -346,7 +338,6 @@ static ctl_table_t obd_table[] = {
|
|||
.proc_handler = &proc_pages_max
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(OBD_LDLM_TIMEOUT)
|
||||
.procname = "ldlm_timeout",
|
||||
.data = &ldlm_timeout,
|
||||
.maxlen = sizeof(int),
|
||||
|
@ -354,7 +345,6 @@ static ctl_table_t obd_table[] = {
|
|||
.proc_handler = &proc_set_timeout
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(OBD_ALLOC_FAIL_RATE)
|
||||
.procname = "alloc_fail_rate",
|
||||
.data = &obd_alloc_fail_rate,
|
||||
.maxlen = sizeof(int),
|
||||
|
@ -362,7 +352,6 @@ static ctl_table_t obd_table[] = {
|
|||
.proc_handler = &proc_alloc_fail_rate
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(OBD_MAX_DIRTY_PAGES)
|
||||
.procname = "max_dirty_mb",
|
||||
.data = &obd_max_dirty_pages,
|
||||
.maxlen = sizeof(int),
|
||||
|
@ -370,7 +359,6 @@ static ctl_table_t obd_table[] = {
|
|||
.proc_handler = &proc_max_dirty_pages_in_mb
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(OBD_AT_MIN)
|
||||
.procname = "at_min",
|
||||
.data = &at_min,
|
||||
.maxlen = sizeof(int),
|
||||
|
@ -378,7 +366,6 @@ static ctl_table_t obd_table[] = {
|
|||
.proc_handler = &proc_at_min
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(OBD_AT_MAX)
|
||||
.procname = "at_max",
|
||||
.data = &at_max,
|
||||
.maxlen = sizeof(int),
|
||||
|
@ -386,7 +373,6 @@ static ctl_table_t obd_table[] = {
|
|||
.proc_handler = &proc_at_max
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(OBD_AT_EXTRA)
|
||||
.procname = "at_extra",
|
||||
.data = &at_extra,
|
||||
.maxlen = sizeof(int),
|
||||
|
@ -394,7 +380,6 @@ static ctl_table_t obd_table[] = {
|
|||
.proc_handler = &proc_at_extra
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(OBD_AT_EARLY_MARGIN)
|
||||
.procname = "at_early_margin",
|
||||
.data = &at_early_margin,
|
||||
.maxlen = sizeof(int),
|
||||
|
@ -402,26 +387,22 @@ static ctl_table_t obd_table[] = {
|
|||
.proc_handler = &proc_at_early_margin
|
||||
},
|
||||
{
|
||||
INIT_CTL_NAME(OBD_AT_HISTORY)
|
||||
.procname = "at_history",
|
||||
.data = &at_history,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_at_history
|
||||
},
|
||||
{ INIT_CTL_NAME(0) }
|
||||
}
|
||||
};
|
||||
|
||||
static ctl_table_t parent_table[] = {
|
||||
{
|
||||
INIT_CTL_NAME(OBD_SYSCTL)
|
||||
.procname = "lustre",
|
||||
.data = NULL,
|
||||
.maxlen = 0,
|
||||
.mode = 0555,
|
||||
.child = obd_table
|
||||
},
|
||||
{ INIT_CTL_NAME(0) }
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ struct llog_handle *llog_alloc_handle(void)
|
|||
|
||||
OBD_ALLOC_PTR(loghandle);
|
||||
if (loghandle == NULL)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
return NULL;
|
||||
|
||||
init_rwsem(&loghandle->lgh_lock);
|
||||
spin_lock_init(&loghandle->lgh_hdr_lock);
|
||||
|
|
|
@ -246,7 +246,7 @@ int local_object_create(const struct lu_env *env,
|
|||
struct dt_object_format *dof, struct thandle *th)
|
||||
{
|
||||
struct dt_thread_info *dti = dt_info(env);
|
||||
obd_id lastid;
|
||||
__le64 lastid;
|
||||
int rc;
|
||||
|
||||
rc = dt_create(env, o, attr, NULL, dof, th);
|
||||
|
|
|
@ -1106,7 +1106,7 @@ static struct echo_object *cl_echo_object_find(struct echo_device *d,
|
|||
/* coverity[overrun-buffer-val] */
|
||||
obj = cl_object_find(env, echo_dev2cl(d), fid, &conf->eoc_cl);
|
||||
if (IS_ERR(obj))
|
||||
GOTO(out, eco = (void*)obj);
|
||||
GOTO(out, eco = (void *)obj);
|
||||
|
||||
eco = cl2echo_obj(obj);
|
||||
if (eco->eo_deleted) {
|
||||
|
|
|
@ -46,10 +46,6 @@
|
|||
#include <obd_ost.h>
|
||||
#include <obd_lov.h>
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
# include <ctype.h>
|
||||
#endif
|
||||
|
||||
#include <lustre_ha.h>
|
||||
#include <lprocfs_status.h>
|
||||
#include <lustre_log.h>
|
||||
|
|
|
@ -10,7 +10,7 @@ ldlm_objs += $(LDLM)ldlm_pool.o
|
|||
ldlm_objs += $(LDLM)interval_tree.o
|
||||
ptlrpc_objs := client.o recover.o connection.o niobuf.o pack_generic.o
|
||||
ptlrpc_objs += events.o ptlrpc_module.o service.o pinger.o
|
||||
ptlrpc_objs += llog_net.o llog_client.o llog_server.o import.o ptlrpcd.o
|
||||
ptlrpc_objs += llog_net.o llog_client.o import.o ptlrpcd.o
|
||||
ptlrpc_objs += pers.o lproc_ptlrpc.o wiretest.o layout.o
|
||||
ptlrpc_objs += sec.o sec_bulk.o sec_gc.o sec_config.o sec_lproc.o
|
||||
ptlrpc_objs += sec_null.o sec_plain.o nrs.o nrs_fifo.o
|
||||
|
|
|
@ -200,7 +200,7 @@ void __ptlrpc_free_bulk(struct ptlrpc_bulk_desc *desc, int unpin)
|
|||
class_import_put(desc->bd_import);
|
||||
|
||||
if (unpin) {
|
||||
for (i = 0; i < desc->bd_iov_count ; i++)
|
||||
for (i = 0; i < desc->bd_iov_count; i++)
|
||||
page_cache_release(desc->bd_iov[i].kiov_page);
|
||||
}
|
||||
|
||||
|
@ -459,7 +459,7 @@ ptlrpc_init_rq_pool(int num_rq, int msgsize,
|
|||
{
|
||||
struct ptlrpc_request_pool *pool;
|
||||
|
||||
OBD_ALLOC(pool, sizeof (struct ptlrpc_request_pool));
|
||||
OBD_ALLOC(pool, sizeof(struct ptlrpc_request_pool));
|
||||
if (!pool)
|
||||
return NULL;
|
||||
|
||||
|
@ -475,7 +475,7 @@ ptlrpc_init_rq_pool(int num_rq, int msgsize,
|
|||
|
||||
if (list_empty(&pool->prp_req_list)) {
|
||||
/* have not allocated a single request for the pool */
|
||||
OBD_FREE(pool, sizeof (struct ptlrpc_request_pool));
|
||||
OBD_FREE(pool, sizeof(struct ptlrpc_request_pool));
|
||||
pool = NULL;
|
||||
}
|
||||
return pool;
|
||||
|
@ -881,7 +881,7 @@ void ptlrpc_set_destroy(struct ptlrpc_request_set *set)
|
|||
/* Requests on the set should either all be completed, or all be new */
|
||||
expected_phase = (atomic_read(&set->set_remaining) == 0) ?
|
||||
RQ_PHASE_COMPLETE : RQ_PHASE_NEW;
|
||||
list_for_each (tmp, &set->set_requests) {
|
||||
list_for_each(tmp, &set->set_requests) {
|
||||
struct ptlrpc_request *req =
|
||||
list_entry(tmp, struct ptlrpc_request,
|
||||
rq_set_chain);
|
||||
|
@ -912,7 +912,7 @@ void ptlrpc_set_destroy(struct ptlrpc_request_set *set)
|
|||
req->rq_invalid_rqset = 0;
|
||||
spin_unlock(&req->rq_lock);
|
||||
|
||||
ptlrpc_req_finished (req);
|
||||
ptlrpc_req_finished(req);
|
||||
}
|
||||
|
||||
LASSERT(atomic_read(&set->set_remaining) == 0);
|
||||
|
@ -1020,7 +1020,7 @@ static int ptlrpc_import_delay_req(struct obd_import *imp,
|
|||
{
|
||||
int delay = 0;
|
||||
|
||||
LASSERT (status != NULL);
|
||||
LASSERT(status != NULL);
|
||||
*status = 0;
|
||||
|
||||
if (req->rq_ctx_init || req->rq_ctx_fini) {
|
||||
|
@ -1039,7 +1039,7 @@ static int ptlrpc_import_delay_req(struct obd_import *imp,
|
|||
*status = -EIO;
|
||||
} else if (req->rq_send_state == LUSTRE_IMP_CONNECTING &&
|
||||
imp->imp_state == LUSTRE_IMP_CONNECTING) {
|
||||
/* allow CONNECT even if import is invalid */ ;
|
||||
/* allow CONNECT even if import is invalid */
|
||||
if (atomic_read(&imp->imp_inval_count) != 0) {
|
||||
DEBUG_REQ(D_ERROR, req, "invalidate in flight");
|
||||
*status = -EIO;
|
||||
|
@ -1596,7 +1596,8 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set)
|
|||
continue;
|
||||
|
||||
spin_lock(&imp->imp_lock);
|
||||
if (ptlrpc_import_delay_req(imp, req, &status)){
|
||||
if (ptlrpc_import_delay_req(imp, req,
|
||||
&status)) {
|
||||
/* put on delay list - only if we wait
|
||||
* recovery finished - before send */
|
||||
list_del_init(&req->rq_list);
|
||||
|
@ -1752,7 +1753,7 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set)
|
|||
|
||||
ptlrpc_rqphase_move(req, RQ_PHASE_INTERPRET);
|
||||
|
||||
interpret:
|
||||
interpret:
|
||||
LASSERT(req->rq_phase == RQ_PHASE_INTERPRET);
|
||||
|
||||
/* This moves to "unregistering" phase we need to wait for
|
||||
|
@ -1907,7 +1908,7 @@ int ptlrpc_expired_set(void *data)
|
|||
/*
|
||||
* A timeout expired. See which reqs it applies to...
|
||||
*/
|
||||
list_for_each (tmp, &set->set_requests) {
|
||||
list_for_each(tmp, &set->set_requests) {
|
||||
struct ptlrpc_request *req =
|
||||
list_entry(tmp, struct ptlrpc_request,
|
||||
rq_set_chain);
|
||||
|
@ -2688,7 +2689,7 @@ int ptlrpc_replay_req(struct ptlrpc_request *req)
|
|||
|
||||
LASSERT(req->rq_import->imp_state == LUSTRE_IMP_REPLAY);
|
||||
|
||||
LASSERT (sizeof (*aa) <= sizeof (req->rq_async_args));
|
||||
LASSERT(sizeof(*aa) <= sizeof(req->rq_async_args));
|
||||
aa = ptlrpc_req_async_args(req);
|
||||
memset(aa, 0, sizeof(*aa));
|
||||
|
||||
|
@ -2962,7 +2963,7 @@ void *ptlrpcd_alloc_work(struct obd_import *imp,
|
|||
init_waitqueue_head(&req->rq_set_waitq);
|
||||
atomic_set(&req->rq_refcount, 1);
|
||||
|
||||
CLASSERT (sizeof(*args) <= sizeof(req->rq_async_args));
|
||||
CLASSERT(sizeof(*args) <= sizeof(req->rq_async_args));
|
||||
args = ptlrpc_req_async_args(req);
|
||||
args->magic = PTLRPC_WORK_MAGIC;
|
||||
args->cb = cb;
|
||||
|
|
|
@ -56,9 +56,9 @@ void request_out_callback(lnet_event_t *ev)
|
|||
struct ptlrpc_cb_id *cbid = ev->md.user_ptr;
|
||||
struct ptlrpc_request *req = cbid->cbid_arg;
|
||||
|
||||
LASSERT (ev->type == LNET_EVENT_SEND ||
|
||||
ev->type == LNET_EVENT_UNLINK);
|
||||
LASSERT (ev->unlinked);
|
||||
LASSERT(ev->type == LNET_EVENT_SEND ||
|
||||
ev->type == LNET_EVENT_UNLINK);
|
||||
LASSERT(ev->unlinked);
|
||||
|
||||
DEBUG_REQ(D_NET, req, "type %d, status %d", ev->type, ev->status);
|
||||
|
||||
|
@ -90,9 +90,9 @@ void reply_in_callback(lnet_event_t *ev)
|
|||
|
||||
DEBUG_REQ(D_NET, req, "type %d, status %d", ev->type, ev->status);
|
||||
|
||||
LASSERT (ev->type == LNET_EVENT_PUT || ev->type == LNET_EVENT_UNLINK);
|
||||
LASSERT (ev->md.start == req->rq_repbuf);
|
||||
LASSERT (ev->offset + ev->mlength <= req->rq_repbuf_len);
|
||||
LASSERT(ev->type == LNET_EVENT_PUT || ev->type == LNET_EVENT_UNLINK);
|
||||
LASSERT(ev->md.start == req->rq_repbuf);
|
||||
LASSERT(ev->offset + ev->mlength <= req->rq_repbuf_len);
|
||||
/* We've set LNET_MD_MANAGE_REMOTE for all outgoing requests
|
||||
for adaptive timeouts' early reply. */
|
||||
LASSERT((ev->md.options & LNET_MD_MANAGE_REMOTE) != 0);
|
||||
|
@ -113,7 +113,7 @@ void reply_in_callback(lnet_event_t *ev)
|
|||
goto out_wake;
|
||||
}
|
||||
|
||||
if (ev->mlength < ev->rlength ) {
|
||||
if (ev->mlength < ev->rlength) {
|
||||
CDEBUG(D_RPCTRACE, "truncate req %p rpc %d - %d+%d\n", req,
|
||||
req->rq_replen, ev->rlength, ev->offset);
|
||||
req->rq_reply_truncate = 1;
|
||||
|
@ -167,18 +167,18 @@ void reply_in_callback(lnet_event_t *ev)
|
|||
/*
|
||||
* Client's bulk has been written/read
|
||||
*/
|
||||
void client_bulk_callback (lnet_event_t *ev)
|
||||
void client_bulk_callback(lnet_event_t *ev)
|
||||
{
|
||||
struct ptlrpc_cb_id *cbid = ev->md.user_ptr;
|
||||
struct ptlrpc_bulk_desc *desc = cbid->cbid_arg;
|
||||
struct ptlrpc_request *req;
|
||||
|
||||
LASSERT ((desc->bd_type == BULK_PUT_SINK &&
|
||||
ev->type == LNET_EVENT_PUT) ||
|
||||
(desc->bd_type == BULK_GET_SOURCE &&
|
||||
ev->type == LNET_EVENT_GET) ||
|
||||
ev->type == LNET_EVENT_UNLINK);
|
||||
LASSERT (ev->unlinked);
|
||||
LASSERT((desc->bd_type == BULK_PUT_SINK &&
|
||||
ev->type == LNET_EVENT_PUT) ||
|
||||
(desc->bd_type == BULK_GET_SOURCE &&
|
||||
ev->type == LNET_EVENT_GET) ||
|
||||
ev->type == LNET_EVENT_UNLINK);
|
||||
LASSERT(ev->unlinked);
|
||||
|
||||
if (CFS_FAIL_CHECK_ORSET(OBD_FAIL_PTLRPC_CLIENT_BULK_CB, CFS_FAIL_ONCE))
|
||||
ev->status = -EIO;
|
||||
|
@ -283,11 +283,11 @@ void request_in_callback(lnet_event_t *ev)
|
|||
struct ptlrpc_service *service = svcpt->scp_service;
|
||||
struct ptlrpc_request *req;
|
||||
|
||||
LASSERT (ev->type == LNET_EVENT_PUT ||
|
||||
ev->type == LNET_EVENT_UNLINK);
|
||||
LASSERT ((char *)ev->md.start >= rqbd->rqbd_buffer);
|
||||
LASSERT ((char *)ev->md.start + ev->offset + ev->mlength <=
|
||||
rqbd->rqbd_buffer + service->srv_buf_size);
|
||||
LASSERT(ev->type == LNET_EVENT_PUT ||
|
||||
ev->type == LNET_EVENT_UNLINK);
|
||||
LASSERT((char *)ev->md.start >= rqbd->rqbd_buffer);
|
||||
LASSERT((char *)ev->md.start + ev->offset + ev->mlength <=
|
||||
rqbd->rqbd_buffer + service->srv_buf_size);
|
||||
|
||||
CDEBUG((ev->status == 0) ? D_NET : D_ERROR,
|
||||
"event type %d, status %d, service %s\n",
|
||||
|
@ -300,9 +300,9 @@ void request_in_callback(lnet_event_t *ev)
|
|||
* we'd have to re-post the rqbd, which we can't do in this
|
||||
* context. */
|
||||
req = &rqbd->rqbd_req;
|
||||
memset(req, 0, sizeof (*req));
|
||||
memset(req, 0, sizeof(*req));
|
||||
} else {
|
||||
LASSERT (ev->type == LNET_EVENT_PUT);
|
||||
LASSERT(ev->type == LNET_EVENT_PUT);
|
||||
if (ev->status != 0) {
|
||||
/* We moaned above already... */
|
||||
return;
|
||||
|
@ -381,19 +381,19 @@ void reply_out_callback(lnet_event_t *ev)
|
|||
struct ptlrpc_reply_state *rs = cbid->cbid_arg;
|
||||
struct ptlrpc_service_part *svcpt = rs->rs_svcpt;
|
||||
|
||||
LASSERT (ev->type == LNET_EVENT_SEND ||
|
||||
ev->type == LNET_EVENT_ACK ||
|
||||
ev->type == LNET_EVENT_UNLINK);
|
||||
LASSERT(ev->type == LNET_EVENT_SEND ||
|
||||
ev->type == LNET_EVENT_ACK ||
|
||||
ev->type == LNET_EVENT_UNLINK);
|
||||
|
||||
if (!rs->rs_difficult) {
|
||||
/* 'Easy' replies have no further processing so I drop the
|
||||
* net's ref on 'rs' */
|
||||
LASSERT (ev->unlinked);
|
||||
LASSERT(ev->unlinked);
|
||||
ptlrpc_rs_decref(rs);
|
||||
return;
|
||||
}
|
||||
|
||||
LASSERT (rs->rs_on_net);
|
||||
LASSERT(rs->rs_on_net);
|
||||
|
||||
if (ev->unlinked) {
|
||||
/* Last network callback. The net's ref on 'rs' stays put
|
||||
|
@ -419,18 +419,17 @@ static void ptlrpc_master_callback(lnet_event_t *ev)
|
|||
void (*callback)(lnet_event_t *ev) = cbid->cbid_fn;
|
||||
|
||||
/* Honestly, it's best to find out early. */
|
||||
LASSERT (cbid->cbid_arg != LP_POISON);
|
||||
LASSERT (callback == request_out_callback ||
|
||||
callback == reply_in_callback ||
|
||||
callback == client_bulk_callback ||
|
||||
callback == request_in_callback ||
|
||||
callback == reply_out_callback
|
||||
);
|
||||
LASSERT(cbid->cbid_arg != LP_POISON);
|
||||
LASSERT(callback == request_out_callback ||
|
||||
callback == reply_in_callback ||
|
||||
callback == client_bulk_callback ||
|
||||
callback == request_in_callback ||
|
||||
callback == reply_out_callback);
|
||||
|
||||
callback (ev);
|
||||
callback(ev);
|
||||
}
|
||||
|
||||
int ptlrpc_uuid_to_peer (struct obd_uuid *uuid,
|
||||
int ptlrpc_uuid_to_peer(struct obd_uuid *uuid,
|
||||
lnet_process_id_t *peer, lnet_nid_t *self)
|
||||
{
|
||||
int best_dist = 0;
|
||||
|
@ -538,7 +537,7 @@ int ptlrpc_ni_init(void)
|
|||
/* We're not passing any limits yet... */
|
||||
rc = LNetNIInit(pid);
|
||||
if (rc < 0) {
|
||||
CDEBUG (D_NET, "Can't init network interface: %d\n", rc);
|
||||
CDEBUG(D_NET, "Can't init network interface: %d\n", rc);
|
||||
return (-ENOENT);
|
||||
}
|
||||
|
||||
|
@ -552,7 +551,7 @@ int ptlrpc_ni_init(void)
|
|||
if (rc == 0)
|
||||
return 0;
|
||||
|
||||
CERROR ("Failed to allocate event queue: %d\n", rc);
|
||||
CERROR("Failed to allocate event queue: %d\n", rc);
|
||||
LNetNIFini();
|
||||
|
||||
return (-ENOMEM);
|
||||
|
|
|
@ -64,9 +64,9 @@
|
|||
#define G_REFLECT (-2045022961L)
|
||||
#define G_WRONG_TOKID (-2045022960L)
|
||||
|
||||
#define g_OID_equal(o1,o2) \
|
||||
(((o1)->len == (o2)->len) && \
|
||||
(memcmp((o1)->data,(o2)->data,(int) (o1)->len) == 0))
|
||||
#define g_OID_equal(o1, o2) \
|
||||
(((o1)->len == (o2)->len) && \
|
||||
(memcmp((o1)->data, (o2)->data, (int) (o1)->len) == 0))
|
||||
|
||||
__u32 g_verify_token_header(rawobj_t *mech,
|
||||
int *body_size,
|
||||
|
|
|
@ -106,14 +106,14 @@ typedef unsigned int OM_uint32;
|
|||
* evaluates its argument only once.
|
||||
*/
|
||||
#define GSS_CALLING_ERROR(x) \
|
||||
((x) & (GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET))
|
||||
((x) & (GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET))
|
||||
#define GSS_ROUTINE_ERROR(x) \
|
||||
((x) & (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET))
|
||||
((x) & (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET))
|
||||
#define GSS_SUPPLEMENTARY_INFO(x) \
|
||||
((x) & (GSS_C_SUPPLEMENTARY_MASK << GSS_C_SUPPLEMENTARY_OFFSET))
|
||||
((x) & (GSS_C_SUPPLEMENTARY_MASK << GSS_C_SUPPLEMENTARY_OFFSET))
|
||||
#define GSS_ERROR(x) \
|
||||
((x) & ((GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET) | \
|
||||
(GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET)))
|
||||
((x) & ((GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET) | \
|
||||
(GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET)))
|
||||
|
||||
/*
|
||||
* Now the actual status code definitions
|
||||
|
|
|
@ -165,7 +165,7 @@ void ctx_start_timer_kr(struct ptlrpc_cli_ctx *ctx, long timeout)
|
|||
|
||||
init_timer(timer);
|
||||
timer->expires = timeout;
|
||||
timer->data = (unsigned long ) ctx;
|
||||
timer->data = (unsigned long) ctx;
|
||||
timer->function = ctx_upcall_timeout_kr;
|
||||
|
||||
add_timer(timer);
|
||||
|
|
|
@ -1276,7 +1276,7 @@ __u32 gss_wrap_kerberos(struct gss_ctx *gctx,
|
|||
arc4_out_key:
|
||||
rawobj_free(&arc4_keye);
|
||||
arc4_out:
|
||||
do {} while(0); /* just to avoid compile warning */
|
||||
do {} while (0); /* just to avoid compile warning */
|
||||
} else {
|
||||
rc = krb5_encrypt_rawobjs(kctx->kc_keye.kb_tfm, 0,
|
||||
3, data_desc, &cipher, 1);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue